Commit graph

301 commits

Author SHA1 Message Date
HyukWoo Park
f540c36edb Add syntax error about declarations for if statement
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-04-07 12:06:39 +09:00
HyukWoo Park
b2b9fb6afd Fix labelled typo
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-04-07 12:06:39 +09:00
HyukWoo Park
6610ae4825 Throw SyntaxError when function or class declaration is not located correctly
* throw error if function or class declaration is not located at the top level or inside a block

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2021-04-05 12:47:00 +09:00
Seonghyun Kim
40ebd4f837 await identifier is illegal expression on async function parameter
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-03-02 12:40:44 +09:00
Seonghyun Kim
161f516c54 Implement basic things of top level await
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-02-18 14:52:23 +09:00
Seonghyun Kim
b791bd9850 Disallow using arguments variable in class field when using eval function
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-02-02 10:21:45 +09:00
Seonghyun Kim
109d199302 Reimplement static field initializer
* wrap initializer expr into virtual arrow function like instance field
* users can access super property in eval

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-02-02 10:21:45 +09:00
Seonghyun Kim
5f75330bab Check computed name correctly in class static field
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-01-26 10:14:22 +09:00
Seonghyun Kim
dac08ab369 Implement runtime things of class field
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-01-21 18:22:20 +09:00
Seonghyun Kim
20f3478f3d Implement parsing class field and add field init function
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-01-21 18:22:20 +09:00
Seonghyun Kim
5016b7af3b Implement fast-path of super expression in static field initializer
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-01-15 11:39:57 +09:00
Seonghyun Kim
f0c64aa74a Implement super keyword in class static field init
* Implement Open, Close env Bytecode for this

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-01-13 17:06:44 +09:00
Seonghyun Kim
4f122f2900 Implement basic operation of static class field
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2021-01-05 15:17:14 +09:00
Seonghyun Kim
44909c6b22 Merge duplicate code as macro
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-12-21 12:13:03 +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
2720b9f4eb Minor fix about lexical declared function
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-11-06 17:00:18 +09:00
HyukWoo Park
820e9f0c4d Handle syntax errors for lexically declared functions
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-11-05 10:30:13 +09:00
HyukWoo Park
897a1d2ae5 Fix some minor defects and build errors
* fix defects checked by static analysis
* fix Jenkins and actions build script

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-10-23 11:28:08 +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
9f8b6fdb04 Don't use UnaryMinus ByteCode if possible
* If the parser gets -1, the parser divide -1 into UnaryMinus and LiteralNode.
* This patch remove UnaryMinus and change Literal value negative

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-10-16 12:55:41 +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
714d398364 Fix minor style defects found by cppcheck
* add const keyword for constant functions
* reduce the scope of variables if possible

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-10-08 14:40:48 +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
2bce8e3d5e Skip generating the bytecode of strict directive
* strict directive ('use strict') just marks the strict mode without any operation

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-09-08 11:01:10 +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
ccdf475f9b Implement new config for smaller device
* In small config, we turn off SyntaxChecker for small binary size
* CompressibleString should get VMInstance instead of Context
* If ICU is disabled, we don't need unicode information in yarr
* Remove unused variable in yarr(RegExpJitTables)
* Fix lz4 compile error

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-08-06 14:07:11 +09:00
Seonghyun Kim
ba4763e888 Implement runtime part of dynamic-import
* Implement one of parsing error of module
* Fix one of stack usage error on FunctionObjectInlines

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-07-30 11:56:17 +09:00
Seonghyun Kim
5dc636380c Implement parsing dynamic import expression
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-07-30 11:56:17 +09:00
Seonghyun Kim
6503fc0416 Implement import.meta spec(MetaProperty)
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-07-16 12:51:24 +09:00
Seonghyun Kim
3f1001454e In parser, invalid assignment error is changed from ReferenceError to SyntaxError
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-07-16 12:51:24 +09:00
Seonghyun Kim
fd969d6da2 Each formal parameter should not have separate Environment Record(the spec is changed)
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-07-09 11:11:18 +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
HyukWoo Park
747803bf81 Add InterpretedCodeBlockWithRareData
* extract infrequently used m_rareData member from InterpretedCodeBlock
* InterpretedCodeBlockWithRareData handles InterpretedCodeBlockRareData inside itself

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-07-08 16:56:44 +09:00
HyukWoo Park
2fe9333814 Divide CodeBlock into NativeCodeBlock and InterpretedCodeBlock
* NativeCodeBlock is newly added for NativeFunctionObject
* all interpreter-related info is moved into InterpretedCodeBlock

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-07-08 16:56:44 +09:00
HyukWoo Park
cd09ccbb07 Rename ASTContext structure
* rename to ASTScopeContext and ASTBlockContext
* remove redundant ASTScopeContext parameter

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-07-06 10:07:56 +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
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
Robert Fancsik
4dfaec7c4a Statement MetaNodes should be early constructed
Since the debugger breakpoint generation requires a continuously increasing series of LOC indices
the statement node infos should be constructed in the beginning of their parsing functions.

Signed-off-by: Robert Fancsik <frobert@inf.u-szeged.hu>
2020-06-11 18:12:46 +09:00
Seonghyun Kim
389c6d8532 Annex B defines an early error for duplicate PropertyName of __proto__, in object initializers,
but this does not apply to Object Assignment patterns

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-06-01 14:17:29 +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
Robert Fancsik
c85ec4f4a9 Statements LOC info should not be modified when the debugger is enabled
The line info for each breakpoint can be calculated from the LOC index.
This patch resolves the problem, mentioned in #649.

Signed-off-by: Robert Fancsik <frobert@inf.u-szeged.hu>
2020-05-27 17:43:00 +09:00
Seonghyun Kim
4f3774be0c Implement tagged-template cache on CodeBlock according to GetTemplateObject(templateLiteral) on spec
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-05-27 17:09:09 +09:00
Seonghyun Kim
fe0c65118c * When evaluate super.foo = 1 we should throw TypeError.
when PutValue is failed + isStrict('use strict` or class method).

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-05-27 17:09:09 +09:00
Seonghyun Kim
c9e4d5c6fd Implement more things about module
* Implement export * as {name} from {src} feature
* Update Script::resolveExport for following new spec
* Update test262 driver for running test cases correctly
* Implement changes of ModuleNamespaceObject::[[*]]

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-05-26 12:54:45 +09:00
Seonghyun Kim
ee97ae6412 Fix module bugs
* Export default function declaration should treat as function declaration
* But there is no name on export function decl, we should the statement as function expression
* Check duplicate export name correctly
* Don't include FIXTURE files as testset in test262

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-05-26 12:54:45 +09:00
Seonghyun Kim
323c2dca20 Each function parameter should have own declarative environment.
but I don't want to add extra bytecodes for this.
and It is only needed when there is direct eval operation.
so I wrap each parameter block with small arrow function.

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-05-18 15:18:10 +09:00
Seonghyun Kim
355d7244f1 Fix minor issues
* When there is arrow function on class ctor, we should use heap-allocated lex env for class ctor.
  because we need to compute this variable on run-time
* when there is super expression with computed case, we should load this binding first for testing binding

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
2020-05-18 15:18:10 +09:00
HyukWoo Park
3520529a50 Fix minor defects
* remove obsolete return statements
* add guard code in parseClassElement

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2020-05-08 16:09:45 +09:00