mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
lottie/jerryscript: removed dead code
This eliminates the jerryscript features which are unlikely to be used by thorvg. - JERRY_LINE_INFO - JERRY_PROMISE_CALLBACK - JERRY_FUNCTION_TO_STRING - JERRY_MEM_GC_BEFORE_EACH_ALLOC - JERRY_CPOINTER_32_BIT - JERRY_REGEXP_STRICT_MODE
This commit is contained in:
parent
eab9d68e67
commit
c22af13027
36 changed files with 7 additions and 2109 deletions
|
@ -126,13 +126,6 @@ ecma_compiled_code_resolve_extended_info (const ecma_compiled_code_t *bytecode_h
|
||||||
base_p--;
|
base_p--;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
if (bytecode_header_p->status_flags & CBC_CODE_FLAGS_HAS_LINE_INFO)
|
|
||||||
{
|
|
||||||
base_p--;
|
|
||||||
}
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
JERRY_ASSERT (((uint8_t *) base_p)[-1] != 0);
|
JERRY_ASSERT (((uint8_t *) base_p)[-1] != 0);
|
||||||
|
|
||||||
return ((uint8_t *) base_p) - 1;
|
return ((uint8_t *) base_p) - 1;
|
||||||
|
|
|
@ -1562,13 +1562,6 @@ ecma_gc_free_property (ecma_object_t *object_p, /**< object */
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
ecma_getter_setter_pointers_t *getter_setter_pair_p;
|
|
||||||
getter_setter_pair_p =
|
|
||||||
ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t, prop_pair_p->values[index].getter_setter_pair_cp);
|
|
||||||
jmem_pools_free (getter_setter_pair_p, sizeof (ecma_getter_setter_pointers_t));
|
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,9 +120,6 @@ typedef enum
|
||||||
#if JERRY_MODULE_SYSTEM
|
#if JERRY_MODULE_SYSTEM
|
||||||
ECMA_PARSE_INTERNAL_HAS_IMPORT_META = (1u << 18), /**< module has import.meta expression */
|
ECMA_PARSE_INTERNAL_HAS_IMPORT_META = (1u << 18), /**< module has import.meta expression */
|
||||||
#endif /* JERRY_MODULE_SYSTEM */
|
#endif /* JERRY_MODULE_SYSTEM */
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
ECMA_PARSE_INTERNAL_HAS_4_BYTE_MARKER = (1u << 19), /**< source has 4 byte marker */
|
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
#ifndef JERRY_NDEBUG
|
#ifndef JERRY_NDEBUG
|
||||||
/**
|
/**
|
||||||
* This flag represents an error in for in/of statements, which cannot be set
|
* This flag represents an error in for in/of statements, which cannot be set
|
||||||
|
@ -521,16 +518,9 @@ typedef uint8_t ecma_property_t; /**< ecma_property_types_t (3 bit) and ecma_pro
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
jmem_cpointer_t next_property_cp; /**< next cpointer */
|
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
ecma_property_t types[ECMA_PROPERTY_PAIR_ITEM_COUNT]; /**< two property type slot. The first represent
|
ecma_property_t types[ECMA_PROPERTY_PAIR_ITEM_COUNT]; /**< two property type slot. The first represent
|
||||||
* the type of this property (e.g. property pair) */
|
* the type of this property (e.g. property pair) */
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
uint16_t padding; /**< an unused value */
|
|
||||||
#else /* !JERRY_CPOINTER_32_BIT */
|
|
||||||
jmem_cpointer_t next_property_cp; /**< next cpointer */
|
jmem_cpointer_t next_property_cp; /**< next cpointer */
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
} ecma_property_header_t;
|
} ecma_property_header_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -548,11 +538,7 @@ typedef struct
|
||||||
typedef union
|
typedef union
|
||||||
{
|
{
|
||||||
ecma_value_t value; /**< value of a property */
|
ecma_value_t value; /**< value of a property */
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
jmem_cpointer_t getter_setter_pair_cp; /**< cpointer to getter setter pair */
|
|
||||||
#else /* !JERRY_CPOINTER_32_BIT */
|
|
||||||
ecma_getter_setter_pointers_t getter_setter_pair; /**< getter setter pair */
|
ecma_getter_setter_pointers_t getter_setter_pair; /**< getter setter pair */
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
} ecma_property_value_t;
|
} ecma_property_value_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -863,22 +849,11 @@ typedef enum
|
||||||
*/
|
*/
|
||||||
#define ECMA_OBJECT_REF_ONE (1u << ECMA_OBJECT_REF_SHIFT)
|
#define ECMA_OBJECT_REF_ONE (1u << ECMA_OBJECT_REF_SHIFT)
|
||||||
|
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Type of the descriptor field of an object
|
|
||||||
*/
|
|
||||||
typedef uint32_t ecma_object_descriptor_t;
|
|
||||||
|
|
||||||
#else /* !JERRY_CPOINTER_32_BIT */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type of the descriptor field of an object
|
* Type of the descriptor field of an object
|
||||||
*/
|
*/
|
||||||
typedef uint16_t ecma_object_descriptor_t;
|
typedef uint16_t ecma_object_descriptor_t;
|
||||||
|
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bitmask for an ecma-object reference count field
|
* Bitmask for an ecma-object reference count field
|
||||||
*/
|
*/
|
||||||
|
@ -1439,11 +1414,7 @@ typedef enum
|
||||||
* Maximum value of the immediate part of a direct magic string.
|
* Maximum value of the immediate part of a direct magic string.
|
||||||
* Must be compatible with the immediate property name.
|
* Must be compatible with the immediate property name.
|
||||||
*/
|
*/
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
#define ECMA_DIRECT_STRING_MAX_IMM 0x07ffffff
|
|
||||||
#else /* !JERRY_CPOINTER_32_BIT */
|
|
||||||
#define ECMA_DIRECT_STRING_MAX_IMM 0x0000ffff
|
#define ECMA_DIRECT_STRING_MAX_IMM 0x0000ffff
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shift for direct string value part in ecma_value_t.
|
* Shift for direct string value part in ecma_value_t.
|
||||||
|
@ -1770,11 +1741,7 @@ typedef struct
|
||||||
/**
|
/**
|
||||||
* Container of an LCache entry identifier
|
* Container of an LCache entry identifier
|
||||||
*/
|
*/
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
typedef uint64_t ecma_lcache_hash_entry_id_t;
|
|
||||||
#else /* !JERRY_CPOINTER_32_BIT */
|
|
||||||
typedef uint32_t ecma_lcache_hash_entry_id_t;
|
typedef uint32_t ecma_lcache_hash_entry_id_t;
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entry of LCache hash table
|
* Entry of LCache hash table
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include "ecma-gc.h"
|
#include "ecma-gc.h"
|
||||||
#include "ecma-globals.h"
|
#include "ecma-globals.h"
|
||||||
#include "ecma-lcache.h"
|
#include "ecma-lcache.h"
|
||||||
#include "ecma-line-info.h"
|
|
||||||
#include "ecma-property-hashmap.h"
|
#include "ecma-property-hashmap.h"
|
||||||
|
|
||||||
#include "byte-code.h"
|
#include "byte-code.h"
|
||||||
|
@ -555,16 +554,8 @@ ecma_create_named_accessor_property (ecma_object_t *object_p, /**< object */
|
||||||
uint8_t type_and_flags = prop_attributes;
|
uint8_t type_and_flags = prop_attributes;
|
||||||
|
|
||||||
ecma_property_value_t value;
|
ecma_property_value_t value;
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
ecma_getter_setter_pointers_t *getter_setter_pair_p;
|
|
||||||
getter_setter_pair_p = jmem_pools_alloc (sizeof (ecma_getter_setter_pointers_t));
|
|
||||||
ECMA_SET_POINTER (getter_setter_pair_p->getter_cp, get_p);
|
|
||||||
ECMA_SET_POINTER (getter_setter_pair_p->setter_cp, set_p);
|
|
||||||
ECMA_SET_NON_NULL_POINTER (value.getter_setter_pair_cp, getter_setter_pair_p);
|
|
||||||
#else /* !JERRY_CPOINTER_32_BIT */
|
|
||||||
ECMA_SET_POINTER (value.getter_setter_pair.getter_cp, get_p);
|
ECMA_SET_POINTER (value.getter_setter_pair.getter_cp, get_p);
|
||||||
ECMA_SET_POINTER (value.getter_setter_pair.setter_cp, set_p);
|
ECMA_SET_POINTER (value.getter_setter_pair.setter_cp, set_p);
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
|
|
||||||
return ecma_create_property (object_p, name_p, type_and_flags, value, out_prop_p);
|
return ecma_create_property (object_p, name_p, type_and_flags, value, out_prop_p);
|
||||||
} /* ecma_create_named_accessor_property */
|
} /* ecma_create_named_accessor_property */
|
||||||
|
@ -935,11 +926,7 @@ ecma_named_data_property_assign_value (ecma_object_t *obj_p, /**< object */
|
||||||
ecma_getter_setter_pointers_t *
|
ecma_getter_setter_pointers_t *
|
||||||
ecma_get_named_accessor_property (const ecma_property_value_t *prop_value_p) /**< property value reference */
|
ecma_get_named_accessor_property (const ecma_property_value_t *prop_value_p) /**< property value reference */
|
||||||
{
|
{
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
return ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t, prop_value_p->getter_setter_pair_cp);
|
|
||||||
#else /* !JERRY_CPOINTER_32_BIT */
|
|
||||||
return (ecma_getter_setter_pointers_t *) &prop_value_p->getter_setter_pair;
|
return (ecma_getter_setter_pointers_t *) &prop_value_p->getter_setter_pair;
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
} /* ecma_get_named_accessor_property */
|
} /* ecma_get_named_accessor_property */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -952,13 +939,7 @@ ecma_set_named_accessor_property_getter (ecma_object_t *object_p, /**< the prope
|
||||||
{
|
{
|
||||||
ecma_assert_object_contains_the_property (object_p, prop_value_p, false);
|
ecma_assert_object_contains_the_property (object_p, prop_value_p, false);
|
||||||
|
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
ecma_getter_setter_pointers_t *getter_setter_pair_p;
|
|
||||||
getter_setter_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t, prop_value_p->getter_setter_pair_cp);
|
|
||||||
ECMA_SET_POINTER (getter_setter_pair_p->getter_cp, getter_p);
|
|
||||||
#else /* !JERRY_CPOINTER_32_BIT */
|
|
||||||
ECMA_SET_POINTER (prop_value_p->getter_setter_pair.getter_cp, getter_p);
|
ECMA_SET_POINTER (prop_value_p->getter_setter_pair.getter_cp, getter_p);
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
} /* ecma_set_named_accessor_property_getter */
|
} /* ecma_set_named_accessor_property_getter */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -971,13 +952,7 @@ ecma_set_named_accessor_property_setter (ecma_object_t *object_p, /**< the prope
|
||||||
{
|
{
|
||||||
ecma_assert_object_contains_the_property (object_p, prop_value_p, false);
|
ecma_assert_object_contains_the_property (object_p, prop_value_p, false);
|
||||||
|
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
ecma_getter_setter_pointers_t *getter_setter_pair_p;
|
|
||||||
getter_setter_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t, prop_value_p->getter_setter_pair_cp);
|
|
||||||
ECMA_SET_POINTER (getter_setter_pair_p->setter_cp, setter_p);
|
|
||||||
#else /* !JERRY_CPOINTER_32_BIT */
|
|
||||||
ECMA_SET_POINTER (prop_value_p->getter_setter_pair.setter_cp, setter_p);
|
ECMA_SET_POINTER (prop_value_p->getter_setter_pair.setter_cp, setter_p);
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
} /* ecma_set_named_accessor_property_setter */
|
} /* ecma_set_named_accessor_property_setter */
|
||||||
|
|
||||||
#if JERRY_MODULE_SYSTEM
|
#if JERRY_MODULE_SYSTEM
|
||||||
|
@ -999,17 +974,10 @@ ecma_property_to_reference (ecma_property_t *property_p) /**< data or reference
|
||||||
|
|
||||||
jmem_cpointer_tag_t offset = (jmem_cpointer_tag_t) (((uintptr_t) property_p) & 0x1);
|
jmem_cpointer_tag_t offset = (jmem_cpointer_tag_t) (((uintptr_t) property_p) & 0x1);
|
||||||
|
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
if (offset != 0)
|
|
||||||
{
|
|
||||||
--referenced_value_p;
|
|
||||||
}
|
|
||||||
#else /* !JERRY_CPOINTER_32_BIT */
|
|
||||||
if (offset == 0)
|
if (offset == 0)
|
||||||
{
|
{
|
||||||
++referenced_value_p;
|
++referenced_value_p;
|
||||||
}
|
}
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
|
|
||||||
JERRY_ASSERT ((((uintptr_t) referenced_value_p) & (((uintptr_t) 1 << JMEM_ALIGNMENT_LOG) - 1)) == 0);
|
JERRY_ASSERT ((((uintptr_t) referenced_value_p) & (((uintptr_t) 1 << JMEM_ALIGNMENT_LOG) - 1)) == 0);
|
||||||
|
|
||||||
|
@ -1029,17 +997,10 @@ ecma_get_property_value_from_named_reference (ecma_property_value_t *reference_p
|
||||||
ecma_value_t value = reference_p->value;
|
ecma_value_t value = reference_p->value;
|
||||||
reference_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_property_value_t, value);
|
reference_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_property_value_t, value);
|
||||||
|
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
if (ECMA_GET_FIRST_BIT_FROM_POINTER_TAG (value))
|
|
||||||
{
|
|
||||||
++reference_p;
|
|
||||||
}
|
|
||||||
#else /* !JERRY_CPOINTER_32_BIT */
|
|
||||||
if (!ECMA_GET_FIRST_BIT_FROM_POINTER_TAG (value))
|
if (!ECMA_GET_FIRST_BIT_FROM_POINTER_TAG (value))
|
||||||
{
|
{
|
||||||
--reference_p;
|
--reference_p;
|
||||||
}
|
}
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
|
|
||||||
return reference_p;
|
return reference_p;
|
||||||
} /* ecma_get_property_value_from_named_reference */
|
} /* ecma_get_property_value_from_named_reference */
|
||||||
|
@ -1438,16 +1399,6 @@ ecma_script_deref (ecma_value_t script_value) /**< script value */
|
||||||
}
|
}
|
||||||
#endif /* JERRY_MODULE_SYSTEM */
|
#endif /* JERRY_MODULE_SYSTEM */
|
||||||
|
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
ecma_deref_ecma_string (ecma_get_string_from_value (script_p->source_code));
|
|
||||||
|
|
||||||
if (type & CBC_SCRIPT_HAS_FUNCTION_ARGUMENTS)
|
|
||||||
{
|
|
||||||
ecma_deref_ecma_string (ecma_get_string_from_value (CBC_SCRIPT_GET_FUNCTION_ARGUMENTS (script_p, type)));
|
|
||||||
script_size += sizeof (ecma_value_t);
|
|
||||||
}
|
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
|
|
||||||
jmem_heap_free_block (script_p, script_size);
|
jmem_heap_free_block (script_p, script_size);
|
||||||
} /* ecma_script_deref */
|
} /* ecma_script_deref */
|
||||||
|
|
||||||
|
@ -1535,13 +1486,6 @@ ecma_bytecode_deref (ecma_compiled_code_t *bytecode_p) /**< byte code pointer */
|
||||||
ecma_collection_free_template_literal (collection_p);
|
ecma_collection_free_template_literal (collection_p);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
if (bytecode_p->status_flags & CBC_CODE_FLAGS_HAS_LINE_INFO)
|
|
||||||
{
|
|
||||||
ecma_line_info_free (ecma_compiled_code_get_line_info (bytecode_p));
|
|
||||||
}
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1687,36 +1631,6 @@ ecma_compiled_code_get_tagged_template_collection (const ecma_compiled_code_t *b
|
||||||
return ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, base_p[-1]);
|
return ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, base_p[-1]);
|
||||||
} /* ecma_compiled_code_get_tagged_template_collection */
|
} /* ecma_compiled_code_get_tagged_template_collection */
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the line info data from the byte code
|
|
||||||
*
|
|
||||||
* @return pointer to the line info data
|
|
||||||
*/
|
|
||||||
uint8_t *
|
|
||||||
ecma_compiled_code_get_line_info (const ecma_compiled_code_t *bytecode_header_p) /**< compiled code */
|
|
||||||
{
|
|
||||||
JERRY_ASSERT (bytecode_header_p != NULL);
|
|
||||||
JERRY_ASSERT (bytecode_header_p->status_flags & CBC_CODE_FLAGS_HAS_LINE_INFO);
|
|
||||||
|
|
||||||
ecma_value_t *base_p = ecma_compiled_code_resolve_arguments_start (bytecode_header_p);
|
|
||||||
|
|
||||||
if (CBC_FUNCTION_GET_TYPE (bytecode_header_p->status_flags) != CBC_FUNCTION_CONSTRUCTOR)
|
|
||||||
{
|
|
||||||
base_p--;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bytecode_header_p->status_flags & CBC_CODE_FLAGS_HAS_TAGGED_LITERALS)
|
|
||||||
{
|
|
||||||
base_p--;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ECMA_GET_INTERNAL_VALUE_POINTER (uint8_t, base_p[-1]);
|
|
||||||
} /* ecma_compiled_code_get_line_info */
|
|
||||||
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the source name of a compiled code.
|
* Get the source name of a compiled code.
|
||||||
*
|
*
|
||||||
|
|
|
@ -486,9 +486,6 @@ ecma_value_t ecma_script_get_from_value (ecma_value_t value);
|
||||||
ecma_value_t *ecma_compiled_code_resolve_arguments_start (const ecma_compiled_code_t *bytecode_header_p);
|
ecma_value_t *ecma_compiled_code_resolve_arguments_start (const ecma_compiled_code_t *bytecode_header_p);
|
||||||
ecma_value_t *ecma_compiled_code_resolve_function_name (const ecma_compiled_code_t *bytecode_header_p);
|
ecma_value_t *ecma_compiled_code_resolve_function_name (const ecma_compiled_code_t *bytecode_header_p);
|
||||||
ecma_collection_t *ecma_compiled_code_get_tagged_template_collection (const ecma_compiled_code_t *bytecode_header_p);
|
ecma_collection_t *ecma_compiled_code_get_tagged_template_collection (const ecma_compiled_code_t *bytecode_header_p);
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
uint8_t *ecma_compiled_code_get_line_info (const ecma_compiled_code_t *bytecode_header_p);
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
ecma_value_t ecma_get_source_name (const ecma_compiled_code_t *bytecode_p);
|
ecma_value_t ecma_get_source_name (const ecma_compiled_code_t *bytecode_p);
|
||||||
#if (JERRY_STACK_LIMIT != 0)
|
#if (JERRY_STACK_LIMIT != 0)
|
||||||
uintptr_t ecma_get_current_stack_usage (void);
|
uintptr_t ecma_get_current_stack_usage (void);
|
||||||
|
|
|
@ -33,11 +33,7 @@
|
||||||
/**
|
/**
|
||||||
* Bitshift index for calculating hash.
|
* Bitshift index for calculating hash.
|
||||||
*/
|
*/
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
#define ECMA_LCACHE_HASH_BITSHIFT_INDEX (2 * JMEM_ALIGNMENT_LOG)
|
|
||||||
#else /* !JERRY_CPOINTER_32_BIT */
|
|
||||||
#define ECMA_LCACHE_HASH_BITSHIFT_INDEX 0
|
#define ECMA_LCACHE_HASH_BITSHIFT_INDEX 0
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mask for hash bits
|
* Mask for hash bits
|
||||||
|
|
|
@ -1,271 +0,0 @@
|
||||||
/* Copyright JS Foundation and other contributors, http://js.foundation
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "ecma-line-info.h"
|
|
||||||
|
|
||||||
#include "ecma-helpers.h"
|
|
||||||
|
|
||||||
/** \addtogroup ecma ECMA
|
|
||||||
* @{
|
|
||||||
*
|
|
||||||
* \addtogroup ecmalineinfo Line info
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
|
|
||||||
/* The layout of the structure is defined in js-parser-line-info-create.c */
|
|
||||||
|
|
||||||
JERRY_STATIC_ASSERT ((ECMA_LINE_INFO_COLUMN_DEFAULT - 1) == ((ECMA_LINE_INFO_ENCODE_TWO_BYTE >> 1) - 1),
|
|
||||||
ecma_line_info_column_1_must_be_accessible_with_the_highest_one_byte_negative_value);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Decodes an uint32_t number, and updates the buffer position.
|
|
||||||
* Numbers expected to be larger values.
|
|
||||||
*
|
|
||||||
* @return the decoded value
|
|
||||||
*/
|
|
||||||
uint32_t
|
|
||||||
ecma_line_info_decode_vlq (uint8_t **buffer_p) /**< [in/out] target buffer */
|
|
||||||
{
|
|
||||||
uint8_t *source_p = *buffer_p;
|
|
||||||
uint32_t value = 0;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
value = (value << ECMA_LINE_INFO_VLQ_SHIFT) | (*source_p & ECMA_LINE_INFO_VLQ_MASK);
|
|
||||||
} while (*source_p++ & ECMA_LINE_INFO_VLQ_CONTINUE);
|
|
||||||
|
|
||||||
*buffer_p = source_p;
|
|
||||||
return value;
|
|
||||||
} /* ecma_line_info_decode_vlq */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Decodes an uint32_t number, and updates the buffer position.
|
|
||||||
* Numbers expected to be smaller values.
|
|
||||||
*
|
|
||||||
* @return the decoded value
|
|
||||||
*/
|
|
||||||
static uint32_t
|
|
||||||
ecma_line_info_decode_small (uint8_t **buffer_p) /**< [in/out] target buffer */
|
|
||||||
{
|
|
||||||
uint8_t *source_p = *buffer_p;
|
|
||||||
uint32_t type = source_p[0];
|
|
||||||
|
|
||||||
*buffer_p = source_p + 1;
|
|
||||||
|
|
||||||
if (type < ECMA_LINE_INFO_ENCODE_TWO_BYTE_MIN)
|
|
||||||
{
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type == ECMA_LINE_INFO_ENCODE_TWO_BYTE)
|
|
||||||
{
|
|
||||||
*buffer_p = source_p + 2;
|
|
||||||
return ((uint32_t) source_p[1]) + ECMA_LINE_INFO_ENCODE_TWO_BYTE_MIN;
|
|
||||||
}
|
|
||||||
|
|
||||||
JERRY_ASSERT (type == ECMA_LINE_INFO_ENCODE_VLQ);
|
|
||||||
return ecma_line_info_decode_vlq (buffer_p) + ECMA_LINE_INFO_ENCODE_VLQ_MIN;
|
|
||||||
} /* ecma_line_info_decode_small */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates a value using an encoded difference.
|
|
||||||
*
|
|
||||||
* @return updated value
|
|
||||||
*/
|
|
||||||
uint32_t
|
|
||||||
ecma_line_info_difference_update (uint32_t current_value, /**< current value */
|
|
||||||
uint32_t difference_value) /**< encoded difference */
|
|
||||||
{
|
|
||||||
if ((difference_value & 0x1) == ECMA_LINE_INFO_INCREASE)
|
|
||||||
{
|
|
||||||
return current_value + (difference_value >> 1) + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return current_value - (difference_value >> 1);
|
|
||||||
} /* ecma_line_info_difference_update */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Release line info data.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
ecma_line_info_free (uint8_t *line_info_p) /**< line info buffer */
|
|
||||||
{
|
|
||||||
uint8_t *source_p = line_info_p;
|
|
||||||
uint32_t total_length = ecma_line_info_decode_vlq (&source_p);
|
|
||||||
|
|
||||||
jmem_heap_free_block (line_info_p, total_length + (uint32_t) (source_p - line_info_p));
|
|
||||||
} /* ecma_line_info_free */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the line/column information for a given byte code offset.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
ecma_line_info_get (uint8_t *line_info_p, /**< line info buffer */
|
|
||||||
uint32_t offset, /**< byte code offset */
|
|
||||||
jerry_frame_location_t *location_p) /**< [out] location */
|
|
||||||
{
|
|
||||||
uint32_t line = 1;
|
|
||||||
uint32_t column = ECMA_LINE_INFO_COLUMN_DEFAULT;
|
|
||||||
uint32_t end_offset = 0;
|
|
||||||
uint32_t end_offset_increase;
|
|
||||||
uint32_t value;
|
|
||||||
|
|
||||||
/* Skip total_length. */
|
|
||||||
ecma_line_info_decode_vlq (&line_info_p);
|
|
||||||
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
value = ecma_line_info_decode_vlq (&line_info_p);
|
|
||||||
line = ecma_line_info_difference_update (line, value);
|
|
||||||
|
|
||||||
if (*line_info_p == 0)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t *size_p = line_info_p + *line_info_p + (ECMA_LINE_INFO_STREAM_SIZE_MIN + 1);
|
|
||||||
|
|
||||||
uint32_t next_end_offset = end_offset + ecma_line_info_decode_vlq (&size_p);
|
|
||||||
|
|
||||||
if (offset < next_end_offset)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
end_offset = next_end_offset;
|
|
||||||
line_info_p = size_p;
|
|
||||||
}
|
|
||||||
|
|
||||||
line_info_p++;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
end_offset_increase = ecma_line_info_decode_small (&line_info_p);
|
|
||||||
|
|
||||||
if (end_offset_increase & ECMA_LINE_INFO_HAS_LINE)
|
|
||||||
{
|
|
||||||
value = ecma_line_info_decode_small (&line_info_p);
|
|
||||||
line = ecma_line_info_difference_update (line, value);
|
|
||||||
column = ECMA_LINE_INFO_COLUMN_DEFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
end_offset_increase >>= 1;
|
|
||||||
|
|
||||||
value = ecma_line_info_decode_small (&line_info_p);
|
|
||||||
column = ecma_line_info_difference_update (column, value);
|
|
||||||
|
|
||||||
end_offset += end_offset_increase;
|
|
||||||
} while (end_offset_increase != 0 && end_offset <= offset);
|
|
||||||
|
|
||||||
location_p->line = line;
|
|
||||||
location_p->column = column;
|
|
||||||
} /* ecma_line_info_get */
|
|
||||||
|
|
||||||
#if JERRY_PARSER_DUMP_BYTE_CODE
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Dumps line info data.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
ecma_line_info_dump (uint8_t *line_info_p) /**< dumps line info data */
|
|
||||||
{
|
|
||||||
bool block_last = false;
|
|
||||||
uint32_t block_line = 1;
|
|
||||||
uint32_t block_byte_code_offset = 0;
|
|
||||||
uint32_t value;
|
|
||||||
|
|
||||||
value = ecma_line_info_decode_vlq (&line_info_p);
|
|
||||||
JERRY_DEBUG_MSG ("\nLine info size: %d bytes\n", (int) value);
|
|
||||||
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
value = ecma_line_info_decode_vlq (&line_info_p);
|
|
||||||
block_line = ecma_line_info_difference_update (block_line, value);
|
|
||||||
|
|
||||||
JERRY_DEBUG_MSG ("\nNew block: line: %d", (int) block_line);
|
|
||||||
|
|
||||||
if (*line_info_p == 0)
|
|
||||||
{
|
|
||||||
JERRY_DEBUG_MSG (" StreamLength: [last]\n");
|
|
||||||
block_last = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
uint8_t *size_p = line_info_p + *line_info_p + (ECMA_LINE_INFO_STREAM_SIZE_MIN + 1);
|
|
||||||
|
|
||||||
value = ecma_line_info_decode_vlq (&size_p);
|
|
||||||
|
|
||||||
JERRY_DEBUG_MSG (" StreamLength: %d ByteCodeSize: %d\n",
|
|
||||||
(int) (*line_info_p + ECMA_LINE_INFO_STREAM_SIZE_MIN),
|
|
||||||
(int) value);
|
|
||||||
}
|
|
||||||
|
|
||||||
line_info_p++;
|
|
||||||
|
|
||||||
uint32_t stream_line = block_line;
|
|
||||||
uint32_t stream_column = ECMA_LINE_INFO_COLUMN_DEFAULT;
|
|
||||||
uint32_t stream_end_offset = block_byte_code_offset;
|
|
||||||
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
uint32_t stream_end_offset_increase = ecma_line_info_decode_small (&line_info_p);
|
|
||||||
|
|
||||||
if (stream_end_offset_increase & ECMA_LINE_INFO_HAS_LINE)
|
|
||||||
{
|
|
||||||
value = ecma_line_info_decode_small (&line_info_p);
|
|
||||||
stream_line = ecma_line_info_difference_update (stream_line, value);
|
|
||||||
stream_column = ECMA_LINE_INFO_COLUMN_DEFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
stream_end_offset_increase >>= 1;
|
|
||||||
|
|
||||||
value = ecma_line_info_decode_small (&line_info_p);
|
|
||||||
stream_column = ecma_line_info_difference_update (stream_column, value);
|
|
||||||
|
|
||||||
if (stream_end_offset_increase == 0)
|
|
||||||
{
|
|
||||||
JERRY_DEBUG_MSG (" ByteCodeEndOffset: [unterminated] Line: %d Column: %d\n",
|
|
||||||
(int) stream_line,
|
|
||||||
(int) stream_column);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
stream_end_offset += stream_end_offset_increase;
|
|
||||||
|
|
||||||
JERRY_DEBUG_MSG (" ByteCodeEndOffset: %d Line: %d Column: %d\n",
|
|
||||||
(int) stream_end_offset,
|
|
||||||
(int) stream_line,
|
|
||||||
(int) stream_column);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (block_last)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
block_byte_code_offset += ecma_line_info_decode_vlq (&line_info_p);
|
|
||||||
}
|
|
||||||
} /* ecma_line_info_dump */
|
|
||||||
|
|
||||||
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
|
|
||||||
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
* @}
|
|
||||||
*/
|
|
|
@ -1,114 +0,0 @@
|
||||||
/* Copyright JS Foundation and other contributors, http://js.foundation
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef ECMA_LINE_INFO_H
|
|
||||||
#define ECMA_LINE_INFO_H
|
|
||||||
|
|
||||||
/** \addtogroup ecma ECMA
|
|
||||||
* @{
|
|
||||||
*
|
|
||||||
* \addtogroup ecmalineinfo Line info
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef JERRY_LINE_INFO
|
|
||||||
|
|
||||||
#include "ecma-globals.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Increase the current value of line or column.
|
|
||||||
*/
|
|
||||||
#define ECMA_LINE_INFO_INCREASE 0x0
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Decrease the current value of line or column.
|
|
||||||
*/
|
|
||||||
#define ECMA_LINE_INFO_DECREASE 0x1
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Line update is present.
|
|
||||||
*/
|
|
||||||
#define ECMA_LINE_INFO_HAS_LINE 0x1
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A default value for columns after a line update.
|
|
||||||
*/
|
|
||||||
#define ECMA_LINE_INFO_COLUMN_DEFAULT 127
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Vlq encoding: flag which is set for all bytes except the last one.
|
|
||||||
*/
|
|
||||||
#define ECMA_LINE_INFO_VLQ_CONTINUE 0x80
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Vlq encoding: mask to decode the number fragment.
|
|
||||||
*/
|
|
||||||
#define ECMA_LINE_INFO_VLQ_MASK 0x7f
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Vlq encoding: number of bits stored in a byte.
|
|
||||||
*/
|
|
||||||
#define ECMA_LINE_INFO_VLQ_SHIFT 7
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Small encoding: a value which represents a two byte long number.
|
|
||||||
*/
|
|
||||||
#define ECMA_LINE_INFO_ENCODE_TWO_BYTE (UINT8_MAX - 1)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Small encoding: minimum value of an encoded two byte long number.
|
|
||||||
*/
|
|
||||||
#define ECMA_LINE_INFO_ENCODE_TWO_BYTE_MIN (UINT8_MAX - 1)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Small encoding: a value which represents a three byte long number.
|
|
||||||
*/
|
|
||||||
#define ECMA_LINE_INFO_ENCODE_VLQ UINT8_MAX
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Small encoding: minimum value of an encoded three byte long number.
|
|
||||||
*/
|
|
||||||
#define ECMA_LINE_INFO_ENCODE_VLQ_MIN (ECMA_LINE_INFO_ENCODE_TWO_BYTE_MIN + UINT8_MAX + 1)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Maximum number of line/column entries stored in a stream.
|
|
||||||
*/
|
|
||||||
#define ECMA_LINE_INFO_STREAM_VALUE_COUNT_MAX 48
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Minimum size of a stream (except the last one).
|
|
||||||
*/
|
|
||||||
#define ECMA_LINE_INFO_STREAM_SIZE_MIN ((2 * ECMA_LINE_INFO_STREAM_VALUE_COUNT_MAX) - 1)
|
|
||||||
|
|
||||||
/* Helper functions for parser/js/js-parser-line-info-create.c. */
|
|
||||||
uint32_t ecma_line_info_decode_vlq (uint8_t **buffer_p);
|
|
||||||
uint32_t ecma_line_info_difference_update (uint32_t current_value, uint32_t difference_value);
|
|
||||||
|
|
||||||
/* General functions. */
|
|
||||||
void ecma_line_info_free (uint8_t *line_info_p);
|
|
||||||
void ecma_line_info_get (uint8_t *line_info_p, uint32_t offset, jerry_frame_location_t *location_p);
|
|
||||||
|
|
||||||
#if JERRY_PARSER_DUMP_BYTE_CODE
|
|
||||||
void ecma_line_info_dump (uint8_t *line_info_p);
|
|
||||||
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
|
|
||||||
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endif /* !ECMA_LINE_INFO_H */
|
|
|
@ -9,7 +9,6 @@ source_file = [
|
||||||
'ecma-helpers.h',
|
'ecma-helpers.h',
|
||||||
'ecma-init-finalize.h',
|
'ecma-init-finalize.h',
|
||||||
'ecma-lcache.h',
|
'ecma-lcache.h',
|
||||||
'ecma-line-info.h',
|
|
||||||
'ecma-literal-storage.h',
|
'ecma-literal-storage.h',
|
||||||
'ecma-module.h',
|
'ecma-module.h',
|
||||||
'ecma-property-hashmap.h',
|
'ecma-property-hashmap.h',
|
||||||
|
@ -27,7 +26,6 @@ source_file = [
|
||||||
'ecma-helpers.cpp',
|
'ecma-helpers.cpp',
|
||||||
'ecma-init-finalize.cpp',
|
'ecma-init-finalize.cpp',
|
||||||
'ecma-lcache.cpp',
|
'ecma-lcache.cpp',
|
||||||
'ecma-line-info.cpp',
|
|
||||||
'ecma-literal-storage.cpp',
|
'ecma-literal-storage.cpp',
|
||||||
'ecma-module.cpp',
|
'ecma-module.cpp',
|
||||||
'ecma-property-hashmap.cpp'
|
'ecma-property-hashmap.cpp'
|
||||||
|
|
|
@ -87,105 +87,7 @@ ecma_builtin_function_prototype_object_to_string (ecma_object_t *func_obj_p) /**
|
||||||
return ecma_make_magic_string_value (LIT_MAGIC_STRING_FUNCTION_TO_STRING_NATIVE);
|
return ecma_make_magic_string_value (LIT_MAGIC_STRING_FUNCTION_TO_STRING_NATIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
const ecma_compiled_code_t *bytecode_p;
|
|
||||||
bytecode_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) func_obj_p);
|
|
||||||
|
|
||||||
ecma_value_t script_value = ((cbc_uint8_arguments_t *) bytecode_p)->script_value;
|
|
||||||
cbc_script_t *script_p = ECMA_GET_INTERNAL_VALUE_POINTER (cbc_script_t, script_value);
|
|
||||||
|
|
||||||
if (bytecode_p->status_flags & CBC_CODE_FLAGS_HAS_EXTENDED_INFO)
|
|
||||||
{
|
|
||||||
uint8_t *extended_info_p = ecma_compiled_code_resolve_extended_info (bytecode_p);
|
|
||||||
uint8_t extended_info = *extended_info_p;
|
|
||||||
|
|
||||||
if (extended_info & CBC_EXTENDED_CODE_FLAGS_HAS_SOURCE_CODE_RANGE)
|
|
||||||
{
|
|
||||||
if (extended_info & CBC_EXTENDED_CODE_FLAGS_HAS_ARGUMENT_LENGTH)
|
|
||||||
{
|
|
||||||
ecma_extended_info_decode_vlq (&extended_info_p);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t range_start = ecma_extended_info_decode_vlq (&extended_info_p);
|
|
||||||
uint32_t range_size = ecma_extended_info_decode_vlq (&extended_info_p);
|
|
||||||
ecma_value_t source_code;
|
|
||||||
|
|
||||||
if (!(extended_info & CBC_EXTENDED_CODE_FLAGS_SOURCE_CODE_IN_ARGUMENTS))
|
|
||||||
{
|
|
||||||
source_code = script_p->source_code;
|
|
||||||
#if JERRY_SNAPSHOT_EXEC
|
|
||||||
if (ecma_is_value_magic_string (source_code, LIT_MAGIC_STRING__EMPTY))
|
|
||||||
{
|
|
||||||
return ecma_make_magic_string_value (LIT_MAGIC_STRING_FUNCTION_TO_STRING_ECMA);
|
return ecma_make_magic_string_value (LIT_MAGIC_STRING_FUNCTION_TO_STRING_ECMA);
|
||||||
}
|
|
||||||
#endif /* JERRY_SNAPSHOT_EXEC */
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#if JERRY_SNAPSHOT_EXEC
|
|
||||||
if (!(script_p->refs_and_type & CBC_SCRIPT_HAS_FUNCTION_ARGUMENTS))
|
|
||||||
{
|
|
||||||
return ecma_make_magic_string_value (LIT_MAGIC_STRING_FUNCTION_TO_STRING_ECMA);
|
|
||||||
}
|
|
||||||
#else /* !JERRY_SNAPSHOT_EXEC */
|
|
||||||
JERRY_ASSERT (script_p->refs_and_type & CBC_SCRIPT_HAS_FUNCTION_ARGUMENTS);
|
|
||||||
#endif /* JERRY_SNAPSHOT_EXEC */
|
|
||||||
|
|
||||||
source_code = CBC_SCRIPT_GET_FUNCTION_ARGUMENTS (script_p, script_p->refs_and_type);
|
|
||||||
}
|
|
||||||
|
|
||||||
ecma_string_t *result_string_p;
|
|
||||||
|
|
||||||
ECMA_STRING_TO_UTF8_STRING (ecma_get_string_from_value (source_code), source_p, source_size);
|
|
||||||
result_string_p = ecma_new_ecma_string_from_utf8 (source_p + range_start, range_size);
|
|
||||||
ECMA_FINALIZE_UTF8_STRING (source_p, source_size);
|
|
||||||
|
|
||||||
return ecma_make_string_value (result_string_p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if JERRY_SNAPSHOT_EXEC
|
|
||||||
if (!(script_p->refs_and_type & CBC_SCRIPT_HAS_FUNCTION_ARGUMENTS))
|
|
||||||
{
|
|
||||||
return ecma_make_magic_string_value (LIT_MAGIC_STRING_FUNCTION_TO_STRING_ECMA);
|
|
||||||
}
|
|
||||||
#else /* !JERRY_SNAPSHOT_EXEC */
|
|
||||||
JERRY_ASSERT (script_p->refs_and_type & CBC_SCRIPT_HAS_FUNCTION_ARGUMENTS);
|
|
||||||
#endif /* JERRY_SNAPSHOT_EXEC */
|
|
||||||
|
|
||||||
lit_magic_string_id_t header_id = LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON;
|
|
||||||
|
|
||||||
switch (CBC_FUNCTION_GET_TYPE (bytecode_p->status_flags))
|
|
||||||
{
|
|
||||||
case CBC_FUNCTION_GENERATOR:
|
|
||||||
{
|
|
||||||
header_id = LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON_GENERATOR;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case CBC_FUNCTION_ASYNC_GENERATOR:
|
|
||||||
{
|
|
||||||
header_id = LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON_ASYNC_GENERATOR;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case CBC_FUNCTION_ASYNC:
|
|
||||||
{
|
|
||||||
header_id = LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON_ASYNC;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ecma_stringbuilder_t builder = ecma_stringbuilder_create_from (ecma_get_magic_string (header_id));
|
|
||||||
ecma_value_t function_arguments = CBC_SCRIPT_GET_FUNCTION_ARGUMENTS (script_p, script_p->refs_and_type);
|
|
||||||
|
|
||||||
ecma_stringbuilder_append (&builder, ecma_get_string_from_value (function_arguments));
|
|
||||||
ecma_stringbuilder_append_raw (&builder, (const lit_utf8_byte_t *) "\n) {\n", 5);
|
|
||||||
ecma_stringbuilder_append (&builder, ecma_get_string_from_value (script_p->source_code));
|
|
||||||
ecma_stringbuilder_append_raw (&builder, (const lit_utf8_byte_t *) "\n}", 2);
|
|
||||||
|
|
||||||
return ecma_make_string_value (ecma_stringbuilder_finalize (&builder));
|
|
||||||
#else /* !JERRY_FUNCTION_TO_STRING */
|
|
||||||
return ecma_make_magic_string_value (LIT_MAGIC_STRING_FUNCTION_TO_STRING_ECMA);
|
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
} /* ecma_builtin_function_prototype_object_to_string */
|
} /* ecma_builtin_function_prototype_object_to_string */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -30,10 +30,6 @@
|
||||||
#include "jcontext.h"
|
#include "jcontext.h"
|
||||||
#include "jrt.h"
|
#include "jrt.h"
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
#include "vm.h"
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
/** \addtogroup ecma ECMA
|
/** \addtogroup ecma ECMA
|
||||||
* @{
|
* @{
|
||||||
*
|
*
|
||||||
|
@ -148,22 +144,6 @@ ecma_new_standard_error (jerry_error_t error_type, /**< native error type */
|
||||||
(ecma_make_object_value (error_object_p), JERRY_CONTEXT (error_object_created_callback_user_p));
|
(ecma_make_object_value (error_object_p), JERRY_CONTEXT (error_object_created_callback_user_p));
|
||||||
JERRY_CONTEXT (status_flags) &= (uint32_t) ~ECMA_STATUS_ERROR_UPDATE;
|
JERRY_CONTEXT (status_flags) &= (uint32_t) ~ECMA_STATUS_ERROR_UPDATE;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
/* Default decorator when line info is enabled. */
|
|
||||||
ecma_string_t *stack_str_p = ecma_get_magic_string (LIT_MAGIC_STRING_STACK);
|
|
||||||
|
|
||||||
ecma_property_value_t *prop_value_p =
|
|
||||||
ecma_create_named_data_property (error_object_p, stack_str_p, ECMA_PROPERTY_CONFIGURABLE_WRITABLE, NULL);
|
|
||||||
ecma_deref_ecma_string (stack_str_p);
|
|
||||||
|
|
||||||
ecma_value_t backtrace_value = vm_get_backtrace (0);
|
|
||||||
|
|
||||||
prop_value_p->value = backtrace_value;
|
|
||||||
ecma_deref_object (ecma_get_object_from_value (backtrace_value));
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
}
|
|
||||||
|
|
||||||
return error_object_p;
|
return error_object_p;
|
||||||
} /* ecma_new_standard_error */
|
} /* ecma_new_standard_error */
|
||||||
|
|
|
@ -535,25 +535,12 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
|
||||||
JERRY_ASSERT (current_prop & ECMA_PROPERTY_FLAG_DATA);
|
JERRY_ASSERT (current_prop & ECMA_PROPERTY_FLAG_DATA);
|
||||||
ecma_free_value_if_not_object (value_p->value);
|
ecma_free_value_if_not_object (value_p->value);
|
||||||
|
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
ecma_getter_setter_pointers_t *getter_setter_pair_p;
|
|
||||||
getter_setter_pair_p = jmem_pools_alloc (sizeof (ecma_getter_setter_pointers_t));
|
|
||||||
getter_setter_pair_p->getter_cp = JMEM_CP_NULL;
|
|
||||||
getter_setter_pair_p->setter_cp = JMEM_CP_NULL;
|
|
||||||
ECMA_SET_NON_NULL_POINTER (value_p->getter_setter_pair_cp, getter_setter_pair_p);
|
|
||||||
#else /* !JERRY_CPOINTER_32_BIT */
|
|
||||||
value_p->getter_setter_pair.getter_cp = JMEM_CP_NULL;
|
value_p->getter_setter_pair.getter_cp = JMEM_CP_NULL;
|
||||||
value_p->getter_setter_pair.setter_cp = JMEM_CP_NULL;
|
value_p->getter_setter_pair.setter_cp = JMEM_CP_NULL;
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
JERRY_ASSERT (!(current_prop & ECMA_PROPERTY_FLAG_DATA));
|
JERRY_ASSERT (!(current_prop & ECMA_PROPERTY_FLAG_DATA));
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
ecma_getter_setter_pointers_t *getter_setter_pair_p;
|
|
||||||
getter_setter_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t, value_p->getter_setter_pair_cp);
|
|
||||||
jmem_pools_free (getter_setter_pair_p, sizeof (ecma_getter_setter_pointers_t));
|
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
value_p->value = ECMA_VALUE_UNDEFINED;
|
value_p->value = ECMA_VALUE_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,10 +33,6 @@ typedef enum
|
||||||
ECMA_PROMISE_IS_PENDING = (1 << 0), /**< pending state */
|
ECMA_PROMISE_IS_PENDING = (1 << 0), /**< pending state */
|
||||||
ECMA_PROMISE_IS_FULFILLED = (1 << 1), /**< fulfilled state */
|
ECMA_PROMISE_IS_FULFILLED = (1 << 1), /**< fulfilled state */
|
||||||
ECMA_PROMISE_ALREADY_RESOLVED = (1 << 2), /**< already resolved */
|
ECMA_PROMISE_ALREADY_RESOLVED = (1 << 2), /**< already resolved */
|
||||||
#if JERRY_PROMISE_CALLBACK
|
|
||||||
ECMA_PROMISE_UNHANDLED_REJECT = (1 << 3), /**< a Promise is rejected without a catch handler,
|
|
||||||
* related to ES11: 25.6.6 [[PromiseIsHandled]] */
|
|
||||||
#endif /* JERRY_PROMISE_CALLBACK */
|
|
||||||
} ecma_promise_flags_t;
|
} ecma_promise_flags_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -64,20 +64,6 @@
|
||||||
* Engine internal and misc configurations.
|
* Engine internal and misc configurations.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies the compressed pointer representation
|
|
||||||
*
|
|
||||||
* Allowed values:
|
|
||||||
* 0: use 16 bit representation
|
|
||||||
* 1: use 32 bit representation
|
|
||||||
*
|
|
||||||
* Default value: 0
|
|
||||||
* For more details see: jmem/jmem.h
|
|
||||||
*/
|
|
||||||
#ifndef JERRY_CPOINTER_32_BIT
|
|
||||||
#define JERRY_CPOINTER_32_BIT 0
|
|
||||||
#endif /* !defined (JERRY_CPOINTER_32_BIT) */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable/Disable built-in error messages for error objects.
|
* Enable/Disable built-in error messages for error objects.
|
||||||
*
|
*
|
||||||
|
@ -157,60 +143,6 @@
|
||||||
#define JERRY_LCACHE 1
|
#define JERRY_LCACHE 1
|
||||||
#endif /* !defined (JERRY_LCACHE) */
|
#endif /* !defined (JERRY_LCACHE) */
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable/Disable function toString operation.
|
|
||||||
*
|
|
||||||
* Allowed values:
|
|
||||||
* 0: Disable function toString operation.
|
|
||||||
* 1: Enable function toString operation.
|
|
||||||
*
|
|
||||||
* Default value: 0
|
|
||||||
*/
|
|
||||||
#ifndef JERRY_FUNCTION_TO_STRING
|
|
||||||
#define JERRY_FUNCTION_TO_STRING 0
|
|
||||||
#endif /* !defined (JERRY_FUNCTION_TO_STRING) */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable/Disable line-info management inside the engine.
|
|
||||||
*
|
|
||||||
* Allowed values:
|
|
||||||
* 0: Disable line-info in the engine.
|
|
||||||
* 1: Enable line-info management.
|
|
||||||
*
|
|
||||||
* Default value: 0
|
|
||||||
*/
|
|
||||||
#ifndef JERRY_LINE_INFO
|
|
||||||
#define JERRY_LINE_INFO 0
|
|
||||||
#endif /* !defined (JERRY_LINE_INFO) */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable/Disable logging inside the engine.
|
|
||||||
*
|
|
||||||
* Allowed values:
|
|
||||||
* 0: Disable internal logging.
|
|
||||||
* 1: Enable internal logging.
|
|
||||||
*
|
|
||||||
* Default value: 0
|
|
||||||
*/
|
|
||||||
#ifndef JERRY_LOGGING
|
|
||||||
#define JERRY_LOGGING 0
|
|
||||||
#endif /* !defined (JERRY_LOGGING) */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable/Disable gc call before every allocation.
|
|
||||||
*
|
|
||||||
* Allowed values:
|
|
||||||
* 0: Disable gc call before each allocation.
|
|
||||||
* 1: Enable and force gc call before each allocation.
|
|
||||||
*
|
|
||||||
* Default value: 0
|
|
||||||
* Warning!: This is an advanced option and will slow down the engine!
|
|
||||||
* Only enable it for debugging purposes.
|
|
||||||
*/
|
|
||||||
#ifndef JERRY_MEM_GC_BEFORE_EACH_ALLOC
|
|
||||||
#define JERRY_MEM_GC_BEFORE_EACH_ALLOC 0
|
|
||||||
#endif /* !defined (JERRY_MEM_GC_BEFORE_EACH_ALLOC) */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use 32-bit/64-bit float for ecma-numbers
|
* Use 32-bit/64-bit float for ecma-numbers
|
||||||
* This option is for expert use only!
|
* This option is for expert use only!
|
||||||
|
@ -266,15 +198,6 @@
|
||||||
#define JERRY_PROPERTY_HASHMAP 0
|
#define JERRY_PROPERTY_HASHMAP 0
|
||||||
#endif /* !defined (JERRY_PROPERTY_HASHMAP) */
|
#endif /* !defined (JERRY_PROPERTY_HASHMAP) */
|
||||||
|
|
||||||
/**
|
|
||||||
* Enables/disables the Promise event callbacks
|
|
||||||
*
|
|
||||||
* Default value: 0
|
|
||||||
*/
|
|
||||||
#ifndef JERRY_PROMISE_CALLBACK
|
|
||||||
#define JERRY_PROMISE_CALLBACK 0
|
|
||||||
#endif /* !defined (JERRY_PROMISE_CALLBACK) */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable/Disable byte code dump functions for RegExp objects.
|
* Enable/Disable byte code dump functions for RegExp objects.
|
||||||
* To dump the RegExp byte code the engine must be initialized with
|
* To dump the RegExp byte code the engine must be initialized with
|
||||||
|
@ -291,15 +214,6 @@
|
||||||
#define JERRY_REGEXP_DUMP_BYTE_CODE 0
|
#define JERRY_REGEXP_DUMP_BYTE_CODE 0
|
||||||
#endif /* !defined (JERRY_REGEXP_DUMP_BYTE_CODE) */
|
#endif /* !defined (JERRY_REGEXP_DUMP_BYTE_CODE) */
|
||||||
|
|
||||||
/**
|
|
||||||
* Enables/disables the RegExp strict mode
|
|
||||||
*
|
|
||||||
* Default value: 0
|
|
||||||
*/
|
|
||||||
#ifndef JERRY_REGEXP_STRICT_MODE
|
|
||||||
#define JERRY_REGEXP_STRICT_MODE 0
|
|
||||||
#endif /* !defined (JERRY_REGEXP_STRICT_MODE) */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable/Disable the snapshot execution functions.
|
* Enable/Disable the snapshot execution functions.
|
||||||
*
|
*
|
||||||
|
@ -345,17 +259,6 @@
|
||||||
#define JERRY_UNICODE_CASE_CONVERSION 0
|
#define JERRY_UNICODE_CASE_CONVERSION 0
|
||||||
#endif /* !defined (JERRY_UNICODE_CASE_CONVERSION) */
|
#endif /* !defined (JERRY_UNICODE_CASE_CONVERSION) */
|
||||||
|
|
||||||
/**
|
|
||||||
* Configures if the internal memory allocations are exposed to Valgrind or not.
|
|
||||||
*
|
|
||||||
* Allowed values:
|
|
||||||
* 0: Disable the Valgrind specific memory allocation notifications.
|
|
||||||
* 1: Enable the Valgrind specific allocation notifications.
|
|
||||||
*/
|
|
||||||
#ifndef JERRY_VALGRIND
|
|
||||||
#define JERRY_VALGRIND 0
|
|
||||||
#endif /* !defined (JERRY_VALGRIND) */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable/Disable the vm execution stop callback function.
|
* Enable/Disable the vm execution stop callback function.
|
||||||
*
|
*
|
||||||
|
@ -409,184 +312,13 @@
|
||||||
#define JERRY_ATTR_GLOBAL_HEAP
|
#define JERRY_ATTR_GLOBAL_HEAP
|
||||||
#endif /* !defined (JERRY_ATTR_GLOBAL_HEAP) */
|
#endif /* !defined (JERRY_ATTR_GLOBAL_HEAP) */
|
||||||
|
|
||||||
/**
|
|
||||||
* Sanity check for macros to see if the values are 0 or 1
|
|
||||||
*
|
|
||||||
* If a new feature is added this should be updated.
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* Check base builtins.
|
|
||||||
*/
|
|
||||||
#if (JERRY_BUILTIN_ANNEXB != 0) && (JERRY_BUILTIN_ANNEXB != 1)
|
|
||||||
#error "Invalid value for JERRY_BUILTIN_ANNEXB macro."
|
|
||||||
#endif /* (JERRY_BUILTIN_ANNEXB != 0) && (JERRY_BUILTIN_ANNEXB != 1) */
|
|
||||||
#if (JERRY_BUILTIN_ARRAY != 0) && (JERRY_BUILTIN_ARRAY != 1)
|
|
||||||
#error "Invalid value for JERRY_BUILTIN_ARRAY macro."
|
|
||||||
#endif /* (JERRY_BUILTIN_ARRAY != 0) && (JERRY_BUILTIN_ARRAY != 1) */
|
|
||||||
#if (JERRY_BUILTIN_BOOLEAN != 0) && (JERRY_BUILTIN_BOOLEAN != 1)
|
|
||||||
#error "Invalid value for JERRY_BUILTIN_BOOLEAN macro."
|
|
||||||
#endif /* (JERRY_BUILTIN_BOOLEAN != 0) && (JERRY_BUILTIN_BOOLEAN != 1) */
|
|
||||||
#if (JERRY_BUILTIN_DATE != 0) && (JERRY_BUILTIN_DATE != 1)
|
|
||||||
#error "Invalid value for JERRY_BUILTIN_DATE macro."
|
|
||||||
#endif /* (JERRY_BUILTIN_DATE != 0) && (JERRY_BUILTIN_DATE != 1) */
|
|
||||||
#if (JERRY_BUILTIN_ERRORS != 0) && (JERRY_BUILTIN_ERRORS != 1)
|
|
||||||
#error "Invalid value for JERRY_BUILTIN_ERRORS macro."
|
|
||||||
#endif /* (JERRY_BUILTIN_ERRORS != 0) && (JERRY_BUILTIN_ERRORS != 1) */
|
|
||||||
#if (JERRY_BUILTIN_MATH != 0) && (JERRY_BUILTIN_MATH != 1)
|
|
||||||
#error "Invalid value for JERRY_BUILTIN_MATH macro."
|
|
||||||
#endif /* (JERRY_BUILTIN_MATH != 0) && (JERRY_BUILTIN_MATH != 1) */
|
|
||||||
#if (JERRY_BUILTIN_NUMBER != 0) && (JERRY_BUILTIN_NUMBER != 1)
|
|
||||||
#error "Invalid value for JERRY_BUILTIN_NUMBER macro."
|
|
||||||
#endif /* (JERRY_BUILTIN_NUMBER != 0) && (JERRY_BUILTIN_NUMBER != 1) */
|
|
||||||
#if (JERRY_BUILTIN_REGEXP != 0) && (JERRY_BUILTIN_REGEXP != 1)
|
|
||||||
#error "Invalid value for JERRY_BUILTIN_REGEXP macro."
|
|
||||||
#endif /* (JERRY_BUILTIN_REGEXP != 0) && (JERRY_BUILTIN_REGEXP != 1) */
|
|
||||||
#if (JERRY_BUILTIN_STRING != 0) && (JERRY_BUILTIN_STRING != 1)
|
|
||||||
#error "Invalid value for JERRY_BUILTIN_STRING macro."
|
|
||||||
#endif /* (JERRY_BUILTIN_STRING != 0) && (JERRY_BUILTIN_STRING != 1) */
|
|
||||||
#if (JERRY_BUILTINS != 0) && (JERRY_BUILTINS != 1)
|
|
||||||
#error "Invalid value for JERRY_BUILTINS macro."
|
|
||||||
#endif /* (JERRY_BUILTINS != 0) && (JERRY_BUILTINS != 1) */
|
|
||||||
#if (JERRY_BUILTIN_REALMS != 0) && (JERRY_BUILTIN_REALMS != 1)
|
|
||||||
#error "Invalid value for JERRY_BUILTIN_REALMS macro."
|
|
||||||
#endif /* (JERRY_BUILTIN_REALMS != 0) && (JERRY_BUILTIN_REALMS != 1) */
|
|
||||||
#if (JERRY_BUILTIN_DATAVIEW != 0) && (JERRY_BUILTIN_DATAVIEW != 1)
|
|
||||||
#error "Invalid value for JERRY_BUILTIN_DATAVIEW macro."
|
|
||||||
#endif /* (JERRY_BUILTIN_DATAVIEW != 0) && (JERRY_BUILTIN_DATAVIEW != 1) */
|
|
||||||
#if (JERRY_BUILTIN_GLOBAL_THIS != 0) && (JERRY_BUILTIN_GLOBAL_THIS != 1)
|
|
||||||
#error "Invalid value for JERRY_BUILTIN_GLOBAL_THIS macro."
|
|
||||||
#endif /* (JERRY_BUILTIN_GLOBAL_THIS != 0) && (JERRY_BUILTIN_GLOBAL_THIS != 1) */
|
|
||||||
#if (JERRY_BUILTIN_REFLECT != 0) && (JERRY_BUILTIN_REFLECT != 1)
|
|
||||||
#error "Invalid value for JERRY_BUILTIN_REFLECT macro."
|
|
||||||
#endif /* (JERRY_BUILTIN_REFLECT != 0) && (JERRY_BUILTIN_REFLECT != 1) */
|
|
||||||
#if (JERRY_BUILTIN_WEAKREF != 0) && (JERRY_BUILTIN_WEAKREF != 1)
|
|
||||||
#error "Invalid value for JERRY_BUILTIN_WEAKREF macro."
|
|
||||||
#endif /* (JERRY_BUILTIN_WEAKREF != 0) && (JERRY_BUILTIN_WEAKREF != 1) */
|
|
||||||
#if (JERRY_BUILTIN_PROXY != 0) && (JERRY_BUILTIN_PROXY != 1)
|
|
||||||
#error "Invalid value for JERRY_BUILTIN_PROXY macro."
|
|
||||||
#endif /* (JERRY_BUILTIN_PROXY != 0) && (JERRY_BUILTIN_PROXY != 1) */
|
|
||||||
#if (JERRY_BUILTIN_TYPEDARRAY != 0) && (JERRY_BUILTIN_TYPEDARRAY != 1)
|
|
||||||
#error "Invalid value for JERRY_BUILTIN_TYPEDARRAY macro."
|
|
||||||
#endif /* (JERRY_BUILTIN_TYPEDARRAY != 0) && (JERRY_BUILTIN_TYPEDARRAY != 1) */
|
|
||||||
#if (JERRY_BUILTIN_SHAREDARRAYBUFFER != 0) && (JERRY_BUILTIN_SHAREDARRAYBUFFER != 1)
|
|
||||||
#error "Invalid value for JERRY_BUILTIN_SHAREDARRAYBUFFER macro."
|
|
||||||
#endif /* (JERRY_BUILTIN_SHAREDARRAYBUFFER != 0) && (JERRY_BUILTIN_SHAREDARRAYBUFFER != 1) */
|
|
||||||
#if (JERRY_BUILTIN_ATOMICS != 0) && (JERRY_BUILTIN_ATOMICS != 1)
|
|
||||||
#error "Invalid value for JERRY_BUILTIN_ATOMICS macro."
|
|
||||||
#endif /* (JERRY_BUILTIN_ATOMICS != 0) && (JERRY_BUILTIN_ATOMICS != 1) */
|
|
||||||
#if (JERRY_BUILTIN_BIGINT != 0) && (JERRY_BUILTIN_BIGINT != 1)
|
|
||||||
#error "Invalid value for JERRY_BUILTIN_BIGINT macro."
|
|
||||||
#endif /* (JERRY_BUILTIN_BIGINT != 0) && (JERRY_BUILTIN_BIGINT != 1) */
|
|
||||||
#if (JERRY_MODULE_SYSTEM != 0) && (JERRY_MODULE_SYSTEM != 1)
|
|
||||||
#error "Invalid value for JERRY_MODULE_SYSTEM macro."
|
|
||||||
#endif /* (JERRY_MODULE_SYSTEM != 0) && (JERRY_MODULE_SYSTEM != 1) */
|
|
||||||
#if (JERRY_BUILTIN_TYPEDARRAY == 0) && (JERRY_BUILTIN_SHAREDARRAYBUFFER == 1)
|
|
||||||
#error "JERRY_BUILTIN_TYPEDARRAY should be enabled too to enable JERRY_BUILTIN_SHAREDARRAYBUFFER macro."
|
|
||||||
#endif /* (JERRY_BUILTIN_TYPEDARRAY == 0) && (JERRY_BUILTIN_SHAREDARRAYBUFFER == 1) */
|
|
||||||
#if (JERRY_BUILTIN_SHAREDARRAYBUFFER == 0) && (JERRY_BUILTIN_ATOMICS == 1)
|
|
||||||
#error "JERRY_BUILTIN_SHAREDARRAYBUFFER should be enabled too to enable JERRY_BUILTIN_ATOMICS macro."
|
|
||||||
#endif /* (JERRY_BUILTIN_SHAREDARRAYBUFFER == 0) && (JERRY_BUILTIN_ATOMICS == 1) */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Internal options.
|
|
||||||
*/
|
|
||||||
#if (JERRY_CPOINTER_32_BIT != 0) && (JERRY_CPOINTER_32_BIT != 1)
|
|
||||||
#error "Invalid value for 'JERRY_CPOINTER_32_BIT' macro."
|
|
||||||
#endif /* (JERRY_CPOINTER_32_BIT != 0) && (JERRY_CPOINTER_32_BIT != 1) */
|
|
||||||
#if (JERRY_ERROR_MESSAGES != 0) && (JERRY_ERROR_MESSAGES != 1)
|
|
||||||
#error "Invalid value for 'JERRY_ERROR_MESSAGES' macro."
|
|
||||||
#endif /* (JERRY_ERROR_MESSAGES != 0) && (JERRY_ERROR_MESSAGES != 1) */
|
|
||||||
#if (JERRY_EXTERNAL_CONTEXT != 0) && (JERRY_EXTERNAL_CONTEXT != 1)
|
|
||||||
#error "Invalid value for 'JERRY_EXTERNAL_CONTEXT' macro."
|
|
||||||
#endif /* (JERRY_EXTERNAL_CONTEXT != 0) && (JERRY_EXTERNAL_CONTEXT != 1) */
|
|
||||||
#if JERRY_GLOBAL_HEAP_SIZE <= 0
|
|
||||||
#error "Invalid value for 'JERRY_GLOBAL_HEAP_SIZE' macro."
|
|
||||||
#endif /* JERRY_GLOBAL_HEAP_SIZE <= 0 */
|
|
||||||
#if JERRY_GC_LIMIT < 0
|
|
||||||
#error "Invalid value for 'JERRY_GC_LIMIT' macro."
|
|
||||||
#endif /* JERRY_GC_LIMIT < 0 */
|
|
||||||
#if JERRY_STACK_LIMIT < 0
|
|
||||||
#error "Invalid value for 'JERRY_STACK_LIMIT' macro."
|
|
||||||
#endif /* JERRY_STACK_LIMIT < 0 */
|
|
||||||
#if JERRY_GC_MARK_LIMIT < 0
|
|
||||||
#error "Invalid value for 'JERRY_GC_MARK_LIMIT' macro."
|
|
||||||
#endif /* JERRY_GC_MARK_LIMIT < 0 */
|
|
||||||
#if (JERRY_LCACHE != 0) && (JERRY_LCACHE != 1)
|
|
||||||
#error "Invalid value for 'JERRY_LCACHE' macro."
|
|
||||||
#endif /* (JERRY_LCACHE != 0) && (JERRY_LCACHE != 1) */
|
|
||||||
#if (JERRY_FUNCTION_TO_STRING != 0) && (JERRY_FUNCTION_TO_STRING != 1)
|
|
||||||
#error "Invalid value for 'JERRY_FUNCTION_TO_STRING' macro."
|
|
||||||
#endif /* (JERRY_FUNCTION_TO_STRING != 0) && (JERRY_FUNCTION_TO_STRING != 1) */
|
|
||||||
#if (JERRY_LINE_INFO != 0) && (JERRY_LINE_INFO != 1)
|
|
||||||
#error "Invalid value for 'JERRY_LINE_INFO' macro."
|
|
||||||
#endif /* (JERRY_LINE_INFO != 0) && (JERRY_LINE_INFO != 1) */
|
|
||||||
#if (JERRY_LOGGING != 0) && (JERRY_LOGGING != 1)
|
|
||||||
#error "Invalid value for 'JERRY_LOGGING' macro."
|
|
||||||
#endif /* (JERRY_LOGGING != 0) && (JERRY_LOGGING != 1) */
|
|
||||||
#if (JERRY_MEM_GC_BEFORE_EACH_ALLOC != 0) && (JERRY_MEM_GC_BEFORE_EACH_ALLOC != 1)
|
|
||||||
#error "Invalid value for 'JERRY_MEM_GC_BEFORE_EACH_ALLOC' macro."
|
|
||||||
#endif /* (JERRY_MEM_GC_BEFORE_EACH_ALLOC != 0) && (JERRY_MEM_GC_BEFORE_EACH_ALLOC != 1) */
|
|
||||||
#if (JERRY_NUMBER_TYPE_FLOAT64 != 0) && (JERRY_NUMBER_TYPE_FLOAT64 != 1)
|
|
||||||
#error "Invalid value for 'JERRY_NUMBER_TYPE_FLOAT64' macro."
|
|
||||||
#endif /* (JERRY_NUMBER_TYPE_FLOAT64 != 0) && (JERRY_NUMBER_TYPE_FLOAT64 != 1) */
|
|
||||||
#if (JERRY_PARSER != 0) && (JERRY_PARSER != 1)
|
|
||||||
#error "Invalid value for 'JERRY_PARSER' macro."
|
|
||||||
#endif /* (JERRY_PARSER != 0) && (JERRY_PARSER != 1) */
|
|
||||||
#if (JERRY_PARSER_DUMP_BYTE_CODE != 0) && (JERRY_PARSER_DUMP_BYTE_CODE != 1)
|
|
||||||
#error "Invalid value for 'JERRY_PARSER_DUMP_BYTE_CODE' macro."
|
|
||||||
#endif /* (JERRY_PARSER_DUMP_BYTE_CODE != 0) && (JERRY_PARSER_DUMP_BYTE_CODE != 1) */
|
|
||||||
#if (JERRY_PROPERTY_HASHMAP != 0) && (JERRY_PROPERTY_HASHMAP != 1)
|
|
||||||
#error "Invalid value for 'JERRY_PROPERTY_HASHMAP' macro."
|
|
||||||
#endif /* (JERRY_PROPERTY_HASHMAP != 0) && (JERRY_PROPERTY_HASHMAP != 1) */
|
|
||||||
#if (JERRY_PROMISE_CALLBACK != 0) && (JERRY_PROMISE_CALLBACK != 1)
|
|
||||||
#error "Invalid value for 'JERRY_PROMISE_CALLBACK' macro."
|
|
||||||
#endif /* (JERRY_PROMISE_CALLBACK != 0) && (JERRY_PROMISE_CALLBACK != 1) */
|
|
||||||
#if (JERRY_REGEXP_DUMP_BYTE_CODE != 0) && (JERRY_REGEXP_DUMP_BYTE_CODE != 1)
|
|
||||||
#error "Invalid value for 'JERRY_REGEXP_DUMP_BYTE_CODE' macro."
|
|
||||||
#endif /* (JERRY_REGEXP_DUMP_BYTE_CODE != 0) && (JERRY_REGEXP_DUMP_BYTE_CODE != 1) */
|
|
||||||
#if (JERRY_REGEXP_STRICT_MODE != 0) && (JERRY_REGEXP_STRICT_MODE != 1)
|
|
||||||
#error "Invalid value for 'JERRY_REGEXP_STRICT_MODE' macro."
|
|
||||||
#endif /* (JERRY_REGEXP_STRICT_MODE != 0) && (JERRY_REGEXP_STRICT_MODE != 1) */
|
|
||||||
#if (JERRY_SNAPSHOT_EXEC != 0) && (JERRY_SNAPSHOT_EXEC != 1)
|
|
||||||
#error "Invalid value for 'JERRY_SNAPSHOT_EXEC' macro."
|
|
||||||
#endif /* (JERRY_SNAPSHOT_EXEC != 0) && (JERRY_SNAPSHOT_EXEC != 1) */
|
|
||||||
#if (JERRY_SNAPSHOT_SAVE != 0) && (JERRY_SNAPSHOT_SAVE != 1)
|
|
||||||
#error "Invalid value for 'JERRY_SNAPSHOT_SAVE' macro."
|
|
||||||
#endif /* (JERRY_SNAPSHOT_SAVE != 0) && (JERRY_SNAPSHOT_SAVE != 1) */
|
|
||||||
#if (JERRY_SYSTEM_ALLOCATOR != 0) && (JERRY_SYSTEM_ALLOCATOR != 1)
|
|
||||||
#error "Invalid value for 'JERRY_SYSTEM_ALLOCATOR' macro."
|
|
||||||
#endif /* (JERRY_SYSTEM_ALLOCATOR != 0) && (JERRY_SYSTEM_ALLOCATOR != 1) */
|
|
||||||
#if (JERRY_UNICODE_CASE_CONVERSION != 0) && (JERRY_UNICODE_CASE_CONVERSION != 1)
|
|
||||||
#error "Invalid value for 'JERRY_UNICODE_CASE_CONVERSION' macro."
|
|
||||||
#endif /* (JERRY_UNICODE_CASE_CONVERSION != 0) && (JERRY_UNICODE_CASE_CONVERSION != 1) */
|
|
||||||
#if (JERRY_VALGRIND != 0) && (JERRY_VALGRIND != 1)
|
|
||||||
#error "Invalid value for 'JERRY_VALGRIND' macro."
|
|
||||||
#endif /* (JERRY_VALGRIND != 0) && (JERRY_VALGRIND != 1) */
|
|
||||||
#if (JERRY_VM_HALT != 0) && (JERRY_VM_HALT != 1)
|
|
||||||
#error "Invalid value for 'JERRY_VM_HALT' macro."
|
|
||||||
#endif /* (JERRY_VM_HALT != 0) && (JERRY_VM_HALT != 1) */
|
|
||||||
#if (JERRY_VM_THROW != 0) && (JERRY_VM_THROW != 1)
|
|
||||||
#error "Invalid value for 'JERRY_VM_THROW' macro."
|
|
||||||
#endif /* (JERRY_VM_THROW != 0) && (JERRY_VM_THROW != 1) */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cross component requirements check.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The date module can only use the float 64 number types.
|
|
||||||
*/
|
|
||||||
#if JERRY_BUILTIN_DATE && !JERRY_NUMBER_TYPE_FLOAT64
|
|
||||||
#error "Date does not support float32"
|
|
||||||
#endif /* JERRY_BUILTIN_DATE && !JERRY_NUMBER_TYPE_FLOAT64 */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Source name related types into a single guard
|
* Source name related types into a single guard
|
||||||
*/
|
*/
|
||||||
#if JERRY_LINE_INFO || JERRY_ERROR_MESSAGES || JERRY_MODULE_SYSTEM
|
#if JERRY_ERROR_MESSAGES
|
||||||
#define JERRY_SOURCE_NAME 1
|
#define JERRY_SOURCE_NAME 1
|
||||||
#else /* !(JERRY_LINE_INFO || JERRY_ERROR_MESSAGES || JERRY_MODULE_SYSTEM) */
|
#else /* !(JERRY_ERROR_MESSAGES) */
|
||||||
#define JERRY_SOURCE_NAME 0
|
#define JERRY_SOURCE_NAME 0
|
||||||
#endif /* JERRY_LINE_INFO || JERRY_ERROR_MESSAGES || JERRY_MODULE_SYSTEM */
|
#endif /* JERRY_ERROR_MESSAGES */
|
||||||
|
|
||||||
#endif /* !JERRYSCRIPT_CONFIG_H */
|
#endif /* !JERRYSCRIPT_CONFIG_H */
|
||||||
|
|
|
@ -121,9 +121,6 @@ struct jerry_context_t
|
||||||
#if JERRY_BUILTIN_REGEXP
|
#if JERRY_BUILTIN_REGEXP
|
||||||
re_compiled_code_t *re_cache[RE_CACHE_SIZE]; /**< regex cache */
|
re_compiled_code_t *re_cache[RE_CACHE_SIZE]; /**< regex cache */
|
||||||
#endif /* JERRY_BUILTIN_REGEXP */
|
#endif /* JERRY_BUILTIN_REGEXP */
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
jmem_pools_chunk_t *jmem_free_16_byte_chunk_p; /**< list of free sixteen byte pool chunks */
|
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
const lit_utf8_byte_t *const *lit_magic_string_ex_array; /**< array of external magic strings */
|
const lit_utf8_byte_t *const *lit_magic_string_ex_array; /**< array of external magic strings */
|
||||||
const lit_utf8_size_t *lit_magic_string_ex_sizes; /**< external magic string lengths */
|
const lit_utf8_size_t *lit_magic_string_ex_sizes; /**< external magic string lengths */
|
||||||
jmem_cpointer_t ecma_gc_objects_cp; /**< List of currently alive objects. */
|
jmem_cpointer_t ecma_gc_objects_cp; /**< List of currently alive objects. */
|
||||||
|
@ -177,11 +174,6 @@ struct jerry_context_t
|
||||||
#endif /* JERRY_BUILTIN_REGEXP */
|
#endif /* JERRY_BUILTIN_REGEXP */
|
||||||
ecma_job_queue_item_t *job_queue_head_p; /**< points to the head item of the job queue */
|
ecma_job_queue_item_t *job_queue_head_p; /**< points to the head item of the job queue */
|
||||||
ecma_job_queue_item_t *job_queue_tail_p; /**< points to the tail item of the job queue */
|
ecma_job_queue_item_t *job_queue_tail_p; /**< points to the tail item of the job queue */
|
||||||
#if JERRY_PROMISE_CALLBACK
|
|
||||||
uint32_t promise_callback_filters; /**< reported event types for promise callback */
|
|
||||||
void *promise_callback_user_p; /**< user pointer for promise callback */
|
|
||||||
jerry_promise_event_cb_t promise_callback; /**< user function for tracking Promise object operations */
|
|
||||||
#endif /* JERRY_PROMISE_CALLBACK */
|
|
||||||
|
|
||||||
#if JERRY_BUILTIN_TYPEDARRAY
|
#if JERRY_BUILTIN_TYPEDARRAY
|
||||||
uint32_t arraybuffer_compact_allocation_limit; /**< maximum size of compact allocation */
|
uint32_t arraybuffer_compact_allocation_limit; /**< maximum size of compact allocation */
|
||||||
|
|
|
@ -28,23 +28,12 @@
|
||||||
* @{
|
* @{
|
||||||
* Valgrind-related options and headers
|
* Valgrind-related options and headers
|
||||||
*/
|
*/
|
||||||
#if JERRY_VALGRIND
|
|
||||||
#include "memcheck.h"
|
|
||||||
|
|
||||||
#define JMEM_VALGRIND_NOACCESS_SPACE(p, s) VALGRIND_MAKE_MEM_NOACCESS ((p), (s))
|
|
||||||
#define JMEM_VALGRIND_UNDEFINED_SPACE(p, s) VALGRIND_MAKE_MEM_UNDEFINED ((p), (s))
|
|
||||||
#define JMEM_VALGRIND_DEFINED_SPACE(p, s) VALGRIND_MAKE_MEM_DEFINED ((p), (s))
|
|
||||||
#define JMEM_VALGRIND_MALLOCLIKE_SPACE(p, s) VALGRIND_MALLOCLIKE_BLOCK ((p), (s), 0, 0)
|
|
||||||
#define JMEM_VALGRIND_RESIZE_SPACE(p, o, n) VALGRIND_RESIZEINPLACE_BLOCK ((p), (o), (n), 0)
|
|
||||||
#define JMEM_VALGRIND_FREELIKE_SPACE(p) VALGRIND_FREELIKE_BLOCK ((p), 0)
|
|
||||||
#else /* !JERRY_VALGRIND */
|
|
||||||
#define JMEM_VALGRIND_NOACCESS_SPACE(p, s)
|
#define JMEM_VALGRIND_NOACCESS_SPACE(p, s)
|
||||||
#define JMEM_VALGRIND_UNDEFINED_SPACE(p, s)
|
#define JMEM_VALGRIND_UNDEFINED_SPACE(p, s)
|
||||||
#define JMEM_VALGRIND_DEFINED_SPACE(p, s)
|
#define JMEM_VALGRIND_DEFINED_SPACE(p, s)
|
||||||
#define JMEM_VALGRIND_MALLOCLIKE_SPACE(p, s)
|
#define JMEM_VALGRIND_MALLOCLIKE_SPACE(p, s)
|
||||||
#define JMEM_VALGRIND_RESIZE_SPACE(p, o, n)
|
#define JMEM_VALGRIND_RESIZE_SPACE(p, o, n)
|
||||||
#define JMEM_VALGRIND_FREELIKE_SPACE(p)
|
#define JMEM_VALGRIND_FREELIKE_SPACE(p)
|
||||||
#endif /* JERRY_VALGRIND */
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
void jmem_heap_init (void);
|
void jmem_heap_init (void);
|
||||||
|
|
|
@ -59,21 +59,13 @@ jmem_compress_pointer (const void *pointer_p) /**< pointer to compress */
|
||||||
|
|
||||||
JERRY_ASSERT (uint_ptr % JMEM_ALIGNMENT == 0);
|
JERRY_ASSERT (uint_ptr % JMEM_ALIGNMENT == 0);
|
||||||
|
|
||||||
#if defined(ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY) && JERRY_CPOINTER_32_BIT
|
|
||||||
JERRY_ASSERT (((jmem_cpointer_t) uint_ptr) == uint_ptr);
|
|
||||||
#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY || !JERRY_CPOINTER_32_BIT */
|
|
||||||
const uintptr_t heap_start = (uintptr_t) &JERRY_HEAP_CONTEXT (first);
|
const uintptr_t heap_start = (uintptr_t) &JERRY_HEAP_CONTEXT (first);
|
||||||
|
|
||||||
uint_ptr -= heap_start;
|
uint_ptr -= heap_start;
|
||||||
uint_ptr >>= JMEM_ALIGNMENT_LOG;
|
uint_ptr >>= JMEM_ALIGNMENT_LOG;
|
||||||
|
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
JERRY_ASSERT (uint_ptr <= UINT32_MAX);
|
|
||||||
#else /* !JERRY_CPOINTER_32_BIT */
|
|
||||||
JERRY_ASSERT (uint_ptr <= UINT16_MAX);
|
JERRY_ASSERT (uint_ptr <= UINT16_MAX);
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
JERRY_ASSERT (uint_ptr != JMEM_CP_NULL);
|
JERRY_ASSERT (uint_ptr != JMEM_CP_NULL);
|
||||||
#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY && JERRY_CPOINTER_32_BIT */
|
|
||||||
|
|
||||||
return (jmem_cpointer_t) uint_ptr;
|
return (jmem_cpointer_t) uint_ptr;
|
||||||
} /* jmem_compress_pointer */
|
} /* jmem_compress_pointer */
|
||||||
|
@ -92,16 +84,12 @@ jmem_decompress_pointer (uintptr_t compressed_pointer) /**< pointer to decompres
|
||||||
|
|
||||||
JERRY_ASSERT (((jmem_cpointer_t) uint_ptr) == uint_ptr);
|
JERRY_ASSERT (((jmem_cpointer_t) uint_ptr) == uint_ptr);
|
||||||
|
|
||||||
#if defined(ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY) && JERRY_CPOINTER_32_BIT
|
|
||||||
JERRY_ASSERT (uint_ptr % JMEM_ALIGNMENT == 0);
|
|
||||||
#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY || !JERRY_CPOINTER_32_BIT */
|
|
||||||
const uintptr_t heap_start = (uintptr_t) &JERRY_HEAP_CONTEXT (first);
|
const uintptr_t heap_start = (uintptr_t) &JERRY_HEAP_CONTEXT (first);
|
||||||
|
|
||||||
uint_ptr <<= JMEM_ALIGNMENT_LOG;
|
uint_ptr <<= JMEM_ALIGNMENT_LOG;
|
||||||
uint_ptr += heap_start;
|
uint_ptr += heap_start;
|
||||||
|
|
||||||
JERRY_ASSERT (jmem_is_heap_pointer ((void *) uint_ptr));
|
JERRY_ASSERT (jmem_is_heap_pointer ((void *) uint_ptr));
|
||||||
#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY && JERRY_CPOINTER_32_BIT */
|
|
||||||
|
|
||||||
return (void *) uint_ptr;
|
return (void *) uint_ptr;
|
||||||
} /* jmem_decompress_pointer */
|
} /* jmem_decompress_pointer */
|
||||||
|
|
|
@ -81,10 +81,6 @@ void
|
||||||
jmem_heap_init (void)
|
jmem_heap_init (void)
|
||||||
{
|
{
|
||||||
#if !JERRY_SYSTEM_ALLOCATOR
|
#if !JERRY_SYSTEM_ALLOCATOR
|
||||||
#if !JERRY_CPOINTER_32_BIT
|
|
||||||
/* the maximum heap size for 16bit compressed pointers should be 512K */
|
|
||||||
JERRY_ASSERT (((UINT16_MAX + 1) << JMEM_ALIGNMENT_LOG) >= JMEM_HEAP_SIZE);
|
|
||||||
#endif /* !JERRY_CPOINTER_32_BIT */
|
|
||||||
JERRY_ASSERT ((uintptr_t) JERRY_HEAP_CONTEXT (area) % JMEM_ALIGNMENT == 0);
|
JERRY_ASSERT ((uintptr_t) JERRY_HEAP_CONTEXT (area) % JMEM_ALIGNMENT == 0);
|
||||||
|
|
||||||
JERRY_CONTEXT (jmem_heap_limit) = CONFIG_GC_LIMIT;
|
JERRY_CONTEXT (jmem_heap_limit) = CONFIG_GC_LIMIT;
|
||||||
|
@ -285,15 +281,11 @@ jmem_heap_gc_and_alloc_block (const size_t size, /**< required memory size */
|
||||||
|
|
||||||
jmem_pressure_t pressure = JMEM_PRESSURE_NONE;
|
jmem_pressure_t pressure = JMEM_PRESSURE_NONE;
|
||||||
|
|
||||||
#if !JERRY_MEM_GC_BEFORE_EACH_ALLOC
|
|
||||||
if (JERRY_CONTEXT (jmem_heap_allocated_size) + size >= JERRY_CONTEXT (jmem_heap_limit))
|
if (JERRY_CONTEXT (jmem_heap_allocated_size) + size >= JERRY_CONTEXT (jmem_heap_limit))
|
||||||
{
|
{
|
||||||
pressure = JMEM_PRESSURE_LOW;
|
pressure = JMEM_PRESSURE_LOW;
|
||||||
ecma_free_unused_memory (pressure);
|
ecma_free_unused_memory (pressure);
|
||||||
}
|
}
|
||||||
#else /* !JERRY_MEM_GC_BEFORE_EACH_ALLOC */
|
|
||||||
ecma_gc_run ();
|
|
||||||
#endif /* JERRY_MEM_GC_BEFORE_EACH_ALLOC */
|
|
||||||
|
|
||||||
void *data_space_p = jmem_heap_alloc (size);
|
void *data_space_p = jmem_heap_alloc (size);
|
||||||
|
|
||||||
|
@ -539,14 +531,10 @@ jmem_heap_realloc_block (void *ptr, /**< memory region to reallocate */
|
||||||
void *ret_block_p = NULL;
|
void *ret_block_p = NULL;
|
||||||
const size_t required_size = aligned_new_size - aligned_old_size;
|
const size_t required_size = aligned_new_size - aligned_old_size;
|
||||||
|
|
||||||
#if !JERRY_MEM_GC_BEFORE_EACH_ALLOC
|
|
||||||
if (JERRY_CONTEXT (jmem_heap_allocated_size) + required_size >= JERRY_CONTEXT (jmem_heap_limit))
|
if (JERRY_CONTEXT (jmem_heap_allocated_size) + required_size >= JERRY_CONTEXT (jmem_heap_limit))
|
||||||
{
|
{
|
||||||
ecma_free_unused_memory (JMEM_PRESSURE_LOW);
|
ecma_free_unused_memory (JMEM_PRESSURE_LOW);
|
||||||
}
|
}
|
||||||
#else /* !JERRY_MEM_GC_BEFORE_EACH_ALLOC */
|
|
||||||
ecma_gc_run ();
|
|
||||||
#endif /* JERRY_MEM_GC_BEFORE_EACH_ALLOC */
|
|
||||||
|
|
||||||
jmem_heap_free_t *prev_p = jmem_heap_find_prev (block_p);
|
jmem_heap_free_t *prev_p = jmem_heap_find_prev (block_p);
|
||||||
JMEM_VALGRIND_DEFINED_SPACE (prev_p, sizeof (jmem_heap_free_t));
|
JMEM_VALGRIND_DEFINED_SPACE (prev_p, sizeof (jmem_heap_free_t));
|
||||||
|
@ -660,14 +648,10 @@ jmem_heap_realloc_block (void *ptr, /**< memory region to reallocate */
|
||||||
#else /* JERRY_SYSTEM_ALLOCATOR */
|
#else /* JERRY_SYSTEM_ALLOCATOR */
|
||||||
const size_t required_size = new_size - old_size;
|
const size_t required_size = new_size - old_size;
|
||||||
|
|
||||||
#if !JERRY_MEM_GC_BEFORE_EACH_ALLOC
|
|
||||||
if (JERRY_CONTEXT (jmem_heap_allocated_size) + required_size >= JERRY_CONTEXT (jmem_heap_limit))
|
if (JERRY_CONTEXT (jmem_heap_allocated_size) + required_size >= JERRY_CONTEXT (jmem_heap_limit))
|
||||||
{
|
{
|
||||||
ecma_free_unused_memory (JMEM_PRESSURE_LOW);
|
ecma_free_unused_memory (JMEM_PRESSURE_LOW);
|
||||||
}
|
}
|
||||||
#else /* !JERRY_MEM_GC_BEFORE_EACH_ALLOC */
|
|
||||||
ecma_gc_run ();
|
|
||||||
#endif /* JERRY_MEM_GC_BEFORE_EACH_ALLOC */
|
|
||||||
|
|
||||||
JERRY_CONTEXT (jmem_heap_allocated_size) += required_size;
|
JERRY_CONTEXT (jmem_heap_allocated_size) += required_size;
|
||||||
|
|
||||||
|
|
|
@ -24,10 +24,6 @@
|
||||||
#define JMEM_ALLOCATOR_INTERNAL
|
#define JMEM_ALLOCATOR_INTERNAL
|
||||||
#include "jmem-allocator-internal.h"
|
#include "jmem-allocator-internal.h"
|
||||||
|
|
||||||
#if JERRY_MEM_GC_BEFORE_EACH_ALLOC
|
|
||||||
#include "ecma-gc.h"
|
|
||||||
#endif /* JERRY_MEM_GC_BEFORE_EACH_ALLOC */
|
|
||||||
|
|
||||||
/** \addtogroup mem Memory allocation
|
/** \addtogroup mem Memory allocation
|
||||||
* @{
|
* @{
|
||||||
*
|
*
|
||||||
|
@ -44,9 +40,6 @@ jmem_pools_finalize (void)
|
||||||
jmem_pools_collect_empty ();
|
jmem_pools_collect_empty ();
|
||||||
|
|
||||||
JERRY_ASSERT (JERRY_CONTEXT (jmem_free_8_byte_chunk_p) == NULL);
|
JERRY_ASSERT (JERRY_CONTEXT (jmem_free_8_byte_chunk_p) == NULL);
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
JERRY_ASSERT (JERRY_CONTEXT (jmem_free_16_byte_chunk_p) == NULL);
|
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
} /* jmem_pools_finalize */
|
} /* jmem_pools_finalize */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,16 +51,7 @@ jmem_pools_finalize (void)
|
||||||
void *JERRY_ATTR_HOT
|
void *JERRY_ATTR_HOT
|
||||||
jmem_pools_alloc (size_t size) /**< size of the chunk */
|
jmem_pools_alloc (size_t size) /**< size of the chunk */
|
||||||
{
|
{
|
||||||
#if JERRY_MEM_GC_BEFORE_EACH_ALLOC
|
|
||||||
ecma_gc_run ();
|
|
||||||
#endif /* JERRY_MEM_GC_BEFORE_EACH_ALLOC */
|
|
||||||
|
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
if (size <= 8)
|
|
||||||
{
|
|
||||||
#else /* !JERRY_CPOINTER_32_BIT */
|
|
||||||
JERRY_ASSERT (size <= 8);
|
JERRY_ASSERT (size <= 8);
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
|
|
||||||
if (JERRY_CONTEXT (jmem_free_8_byte_chunk_p) != NULL)
|
if (JERRY_CONTEXT (jmem_free_8_byte_chunk_p) != NULL)
|
||||||
{
|
{
|
||||||
|
@ -86,30 +70,6 @@ jmem_pools_alloc (size_t size) /**< size of the chunk */
|
||||||
JMEM_HEAP_STAT_ALLOC (8);
|
JMEM_HEAP_STAT_ALLOC (8);
|
||||||
return chunk_p;
|
return chunk_p;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
}
|
|
||||||
|
|
||||||
JERRY_ASSERT (size <= 16);
|
|
||||||
|
|
||||||
if (JERRY_CONTEXT (jmem_free_16_byte_chunk_p) != NULL)
|
|
||||||
{
|
|
||||||
const jmem_pools_chunk_t *const chunk_p = JERRY_CONTEXT (jmem_free_16_byte_chunk_p);
|
|
||||||
|
|
||||||
JMEM_VALGRIND_DEFINED_SPACE (chunk_p, sizeof (jmem_pools_chunk_t));
|
|
||||||
JERRY_CONTEXT (jmem_free_16_byte_chunk_p) = chunk_p->next_p;
|
|
||||||
JMEM_VALGRIND_UNDEFINED_SPACE (chunk_p, sizeof (jmem_pools_chunk_t));
|
|
||||||
|
|
||||||
JMEM_HEAP_STAT_ALLOC (16);
|
|
||||||
return (void *) chunk_p;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
void *chunk_p = jmem_heap_alloc_block_internal (16);
|
|
||||||
JMEM_HEAP_STAT_ALLOC (16);
|
|
||||||
return chunk_p;
|
|
||||||
}
|
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
} /* jmem_pools_alloc */
|
} /* jmem_pools_alloc */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -128,27 +88,11 @@ jmem_pools_free (void *chunk_p, /**< pointer to the chunk */
|
||||||
|
|
||||||
JMEM_VALGRIND_DEFINED_SPACE (chunk_to_free_p, size);
|
JMEM_VALGRIND_DEFINED_SPACE (chunk_to_free_p, size);
|
||||||
|
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
if (size <= 8)
|
|
||||||
{
|
|
||||||
#else /* !JERRY_CPOINTER_32_BIT */
|
|
||||||
JERRY_ASSERT (size <= 8);
|
JERRY_ASSERT (size <= 8);
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
|
|
||||||
chunk_to_free_p->next_p = JERRY_CONTEXT (jmem_free_8_byte_chunk_p);
|
chunk_to_free_p->next_p = JERRY_CONTEXT (jmem_free_8_byte_chunk_p);
|
||||||
JERRY_CONTEXT (jmem_free_8_byte_chunk_p) = chunk_to_free_p;
|
JERRY_CONTEXT (jmem_free_8_byte_chunk_p) = chunk_to_free_p;
|
||||||
|
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
JERRY_ASSERT (size <= 16);
|
|
||||||
|
|
||||||
chunk_to_free_p->next_p = JERRY_CONTEXT (jmem_free_16_byte_chunk_p);
|
|
||||||
JERRY_CONTEXT (jmem_free_16_byte_chunk_p) = chunk_to_free_p;
|
|
||||||
}
|
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
|
|
||||||
JMEM_VALGRIND_NOACCESS_SPACE (chunk_to_free_p, size);
|
JMEM_VALGRIND_NOACCESS_SPACE (chunk_to_free_p, size);
|
||||||
} /* jmem_pools_free */
|
} /* jmem_pools_free */
|
||||||
|
|
||||||
|
@ -170,21 +114,6 @@ jmem_pools_collect_empty (void)
|
||||||
jmem_heap_free_block_internal (chunk_p, 8);
|
jmem_heap_free_block_internal (chunk_p, 8);
|
||||||
chunk_p = next_p;
|
chunk_p = next_p;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
chunk_p = JERRY_CONTEXT (jmem_free_16_byte_chunk_p);
|
|
||||||
JERRY_CONTEXT (jmem_free_16_byte_chunk_p) = NULL;
|
|
||||||
|
|
||||||
while (chunk_p)
|
|
||||||
{
|
|
||||||
JMEM_VALGRIND_DEFINED_SPACE (chunk_p, sizeof (jmem_pools_chunk_t));
|
|
||||||
jmem_pools_chunk_t *const next_p = chunk_p->next_p;
|
|
||||||
JMEM_VALGRIND_NOACCESS_SPACE (chunk_p, sizeof (jmem_pools_chunk_t));
|
|
||||||
|
|
||||||
jmem_heap_free_block_internal (chunk_p, 16);
|
|
||||||
chunk_p = next_p;
|
|
||||||
}
|
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
} /* jmem_pools_collect_empty */
|
} /* jmem_pools_collect_empty */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -55,11 +55,7 @@
|
||||||
/**
|
/**
|
||||||
* Shift for tag part in jmem_cpointer_tag_t
|
* Shift for tag part in jmem_cpointer_tag_t
|
||||||
*/
|
*/
|
||||||
#if defined(JMEM_CAN_STORE_POINTER_VALUE_DIRECTLY) && JERRY_CPOINTER_32_BIT
|
|
||||||
#define JMEM_TAG_SHIFT 0
|
|
||||||
#else /* !JMEM_CAN_STORE_POINTER_VALUE_DIRECTLY || !JERRY_CPOINTER_32_BIT */
|
|
||||||
#define JMEM_TAG_SHIFT 3
|
#define JMEM_TAG_SHIFT 3
|
||||||
#endif /* JMEM_CAN_STORE_POINTER_VALUE_DIRECTLY && JERRY_CPOINTER_32_BIT */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bit mask for tag part in jmem_cpointer_tag_t
|
* Bit mask for tag part in jmem_cpointer_tag_t
|
||||||
|
@ -94,11 +90,7 @@ enum
|
||||||
/**
|
/**
|
||||||
* Compressed pointer
|
* Compressed pointer
|
||||||
*/
|
*/
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
typedef uint32_t jmem_cpointer_t;
|
|
||||||
#else /* !JERRY_CPOINTER_32_BIT */
|
|
||||||
typedef uint16_t jmem_cpointer_t;
|
typedef uint16_t jmem_cpointer_t;
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compressed pointer with tag value
|
* Compressed pointer with tag value
|
||||||
|
|
|
@ -122,12 +122,6 @@ void jerry_jrt_set_log_level (jerry_log_level_t level);
|
||||||
/*
|
/*
|
||||||
* Logging
|
* Logging
|
||||||
*/
|
*/
|
||||||
#if JERRY_LOGGING
|
|
||||||
#define JERRY_ERROR_MSG(...) jerry_log (JERRY_LOG_LEVEL_ERROR, __VA_ARGS__)
|
|
||||||
#define JERRY_WARNING_MSG(...) jerry_log (JERRY_LOG_LEVEL_WARNING, __VA_ARGS__)
|
|
||||||
#define JERRY_DEBUG_MSG(...) jerry_log (JERRY_LOG_LEVEL_DEBUG, __VA_ARGS__)
|
|
||||||
#define JERRY_TRACE_MSG(...) jerry_log (JERRY_LOG_LEVEL_TRACE, __VA_ARGS__)
|
|
||||||
#else /* !JERRY_LOGGING */
|
|
||||||
#define JERRY_ERROR_MSG(...) \
|
#define JERRY_ERROR_MSG(...) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
|
@ -160,7 +154,6 @@ void jerry_jrt_set_log_level (jerry_log_level_t level);
|
||||||
JERRY_UNUSED_ALL (__VA_ARGS__); \
|
JERRY_UNUSED_ALL (__VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#endif /* JERRY_LOGGING */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Size of struct member
|
* Size of struct member
|
||||||
|
|
|
@ -259,9 +259,6 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SLICE, "slice")
|
||||||
|| JERRY_BUILTIN_STRING \
|
|| JERRY_BUILTIN_STRING \
|
||||||
|| JERRY_BUILTIN_TYPEDARRAY */
|
|| JERRY_BUILTIN_TYPEDARRAY */
|
||||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SPLIT, "split")
|
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SPLIT, "split")
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_STACK, "stack")
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
#if JERRY_BUILTIN_ATOMICS
|
#if JERRY_BUILTIN_ATOMICS
|
||||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATOMICS_STORE, "store")
|
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATOMICS_STORE, "store")
|
||||||
#endif /* JERRY_BUILTIN_ATOMICS */
|
#endif /* JERRY_BUILTIN_ATOMICS */
|
||||||
|
@ -844,30 +841,15 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UTC_MILLISECONDS_UL, "setUTCMilliseco
|
||||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_LOCALE_DATE_STRING_UL, "toLocaleDateString")
|
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_LOCALE_DATE_STRING_UL, "toLocaleDateString")
|
||||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_LOCALE_TIME_STRING_UL, "toLocaleTimeString")
|
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_LOCALE_TIME_STRING_UL, "toLocaleTimeString")
|
||||||
#endif /* JERRY_BUILTIN_DATE */
|
#endif /* JERRY_BUILTIN_DATE */
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON, "function anonymous(")
|
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_OWN_PROPERTY_NAMES_UL, "getOwnPropertyNames")
|
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_OWN_PROPERTY_NAMES_UL, "getOwnPropertyNames")
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON_GENERATOR, "function* anonymous(")
|
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PROPERTY_IS_ENUMERABLE_UL, "propertyIsEnumerable")
|
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PROPERTY_IS_ENUMERABLE_UL, "propertyIsEnumerable")
|
||||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_OWN_PROPERTY_SYMBOLS_UL, "getOwnPropertySymbols")
|
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_OWN_PROPERTY_SYMBOLS_UL, "getOwnPropertySymbols")
|
||||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ASYNC_GENERATOR_FUNCTION_UL, "AsyncGeneratorFunction")
|
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ASYNC_GENERATOR_FUNCTION_UL, "AsyncGeneratorFunction")
|
||||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REGEXP_STRING_ITERATOR_UL, "RegExp String Iterator")
|
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REGEXP_STRING_ITERATOR_UL, "RegExp String Iterator")
|
||||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTOR_UL, "getOwnPropertyDescriptor")
|
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTOR_UL, "getOwnPropertyDescriptor")
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON_ASYNC, "async function anonymous(")
|
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTORS_UL, "getOwnPropertyDescriptors")
|
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTORS_UL, "getOwnPropertyDescriptors")
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON_ASYNC_GENERATOR, "async function* anonymous(")
|
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FUNCTION_TO_STRING_NATIVE, "function () { [native code] }")
|
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FUNCTION_TO_STRING_NATIVE, "function () { [native code] }")
|
||||||
#if JERRY_SNAPSHOT_EXEC || !(JERRY_FUNCTION_TO_STRING)
|
|
||||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FUNCTION_TO_STRING_ECMA, "function () { /* ecmascript */ }")
|
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FUNCTION_TO_STRING_ECMA, "function () { /* ecmascript */ }")
|
||||||
#endif /* JERRY_SNAPSHOT_EXEC \
|
|
||||||
|| !(JERRY_FUNCTION_TO_STRING) */
|
|
||||||
|
|
||||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (0, LIT_MAGIC_STRING__EMPTY)
|
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (0, LIT_MAGIC_STRING__EMPTY)
|
||||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (1, LIT_MAGIC_STRING_SPACE_CHAR)
|
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (1, LIT_MAGIC_STRING_SPACE_CHAR)
|
||||||
|
@ -944,42 +926,17 @@ LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (17, LIT_MAGIC_STRING_BYTES_PER_ELEMENT_
|
||||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (17, LIT_MAGIC_STRING_GENERATOR_FUNCTION_UL)
|
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (17, LIT_MAGIC_STRING_GENERATOR_FUNCTION_UL)
|
||||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (18, LIT_MAGIC_STRING_DECODE_URI_COMPONENT)
|
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (18, LIT_MAGIC_STRING_DECODE_URI_COMPONENT)
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (19, LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON)
|
|
||||||
#else /* !(JERRY_FUNCTION_TO_STRING) */
|
|
||||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (19, LIT_MAGIC_STRING_GET_OWN_PROPERTY_NAMES_UL)
|
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (19, LIT_MAGIC_STRING_GET_OWN_PROPERTY_NAMES_UL)
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (20, LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON_GENERATOR)
|
|
||||||
#else /* !(JERRY_FUNCTION_TO_STRING) */
|
|
||||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (20, LIT_MAGIC_STRING_PROPERTY_IS_ENUMERABLE_UL)
|
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (20, LIT_MAGIC_STRING_PROPERTY_IS_ENUMERABLE_UL)
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (21, LIT_MAGIC_STRING_GET_OWN_PROPERTY_SYMBOLS_UL)
|
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (21, LIT_MAGIC_STRING_GET_OWN_PROPERTY_SYMBOLS_UL)
|
||||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (22, LIT_MAGIC_STRING_ASYNC_GENERATOR_FUNCTION_UL)
|
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (22, LIT_MAGIC_STRING_ASYNC_GENERATOR_FUNCTION_UL)
|
||||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (23, LIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTOR_UL)
|
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (23, LIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTOR_UL)
|
||||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (24, LIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTOR_UL)
|
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (24, LIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTOR_UL)
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (25, LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON_ASYNC)
|
|
||||||
#else /* !(JERRY_FUNCTION_TO_STRING) */
|
|
||||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (25, LIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTORS_UL)
|
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (25, LIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTORS_UL)
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (26, LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON_ASYNC_GENERATOR)
|
|
||||||
#else /* !(JERRY_FUNCTION_TO_STRING) */
|
|
||||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (26, LIT_MAGIC_STRING_FUNCTION_TO_STRING_NATIVE)
|
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (26, LIT_MAGIC_STRING_FUNCTION_TO_STRING_NATIVE)
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (27, LIT_MAGIC_STRING_FUNCTION_TO_STRING_NATIVE)
|
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (27, LIT_MAGIC_STRING_FUNCTION_TO_STRING_NATIVE)
|
||||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (28, LIT_MAGIC_STRING_FUNCTION_TO_STRING_NATIVE)
|
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (28, LIT_MAGIC_STRING_FUNCTION_TO_STRING_NATIVE)
|
||||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (29, LIT_MAGIC_STRING_FUNCTION_TO_STRING_NATIVE)
|
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (29, LIT_MAGIC_STRING_FUNCTION_TO_STRING_NATIVE)
|
||||||
#if JERRY_SNAPSHOT_EXEC || !(JERRY_FUNCTION_TO_STRING)
|
|
||||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (30, LIT_MAGIC_STRING_FUNCTION_TO_STRING_ECMA)
|
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (30, LIT_MAGIC_STRING_FUNCTION_TO_STRING_ECMA)
|
||||||
#endif /* JERRY_SNAPSHOT_EXEC \
|
|
||||||
|| !(JERRY_FUNCTION_TO_STRING) */
|
|
||||||
#if JERRY_SNAPSHOT_EXEC || !(JERRY_FUNCTION_TO_STRING)
|
|
||||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (31, LIT_MAGIC_STRING_FUNCTION_TO_STRING_ECMA)
|
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (31, LIT_MAGIC_STRING_FUNCTION_TO_STRING_ECMA)
|
||||||
#endif /* JERRY_SNAPSHOT_EXEC \
|
|
||||||
|| !(JERRY_FUNCTION_TO_STRING) */
|
|
||||||
#if JERRY_SNAPSHOT_EXEC || !(JERRY_FUNCTION_TO_STRING)
|
|
||||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (32, LIT_MAGIC_STRING_FUNCTION_TO_STRING_ECMA)
|
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (32, LIT_MAGIC_STRING_FUNCTION_TO_STRING_ECMA)
|
||||||
#endif /* JERRY_SNAPSHOT_EXEC \
|
|
||||||
|| !(JERRY_FUNCTION_TO_STRING) */
|
|
||||||
|
|
|
@ -979,9 +979,6 @@ typedef struct
|
||||||
#if JERRY_SOURCE_NAME
|
#if JERRY_SOURCE_NAME
|
||||||
ecma_value_t source_name; /**< source name */
|
ecma_value_t source_name; /**< source name */
|
||||||
#endif /* JERRY_SOURCE_NAME */
|
#endif /* JERRY_SOURCE_NAME */
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
ecma_value_t source_code; /**< source code */
|
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
} cbc_script_t;
|
} cbc_script_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -82,11 +82,7 @@ typedef enum
|
||||||
/**
|
/**
|
||||||
* Type of property length.
|
* Type of property length.
|
||||||
*/
|
*/
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
typedef uint32_t prop_length_t;
|
|
||||||
#else /* !JERRY_CPOINTER_32_BIT */
|
|
||||||
typedef uint16_t prop_length_t;
|
typedef uint16_t prop_length_t;
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Literal data.
|
* Literal data.
|
||||||
|
|
|
@ -653,9 +653,6 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
|
||||||
{
|
{
|
||||||
decoded_length = 2 * 3;
|
decoded_length = 2 * 3;
|
||||||
status_flags = LEXER_LIT_LOCATION_HAS_ESCAPE;
|
status_flags = LEXER_LIT_LOCATION_HAS_ESCAPE;
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
context_p->global_status_flags |= ECMA_PARSE_INTERNAL_HAS_4_BYTE_MARKER;
|
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1041,9 +1038,6 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
|
||||||
source_p += 4;
|
source_p += 4;
|
||||||
raw_length_adjust += 2;
|
raw_length_adjust += 2;
|
||||||
column++;
|
column++;
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
context_p->global_status_flags |= ECMA_PARSE_INTERNAL_HAS_4_BYTE_MARKER;
|
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (*source_p == LIT_CHAR_TAB)
|
else if (*source_p == LIT_CHAR_TAB)
|
||||||
|
@ -1467,11 +1461,6 @@ lexer_next_token (parser_context_t *context_p) /**< context */
|
||||||
{
|
{
|
||||||
size_t length;
|
size_t length;
|
||||||
|
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
/* Needed by arrow functions with expression body */
|
|
||||||
context_p->function_end_p = context_p->source_p;
|
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
|
|
||||||
lexer_skip_spaces (context_p);
|
lexer_skip_spaces (context_p);
|
||||||
|
|
||||||
context_p->token.keyword_type = LEXER_EOS;
|
context_p->token.keyword_type = LEXER_EOS;
|
||||||
|
@ -3019,13 +3008,6 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
|
||||||
|
|
||||||
JERRY_ASSERT ((ident_opts & LEXER_OBJ_IDENT_CLASS_IDENTIFIER) || !(ident_opts & LEXER_OBJ_IDENT_CLASS_NO_STATIC));
|
JERRY_ASSERT ((ident_opts & LEXER_OBJ_IDENT_CLASS_IDENTIFIER) || !(ident_opts & LEXER_OBJ_IDENT_CLASS_NO_STATIC));
|
||||||
|
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
if (ident_opts & LEXER_OBJ_IDENT_SET_FUNCTION_START)
|
|
||||||
{
|
|
||||||
context_p->function_start_p = context_p->source_p;
|
|
||||||
}
|
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
|
|
||||||
if (lexer_parse_identifier (context_p, LEXER_PARSE_NO_OPTS))
|
if (lexer_parse_identifier (context_p, LEXER_PARSE_NO_OPTS))
|
||||||
{
|
{
|
||||||
if (!(ident_opts & (LEXER_OBJ_IDENT_ONLY_IDENTIFIERS | LEXER_OBJ_IDENT_OBJECT_PATTERN)))
|
if (!(ident_opts & (LEXER_OBJ_IDENT_ONLY_IDENTIFIERS | LEXER_OBJ_IDENT_OBJECT_PATTERN)))
|
||||||
|
@ -3086,10 +3068,6 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
|
||||||
}
|
}
|
||||||
case LIT_CHAR_LEFT_SQUARE:
|
case LIT_CHAR_LEFT_SQUARE:
|
||||||
{
|
{
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
const uint8_t *function_start_p = context_p->function_start_p;
|
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
|
|
||||||
lexer_consume_next_character (context_p);
|
lexer_consume_next_character (context_p);
|
||||||
|
|
||||||
lexer_next_token (context_p);
|
lexer_next_token (context_p);
|
||||||
|
@ -3099,10 +3077,6 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
|
||||||
{
|
{
|
||||||
parser_raise_error (context_p, PARSER_ERR_RIGHT_SQUARE_EXPECTED);
|
parser_raise_error (context_p, PARSER_ERR_RIGHT_SQUARE_EXPECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
context_p->function_start_p = function_start_p;
|
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case LIT_CHAR_ASTERISK:
|
case LIT_CHAR_ASTERISK:
|
||||||
|
|
|
@ -274,11 +274,7 @@ typedef enum
|
||||||
LEXER_OBJ_IDENT_CLASS_NO_STATIC = (1u << 2), /**< static keyword was not present before the identifier */
|
LEXER_OBJ_IDENT_CLASS_NO_STATIC = (1u << 2), /**< static keyword was not present before the identifier */
|
||||||
LEXER_OBJ_IDENT_OBJECT_PATTERN = (1u << 3), /**< parse "get"/"set" as string literal in object pattern */
|
LEXER_OBJ_IDENT_OBJECT_PATTERN = (1u << 3), /**< parse "get"/"set" as string literal in object pattern */
|
||||||
LEXER_OBJ_IDENT_CLASS_PRIVATE = (1u << 4), /**< static keyword was not present before the identifier */
|
LEXER_OBJ_IDENT_CLASS_PRIVATE = (1u << 4), /**< static keyword was not present before the identifier */
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
LEXER_OBJ_IDENT_SET_FUNCTION_START = (1u << 5), /**< set function start */
|
|
||||||
#else /* !JERRY_FUNCTION_TO_STRING */
|
|
||||||
LEXER_OBJ_IDENT_SET_FUNCTION_START = 0, /**< set function start (disabled) */
|
LEXER_OBJ_IDENT_SET_FUNCTION_START = 0, /**< set function start (disabled) */
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
} lexer_obj_ident_opts_t;
|
} lexer_obj_ident_opts_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1978,10 +1978,6 @@ parser_parse_unary_expression (parser_context_t *context_p, /**< context */
|
||||||
{
|
{
|
||||||
JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_FUNCTION);
|
JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_FUNCTION);
|
||||||
|
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
context_p->function_start_p = context_p->token.lit_location.char_p;
|
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
|
|
||||||
uint32_t arrow_status_flags =
|
uint32_t arrow_status_flags =
|
||||||
(PARSER_IS_FUNCTION | PARSER_IS_ARROW_FUNCTION
|
(PARSER_IS_FUNCTION | PARSER_IS_ARROW_FUNCTION
|
||||||
| (context_p->status_flags & (PARSER_INSIDE_CLASS_FIELD | PARSER_IS_CLASS_STATIC_BLOCK)));
|
| (context_p->status_flags & (PARSER_INSIDE_CLASS_FIELD | PARSER_IS_CLASS_STATIC_BLOCK)));
|
||||||
|
@ -2086,9 +2082,6 @@ parser_parse_unary_expression (parser_context_t *context_p, /**< context */
|
||||||
}
|
}
|
||||||
case LEXER_KEYW_FUNCTION:
|
case LEXER_KEYW_FUNCTION:
|
||||||
{
|
{
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
context_p->function_start_p = context_p->token.lit_location.char_p;
|
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
parser_parse_function_expression (context_p, PARSER_FUNCTION_CLOSURE | PARSER_IS_FUNC_EXPRESSION);
|
parser_parse_function_expression (context_p, PARSER_FUNCTION_CLOSURE | PARSER_IS_FUNC_EXPRESSION);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2227,10 +2220,6 @@ parser_parse_unary_expression (parser_context_t *context_p, /**< context */
|
||||||
|
|
||||||
parser_check_assignment_expr (context_p);
|
parser_check_assignment_expr (context_p);
|
||||||
|
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
context_p->function_start_p = context_p->source_p - 1;
|
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
|
|
||||||
uint32_t arrow_status_flags =
|
uint32_t arrow_status_flags =
|
||||||
(PARSER_IS_FUNCTION | PARSER_IS_ARROW_FUNCTION
|
(PARSER_IS_FUNCTION | PARSER_IS_ARROW_FUNCTION
|
||||||
| (context_p->status_flags & (PARSER_INSIDE_CLASS_FIELD | PARSER_IS_CLASS_STATIC_BLOCK)));
|
| (context_p->status_flags & (PARSER_INSIDE_CLASS_FIELD | PARSER_IS_CLASS_STATIC_BLOCK)));
|
||||||
|
@ -3592,9 +3581,6 @@ parser_pattern_process_assignment (parser_context_t *context_p, /**< context */
|
||||||
}
|
}
|
||||||
|
|
||||||
parser_line_counter_t ident_line_counter = context_p->token.line;
|
parser_line_counter_t ident_line_counter = context_p->token.line;
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
parser_line_counter_t ident_column_counter = context_p->token.column;
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
if (flags & PARSER_PATTERN_BINDING)
|
if (flags & PARSER_PATTERN_BINDING)
|
||||||
{
|
{
|
||||||
|
@ -3648,9 +3634,6 @@ parser_pattern_process_assignment (parser_context_t *context_p, /**< context */
|
||||||
}
|
}
|
||||||
|
|
||||||
parser_pattern_form_assignment (context_p, flags, rhs_opcode, literal_index, ident_line_counter);
|
parser_pattern_form_assignment (context_p, flags, rhs_opcode, literal_index, ident_line_counter);
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
parser_line_info_append (context_p, ident_line_counter, ident_column_counter);
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
return false;
|
return false;
|
||||||
} /* parser_pattern_process_assignment */
|
} /* parser_pattern_process_assignment */
|
||||||
|
|
||||||
|
@ -3835,9 +3818,6 @@ parser_parse_object_initializer (parser_context_t *context_p, /**< context */
|
||||||
|| context_p->token.type == LEXER_COMMA);
|
|| context_p->token.type == LEXER_COMMA);
|
||||||
|
|
||||||
parser_pattern_form_assignment (context_p, flags, push_prop_opcode, prop_index, start_line);
|
parser_pattern_form_assignment (context_p, flags, push_prop_opcode, prop_index, start_line);
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
parser_line_info_append (context_p, start_line, start_column);
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context_p->token.type == LEXER_RIGHT_BRACE)
|
if (context_p->token.type == LEXER_RIGHT_BRACE)
|
||||||
|
|
|
@ -441,18 +441,6 @@ typedef struct
|
||||||
struct scanner_context_t;
|
struct scanner_context_t;
|
||||||
typedef struct scanner_context_t scanner_context_t;
|
typedef struct scanner_context_t scanner_context_t;
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
parser_mem_page_t *last_page_p; /**< last page of line info data */
|
|
||||||
uint32_t byte_code_position; /**< last byte code position */
|
|
||||||
parser_line_counter_t line; /**< last line */
|
|
||||||
parser_line_counter_t column; /**< last column */
|
|
||||||
} parser_line_info_data_t;
|
|
||||||
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of private field contexts
|
* List of private field contexts
|
||||||
*/
|
*/
|
||||||
|
@ -495,14 +483,6 @@ typedef struct parser_saved_context_t
|
||||||
#ifndef JERRY_NDEBUG
|
#ifndef JERRY_NDEBUG
|
||||||
uint16_t context_stack_depth; /**< current context stack depth */
|
uint16_t context_stack_depth; /**< current context stack depth */
|
||||||
#endif /* !JERRY_NDEBUG */
|
#endif /* !JERRY_NDEBUG */
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
parser_line_info_data_t *line_info_p; /**< line info data */
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
const uint8_t *function_start_p; /**< start position of the current function */
|
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
} parser_saved_context_t;
|
} parser_saved_context_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -592,14 +572,6 @@ typedef struct
|
||||||
uint32_t total_byte_code_size; /**< total byte code size */
|
uint32_t total_byte_code_size; /**< total byte code size */
|
||||||
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
|
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
parser_line_info_data_t *line_info_p; /**< line info data */
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
const uint8_t *function_start_p; /**< start position of the function which will be parsed */
|
|
||||||
const uint8_t *function_end_p; /**< end position of the current function */
|
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
} parser_context_t;
|
} parser_context_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -849,19 +821,6 @@ parser_module_add_names_to_node (parser_context_t *context_p, ecma_string_t *ime
|
||||||
|
|
||||||
#endif /* JERRY_MODULE_SYSTEM */
|
#endif /* JERRY_MODULE_SYSTEM */
|
||||||
|
|
||||||
/*
|
|
||||||
* @}
|
|
||||||
*
|
|
||||||
* \addtogroup jsparser_line_info_create Create line info data
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
void parser_line_info_free (parser_line_info_data_t *line_info_p);
|
|
||||||
void parser_line_info_append (parser_context_t *context_p, parser_line_counter_t line, parser_line_counter_t column);
|
|
||||||
uint8_t *parser_line_info_generate (parser_context_t *context_p);
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*
|
*
|
||||||
|
|
|
@ -38,11 +38,7 @@
|
||||||
* Maximum string limit.
|
* Maximum string limit.
|
||||||
* Limit: 2147483647 / 65535.
|
* Limit: 2147483647 / 65535.
|
||||||
*/
|
*/
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
#define PARSER_MAXIMUM_STRING_LIMIT 2147483647
|
|
||||||
#else /* !JERRY_CPOINTER_32_BIT */
|
|
||||||
#define PARSER_MAXIMUM_STRING_LIMIT 65535
|
#define PARSER_MAXIMUM_STRING_LIMIT 65535
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum string length.
|
* Maximum string length.
|
||||||
|
|
|
@ -1,592 +0,0 @@
|
||||||
/* Copyright JS Foundation and other contributors, http://js.foundation
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "ecma-line-info.h"
|
|
||||||
|
|
||||||
#include "js-parser-internal.h"
|
|
||||||
|
|
||||||
/** \addtogroup parser Parser
|
|
||||||
* @{
|
|
||||||
*
|
|
||||||
* \addtogroup jsparser JavaScript
|
|
||||||
* @{
|
|
||||||
*
|
|
||||||
* \addtogroup jsparser_line_info_create Create line info data
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if JERRY_PARSER
|
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The line-info data structure uses two number encodings:
|
|
||||||
*
|
|
||||||
* Vlq (variable length quantity):
|
|
||||||
* Each byte has 7 bit data and the highest bit is set for continuation.
|
|
||||||
* The format is big endian.
|
|
||||||
*
|
|
||||||
* Small:
|
|
||||||
* One byte can encode signed values between 127 and -126.
|
|
||||||
* Two byte can encode signed values between 319 and -318.
|
|
||||||
* Large values are encoded with vlq with a prefix byte.
|
|
||||||
*
|
|
||||||
* The line-info data structure is a sequence of chunks:
|
|
||||||
*
|
|
||||||
* +------+--------------+------------+----------------+
|
|
||||||
* | Line | StreamLength | StreamData | [ByteCodeSize] |
|
|
||||||
* +------+--------------+------------+----------------+
|
|
||||||
*
|
|
||||||
* Line [Vlq encoding]:
|
|
||||||
* Specifies the start line of this chunk, relative to its previous value.
|
|
||||||
* The starting column is always ECMA_LINE_INFO_COLUMN_DEFAULT
|
|
||||||
*
|
|
||||||
* StreamLength [uint8_t]:
|
|
||||||
* Length of the StreamData in bytes minus ECMA_LINE_INFO_STREAM_SIZE_MIN.
|
|
||||||
* The 0 value represents the last chunk, which size is not specified
|
|
||||||
* (Can be less than ECMA_LINE_INFO_STREAM_SIZE_MIN).
|
|
||||||
*
|
|
||||||
* StreamData [sequence of bytes]:
|
|
||||||
* Sequence of the following items:
|
|
||||||
*
|
|
||||||
* +-----------+--------+--------+
|
|
||||||
* | EndOffset | [Line] | Column |
|
|
||||||
* +-----------+--------+--------+
|
|
||||||
*
|
|
||||||
* EndOffset [Small encoding]:
|
|
||||||
* Specifies the EndOffset in the byte code, relative to the previous EndOffset.
|
|
||||||
* The range of byte codes corresponding to the line/column position of this item
|
|
||||||
* is between the EndOffset of the previous item (inclusive) and the EndOffset
|
|
||||||
* of this item (exclusive). The last end offset of a stream is always 0, which
|
|
||||||
* represents an unterminated range.
|
|
||||||
*
|
|
||||||
* Line [Small encoding] [Optional]:
|
|
||||||
* If bit 1 of end offset is set, this specifies the line position of this item,
|
|
||||||
* relative to the previous line position, and the column position is set to
|
|
||||||
* ECMA_LINE_INFO_COLUMN_DEFAULT.
|
|
||||||
*
|
|
||||||
* Column [Small encoding]:
|
|
||||||
* Specifies the current column position relative to the previous column position.
|
|
||||||
*
|
|
||||||
* ByteCodeSize [Vlq encoding] [Optional]:
|
|
||||||
* If StreamLength is not 0, this specifies the byte code size of the whole range.
|
|
||||||
* This value can be used to skip the byte codes which line info is stored
|
|
||||||
* in this chunk. This information is not available for the last chunk.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Maximum number of bytes requires to encode a number.
|
|
||||||
*/
|
|
||||||
#define PARSER_LINE_INFO_BUFFER_MAX_SIZE 6
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stream generation ends after this size is reached,
|
|
||||||
* since there might be not enough place for the next item.
|
|
||||||
*/
|
|
||||||
#define PARSER_LINE_INFO_STREAM_SIZE_LIMIT \
|
|
||||||
(ECMA_LINE_INFO_STREAM_SIZE_MIN + UINT8_MAX - ((2 * PARSER_LINE_INFO_BUFFER_MAX_SIZE) + 1))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Page size of line info pages excluding the first one.
|
|
||||||
*/
|
|
||||||
#define PARSER_LINE_INFO_PAGE_SIZE (sizeof (parser_mem_page_t *) + PARSER_STACK_PAGE_SIZE)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Page size of the first line info page.
|
|
||||||
*/
|
|
||||||
#define PARSER_LINE_INFO_FIRST_PAGE_SIZE (sizeof (parser_line_info_data_t) + PARSER_LINE_INFO_PAGE_SIZE)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get memory data of the first page.
|
|
||||||
*/
|
|
||||||
#define PARSER_LINE_INFO_GET_FIRST_PAGE(line_info_p) (((parser_mem_page_t *) ((line_info_p) + 1)))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free line info temporary data collected during parsing.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
parser_line_info_free (parser_line_info_data_t *line_info_p)
|
|
||||||
{
|
|
||||||
if (line_info_p == NULL)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
parser_mem_page_t *current_page_p = PARSER_LINE_INFO_GET_FIRST_PAGE (line_info_p)->next_p;
|
|
||||||
parser_free (line_info_p, PARSER_LINE_INFO_FIRST_PAGE_SIZE);
|
|
||||||
|
|
||||||
while (current_page_p != NULL)
|
|
||||||
{
|
|
||||||
parser_mem_page_t *next_p = current_page_p->next_p;
|
|
||||||
|
|
||||||
parser_free (current_page_p, PARSER_LINE_INFO_PAGE_SIZE);
|
|
||||||
current_page_p = next_p;
|
|
||||||
}
|
|
||||||
} /* parser_line_info_free */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Encodes an uint32_t number into a buffer. Numbers expected to be larger values.
|
|
||||||
*
|
|
||||||
* @return the number of bytes written to the buffer
|
|
||||||
*/
|
|
||||||
static uint32_t
|
|
||||||
parser_line_info_encode_vlq (uint8_t *buffer_p, /**< target buffer */
|
|
||||||
uint32_t value) /**< encoded value */
|
|
||||||
{
|
|
||||||
if (value <= ECMA_LINE_INFO_VLQ_MASK)
|
|
||||||
{
|
|
||||||
*buffer_p = (uint8_t) value;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t length = 0;
|
|
||||||
uint32_t current_value = value;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
current_value >>= ECMA_LINE_INFO_VLQ_SHIFT;
|
|
||||||
length++;
|
|
||||||
} while (current_value > 0);
|
|
||||||
|
|
||||||
buffer_p += length;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
*(--buffer_p) = (uint8_t) (value | ECMA_LINE_INFO_VLQ_CONTINUE);
|
|
||||||
value >>= ECMA_LINE_INFO_VLQ_SHIFT;
|
|
||||||
} while (value > 0);
|
|
||||||
|
|
||||||
buffer_p[length - 1] &= ECMA_LINE_INFO_VLQ_MASK;
|
|
||||||
return length;
|
|
||||||
} /* parser_line_info_encode_vlq */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Encodes an uint32_t number into a buffer. Numbers expected to be smaller values.
|
|
||||||
*
|
|
||||||
* @return the number of bytes written to the buffer
|
|
||||||
*/
|
|
||||||
static uint32_t
|
|
||||||
parser_line_info_encode_small (uint8_t *buffer_p, /**< target buffer */
|
|
||||||
uint32_t value) /**< encoded value */
|
|
||||||
{
|
|
||||||
if (JERRY_LIKELY (value < ECMA_LINE_INFO_ENCODE_TWO_BYTE_MIN))
|
|
||||||
{
|
|
||||||
buffer_p[0] = (uint8_t) value;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (JERRY_LIKELY (value < ECMA_LINE_INFO_ENCODE_VLQ_MIN))
|
|
||||||
{
|
|
||||||
buffer_p[0] = ECMA_LINE_INFO_ENCODE_TWO_BYTE;
|
|
||||||
buffer_p[1] = (uint8_t) (value - ECMA_LINE_INFO_ENCODE_TWO_BYTE_MIN);
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
*buffer_p++ = ECMA_LINE_INFO_ENCODE_VLQ;
|
|
||||||
return parser_line_info_encode_vlq (buffer_p, value - ECMA_LINE_INFO_ENCODE_VLQ_MIN) + 1;
|
|
||||||
} /* parser_line_info_encode_small */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Encodes the difference between two values.
|
|
||||||
*
|
|
||||||
* @return encoded difference
|
|
||||||
*/
|
|
||||||
static inline uint32_t
|
|
||||||
parser_line_info_difference_get (uint32_t current_value, /**< current value */
|
|
||||||
uint32_t prev_value) /**< previous value */
|
|
||||||
{
|
|
||||||
uint32_t result = current_value - prev_value - 1;
|
|
||||||
|
|
||||||
if (result <= (UINT32_MAX >> 1))
|
|
||||||
{
|
|
||||||
return (result << 1) | ECMA_LINE_INFO_INCREASE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ((UINT32_MAX - result) << 1) | ECMA_LINE_INFO_DECREASE;
|
|
||||||
} /* parser_line_info_difference_get */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Appends a value at the end of the line info stream.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
parser_line_info_append_number (parser_context_t *context_p, /**< context */
|
|
||||||
uint32_t value) /**< value to be encoded */
|
|
||||||
{
|
|
||||||
parser_line_info_data_t *line_info_p = context_p->line_info_p;
|
|
||||||
uint8_t buffer[PARSER_LINE_INFO_BUFFER_MAX_SIZE];
|
|
||||||
|
|
||||||
JERRY_ASSERT (line_info_p != NULL);
|
|
||||||
|
|
||||||
uint32_t length = parser_line_info_encode_vlq (buffer, value);
|
|
||||||
uint8_t offset = line_info_p->last_page_p->bytes[0];
|
|
||||||
|
|
||||||
if (offset + length <= PARSER_STACK_PAGE_SIZE)
|
|
||||||
{
|
|
||||||
memcpy (line_info_p->last_page_p->bytes + offset, buffer, length);
|
|
||||||
|
|
||||||
line_info_p->last_page_p->bytes[0] = (uint8_t) (length + offset);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
parser_mem_page_t *new_page_p;
|
|
||||||
new_page_p = (parser_mem_page_t *) parser_malloc (context_p, PARSER_LINE_INFO_PAGE_SIZE);
|
|
||||||
|
|
||||||
new_page_p->next_p = NULL;
|
|
||||||
|
|
||||||
line_info_p->last_page_p->next_p = new_page_p;
|
|
||||||
line_info_p->last_page_p = new_page_p;
|
|
||||||
|
|
||||||
new_page_p->bytes[0] = (uint8_t) (length + 1);
|
|
||||||
memcpy (new_page_p->bytes + 1, buffer, length);
|
|
||||||
} /* parser_line_info_append_number */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the current line information data.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
parser_line_info_append (parser_context_t *context_p, /**< context */
|
|
||||||
parser_line_counter_t line, /**< line */
|
|
||||||
parser_line_counter_t column) /**< column */
|
|
||||||
{
|
|
||||||
parser_line_info_data_t *line_info_p = context_p->line_info_p;
|
|
||||||
uint32_t value;
|
|
||||||
|
|
||||||
if (line_info_p != NULL)
|
|
||||||
{
|
|
||||||
if (line_info_p->byte_code_position == context_p->byte_code_size
|
|
||||||
|| (line_info_p->line == line && line_info_p->column == column))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sets ECMA_LINE_INFO_HAS_LINE bit. */
|
|
||||||
value = (uint32_t) (line != line_info_p->line);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
line_info_p = (parser_line_info_data_t *) parser_malloc (context_p, PARSER_LINE_INFO_FIRST_PAGE_SIZE);
|
|
||||||
context_p->line_info_p = line_info_p;
|
|
||||||
|
|
||||||
parser_mem_page_t *page_p = PARSER_LINE_INFO_GET_FIRST_PAGE (line_info_p);
|
|
||||||
page_p->next_p = NULL;
|
|
||||||
page_p->bytes[0] = 1;
|
|
||||||
|
|
||||||
line_info_p->last_page_p = page_p;
|
|
||||||
line_info_p->byte_code_position = 0;
|
|
||||||
line_info_p->line = 1;
|
|
||||||
line_info_p->column = 1;
|
|
||||||
|
|
||||||
/* Sets ECMA_LINE_INFO_HAS_LINE bit. */
|
|
||||||
value = (uint32_t) (line != 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
value |= ((context_p->byte_code_size - line_info_p->byte_code_position) << 1);
|
|
||||||
|
|
||||||
parser_line_info_append_number (context_p, value);
|
|
||||||
line_info_p->byte_code_position = context_p->byte_code_size;
|
|
||||||
|
|
||||||
if (value & ECMA_LINE_INFO_HAS_LINE)
|
|
||||||
{
|
|
||||||
value = parser_line_info_difference_get (line, line_info_p->line);
|
|
||||||
parser_line_info_append_number (context_p, value);
|
|
||||||
line_info_p->line = line;
|
|
||||||
}
|
|
||||||
|
|
||||||
value = parser_line_info_difference_get (column, line_info_p->column);
|
|
||||||
parser_line_info_append_number (context_p, value);
|
|
||||||
line_info_p->column = column;
|
|
||||||
} /* parser_line_info_append */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Line info iterator structure
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
parser_mem_page_t *current_page_p; /**< current page */
|
|
||||||
uint32_t offset; /**< current offset */
|
|
||||||
} parser_line_info_iterator_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Decodes the next value from the iterator stream
|
|
||||||
*/
|
|
||||||
static uint32_t
|
|
||||||
parser_line_info_iterator_get (parser_line_info_iterator_t *iterator_p) /**< iterator */
|
|
||||||
{
|
|
||||||
uint8_t *source_p = iterator_p->current_page_p->bytes + iterator_p->offset;
|
|
||||||
uint32_t result = ecma_line_info_decode_vlq (&source_p);
|
|
||||||
|
|
||||||
iterator_p->offset = (uint32_t) (source_p - iterator_p->current_page_p->bytes);
|
|
||||||
|
|
||||||
JERRY_ASSERT (iterator_p->offset <= iterator_p->current_page_p->bytes[0]);
|
|
||||||
|
|
||||||
if (iterator_p->offset < iterator_p->current_page_p->bytes[0])
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
iterator_p->current_page_p = iterator_p->current_page_p->next_p;
|
|
||||||
iterator_p->offset = 1;
|
|
||||||
return result;
|
|
||||||
} /* parser_line_info_iterator_get */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate line info data
|
|
||||||
*
|
|
||||||
* @return generated line info data
|
|
||||||
*/
|
|
||||||
uint8_t *
|
|
||||||
parser_line_info_generate (parser_context_t *context_p) /**< context */
|
|
||||||
{
|
|
||||||
parser_line_info_iterator_t iterator;
|
|
||||||
uint8_t *line_info_p = NULL;
|
|
||||||
uint8_t *dst_p = NULL;
|
|
||||||
uint32_t total_length = 0;
|
|
||||||
uint32_t total_length_size = 0;
|
|
||||||
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
/* The following code runs twice: first the size of the data,
|
|
||||||
* is computed and the data is generated during the second run.
|
|
||||||
* Note: line_info_p is NULL during the first run. */
|
|
||||||
parser_mem_page_t *iterator_byte_code_page_p = context_p->byte_code.first_p;
|
|
||||||
uint32_t iterator_byte_code_page_offset = 0;
|
|
||||||
uint32_t iterator_byte_code_base = 0;
|
|
||||||
uint32_t iterator_last_byte_code_offset = UINT32_MAX;
|
|
||||||
uint32_t iterator_prev_line = 0;
|
|
||||||
uint32_t iterator_prev_column = 0;
|
|
||||||
uint32_t iterator_line = 1;
|
|
||||||
uint32_t iterator_column = 1;
|
|
||||||
uint8_t block_buffer[PARSER_LINE_INFO_BUFFER_MAX_SIZE];
|
|
||||||
uint8_t line_column_buffer[PARSER_LINE_INFO_BUFFER_MAX_SIZE * 2];
|
|
||||||
uint8_t *block_size_p = NULL;
|
|
||||||
uint32_t block_byte_code_offset = 0;
|
|
||||||
uint32_t block_prev_line = 1;
|
|
||||||
uint32_t stream_byte_code_offset = 0;
|
|
||||||
uint32_t stream_current_line = 1;
|
|
||||||
uint32_t stream_current_column = ECMA_LINE_INFO_COLUMN_DEFAULT;
|
|
||||||
uint32_t stream_prev_line = 1;
|
|
||||||
uint32_t stream_prev_column = ECMA_LINE_INFO_COLUMN_DEFAULT;
|
|
||||||
uint32_t stream_size = 0;
|
|
||||||
uint32_t stream_value_count = 0;
|
|
||||||
uint32_t value;
|
|
||||||
|
|
||||||
iterator.current_page_p = PARSER_LINE_INFO_GET_FIRST_PAGE (context_p->line_info_p);
|
|
||||||
iterator.offset = 1;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
/* Decode line information generated during parsing. */
|
|
||||||
value = parser_line_info_iterator_get (&iterator);
|
|
||||||
iterator_byte_code_page_offset += (value >> 1);
|
|
||||||
|
|
||||||
if (value & 0x1)
|
|
||||||
{
|
|
||||||
value = parser_line_info_iterator_get (&iterator);
|
|
||||||
JERRY_ASSERT (value != ((0 << 1) | ECMA_LINE_INFO_DECREASE));
|
|
||||||
iterator_line = ecma_line_info_difference_update (iterator_line, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
value = parser_line_info_iterator_get (&iterator);
|
|
||||||
iterator_column = ecma_line_info_difference_update (iterator_column, value);
|
|
||||||
|
|
||||||
while (iterator_byte_code_page_offset >= PARSER_CBC_STREAM_PAGE_SIZE)
|
|
||||||
{
|
|
||||||
uint8_t relative_offset = iterator_byte_code_page_p->bytes[PARSER_CBC_STREAM_PAGE_SIZE - 1];
|
|
||||||
iterator_byte_code_base += relative_offset & CBC_LOWER_SEVEN_BIT_MASK;
|
|
||||||
iterator_byte_code_page_offset -= PARSER_CBC_STREAM_PAGE_SIZE;
|
|
||||||
iterator_byte_code_page_p = iterator_byte_code_page_p->next_p;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t iterator_byte_code_offset = iterator_byte_code_base;
|
|
||||||
|
|
||||||
if (iterator_byte_code_page_offset > 0)
|
|
||||||
{
|
|
||||||
uint8_t relative_offset = iterator_byte_code_page_p->bytes[iterator_byte_code_page_offset - 1];
|
|
||||||
iterator_byte_code_offset += relative_offset & CBC_LOWER_SEVEN_BIT_MASK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Skip those line/column pairs which byte code was discarded during post processing
|
|
||||||
* or does not change line/column (this is possible when multiple skips occur). */
|
|
||||||
if (iterator_byte_code_offset == iterator_last_byte_code_offset
|
|
||||||
|| (iterator_line == iterator_prev_line && iterator_column == iterator_prev_column))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
iterator_prev_line = iterator_line;
|
|
||||||
iterator_prev_column = iterator_column;
|
|
||||||
iterator_last_byte_code_offset = iterator_byte_code_offset;
|
|
||||||
|
|
||||||
if (block_size_p != NULL)
|
|
||||||
{
|
|
||||||
/* Sets ECMA_LINE_INFO_HAS_LINE bit. */
|
|
||||||
value = (((iterator_byte_code_offset - stream_byte_code_offset) << 1)
|
|
||||||
| (uint32_t) (stream_prev_line != stream_current_line));
|
|
||||||
|
|
||||||
uint32_t line_column_size = 0;
|
|
||||||
uint32_t offset_size = parser_line_info_encode_small (block_buffer, value);
|
|
||||||
stream_byte_code_offset = iterator_byte_code_offset;
|
|
||||||
|
|
||||||
if (value & ECMA_LINE_INFO_HAS_LINE)
|
|
||||||
{
|
|
||||||
value = parser_line_info_difference_get (stream_current_line, stream_prev_line);
|
|
||||||
line_column_size = parser_line_info_encode_small (line_column_buffer, value);
|
|
||||||
stream_prev_line = stream_current_line;
|
|
||||||
stream_prev_column = ECMA_LINE_INFO_COLUMN_DEFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
value = parser_line_info_difference_get (stream_current_column, stream_prev_column);
|
|
||||||
line_column_size += parser_line_info_encode_small (line_column_buffer + line_column_size, value);
|
|
||||||
|
|
||||||
stream_prev_column = stream_current_column;
|
|
||||||
stream_current_line = iterator_line;
|
|
||||||
stream_current_column = iterator_column;
|
|
||||||
|
|
||||||
stream_value_count++;
|
|
||||||
|
|
||||||
if (stream_value_count < ECMA_LINE_INFO_STREAM_VALUE_COUNT_MAX
|
|
||||||
&& (stream_size + offset_size + line_column_size <= PARSER_LINE_INFO_STREAM_SIZE_LIMIT))
|
|
||||||
{
|
|
||||||
stream_size += offset_size + line_column_size;
|
|
||||||
|
|
||||||
if (line_info_p != NULL)
|
|
||||||
{
|
|
||||||
memcpy (dst_p, block_buffer, offset_size);
|
|
||||||
dst_p += offset_size;
|
|
||||||
memcpy (dst_p, line_column_buffer, line_column_size);
|
|
||||||
dst_p += line_column_size;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Finalize the current chunk. The size of EndOffset is always 1. */
|
|
||||||
stream_size += 1 + line_column_size;
|
|
||||||
|
|
||||||
JERRY_ASSERT (stream_size > ECMA_LINE_INFO_STREAM_SIZE_MIN
|
|
||||||
&& (stream_size - ECMA_LINE_INFO_STREAM_SIZE_MIN) <= UINT8_MAX);
|
|
||||||
|
|
||||||
if (line_info_p != NULL)
|
|
||||||
{
|
|
||||||
*block_size_p = (uint8_t) (stream_size - ECMA_LINE_INFO_STREAM_SIZE_MIN);
|
|
||||||
/* Set EndOffset to 0 and copy the has_line bit. */
|
|
||||||
*dst_p++ = (uint8_t) (block_buffer[0] & ECMA_LINE_INFO_HAS_LINE);
|
|
||||||
memcpy (dst_p, line_column_buffer, line_column_size);
|
|
||||||
dst_p += line_column_size;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
total_length += stream_size;
|
|
||||||
dst_p = block_buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t byte_code_diff = iterator_last_byte_code_offset - block_byte_code_offset;
|
|
||||||
dst_p += parser_line_info_encode_vlq (dst_p, byte_code_diff);
|
|
||||||
block_byte_code_offset = iterator_last_byte_code_offset;
|
|
||||||
|
|
||||||
if (line_info_p == NULL)
|
|
||||||
{
|
|
||||||
total_length += (uint32_t) (dst_p - block_buffer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Start a new chunk. */
|
|
||||||
if (line_info_p == NULL)
|
|
||||||
{
|
|
||||||
dst_p = block_buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
value = parser_line_info_difference_get (iterator_line, block_prev_line);
|
|
||||||
|
|
||||||
dst_p += parser_line_info_encode_vlq (dst_p, value);
|
|
||||||
block_size_p = dst_p;
|
|
||||||
dst_p++;
|
|
||||||
|
|
||||||
if (line_info_p == NULL)
|
|
||||||
{
|
|
||||||
total_length += (uint32_t) (dst_p - block_buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
block_prev_line = iterator_line;
|
|
||||||
stream_current_line = iterator_line;
|
|
||||||
stream_current_column = iterator_column;
|
|
||||||
stream_prev_line = iterator_line;
|
|
||||||
stream_prev_column = ECMA_LINE_INFO_COLUMN_DEFAULT;
|
|
||||||
stream_size = 0;
|
|
||||||
stream_value_count = 0;
|
|
||||||
} while (iterator.current_page_p != NULL);
|
|
||||||
|
|
||||||
value = (stream_prev_line != stream_current_line);
|
|
||||||
|
|
||||||
/* Finalize the last stream */
|
|
||||||
if (line_info_p == NULL)
|
|
||||||
{
|
|
||||||
dst_p = line_column_buffer;
|
|
||||||
total_length += stream_size + 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*block_size_p = 0;
|
|
||||||
/* Small encoded value of has_line bit. */
|
|
||||||
*dst_p++ = (uint8_t) value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (value)
|
|
||||||
{
|
|
||||||
value = parser_line_info_difference_get (stream_current_line, stream_prev_line);
|
|
||||||
dst_p += parser_line_info_encode_small (dst_p, value);
|
|
||||||
stream_prev_column = ECMA_LINE_INFO_COLUMN_DEFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
value = parser_line_info_difference_get (stream_current_column, stream_prev_column);
|
|
||||||
dst_p += parser_line_info_encode_small (dst_p, value);
|
|
||||||
|
|
||||||
if (line_info_p == NULL)
|
|
||||||
{
|
|
||||||
total_length += (uint32_t) (dst_p - line_column_buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (line_info_p != NULL)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
total_length_size = parser_line_info_encode_vlq (block_buffer, total_length);
|
|
||||||
|
|
||||||
/* TODO: Support allocation fail. */
|
|
||||||
line_info_p = (uint8_t *) jmem_heap_alloc_block (total_length + total_length_size);
|
|
||||||
dst_p = line_info_p + parser_line_info_encode_vlq (line_info_p, total_length);
|
|
||||||
}
|
|
||||||
|
|
||||||
JERRY_ASSERT (line_info_p + total_length_size + total_length == dst_p);
|
|
||||||
|
|
||||||
#if JERRY_PARSER_DUMP_BYTE_CODE
|
|
||||||
if (context_p->is_show_opcodes)
|
|
||||||
{
|
|
||||||
ecma_line_info_dump (line_info_p);
|
|
||||||
}
|
|
||||||
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
|
|
||||||
|
|
||||||
return line_info_p;
|
|
||||||
} /* parser_line_info_generate */
|
|
||||||
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
#endif /* JERRY_PARSER */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
* @}
|
|
||||||
* @}
|
|
||||||
*/
|
|
|
@ -453,11 +453,8 @@ parser_parse_var_statement (parser_context_t *context_p) /**< context */
|
||||||
lexer_expect_identifier (context_p, LEXER_IDENT_LITERAL);
|
lexer_expect_identifier (context_p, LEXER_IDENT_LITERAL);
|
||||||
JERRY_ASSERT (context_p->token.type == LEXER_LITERAL
|
JERRY_ASSERT (context_p->token.type == LEXER_LITERAL
|
||||||
&& context_p->token.lit_location.type == LEXER_IDENT_LITERAL);
|
&& context_p->token.lit_location.type == LEXER_IDENT_LITERAL);
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
parser_line_counter_t ident_column_counter = context_p->token.column;
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
#if JERRY_MODULE_SYSTEM
|
#if JERRY_MODULE_SYSTEM
|
||||||
parser_module_append_export_name (context_p);
|
parser_module_append_export_name (context_p);
|
||||||
#endif /* JERRY_MODULE_SYSTEM */
|
#endif /* JERRY_MODULE_SYSTEM */
|
||||||
|
|
||||||
|
@ -476,9 +473,6 @@ parser_parse_var_statement (parser_context_t *context_p) /**< context */
|
||||||
|
|
||||||
if (context_p->token.type == LEXER_ASSIGN)
|
if (context_p->token.type == LEXER_ASSIGN)
|
||||||
{
|
{
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
parser_line_info_append (context_p, ident_line_counter, ident_column_counter);
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
uint16_t index = context_p->lit_object.index;
|
uint16_t index = context_p->lit_object.index;
|
||||||
|
|
||||||
|
@ -600,13 +594,6 @@ parser_parse_function_statement (parser_context_t *context_p) /**< context */
|
||||||
parser_raise_error (context_p, PARSER_ERR_LEXICAL_SINGLE_STATEMENT);
|
parser_raise_error (context_p, PARSER_ERR_LEXICAL_SINGLE_STATEMENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
if (!(context_p->next_scanner_info_p->u8_arg & SCANNER_FUNCTION_ASYNC))
|
|
||||||
{
|
|
||||||
context_p->function_start_p = context_p->token.lit_location.char_p;
|
|
||||||
}
|
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
|
|
||||||
bool is_generator_function = false;
|
bool is_generator_function = false;
|
||||||
|
|
||||||
if (lexer_consume_generator (context_p))
|
if (lexer_consume_generator (context_p))
|
||||||
|
@ -1701,10 +1688,6 @@ parser_parse_switch_statement_start (parser_context_t *context_p) /**< context *
|
||||||
|
|
||||||
switch_case_was_found = true;
|
switch_case_was_found = true;
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
parser_line_info_append (context_p, context_p->token.line, context_p->token.column);
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
parser_parse_expression (context_p, PARSE_EXPR);
|
parser_parse_expression (context_p, PARSE_EXPR);
|
||||||
|
|
||||||
if (context_p->token.type != LEXER_COLON)
|
if (context_p->token.type != LEXER_COLON)
|
||||||
|
@ -2356,9 +2339,6 @@ parser_parse_export_statement (parser_context_t *context_p) /**< context */
|
||||||
&& context_p->next_scanner_info_p->source_p == context_p->source_p
|
&& context_p->next_scanner_info_p->source_p == context_p->source_p
|
||||||
&& context_p->next_scanner_info_p->type == SCANNER_TYPE_FUNCTION)
|
&& context_p->next_scanner_info_p->type == SCANNER_TYPE_FUNCTION)
|
||||||
{
|
{
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
context_p->function_start_p = context_p->token.lit_location.char_p;
|
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
lexer_next_token (context_p);
|
lexer_next_token (context_p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2600,10 +2580,6 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
|
||||||
context_p->status_flags &= (uint32_t) ~PARSER_IS_STRICT;
|
context_p->status_flags &= (uint32_t) ~PARSER_IS_STRICT;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
parser_line_info_append (context_p, context_p->token.line, context_p->token.column);
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
lexer_construct_literal_object (context_p, &lit_location, LEXER_STRING_LITERAL);
|
lexer_construct_literal_object (context_p, &lit_location, LEXER_STRING_LITERAL);
|
||||||
parser_emit_cbc_literal_from_token (context_p, CBC_PUSH_LITERAL);
|
parser_emit_cbc_literal_from_token (context_p, CBC_PUSH_LITERAL);
|
||||||
/* The extra_value is used for saving the token. */
|
/* The extra_value is used for saving the token. */
|
||||||
|
@ -2655,17 +2631,6 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
|
||||||
JERRY_ASSERT (context_p->stack_top_uint8 != PARSER_STATEMENT_PRIVATE_SCOPE
|
JERRY_ASSERT (context_p->stack_top_uint8 != PARSER_STATEMENT_PRIVATE_SCOPE
|
||||||
&& context_p->stack_top_uint8 != PARSER_STATEMENT_PRIVATE_CONTEXT);
|
&& context_p->stack_top_uint8 != PARSER_STATEMENT_PRIVATE_CONTEXT);
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
if (context_p->token.type != LEXER_SEMICOLON && context_p->token.type != LEXER_LEFT_BRACE
|
|
||||||
&& context_p->token.type != LEXER_RIGHT_BRACE && context_p->token.type != LEXER_KEYW_VAR
|
|
||||||
&& context_p->token.type != LEXER_KEYW_LET && context_p->token.type != LEXER_KEYW_CONST
|
|
||||||
&& context_p->token.type != LEXER_KEYW_FUNCTION && context_p->token.type != LEXER_KEYW_CASE
|
|
||||||
&& context_p->token.type != LEXER_KEYW_DEFAULT)
|
|
||||||
{
|
|
||||||
parser_line_info_append (context_p, context_p->token.line, context_p->token.column);
|
|
||||||
}
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
switch (context_p->token.type)
|
switch (context_p->token.type)
|
||||||
{
|
{
|
||||||
case LEXER_SEMICOLON:
|
case LEXER_SEMICOLON:
|
||||||
|
@ -2963,9 +2928,6 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
|
||||||
parser_raise_error (context_p, PARSER_ERR_LEXICAL_SINGLE_STATEMENT);
|
parser_raise_error (context_p, PARSER_ERR_LEXICAL_SINGLE_STATEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
context_p->function_start_p = context_p->token.lit_location.char_p;
|
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
lexer_next_token (context_p);
|
lexer_next_token (context_p);
|
||||||
JERRY_ASSERT (context_p->token.type == LEXER_KEYW_FUNCTION);
|
JERRY_ASSERT (context_p->token.type == LEXER_KEYW_FUNCTION);
|
||||||
continue;
|
continue;
|
||||||
|
@ -3051,17 +3013,6 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
|
||||||
{
|
{
|
||||||
if (context_p->status_flags & PARSER_IS_CLOSURE)
|
if (context_p->status_flags & PARSER_IS_CLOSURE)
|
||||||
{
|
{
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
if (context_p->line_info_p == NULL)
|
|
||||||
{
|
|
||||||
parser_line_info_append (context_p, context_p->token.line, context_p->token.column);
|
|
||||||
}
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
context_p->function_end_p = context_p->source_p;
|
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
|
|
||||||
parser_stack_pop_uint8 (context_p);
|
parser_stack_pop_uint8 (context_p);
|
||||||
context_p->last_statement.current_p = NULL;
|
context_p->last_statement.current_p = NULL;
|
||||||
/* There is no lexer_next_token here, since the
|
/* There is no lexer_next_token here, since the
|
||||||
|
@ -3214,13 +3165,6 @@ consume_last_statement:
|
||||||
{
|
{
|
||||||
parser_raise_error (context_p, PARSER_ERR_STATEMENT_EXPECTED);
|
parser_raise_error (context_p, PARSER_ERR_STATEMENT_EXPECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
if (context_p->line_info_p == NULL)
|
|
||||||
{
|
|
||||||
parser_line_info_append (context_p, context_p->token.line, context_p->token.column);
|
|
||||||
}
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
} /* parser_parse_statements */
|
} /* parser_parse_statements */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -19,10 +19,6 @@
|
||||||
|
|
||||||
#if JERRY_PARSER
|
#if JERRY_PARSER
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
#include "jcontext.h"
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
/** \addtogroup parser Parser
|
/** \addtogroup parser Parser
|
||||||
* @{
|
* @{
|
||||||
*
|
*
|
||||||
|
|
|
@ -584,10 +584,6 @@ parser_post_processing (parser_context_t *context_p) /**< context */
|
||||||
JERRY_ASSERT (!(context_p->status_flags & PARSER_NO_END_LABEL));
|
JERRY_ASSERT (!(context_p->status_flags & PARSER_NO_END_LABEL));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
JERRY_ASSERT (context_p->line_info_p != NULL);
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
JERRY_ASSERT (context_p->stack_depth == 0);
|
JERRY_ASSERT (context_p->stack_depth == 0);
|
||||||
#ifndef JERRY_NDEBUG
|
#ifndef JERRY_NDEBUG
|
||||||
JERRY_ASSERT (context_p->context_stack_depth == 0);
|
JERRY_ASSERT (context_p->context_stack_depth == 0);
|
||||||
|
@ -838,9 +834,6 @@ parser_post_processing (parser_context_t *context_p) /**< context */
|
||||||
total_size += sizeof (ecma_value_t);
|
total_size += sizeof (ecma_value_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
total_size += sizeof (ecma_value_t);
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
uint8_t extended_info = 0;
|
uint8_t extended_info = 0;
|
||||||
|
|
||||||
if (context_p->argument_length != UINT16_MAX)
|
if (context_p->argument_length != UINT16_MAX)
|
||||||
|
@ -848,27 +841,6 @@ parser_post_processing (parser_context_t *context_p) /**< context */
|
||||||
extended_info |= CBC_EXTENDED_CODE_FLAGS_HAS_ARGUMENT_LENGTH;
|
extended_info |= CBC_EXTENDED_CODE_FLAGS_HAS_ARGUMENT_LENGTH;
|
||||||
total_size += ecma_extended_info_get_encoded_length (context_p->argument_length);
|
total_size += ecma_extended_info_get_encoded_length (context_p->argument_length);
|
||||||
}
|
}
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
if (context_p->last_context_p != NULL)
|
|
||||||
{
|
|
||||||
extended_info |= CBC_EXTENDED_CODE_FLAGS_HAS_SOURCE_CODE_RANGE;
|
|
||||||
|
|
||||||
const uint8_t *start_p = context_p->source_start_p;
|
|
||||||
const uint8_t *function_start_p = context_p->last_context_p->function_start_p;
|
|
||||||
|
|
||||||
if (function_start_p < start_p || function_start_p >= start_p + context_p->source_size)
|
|
||||||
{
|
|
||||||
JERRY_ASSERT (context_p->arguments_start_p != NULL && function_start_p >= context_p->arguments_start_p
|
|
||||||
&& function_start_p < context_p->arguments_start_p + context_p->arguments_size);
|
|
||||||
|
|
||||||
start_p = context_p->arguments_start_p;
|
|
||||||
extended_info |= CBC_EXTENDED_CODE_FLAGS_SOURCE_CODE_IN_ARGUMENTS;
|
|
||||||
}
|
|
||||||
|
|
||||||
total_size += ecma_extended_info_get_encoded_length ((uint32_t) (function_start_p - start_p));
|
|
||||||
total_size += ecma_extended_info_get_encoded_length ((uint32_t) (context_p->function_end_p - function_start_p));
|
|
||||||
}
|
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
if (extended_info != 0)
|
if (extended_info != 0)
|
||||||
{
|
{
|
||||||
total_size += sizeof (uint8_t);
|
total_size += sizeof (uint8_t);
|
||||||
|
@ -1005,11 +977,6 @@ parser_post_processing (parser_context_t *context_p) /**< context */
|
||||||
}
|
}
|
||||||
|
|
||||||
compiled_code_p->status_flags |= function_type;
|
compiled_code_p->status_flags |= function_type;
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
compiled_code_p->status_flags |= CBC_CODE_FLAGS_HAS_LINE_INFO;
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
literal_pool_p = ((ecma_value_t *) byte_code_p) - context_p->register_count;
|
literal_pool_p = ((ecma_value_t *) byte_code_p) - context_p->register_count;
|
||||||
byte_code_p += literal_length;
|
byte_code_p += literal_length;
|
||||||
dst_p = byte_code_p;
|
dst_p = byte_code_p;
|
||||||
|
@ -1170,10 +1137,6 @@ parser_post_processing (parser_context_t *context_p) /**< context */
|
||||||
}
|
}
|
||||||
JERRY_ASSERT (dst_p == byte_code_p + length);
|
JERRY_ASSERT (dst_p == byte_code_p + length);
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
uint8_t *line_info_p = parser_line_info_generate (context_p);
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
parse_update_branches (context_p, byte_code_p);
|
parse_update_branches (context_p, byte_code_p);
|
||||||
|
|
||||||
parser_cbc_stream_free (&context_p->byte_code);
|
parser_cbc_stream_free (&context_p->byte_code);
|
||||||
|
@ -1249,16 +1212,8 @@ parser_post_processing (parser_context_t *context_p) /**< context */
|
||||||
*(--base_p) = (ecma_value_t) context_p->tagged_template_literal_cp;
|
*(--base_p) = (ecma_value_t) context_p->tagged_template_literal_cp;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
ECMA_SET_INTERNAL_VALUE_POINTER (base_p[-1], line_info_p);
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
if (extended_info != 0)
|
if (extended_info != 0)
|
||||||
{
|
{
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
base_p--;
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
uint8_t *extended_info_p = ((uint8_t *) base_p) - 1;
|
uint8_t *extended_info_p = ((uint8_t *) base_p) - 1;
|
||||||
|
|
||||||
compiled_code_p->status_flags |= CBC_CODE_FLAGS_HAS_EXTENDED_INFO;
|
compiled_code_p->status_flags |= CBC_CODE_FLAGS_HAS_EXTENDED_INFO;
|
||||||
|
@ -1268,23 +1223,6 @@ parser_post_processing (parser_context_t *context_p) /**< context */
|
||||||
{
|
{
|
||||||
ecma_extended_info_encode_vlq (&extended_info_p, context_p->argument_length);
|
ecma_extended_info_encode_vlq (&extended_info_p, context_p->argument_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
if (context_p->last_context_p != NULL)
|
|
||||||
{
|
|
||||||
const uint8_t *start_p = context_p->source_start_p;
|
|
||||||
|
|
||||||
if (extended_info & CBC_EXTENDED_CODE_FLAGS_SOURCE_CODE_IN_ARGUMENTS)
|
|
||||||
{
|
|
||||||
start_p = context_p->arguments_start_p;
|
|
||||||
}
|
|
||||||
|
|
||||||
const uint8_t *function_start_p = context_p->last_context_p->function_start_p;
|
|
||||||
|
|
||||||
ecma_extended_info_encode_vlq (&extended_info_p, (uint32_t) (function_start_p - start_p));
|
|
||||||
ecma_extended_info_encode_vlq (&extended_info_p, (uint32_t) (context_p->function_end_p - function_start_p));
|
|
||||||
}
|
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if JERRY_PARSER_DUMP_BYTE_CODE
|
#if JERRY_PARSER_DUMP_BYTE_CODE
|
||||||
|
@ -1843,13 +1781,6 @@ parser_script_size (parser_context_t *context_p) /**< context */
|
||||||
script_size += sizeof (ecma_value_t);
|
script_size += sizeof (ecma_value_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
if (context_p->argument_list != ECMA_VALUE_EMPTY)
|
|
||||||
{
|
|
||||||
script_size += sizeof (ecma_value_t);
|
|
||||||
}
|
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
|
|
||||||
#if JERRY_MODULE_SYSTEM
|
#if JERRY_MODULE_SYSTEM
|
||||||
if (context_p->global_status_flags & ECMA_PARSE_INTERNAL_HAS_IMPORT_META)
|
if (context_p->global_status_flags & ECMA_PARSE_INTERNAL_HAS_IMPORT_META)
|
||||||
{
|
{
|
||||||
|
@ -2045,15 +1976,6 @@ parser_parse_source (void *source_p, /**< source code */
|
||||||
context.context_stack_depth = 0;
|
context.context_stack_depth = 0;
|
||||||
#endif /* !JERRY_NDEBUG */
|
#endif /* !JERRY_NDEBUG */
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
context.line_info_p = NULL;
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
context.function_start_p = NULL;
|
|
||||||
context.function_end_p = NULL;
|
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
|
|
||||||
#if JERRY_PARSER_DUMP_BYTE_CODE
|
#if JERRY_PARSER_DUMP_BYTE_CODE
|
||||||
context.is_show_opcodes = (JERRY_CONTEXT (jerry_init_flags) & JERRY_INIT_SHOW_OPCODES);
|
context.is_show_opcodes = (JERRY_CONTEXT (jerry_init_flags) & JERRY_INIT_SHOW_OPCODES);
|
||||||
context.total_byte_code_size = 0;
|
context.total_byte_code_size = 0;
|
||||||
|
@ -2216,41 +2138,6 @@ parser_parse_source (void *source_p, /**< source code */
|
||||||
}
|
}
|
||||||
#endif /* JERRY_MODULE_SYSTEM */
|
#endif /* JERRY_MODULE_SYSTEM */
|
||||||
|
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
if (!(context.global_status_flags & ECMA_PARSE_HAS_SOURCE_VALUE))
|
|
||||||
{
|
|
||||||
ecma_string_t *string_p;
|
|
||||||
|
|
||||||
if (context.global_status_flags & ECMA_PARSE_INTERNAL_HAS_4_BYTE_MARKER)
|
|
||||||
{
|
|
||||||
string_p = ecma_new_ecma_string_from_utf8_converted_to_cesu8 (context.source_start_p, context.source_size);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
string_p = ecma_new_ecma_string_from_utf8 (context.source_start_p, context.source_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
context.script_p->source_code = ecma_make_string_value (string_p);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ecma_value_t source = ((ecma_value_t *) source_p)[0];
|
|
||||||
|
|
||||||
ecma_ref_ecma_string (ecma_get_string_from_value (source));
|
|
||||||
context.script_p->source_code = source;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (context.argument_list != ECMA_VALUE_EMPTY)
|
|
||||||
{
|
|
||||||
int idx = (context.user_value != ECMA_VALUE_EMPTY) ? 1 : 0;
|
|
||||||
|
|
||||||
CBC_SCRIPT_GET_OPTIONAL_VALUES (context.script_p)[idx] = context.argument_list;
|
|
||||||
|
|
||||||
ecma_ref_ecma_string (ecma_get_string_from_value (context.argument_list));
|
|
||||||
context.script_p->refs_and_type |= CBC_SCRIPT_HAS_FUNCTION_ARGUMENTS;
|
|
||||||
}
|
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
|
|
||||||
#if JERRY_PARSER_DUMP_BYTE_CODE
|
#if JERRY_PARSER_DUMP_BYTE_CODE
|
||||||
if (context.is_show_opcodes)
|
if (context.is_show_opcodes)
|
||||||
{
|
{
|
||||||
|
@ -2299,10 +2186,6 @@ parser_parse_source (void *source_p, /**< source code */
|
||||||
parser_free (context.scope_stack_p, context.scope_stack_size * sizeof (parser_scope_stack_t));
|
parser_free (context.scope_stack_p, context.scope_stack_size * sizeof (parser_scope_stack_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
parser_line_info_free (context.line_info_p);
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
#if JERRY_PARSER_DUMP_BYTE_CODE
|
#if JERRY_PARSER_DUMP_BYTE_CODE
|
||||||
if (context.is_show_opcodes)
|
if (context.is_show_opcodes)
|
||||||
{
|
{
|
||||||
|
@ -2430,14 +2313,6 @@ parser_save_context (parser_context_t *context_p, /**< context */
|
||||||
saved_context_p->context_stack_depth = context_p->context_stack_depth;
|
saved_context_p->context_stack_depth = context_p->context_stack_depth;
|
||||||
#endif /* !JERRY_NDEBUG */
|
#endif /* !JERRY_NDEBUG */
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
saved_context_p->line_info_p = context_p->line_info_p;
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
#if JERRY_FUNCTION_TO_STRING
|
|
||||||
saved_context_p->function_start_p = context_p->function_start_p;
|
|
||||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
|
||||||
|
|
||||||
/* Reset private part of the context. */
|
/* Reset private part of the context. */
|
||||||
|
|
||||||
context_p->status_flags &= PARSER_IS_STRICT;
|
context_p->status_flags &= PARSER_IS_STRICT;
|
||||||
|
@ -2465,9 +2340,6 @@ parser_save_context (parser_context_t *context_p, /**< context */
|
||||||
context_p->context_stack_depth = 0;
|
context_p->context_stack_depth = 0;
|
||||||
#endif /* !JERRY_NDEBUG */
|
#endif /* !JERRY_NDEBUG */
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
context_p->line_info_p = NULL;
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
} /* parser_save_context */
|
} /* parser_save_context */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2484,10 +2356,6 @@ parser_restore_context (parser_context_t *context_p, /**< context */
|
||||||
parser_free (context_p->scope_stack_p, context_p->scope_stack_size * sizeof (parser_scope_stack_t));
|
parser_free (context_p->scope_stack_p, context_p->scope_stack_size * sizeof (parser_scope_stack_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
parser_line_info_free (context_p->line_info_p);
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
/* Restore private part of the context. */
|
/* Restore private part of the context. */
|
||||||
|
|
||||||
JERRY_ASSERT (context_p->last_cbc_opcode == PARSER_CBC_UNAVAILABLE);
|
JERRY_ASSERT (context_p->last_cbc_opcode == PARSER_CBC_UNAVAILABLE);
|
||||||
|
@ -2517,9 +2385,6 @@ parser_restore_context (parser_context_t *context_p, /**< context */
|
||||||
context_p->context_stack_depth = saved_context_p->context_stack_depth;
|
context_p->context_stack_depth = saved_context_p->context_stack_depth;
|
||||||
#endif /* !JERRY_NDEBUG */
|
#endif /* !JERRY_NDEBUG */
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
context_p->line_info_p = saved_context_p->line_info_p;
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
} /* parser_restore_context */
|
} /* parser_restore_context */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2716,10 +2581,6 @@ parser_parse_arrow_function (parser_context_t *context_p, /**< context */
|
||||||
parser_raise_error (context_p, PARSER_ERR_NON_STRICT_ARG_DEFINITION);
|
parser_raise_error (context_p, PARSER_ERR_NON_STRICT_ARG_DEFINITION);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
parser_line_info_append (context_p, context_p->token.line, context_p->token.column);
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
parser_parse_expression (context_p, PARSE_EXPR_NO_COMMA);
|
parser_parse_expression (context_p, PARSE_EXPR_NO_COMMA);
|
||||||
|
|
||||||
if (context_p->last_cbc_opcode == CBC_PUSH_LITERAL)
|
if (context_p->last_cbc_opcode == CBC_PUSH_LITERAL)
|
||||||
|
@ -2857,10 +2718,6 @@ parser_parse_class_fields (parser_context_t *context_p) /**< context */
|
||||||
context_p->source_end_p = range.source_end_p;
|
context_p->source_end_p = range.source_end_p;
|
||||||
lexer_next_token (context_p);
|
lexer_next_token (context_p);
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
parser_line_info_append (context_p, context_p->token.line, context_p->token.column);
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
parser_parse_expression (context_p, PARSE_EXPR_NO_COMMA);
|
parser_parse_expression (context_p, PARSE_EXPR_NO_COMMA);
|
||||||
|
|
||||||
if (context_p->token.type != LEXER_EOS)
|
if (context_p->token.type != LEXER_EOS)
|
||||||
|
@ -2938,13 +2795,6 @@ parser_parse_class_fields (parser_context_t *context_p) /**< context */
|
||||||
context_p->source_end_p = source_end_p;
|
context_p->source_end_p = source_end_p;
|
||||||
scanner_set_location (context_p, &end_location);
|
scanner_set_location (context_p, &end_location);
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
if (context_p->line_info_p == NULL)
|
|
||||||
{
|
|
||||||
parser_line_info_append (context_p, context_p->token.line, context_p->token.column);
|
|
||||||
}
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
compiled_code_p = parser_post_processing (context_p);
|
compiled_code_p = parser_post_processing (context_p);
|
||||||
|
|
||||||
#if JERRY_PARSER_DUMP_BYTE_CODE
|
#if JERRY_PARSER_DUMP_BYTE_CODE
|
||||||
|
@ -3149,10 +2999,6 @@ parser_raise_error (parser_context_t *context_p, /**< context */
|
||||||
ecma_collection_free_template_literal (collection);
|
ecma_collection_free_template_literal (collection);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
parser_line_info_free (saved_context_p->line_info_p);
|
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
|
|
||||||
saved_context_p = saved_context_p->prev_context_p;
|
saved_context_p = saved_context_p->prev_context_p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@ source_file = [
|
||||||
'js-lexer.cpp',
|
'js-lexer.cpp',
|
||||||
'js-parser.cpp',
|
'js-parser.cpp',
|
||||||
'js-parser-expr.cpp',
|
'js-parser-expr.cpp',
|
||||||
'js-parser-line-info-create.cpp',
|
|
||||||
'js-parser-mem.cpp',
|
'js-parser-mem.cpp',
|
||||||
'js-parser-module.cpp',
|
'js-parser-module.cpp',
|
||||||
'js-parser-statm.cpp',
|
'js-parser-statm.cpp',
|
||||||
|
|
|
@ -82,13 +82,6 @@ opfunc_set_data_property (ecma_object_t *object_p, /**< object */
|
||||||
|
|
||||||
if (!(*property_p & ECMA_PROPERTY_FLAG_DATA))
|
if (!(*property_p & ECMA_PROPERTY_FLAG_DATA))
|
||||||
{
|
{
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
ecma_getter_setter_pointers_t *getter_setter_pair_p;
|
|
||||||
getter_setter_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t,
|
|
||||||
ECMA_PROPERTY_VALUE_PTR (property_p)->getter_setter_pair_cp);
|
|
||||||
jmem_pools_free (getter_setter_pair_p, sizeof (ecma_getter_setter_pointers_t));
|
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
|
|
||||||
*property_p |= ECMA_PROPERTY_FLAG_DATA | ECMA_PROPERTY_FLAG_WRITABLE;
|
*property_p |= ECMA_PROPERTY_FLAG_DATA | ECMA_PROPERTY_FLAG_WRITABLE;
|
||||||
prop_value_p->value = ecma_copy_value_if_not_object (value);
|
prop_value_p->value = ecma_copy_value_if_not_object (value);
|
||||||
return;
|
return;
|
||||||
|
@ -143,22 +136,11 @@ opfunc_set_accessor (bool is_getter, /**< is getter accessor */
|
||||||
|
|
||||||
if (*property_p & ECMA_PROPERTY_FLAG_DATA)
|
if (*property_p & ECMA_PROPERTY_FLAG_DATA)
|
||||||
{
|
{
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
ecma_getter_setter_pointers_t *getter_setter_pair_p;
|
|
||||||
getter_setter_pair_p = jmem_pools_alloc (sizeof (ecma_getter_setter_pointers_t));
|
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
|
|
||||||
ecma_free_value_if_not_object (prop_value_p->value);
|
ecma_free_value_if_not_object (prop_value_p->value);
|
||||||
*property_p = (uint8_t) (*property_p & ~(ECMA_PROPERTY_FLAG_DATA | ECMA_PROPERTY_FLAG_WRITABLE));
|
*property_p = (uint8_t) (*property_p & ~(ECMA_PROPERTY_FLAG_DATA | ECMA_PROPERTY_FLAG_WRITABLE));
|
||||||
|
|
||||||
#if JERRY_CPOINTER_32_BIT
|
|
||||||
ECMA_SET_POINTER (getter_setter_pair_p->getter_cp, getter_func_p);
|
|
||||||
ECMA_SET_POINTER (getter_setter_pair_p->setter_cp, setter_func_p);
|
|
||||||
ECMA_SET_NON_NULL_POINTER (prop_value_p->getter_setter_pair_cp, getter_setter_pair_p);
|
|
||||||
#else /* !JERRY_CPOINTER_32_BIT */
|
|
||||||
ECMA_SET_POINTER (prop_value_p->getter_setter_pair.getter_cp, getter_func_p);
|
ECMA_SET_POINTER (prop_value_p->getter_setter_pair.getter_cp, getter_func_p);
|
||||||
ECMA_SET_POINTER (prop_value_p->getter_setter_pair.setter_cp, setter_func_p);
|
ECMA_SET_POINTER (prop_value_p->getter_setter_pair.setter_cp, setter_func_p);
|
||||||
#endif /* JERRY_CPOINTER_32_BIT */
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,6 @@
|
||||||
|
|
||||||
#include "ecma-array-object.h"
|
#include "ecma-array-object.h"
|
||||||
#include "ecma-helpers.h"
|
#include "ecma-helpers.h"
|
||||||
#include "ecma-line-info.h"
|
|
||||||
|
|
||||||
#include "jcontext.h"
|
#include "jcontext.h"
|
||||||
#include "lit-char-helpers.h"
|
#include "lit-char-helpers.h"
|
||||||
#include "vm.h"
|
#include "vm.h"
|
||||||
|
@ -63,74 +61,7 @@ vm_is_direct_eval_form_call (void)
|
||||||
ecma_value_t
|
ecma_value_t
|
||||||
vm_get_backtrace (uint32_t max_depth) /**< maximum backtrace depth, 0 = unlimited */
|
vm_get_backtrace (uint32_t max_depth) /**< maximum backtrace depth, 0 = unlimited */
|
||||||
{
|
{
|
||||||
#if JERRY_LINE_INFO
|
|
||||||
vm_frame_ctx_t *context_p = JERRY_CONTEXT (vm_top_context_p);
|
|
||||||
|
|
||||||
if (max_depth == 0)
|
|
||||||
{
|
|
||||||
max_depth = UINT32_MAX;
|
|
||||||
}
|
|
||||||
|
|
||||||
ecma_object_t *array_p = ecma_op_new_array_object (0);
|
|
||||||
JERRY_ASSERT (ecma_op_object_is_fast_array (array_p));
|
|
||||||
uint32_t index = 0;
|
|
||||||
|
|
||||||
while (context_p != NULL)
|
|
||||||
{
|
|
||||||
const ecma_compiled_code_t *bytecode_header_p = context_p->shared_p->bytecode_header_p;
|
|
||||||
ecma_value_t source_name = ecma_get_source_name (bytecode_header_p);
|
|
||||||
ecma_string_t *str_p = ecma_get_string_from_value (source_name);
|
|
||||||
ecma_stringbuilder_t builder = ecma_stringbuilder_create ();
|
|
||||||
|
|
||||||
if (ecma_string_is_empty (str_p))
|
|
||||||
{
|
|
||||||
ecma_stringbuilder_append_raw (&builder, (const lit_utf8_byte_t *) "<unknown>:", 10);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ecma_stringbuilder_append (&builder, str_p);
|
|
||||||
ecma_stringbuilder_append_byte (&builder, LIT_CHAR_COLON);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bytecode_header_p->status_flags & CBC_CODE_FLAGS_HAS_LINE_INFO)
|
|
||||||
{
|
|
||||||
jerry_frame_location_t location;
|
|
||||||
ecma_line_info_get (ecma_compiled_code_get_line_info (bytecode_header_p),
|
|
||||||
(uint32_t) (context_p->byte_code_p - context_p->byte_code_start_p),
|
|
||||||
&location);
|
|
||||||
|
|
||||||
ecma_string_t *line_str_p = ecma_new_ecma_string_from_uint32 (location.line);
|
|
||||||
ecma_stringbuilder_append (&builder, line_str_p);
|
|
||||||
ecma_deref_ecma_string (line_str_p);
|
|
||||||
|
|
||||||
ecma_stringbuilder_append_byte (&builder, LIT_CHAR_COLON);
|
|
||||||
|
|
||||||
line_str_p = ecma_new_ecma_string_from_uint32 (location.column);
|
|
||||||
ecma_stringbuilder_append (&builder, line_str_p);
|
|
||||||
ecma_deref_ecma_string (line_str_p);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ecma_stringbuilder_append_raw (&builder, (const lit_utf8_byte_t *) "1:1", 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
ecma_string_t *builder_str_p = ecma_stringbuilder_finalize (&builder);
|
|
||||||
ecma_fast_array_set_property (array_p, index, ecma_make_string_value (builder_str_p));
|
|
||||||
ecma_deref_ecma_string (builder_str_p);
|
|
||||||
|
|
||||||
context_p = context_p->prev_context_p;
|
|
||||||
index++;
|
|
||||||
|
|
||||||
if (index >= max_depth)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ecma_make_object_value (array_p);
|
|
||||||
#else /* !JERRY_LINE_INFO */
|
|
||||||
JERRY_UNUSED (max_depth);
|
JERRY_UNUSED (max_depth);
|
||||||
|
|
||||||
return ecma_make_object_value (ecma_op_new_array_object (0));
|
return ecma_make_object_value (ecma_op_new_array_object (0));
|
||||||
#endif /* JERRY_LINE_INFO */
|
|
||||||
} /* vm_get_backtrace */
|
} /* vm_get_backtrace */
|
||||||
|
|
Loading…
Add table
Reference in a new issue