Compact Byte Code parser and executor for Jerry.
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com JerryScript-DCO-1.0-Signed-off-by: Tamas Gergely tgergely.u-szeged@partner.samsung.com JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.u-szeged@partner.samsung.com JerryScript-DCO-1.0-Signed-off-by: István Kádár ikadar@inf.u-szeged.hu JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2015 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2015-2016 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,16 +26,16 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "jrt.h"
|
||||
#include "jrt-bit-fields.h"
|
||||
#include "vm-defines.h"
|
||||
|
||||
JERRY_STATIC_ASSERT (sizeof (ecma_value_t) * JERRY_BITSINBYTE >= ECMA_VALUE_SIZE);
|
||||
JERRY_STATIC_ASSERT (sizeof (ecma_completion_value_t) * JERRY_BITSINBYTE >= ECMA_COMPLETION_VALUE_SIZE);
|
||||
|
||||
/**
|
||||
* Get type field of ecma-value
|
||||
*
|
||||
* @return type field
|
||||
*/
|
||||
static ecma_type_t __attr_pure___
|
||||
ecma_type_t __attr_pure___
|
||||
ecma_get_value_type_field (ecma_value_t value) /**< ecma-value */
|
||||
{
|
||||
return (ecma_type_t) jrt_extract_bit_field (value,
|
||||
@@ -474,19 +474,6 @@ ecma_get_completion_value_value_field (ecma_completion_value_t completion_value)
|
||||
ECMA_COMPLETION_VALUE_VALUE_WIDTH);
|
||||
} /* ecma_get_completion_value_value_field */
|
||||
|
||||
/**
|
||||
* Get target of break / continue completion value
|
||||
*
|
||||
* @return instruction counter
|
||||
*/
|
||||
static vm_instr_counter_t
|
||||
ecma_get_completion_value_target (ecma_completion_value_t completion_value) /**< completion value */
|
||||
{
|
||||
return (vm_instr_counter_t) jrt_extract_bit_field (completion_value,
|
||||
ECMA_COMPLETION_VALUE_TARGET_POS,
|
||||
ECMA_COMPLETION_VALUE_TARGET_WIDTH);
|
||||
} /* ecma_get_completion_value_target */
|
||||
|
||||
/**
|
||||
* Set type field of completion value
|
||||
*
|
||||
@@ -519,21 +506,6 @@ ecma_set_completion_value_value_field (ecma_completion_value_t completion_value,
|
||||
ECMA_COMPLETION_VALUE_VALUE_WIDTH);
|
||||
} /* ecma_set_completion_value_value_field */
|
||||
|
||||
/**
|
||||
* Set target of break / continue completion value
|
||||
*
|
||||
* @return completion value with updated field
|
||||
*/
|
||||
static ecma_completion_value_t __attr_const___
|
||||
ecma_set_completion_value_target (ecma_completion_value_t completion_value, /**< completion value
|
||||
* to set field in */
|
||||
vm_instr_counter_t target) /**< break / continue target */
|
||||
{
|
||||
return (ecma_completion_value_t) jrt_set_bit_field_value (completion_value,
|
||||
target,
|
||||
ECMA_COMPLETION_VALUE_TARGET_POS,
|
||||
ECMA_COMPLETION_VALUE_TARGET_WIDTH);
|
||||
} /* ecma_set_completion_value_target */
|
||||
|
||||
/**
|
||||
* Normal, throw, return, exit and meta completion values constructor
|
||||
@@ -652,24 +624,6 @@ ecma_make_meta_completion_value (void)
|
||||
ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY));
|
||||
} /* ecma_make_meta_completion_value */
|
||||
|
||||
/**
|
||||
* Break / continue completion values constructor
|
||||
*
|
||||
* @return completion value
|
||||
*/
|
||||
ecma_completion_value_t __attr_const___
|
||||
ecma_make_jump_completion_value (vm_instr_counter_t target) /**< target break / continue */
|
||||
{
|
||||
ecma_completion_value_t completion_value = 0;
|
||||
|
||||
completion_value = ecma_set_completion_value_type_field (completion_value,
|
||||
ECMA_COMPLETION_TYPE_JUMP);
|
||||
completion_value = ecma_set_completion_value_target (completion_value,
|
||||
target);
|
||||
|
||||
return completion_value;
|
||||
} /* ecma_make_jump_completion_value */
|
||||
|
||||
/**
|
||||
* Get ecma-value from specified completion value
|
||||
*
|
||||
@@ -722,20 +676,6 @@ ecma_get_object_from_completion_value (ecma_completion_value_t completion_value)
|
||||
return ecma_get_object_from_value (ecma_get_completion_value_value (completion_value));
|
||||
} /* ecma_get_object_from_completion_value */
|
||||
|
||||
/**
|
||||
* Get break / continue target from completion value
|
||||
*
|
||||
* @return instruction counter
|
||||
*/
|
||||
vm_instr_counter_t
|
||||
ecma_get_jump_target_from_completion_value (ecma_completion_value_t completion_value) /**< completion
|
||||
* value */
|
||||
{
|
||||
JERRY_ASSERT (ecma_get_completion_value_type_field (completion_value) == ECMA_COMPLETION_TYPE_JUMP);
|
||||
|
||||
return ecma_get_completion_value_target (completion_value);
|
||||
} /* ecma_get_jump_target_from_completion_value */
|
||||
|
||||
/**
|
||||
* Copy ecma-completion value.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user