diff options
author | Akos Kiss <akiss@inf.u-szeged.hu> | 2017-04-21 11:42:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-21 11:42:36 +0200 |
commit | 67c641e567dc48cc40f431cb12b45cb2205ad71e (patch) | |
tree | 899bd14c5f89820c5982de404a4a4d96ba390cea /jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.inc.h | |
parent | 5231829fc9383be888f06d1cb435d393490e158a (diff) |
Generate lit-magic-strings.inc.h (#1690)
Currently, `lit-magic-strings.inc.h` is manually maintained. This
has several drawbacks:
- keeping the list of magic strings sorted first by length then
alphabetically is error prone,
- it is easy to leave unused magic strings in the list by accident
(e.g., `LIT_MAGIC_STRING_JERRY_UL` is defined as a magic string
but not used anywhere in the code) and,
- it is very hard to add `CONFIG_DISABLE_*_BUILTIN` guards to the
list, even though there are several magic strings, which are used
in some of the configurations only (e.g, "setPrototypeOf" is used
in ES2015 only).
To ease the maintenance of magic strings, this commit moves the
definition of magic strings to a config file
(`lit-magic-strings.ini`), and adds `tools/gen-magic-strings.py` to
generate the `.inc.h` file from this config file and from the use
cases of the strings in the code.
- The magic strings in the config file can appear in any order, the
generator will ensure that they are correctly sorted.
- The generator skips those definitions that are not used anywhere
(and emits a warning to signal that such definitions can be
removed).
- The generator applies the same guards to the definitions in the
`.inc.h` file as found in the code around the use of the strings
to optimize for size.
The commit also changes some builtin-related `.inc.h` files by
adding guards that don't affect functionality but improve the
results of the generator.
To ensure that the invocation of the generator does not get
forgotten, the commit also adds `tools/check-magic-strings.sh` and
binds it into the testing infrastructure.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
Diffstat (limited to 'jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.inc.h')
-rw-r--r-- | jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.inc.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.inc.h index 857aef5e..9c2c3059 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.inc.h @@ -19,6 +19,8 @@ #include "ecma-builtin-helpers-macro-defines.inc.h" +#ifndef CONFIG_DISABLE_REGEXP_BUILTIN + /* ECMA-262 v5, 15.10.6.1 */ OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_REGEXP, @@ -56,4 +58,6 @@ ROUTINE (LIT_MAGIC_STRING_EXEC, ecma_builtin_regexp_prototype_exec, 1, 1) ROUTINE (LIT_MAGIC_STRING_TEST, ecma_builtin_regexp_prototype_test, 1, 1) ROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ecma_builtin_regexp_prototype_to_string, 0, 0) +#endif /* !CONFIG_DISABLE_REGEXP_BUILTIN */ + #include "ecma-builtin-helpers-macro-undefs.inc.h" |