Support getting script object in the backtrace callback. (#4789)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
@@ -1067,7 +1067,7 @@ jerry_exec_snapshot (const uint32_t *snapshot_p, /**< snapshot */
|
||||
}
|
||||
else
|
||||
{
|
||||
ret_val = vm_run_global (bytecode_p);
|
||||
ret_val = vm_run_global (bytecode_p, NULL);
|
||||
if (!(bytecode_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION))
|
||||
{
|
||||
ecma_bytecode_deref (bytecode_p);
|
||||
|
||||
@@ -573,24 +573,19 @@ jerry_run (const jerry_value_t func_val) /**< function to run */
|
||||
|
||||
ecma_object_t *object_p = ecma_get_object_from_value (func_val);
|
||||
|
||||
if (ecma_get_object_type (object_p) != ECMA_OBJECT_TYPE_CLASS)
|
||||
if (!ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_SCRIPT))
|
||||
{
|
||||
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
|
||||
}
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
if (ext_object_p->u.cls.type != ECMA_OBJECT_CLASS_SCRIPT)
|
||||
{
|
||||
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
|
||||
}
|
||||
|
||||
const ecma_compiled_code_t *bytecode_data_p;
|
||||
bytecode_data_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, ext_object_p->u.cls.u3.value);
|
||||
|
||||
JERRY_ASSERT (CBC_FUNCTION_GET_TYPE (bytecode_data_p->status_flags) == CBC_FUNCTION_SCRIPT);
|
||||
|
||||
return jerry_return (vm_run_global (bytecode_data_p));
|
||||
return jerry_return (vm_run_global (bytecode_data_p, object_p));
|
||||
} /* jerry_run */
|
||||
|
||||
/**
|
||||
|
||||
+3
-2
@@ -271,7 +271,8 @@ static const uint16_t vm_decode_table[] JERRY_ATTR_CONST_DATA =
|
||||
* @return ecma value
|
||||
*/
|
||||
ecma_value_t
|
||||
vm_run_global (const ecma_compiled_code_t *bytecode_p) /**< pointer to bytecode to run */
|
||||
vm_run_global (const ecma_compiled_code_t *bytecode_p, /**< pointer to bytecode to run */
|
||||
ecma_object_t *function_object_p) /**< function object if available */
|
||||
{
|
||||
#if JERRY_BUILTIN_REALMS
|
||||
ecma_object_t *global_obj_p = (ecma_object_t *) ecma_op_function_get_realm (bytecode_p);
|
||||
@@ -290,7 +291,7 @@ vm_run_global (const ecma_compiled_code_t *bytecode_p) /**< pointer to bytecode
|
||||
|
||||
vm_frame_ctx_shared_t shared;
|
||||
shared.bytecode_header_p = bytecode_p;
|
||||
shared.function_object_p = NULL;
|
||||
shared.function_object_p = function_object_p;
|
||||
shared.status_flags = 0;
|
||||
|
||||
#if JERRY_BUILTIN_REALMS
|
||||
|
||||
+1
-1
@@ -479,7 +479,7 @@ typedef enum
|
||||
VM_EXEC_CONSTRUCT, /**< construct a new object */
|
||||
} vm_call_operation;
|
||||
|
||||
ecma_value_t vm_run_global (const ecma_compiled_code_t *bytecode_p);
|
||||
ecma_value_t vm_run_global (const ecma_compiled_code_t *bytecode_p, ecma_object_t *function_object_p);
|
||||
ecma_value_t vm_run_eval (ecma_compiled_code_t *bytecode_data_p, uint32_t parse_opts);
|
||||
|
||||
#if JERRY_MODULE_SYSTEM
|
||||
|
||||
Reference in New Issue
Block a user