Skip to content

Commit 077eaeb

Browse files
authored
Update build profile to es.next on esp8266 (#4913)
- fix amalgam build issue with es.next profile - update esp linker script according to: Table 4-1. in https://www.espressif.com/sites/default/files/documentation/2a-esp8266-sdk_getting_started_guide_en.pdf JerryScript-DCO-1.0-Signed-off-by: Martin Negyokru [email protected]
1 parent 26c6031 commit 077eaeb

File tree

3 files changed

+60
-42
lines changed

3 files changed

+60
-42
lines changed

jerry-core/parser/js/js-parser.c

Lines changed: 58 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1971,6 +1971,59 @@ JERRY_STATIC_ASSERT (PARSER_SCANNING_SUCCESSFUL == PARSER_HAS_LATE_LIT_INIT,
19711971
parser_scanning_successful_should_share_the_bit_position_with_parser_has_late_lit_init);
19721972
#endif /* !JERRY_NDEBUG */
19731973

1974+
/**
1975+
* Parser script size
1976+
*/
1977+
static size_t
1978+
parser_script_size (parser_context_t *context_p) /**< context */
1979+
{
1980+
size_t script_size = sizeof (cbc_script_t);
1981+
1982+
if (context_p->user_value != ECMA_VALUE_EMPTY)
1983+
{
1984+
script_size += sizeof (ecma_value_t);
1985+
}
1986+
1987+
#if JERRY_FUNCTION_TO_STRING
1988+
if (context_p->argument_list != ECMA_VALUE_EMPTY)
1989+
{
1990+
script_size += sizeof (ecma_value_t);
1991+
}
1992+
#endif /* JERRY_FUNCTION_TO_STRING */
1993+
1994+
#if JERRY_MODULE_SYSTEM
1995+
if (context_p->global_status_flags & ECMA_PARSE_INTERNAL_HAS_IMPORT_META)
1996+
{
1997+
script_size += sizeof (ecma_value_t);
1998+
}
1999+
#endif /* JERRY_MODULE_SYSTEM */
2000+
return script_size;
2001+
} /* parser_script_size */
2002+
2003+
#if JERRY_SOURCE_NAME
2004+
/**
2005+
* Parser resource name
2006+
*/
2007+
static ecma_value_t
2008+
parser_source_name (parser_context_t *context_p) /**< context */
2009+
{
2010+
if (context_p->options_p != NULL && (context_p->options_p->options & JERRY_PARSE_HAS_SOURCE_NAME))
2011+
{
2012+
JERRY_ASSERT (ecma_is_value_string (context_p->options_p->source_name));
2013+
2014+
ecma_ref_ecma_string (ecma_get_string_from_value (context_p->options_p->source_name));
2015+
return context_p->options_p->source_name;
2016+
}
2017+
2018+
if (context_p->global_status_flags & ECMA_PARSE_EVAL)
2019+
{
2020+
return ecma_make_magic_string_value (LIT_MAGIC_STRING_SOURCE_NAME_EVAL);
2021+
}
2022+
2023+
return ecma_make_magic_string_value (LIT_MAGIC_STRING_SOURCE_NAME_ANON);
2024+
} /* parser_source_name */
2025+
#endif /* JERRY_SOURCE_NAME */
2026+
19742027
/**
19752028
* Parse and compile EcmaScript source code
19762029
*
@@ -2108,22 +2161,6 @@ parser_parse_source (void *source_p, /**< source code */
21082161
context.user_value = context.options_p->user_value;
21092162
}
21102163

2111-
#if JERRY_SOURCE_NAME
2112-
ecma_value_t source_name = ecma_make_magic_string_value (LIT_MAGIC_STRING_SOURCE_NAME_ANON);
2113-
2114-
if (context.options_p != NULL && (context.options_p->options & JERRY_PARSE_HAS_SOURCE_NAME))
2115-
{
2116-
JERRY_ASSERT (ecma_is_value_string (context.options_p->source_name));
2117-
2118-
ecma_ref_ecma_string (ecma_get_string_from_value (context.options_p->source_name));
2119-
source_name = context.options_p->source_name;
2120-
}
2121-
else if (context.global_status_flags & ECMA_PARSE_EVAL)
2122-
{
2123-
source_name = ecma_make_magic_string_value (LIT_MAGIC_STRING_SOURCE_NAME_EVAL);
2124-
}
2125-
#endif /* JERRY_SOURCE_NAME */
2126-
21272164
context.last_context_p = NULL;
21282165
context.last_statement.current_p = NULL;
21292166
context.token.flags = 0;
@@ -2197,27 +2234,6 @@ parser_parse_source (void *source_p, /**< source code */
21972234
return NULL;
21982235
}
21992236

