Fix asserts in opfunc_*jmp_down functions.
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
#include "opcodes-ecma-support.h"
|
#include "opcodes-ecma-support.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 'Jump if true' opcode handler.
|
* 'Jump down if true' opcode handler.
|
||||||
*
|
*
|
||||||
* Note:
|
* Note:
|
||||||
* current opcode's position changes by adding specified offset
|
* 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))
|
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);
|
int_data->pos = (opcode_counter_t) (int_data->pos + offset);
|
||||||
}
|
}
|
||||||
else
|
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:
|
* Note:
|
||||||
* current opcode's position changes by adding specified offset
|
* 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))
|
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);
|
int_data->pos = (opcode_counter_t) (int_data->pos + offset);
|
||||||
}
|
}
|
||||||
else
|
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,
|
const opcode_counter_t offset = calc_opcode_counter_from_idx_idx (opdata.data.jmp_down.opcode_1,
|
||||||
opdata.data.jmp_down.opcode_2);
|
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);
|
int_data->pos = (opcode_counter_t) (int_data->pos + offset);
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,9 @@
|
|||||||
#include "ecma-globals.h"
|
#include "ecma-globals.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
|
||||||
|
/* Maximum opcodes number in bytecode. */
|
||||||
|
#define MAX_OPCODES (256*256 - 1)
|
||||||
|
|
||||||
#define OP_0(action, name) \
|
#define OP_0(action, name) \
|
||||||
__##action (name, void, void, void)
|
__##action (name, void, void, void)
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,6 @@
|
|||||||
#include "stack.h"
|
#include "stack.h"
|
||||||
#include "jerry-libc.h"
|
#include "jerry-libc.h"
|
||||||
|
|
||||||
#define MAX_OPCODES (256*256 - 1)
|
|
||||||
|
|
||||||
#ifndef OPCODE_T_STACK_DEFINED
|
#ifndef OPCODE_T_STACK_DEFINED
|
||||||
DEFINE_STACK_TYPE (opcode_counter_t, opcode_t)
|
DEFINE_STACK_TYPE (opcode_counter_t, opcode_t)
|
||||||
#define OPCODE_T_STACK_DEFINED
|
#define OPCODE_T_STACK_DEFINED
|
||||||
|
|||||||
@@ -186,7 +186,6 @@ main( int __unused argc,
|
|||||||
bool status = run_int();
|
bool status = run_int();
|
||||||
|
|
||||||
serializer_free ();
|
serializer_free ();
|
||||||
mem_heap_print (true, false, true);
|
|
||||||
mem_finalize (false);
|
mem_finalize (false);
|
||||||
|
|
||||||
return (status ? 0 : 1);
|
return (status ? 0 : 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user