Commit graph

79 commits

Author SHA1 Message Date
Seonghyun Kim
87c8a581bd Remove useless peekChar calling in Lexer::lex
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-09-29 10:43:21 +09:00
Zoltan Herczeg
289c3bdabb Reduce keyword comparisons in the parser
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2022-08-30 11:02:52 +09:00
Zoltan Herczeg
c3dbe442ef Further reduce string comparisons in the parser
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2022-08-01 15:23:13 +09:00
Zoltan Herczeg
b476b72ea2 Improve keyword handling in the parser
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2022-07-27 16:01:28 +09:00
Seonghyun Kim
9a1060f48c Refactor basic String classes
* Implement String with inline buffer. this reduce malloc count & reduce memory usage
* Remove typed-gc-malloc from some classes.
  typed malloc classes should have storage for descriptor each malloc.

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2022-03-08 16:27:33 +09:00
HyukWoo Park
ac6b7106b9 Optimize string comparison with typeof operation
* insert AtomicString for typeof strings by parser
* refactoring equal operations

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2022-03-07 13:35:51 +09:00
HyukWoo Park
30f3b3a348 Revise createFunctionSourceFromScriptSource
* add simple syntax checker method in parser to check parameters and body string
* fix it to check parameters and body string seperately
* add several TCs for this patch too

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-11-01 17:03:58 +09:00
Seonghyun Kim
a190dae51a Implement basic parsing of class private field
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-05-17 14:32:54 +09:00
HyukWoo Park
dc84b4af2c Use argument name GC for new operator overloading
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-05-10 10:53:49 +09:00
HyukWoo Park
e3187e52ae Handle tagged template literal in CodeCache
* add relocation case for freeze function address
* remove empty strings from ByteCode and  ByteCodeBlock literal list

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-05-06 10:12:42 +09:00
Seonghyun Kim
11c3bcc964 Implement hashbang grammar
https://github.com/tc39/proposal-hashbang

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-04-26 11:53:13 +09:00
Seonghyun Kim
0711d88306 Revise script parser
* Enable for await statement for Global Module code
* Disable html comment when parsing module code

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-04-16 09:58:15 +09:00
HyukWoo Park
2b775dc2f5 Revise BigInt not to hold VMInstance pointer
* bf_context_t is now defined as a global variable and maintained during the runtime
* VMInstance::finalize is invoked at the end of program to guarantee the life time of bf_context_t

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-03-10 12:29:55 +09:00
HyukWoo Park
53941e1b3a Fix coverity check
* fix conflict with 'typeof' keyword
* include WASM module to coverity scan analysis

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-01-04 18:40:54 +09:00
HyukWoo Park
0ad8bf8e0e Refactoring StaticStrings
* sort string elements in the order
* remove needless keyword strings

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-12-29 14:42:43 +09:00
Seonghyun Kim
028566a1e7 Implement Logical OR assignmenet
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-12-21 12:13:03 +09:00
Seonghyun Kim
23a9a5d76d Implement logical AND assignment
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-12-21 12:13:03 +09:00
Seonghyun Kim
3a6e3f0499 Implement Logical Nullish assignment
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-12-21 12:13:03 +09:00
HyukWoo Park
29c70f7532 Update clang-format version to 6.0
* coding convention fixed following the new clang-format

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-12-18 11:13:15 +09:00
Seonghyun Kim
af81264273 Merge duplicated code as function & remove unused function
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-12-14 17:18:34 +09:00
Seonghyun Kim
5c6498ea1e Implement numberic separator for binary, octal, hex digits
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-12-14 17:18:34 +09:00
Seonghyun Kim
7bb16e58a2 Implement numeric separator for decimal number
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-12-11 10:15:38 +09:00
Seonghyun Kim
8765374818 Implement operations related with BigInt
* Apply new rules on ++, --, - operation
* Implement parsing hex BigInt literal
* Implement BigInt.asUintN, asIntN

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-10-23 11:26:31 +09:00
Seonghyun Kim
44f20f0e56 When parsing string for BigInt, treat empty string as zero
* Optimize String.prototype.trim method
* Turn off slow tests in test262. these tests are failed on some machine due to timeout

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-10-21 14:18:50 +09:00
Seonghyun Kim
8821b0e275 Implement basic type operation of BigInt & basic builtin functions of BigInt
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-10-15 18:55:42 +09:00
HyukWoo Park
f168e4bd7b Remove unused codes found by cppcheck
* remove unused functions
* remove unused variables
* mark necessary but unused variables with UNUSED_VARIABLE

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-10-06 13:11:07 +09:00
HyukWoo Park
a96f39f0e6 Unify regular expression notation as RegExp
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-08-24 14:04:52 +09:00
Seonghyun Kim
3c642c8932 Apply new spec rules of escaped, reserved keyword
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-07-09 11:11:18 +09:00
Seonghyun Kim
149cac159a Implement OptionalExpression and OptionalChain
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-07-06 10:07:28 +09:00
Bela Toth
b69706d0a4 Enable more Unicode characters as variable names
Fixes: #656

Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2020-07-01 15:10:39 +09:00
bence gabor kis
d3e5ec69ce New Feature - Nullish Coalescing (?? operator)
Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-06-29 12:34:53 +09:00
Seonghyun Kim
39e10484d7 When parsing TemplateLiteral in TaggedTemplateExpression, we should not throw SyntaxError.
* Set value as undefined when there is SyntaxError
* Fix memory leak related with throwing esprima::Error

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-06-01 14:17:29 +09:00
HyukWoo Park
0f81aa5dce Represent all global error messages by static class members
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-04-03 11:30:10 +09:00
Achie
f1c1e739ac Enable u+2028 and 2029 seperator characters
Allowing U+2028 (LINE SEPARATOR) and U+2029
(PARAGRAPH SEPARATOR) in string literals
defined in ECMAScript 2019.

Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2020-03-19 11:25:07 +09:00
Seonghyun Kim
ae4b3ee589 Fix bugs
* Treat single `let` as Identifier in parsing ExpressionStatement
* The `let` contextual keyword must not contain Unicode escape sequences.
* U+180E had been changed to `Other, Format [Cf]` from `Separator, Space [Zs]`
  see https://github.com/tc39/ecma262/pull/300, https://github.com/Microsoft/ChakraCore/issues/2120
