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:
Zoltan Herczeg
2021-10-06 11:09:01 +02:00
committed by GitHub
parent 54b1a3c739
commit d98ff6fd30
5 changed files with 57 additions and 13 deletions
+1 -1
View File
@@ -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);
+2 -7
View File
@@ -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 */
/**