Skip to content

Commit 5ecd250

Browse files
committed
Build fix for compact profile. Add disable macros for RegExp builtin files.
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
1 parent c042bf5 commit 5ecd250

File tree

10 files changed

+35
-9
lines changed

10 files changed

+35
-9
lines changed

jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ ecma_builtin_regexp_prototype_exec (ecma_value_t this_arg, /**< this argument */
5757
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
5858

5959
ECMA_TRY_CATCH (obj_this, ecma_op_to_object (this_arg), ret_value);
60+
6061
ecma_object_t *obj_p = ecma_get_object_from_value (obj_this);
6162
ecma_property_t *bytecode_prop = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_REGEXP_BYTECODE);
6263
re_bytecode_t *bytecode_p = ECMA_GET_POINTER (re_bytecode_t, bytecode_prop->u.internal_property.value);
@@ -75,7 +76,6 @@ ecma_builtin_regexp_prototype_exec (ecma_value_t this_arg, /**< this argument */
7576
ssize_t zt_str_size = (ssize_t) sizeof (ecma_char_t) * (chars + 1);
7677
ecma_string_to_zt_string (input_str_p, input_zt_str_p, zt_str_size);
7778

78-
/* FIXME: call of ecma_make_normal_completion_value should be in an ECMA_TRY_CATCH */
7979
ret_value = ecma_regexp_exec_helper (bytecode_p, input_zt_str_p);
8080

8181
MEM_FINALIZE_LOCAL_ARRAY (input_zt_str_p);

jerry-core/ecma/operations/ecma-regexp-object.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
#include "ecma-try-catch-macro.h"
2525
#include "jrt-libc-includes.h"
2626
#include "re-compiler.h"
27-
#include "stdio.h"
27+
28+
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_REGEXP_BUILTIN
2829

2930
#define ECMA_BUILTINS_INTERNAL
3031
#include "ecma-builtins-internal.h"
@@ -39,6 +40,11 @@
3940
#define RE_GLOBAL_START_IDX 0
4041
#define RE_GLOBAL_END_IDX 1
4142

43+
/* flags */
44+
#define RE_FLAG_GLOBAL (1 << 0)
45+
#define RE_FLAG_IGNORE_CASE (1 << 1)
46+
#define RE_FLAG_MULTILINE (1 << 2)
47+
4248
/**
4349
* Parse RegExp flags (global, ignoreCase, multiline)
4450
*/
@@ -1171,3 +1177,5 @@ ecma_regexp_exec_helper (re_bytecode_t *bc_p, /**< start of the RegExp bytecode
11711177
* @}
11721178
* @}
11731179
*/
1180+
1181+
#endif /* CONFIG_ECMA_COMPACT_PROFILE_DISABLE_REGEXP_BUILTIN */

jerry-core/ecma/operations/ecma-regexp-object.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#ifndef ECMA_REGEXP_OBJECT_H
1818
#define ECMA_REGEXP_OBJECT_H
1919

20+
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_REGEXP_BUILTIN
21+
2022
#include "ecma-globals.h"
2123
#include "re-compiler.h"
2224

@@ -55,4 +57,5 @@ ecma_regexp_exec_helper (re_bytecode_t *bc_p, const ecma_char_t *str_p);
5557
* @}
5658
*/
5759

60+
#endif /* CONFIG_ECMA_COMPACT_PROFILE_DISABLE_REGEXP_BUILTIN */
5861
#endif /* !ECMA_REGEXP_OBJECT_H */

jerry-core/parser/js/lexer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
2+
* Copyright 2015 University of Szeged.
23
*
34
* Licensed under the Apache License, Version 2.0 (the "License");
45
* you may not use this file except in compliance with the License.

jerry-core/parser/js/parser.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
2+
* Copyright 2015 University of Szeged.
23
*
34
* Licensed under the Apache License, Version 2.0 (the "License");
45
* you may not use this file except in compliance with the License.

jerry-core/parser/regexp/re-compiler.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
#include "jrt-libc-includes.h"
2121
#include "mem-heap.h"
2222
#include "re-compiler.h"
23-
#include "stdio.h"
23+
24+
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_REGEXP_BUILTIN
2425

2526
#define REGEXP_BYTECODE_BLOCK_SIZE 256UL
2627
#define BYTECODE_LEN(bc_ctx_p) ((uint32_t) (bc_ctx_p->current_p - bc_ctx_p->block_start_p))
@@ -791,4 +792,6 @@ regexp_dump_bytecode (re_bytecode_ctx_t *bc_ctx_p)
791792
}
792793
JERRY_DLOG ("EOF\n");
793794
} /* regexp_dump_bytecode */
794-
#endif
795+
#endif /* JERRY_ENABLE_LOG */
796+
797+
#endif /* CONFIG_ECMA_COMPACT_PROFILE_DISABLE_REGEXP_BUILTIN */