2200-
size_t script_size = sizeof (cbc_script_t);
2201-
2202-
if (context.user_value != ECMA_VALUE_EMPTY)
2203-
{
2204-
script_size += sizeof (ecma_value_t);
2205-
}
2206-
2207-
#if JERRY_FUNCTION_TO_STRING
2208-
if (context.argument_list != ECMA_VALUE_EMPTY)
2209-
{
2210-
script_size += sizeof (ecma_value_t);
2211-
}
2212-
#endif /* JERRY_FUNCTION_TO_STRING */
2213-
2214-
#if JERRY_MODULE_SYSTEM
2215-
if (context.global_status_flags & ECMA_PARSE_INTERNAL_HAS_IMPORT_META)
2216-
{
2217-
script_size += sizeof (ecma_value_t);
2218-
}
2219-
#endif /* JERRY_MODULE_SYSTEM */
2220-
22212237
if (context.arguments_start_p == NULL)
22222238
{
22232239
context.source_p = context.source_start_p;
@@ -2249,7 +2265,7 @@ parser_parse_source (void *source_p, /**< source code */
22492265

22502266
PARSER_TRY (context.try_buffer)
22512267
{
2252-
context.script_p = parser_malloc (&context, script_size);
2268+
context.script_p = parser_malloc (&context, parser_script_size (&context));
22532269

22542270
CBC_SCRIPT_SET_TYPE (context.script_p, context.user_value, CBC_SCRIPT_REF_ONE);
22552271

@@ -2263,7 +2279,7 @@ parser_parse_source (void *source_p, /**< source code */
22632279
#endif /* JERRY_BUILTIN_REALMS */
22642280

22652281
#if JERRY_SOURCE_NAME
2266-
context.script_p->source_name = source_name;
2282+
context.script_p->source_name = parser_source_name (&context);
22672283
#endif /* JERRY_SOURCE_NAME */
22682284

22692285
ECMA_SET_INTERNAL_VALUE_POINTER (context.script_value, context.script_p);
@@ -2437,7 +2453,7 @@ parser_parse_source (void *source_p, /**< source code */
24372453
if (context.script_p != NULL)
24382454
{
24392455
JERRY_ASSERT (context.script_p->refs_and_type >= CBC_SCRIPT_REF_ONE);
2440-
jmem_heap_free_block (context.script_p, script_size);
2456+
jmem_heap_free_block (context.script_p, parser_script_size (&context));
24412457
}
24422458
}
24432459
PARSER_TRY_END
@@ -2512,6 +2528,7 @@ parser_parse_source (void *source_p, /**< source code */
25122528
ecma_value_t err_str_val = ecma_make_string_value (err_str_p);
25132529
ecma_value_t line_str_val = ecma_make_uint32_value (context.token.line);
25142530
ecma_value_t col_str_val = ecma_make_uint32_value (context.token.column);
2531+
ecma_value_t source_name = parser_source_name (&context);
25152532

25162533
ecma_raise_standard_error_with_format (JERRY_ERROR_SYNTAX,
25172534
"% [%:%:%]",
@@ -2520,6 +2537,7 @@ parser_parse_source (void *source_p, /**< source code */
25202537
line_str_val,
25212538
col_str_val);
25222539

2540+
ecma_free_value (source_name);
25232541
ecma_free_value (col_str_val);
25242542
ecma_free_value (line_str_val);
25252543
ecma_deref_ecma_string (err_str_p);

targets/baremetal-sdk/esp8266-rtos-sdk/Makefile.esp8266

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jerry:
5252
-DENABLE_AMALGAM=ON \
5353
-DJERRY_MATH=ON \
5454
-DJERRY_CMDLINE=OFF \
55-
-DJERRY_PROFILE="es5.1" \
55+
-DJERRY_PROFILE="es.next" \
5656
-DEXTERNAL_COMPILE_FLAGS="$(ESP_CFLAGS)" \
5757
-DJERRY_GLOBAL_HEAP_SIZE=$(JERRYHEAP)
5858

targets/baremetal-sdk/esp8266-rtos-sdk/ld/eagle.app.v6.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ MEMORY
2626
dport0_0_seg : org = 0x3FF00000, len = 0x10
2727
dram0_0_seg : org = 0x3FFE8000, len = 0x18000
2828
iram1_0_seg : org = 0x40100000, len = 0x8000
29-
irom0_0_seg : org = 0x40220000, len = 0x7C000
29+
irom0_0_seg : org = 0x40220000, len = 0xBC000
3030
}
3131

3232
INCLUDE ../ld/eagle.app.v6.common.ld

0 commit comments

Comments
 (0)