mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Fix asserts in opfunc_*jmp_down functions.
This commit is contained in:
parent
e77bd4f4e5
commit
d4cd8be349
@ -17,7 +17,7 @@
|
||||
#include "opcodes-ecma-support.h"
|
||||
|
||||
/**
|
||||
* 'Jump if true' opcode handler.
|
||||
* 'Jump down if true' opcode handler.
|
||||
*
|
||||
* Note:
|
||||
* current opcode's position changes by adding specified offset
|
||||
@ -40,7 +40,7 @@ opfunc_is_true_jmp_down (opcode_t opdata, /**< operation data */
|
||||
|
||||
if (ecma_is_value_true (to_bool_completion.u.value))
|
||||
{
|
||||
JERRY_ASSERT (offset != 0);
|
||||
JERRY_ASSERT (offset != 0 && (int_data->pos + offset < MAX_OPCODES));
|
||||
int_data->pos = (opcode_counter_t) (int_data->pos + offset);
|
||||
}
|
||||
else
|
||||
@ -89,7 +89,7 @@ opfunc_is_true_jmp_up (opcode_t opdata, /**< operation data */
|
||||
}
|
||||
|
||||
/**
|
||||
* 'Jump if false' opcode handler.
|
||||
* 'Jump down if false' opcode handler.
|
||||
*
|
||||
* Note:
|
||||
* current opcode's position changes by adding specified offset
|
||||
@ -112,7 +112,7 @@ opfunc_is_false_jmp_down (opcode_t opdata, /**< operation data */
|
||||
|
||||
if (!ecma_is_value_true (to_bool_completion.u.value))
|
||||
{
|
||||
JERRY_ASSERT (offset != 0);
|
||||
JERRY_ASSERT (offset != 0 && (int_data->pos + offset < MAX_OPCODES));
|
||||
int_data->pos = (opcode_counter_t) (int_data->pos + offset);
|
||||
}
|
||||
else
|
||||
@ -173,7 +173,7 @@ opfunc_jmp_down (opcode_t opdata, /**< operation data */
|
||||
const opcode_counter_t offset = calc_opcode_counter_from_idx_idx (opdata.data.jmp_down.opcode_1,
|
||||
opdata.data.jmp_down.opcode_2);
|
||||
|
||||
JERRY_ASSERT (offset != 0);
|
||||
JERRY_ASSERT (offset != 0 && (int_data->pos + offset < MAX_OPCODES));
|
||||
|
||||
int_data->pos = (opcode_counter_t) (int_data->pos + offset);
|
||||
|
||||
|
||||
@ -19,6 +19,9 @@
|
||||
#include "ecma-globals.h"
|
||||
#include "globals.h"
|
||||
|
||||
/* Maximum opcodes number in bytecode. */
|
||||
#define MAX_OPCODES (256*256 - 1)
|
||||
|
||||
#define OP_0(action, name) \
|
||||
__##action (name, void, void, void)
|
||||
|
||||
|
||||
@ -20,8 +20,6 @@
|
||||
#include "stack.h"
|
||||
#include "jerry-libc.h"
|
||||
|
||||
#define MAX_OPCODES (256*256 - 1)
|
||||
|
||||
#ifndef OPCODE_T_STACK_DEFINED
|
||||
DEFINE_STACK_TYPE (opcode_counter_t, opcode_t)
|
||||
#define OPCODE_T_STACK_DEFINED
|
||||
|
||||
@ -186,7 +186,6 @@ main( int __unused argc,
|
||||
bool status = run_int();
|
||||
|
||||
serializer_free ();
|
||||
mem_heap_print (true, false, true);
|
||||
mem_finalize (false);
|
||||
|
||||
return (status ? 0 : 1);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user