jerry-core/parser/regexp/re-compiler.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#ifndef RE_COMPILER_H
1818
#define RE_COMPILER_H
1919

20+
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_REGEXP_BUILTIN
21+
2022
#include "ecma-globals.h"
2123
#include "re-parser.h"
2224

@@ -54,11 +56,6 @@
5456
#define RE_OP_CHAR_CLASS 26
5557
#define RE_OP_INV_CHAR_CLASS 27
5658

57-
/* flags */
58-
#define RE_FLAG_GLOBAL (1 << 0)
59-
#define RE_FLAG_IGNORE_CASE (1 << 1)
60-
#define RE_FLAG_MULTILINE (1 << 2)
61-
6259
#define RE_COMPILE_RECURSION_LIMIT 100
6360

6461
#define IS_CAPTURE_GROUP(x) (((x) < RE_OP_NON_CAPTURE_GROUP_START) ? 1 : 0)
@@ -94,4 +91,5 @@ get_opcode (re_bytecode_t **bc_p);
9491
uint32_t
9592
get_value (re_bytecode_t **bc_p);
9693

94+
#endif /* CONFIG_ECMA_COMPACT_PROFILE_DISABLE_REGEXP_BUILTIN */
9795
#endif /* RE_COMPILER_H */

jerry-core/parser/regexp/re-parser.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#include "re-parser.h"
2323
#include "syntax-errors.h"
2424

25+
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_REGEXP_BUILTIN
26+
2527
#define RE_LOOKUP(str_p, lookup) *(str_p + lookup)
2628
#define RE_ADVANCE(str_p, advance) do { str_p += advance; } while (0)
2729

@@ -812,3 +814,5 @@ re_parse_next_token (re_parser_ctx_t *parser_ctx_p, /**< parser context */
812814

813815
return ret_value;
814816
} /* re_parse_next_token */
817+
818+
#endif /* CONFIG_ECMA_COMPACT_PROFILE_DISABLE_REGEXP_BUILTIN */

jerry-core/parser/regexp/re-parser.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#ifndef RE_PARSER_H
1818
#define RE_PARSER_H
1919

20+
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_REGEXP_BUILTIN
21+
2022
#include "opcodes-dumper.h"
2123

2224
typedef uint8_t token_type_t;
@@ -89,4 +91,5 @@ re_parse_char_class (re_parser_ctx_t *parser_ctx_p,
8991
ecma_completion_value_t
9092
re_parse_next_token (re_parser_ctx_t *parser_ctx_p, re_token_t *out_token_p);
9193

94+
#endif /* CONFIG_ECMA_COMPACT_PROFILE_DISABLE_REGEXP_BUILTIN */
9295
#endif /* RE_PARSER_H */

jerry-core/vm/opcodes.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
2+
* Copyright 2015 University of Szeged.
23
*
34
* Licensed under the Apache License, Version 2.0 (the "License");
45
* you may not use this file except in compliance with the License.
@@ -166,6 +167,7 @@ opfunc_assignment (opcode_t opdata, /**< operation data */
166167
}
167168
else if (type_value_right == OPCODE_ARG_TYPE_REGEXP)
168169
{
170+
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_REGEXP_BUILTIN
169171
const literal_index_t lit_id = serializer_get_literal_id_by_uid (src_val_descr, int_data->pos);
170172
ecma_string_t *string_p = ecma_new_ecma_string_from_lit_index (lit_id);
171173

@@ -216,6 +218,9 @@ opfunc_assignment (opcode_t opdata, /**< operation data */
216218

217219
MEM_FINALIZE_LOCAL_ARRAY (re_str_p)
218220
ecma_deref_ecma_string (string_p);
221+
#else
222+
JERRY_UNIMPLEMENTED ("Regular Expressions are not supported in compact profile!");
223+
#endif /* CONFIG_ECMA_COMPACT_PROFILE_DISABLE_REGEXP_BUILTIN */
219224
}
220225
else
221226
{

0 commit comments

Comments
 (0)