* The `let` contextual keyword must not contain Unicode escape sequences
* We need to allocate new env on right side of for in-of head when there is lexical decl on left side

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-03-12 13:31:43 +09:00
MuHong Byun
e2f1c3f47d Fix LGPL License verison typo (2.0 -> 2.1)
Signed-off-by: MuHong Byun <mh.byun@samsung.com>
2020-03-10 11:35:20 +09:00
Zoltan Herczeg
a555ac52f6 Initial implementation of the Escargot Debugger. 2020-03-05 10:36:55 +09:00
bence gabor kis
3f6c034b51 Minor fix - enable UTF-32 character key property to an object
Allows UTF-32 characters in identifiers.

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2020-02-19 11:13:09 +09:00
Seonghyun Kim
caa0fbc3fe Implement compress CompressibleStrings on GC reclaim end event
* Compress CompressibleStrings on GC reclaim end event
  - if there is reference about data of CompressibleString on stack, we should give up compressing.
    we don't need to search heap space because I redesigned StringView
    (we should not store string buffer data on heap without owner)
* Redesign StringView
  - Don't save string buffer address as its member. because buffer of CompressibleString can be deleted
  - If we don't save string buffer address on StringView, parser performance may dropped.
    becuase parser access string data a lot.
    so I introduce ParserStringView. it saves buffer address. we should ParserStringView on parser only.
    we can save string buffer address while parsing. because GC is disabled while parsing.

* Enable CompressibleString always
* Implement cache of RegExpOptionStrings
* Implement finding system locale function on RuntimeICUBinder avoiding call uloc_getDefault.

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-01-10 17:37:00 +09:00
HyukWoo Park
47bf20782e Check strict mode immediately
* check and convert to strict mode ahead of following tokens
* identifier which has a valid keyword in strict mode is also converted to the complete keyword
* fixes #513

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-01-10 11:17:19 +09:00
HyukWoo Park
7c13a84057 Fix valueStringLiteral method in ScannerResult
* remove unnecessary StringView allocation
* simplify parseObjectPropertyKey mothod

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-12-18 13:38:41 +09:00
seonghyun kim
fba9396ec9 Reduce memory usage
* Reduce size of RopeString
* Use fit memory if possible for ArrayObject fastModeData
* Re-implement ByteCode pruning logic
* Re-implement inline-cache for reducing memory usage
* Remove std::vector with gc_allocator. it can cause memory leak

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-12-18 11:11:26 +09:00
HyukWoo Park
c328e53927 Implement exponential operation
* update exponential operation and exponentiation-equal assignment
* unnecessary header files are removed in some Node files

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-11-27 09:38:22 +09:00
HyukWoo Park
05678d6449 Update parsing of async feature
* add empty async related Nodes
* await and async are handled as a normal identifier
* add const keyword for passed NodeList reference in Node constructor

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-11-06 18:16:31 +09:00
Patrick Kim
b9a6f92b27 Optimize script initialization performance (#462)
* Build numeral literal number in token only if needs
* Build string literal for ast only if needs
* Move NumeralData from ASTContext to ASTNode
* Fix compile error on gcc 7+

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-10-14 19:18:39 +09:00
Hyukwoo Park
1e459af46c Fix several modules of Parser (#461)
* small-sized SmallScannerResult replaces origin ScannerResult in parsing process to reduce the memory pressure.
* ScannerResultVector in parseBinaryExpression is replaced by GC-independent SmallScannerResultVector to reduce the memory overhead (both the performance and memory usage)
* ParseFormalParametersResult holds SyntaxNodeVector instead of NodeVector because each parameter Node is re-generated when it is really necessary (parsing of function call) and we only needs the name and type of each parameter during the pre-parsing
* parser/scanner of parameter parsing is added
* clear up some unnecessary codes such as each friend class annotation in Nodes and NodeVectors

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-10-14 16:36:57 +09:00
Patrick Kim
4bb343552e Optimize script initialization performance (#458)
* Store child {ASTFunctionContext, InterpretedCodeBlock} as linked-list
* Reduce size of ScannerResult
* Remove Parser::scopeContexts
* Fix compile error in old system

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-10-14 13:07:28 +09:00
Patrick Kim
03ac100d7f Optmize escargot (#454)
* Don't allocate new StringView on parser if possible
* Store esprima::Context::firstCoverInitializedNameError as pointer. it can reduce copy cost on esprima::*CoverGrammar
* Make Script as reexcutable if possible
* Don't save parsed source codes
  - Remove SourceStringView
  - When create AtomicString from StringView, we should make new string data instead of reference StringView
* Reduce size of StringBufferAccessData
* Fix crash in toString of FunctionObject.

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-10-11 15:32:04 +09:00
Patrick Kim
87ca01b658 Implement indirect export, import (#453)
* Rename ambiguous variables names(src, source, fileName) into src, sourceCode
* Treat 'await' as keyword

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-10-08 18:25:05 +09:00
Hyukwoo Park
6fa563c68e Update minor syntax errors (#436)
* add invalid hexadecimal escape sequence error
* lexical declaration cannot appear in a single-statement context
* ASTContext structures are divided into another file
* pass more test262 TCs

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-09-20 15:47:50 +09:00