Commit graph

150 commits

Author SHA1 Message Date
Patrick Kim
d1b4ced24c Update lexcial environment. (#313)
- Store lexcial block informantion in InterpretedCodeBlock.
- If lexcial block has no lexcial variables, we should collapse the block.
- If there is no heap-allocated variables in lexcial environment, we can skip allocation of the environment.
- Implement Indexed storage for lexcial environment.
- Allocate lexcial variables in function stack storage if possible.

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-07-18 15:34:10 +09:00
Robert Fancsik
ef59096112 Implement the lexical scoping (#285)
This patch introduces the let and const keyword and all the related lexical scoping rules.

Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-07-05 13:38:11 +09:00
Patrick Kim
c0c83ad0d6 Prepare for implementing es2015 specs (#304)
* Remove ES2015, PROMISE, PROXY, TYPEDARRAY defines
* Change test262 from 5.1 to 2015

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-07-04 15:18:23 +09:00
Hyukwoo Park
6577d2dac9 Merge parsing and bytecode generation process (#297)
* in most cases, parsing and bytecode generation process runs sequentially
* parsing error throws SyntaxError exception inside sandbox and this exception will be catched by the sandbox
* clear up some complicated code

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-07-04 15:17:27 +09:00
Hyukwoo Park
2b145ef54c
Update coding style guide (#296)
* reformat all single logical expression based on the new rule

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-07-03 15:42:41 +09:00
Robert Fancsik
9166b2de38 Implement the generator functions (#270)
Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-06-10 11:55:14 +09:00
Hyukwoo Park
151e30e24d Remove redundant GC objects in parsing (#261)
* unnecessary GC object/structure in parser removed
* explicitly represent stack-allocated object

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-05-28 13:53:40 +09:00
Zoltan Herczeg
34fa4f3d4f Reduce stack usage of the parser. (#269)
Inline CoverGrammar functions and move the common code into helper functions.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-05-23 17:31:49 +09:00
Hyukwoo Park
6d7312579e Optimize memory allocation of Lexer based on the stack (#266)
* each ScannerResult is now allocated on the stack if it is really necessary
* reduce the reference count overhead for each ScannerResult
* ALLOC_TOKEN macro is newly added for allocation of each ScannerResult token

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-05-22 14:58:52 +09:00
Robert Fancsik
2e588a542b Implement patterns (#222)
Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-05-15 21:29:55 +09:00
Hyukwoo Park
3c6dee209b Fix bugs in for-of and iterator operation (#253)
* left should not be assignmentexpression in for-of statement
* this object for iterator operation fixed

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-05-14 18:42:21 +09:00
Robert Fancsik
1fc56fcf9a Implement the class language element part II. (#203)
Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-05-14 09:10:13 +09:00
Patrick Kim
d9976037ce Arrow function can be used as argument (#250)
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-05-13 20:10:09 +09:00
Hyukwoo Park
10bf53ab8b Fix to use Marker instead of MetaNode in parsing of arrow function parameters (#247)
* scanner should be indexed on the relative position to the start position of each parsing unit, so Marker is used instead
* test cases for arrow-function are newly  added

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-05-13 11:39:25 +09:00
Zoltan Herczeg
0caf44d918 Remove tolerateError. (#246)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-05-10 13:20:36 +09:00
Robert Fancsik
d788b0b3a9 Add default argument support for arrow functions (#228)
Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-05-07 18:53:49 +09:00
Zoltan Herczeg
b0f1b83697 Make ScanExpressionResult to behave like an ASTNodeType. (#227)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-05-07 11:19:56 +09:00
Robert Fancsik
cd03a086f1 Implement default arguments (#198)
Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-04-30 16:42:40 +09:00
Zoltan Herczeg
3ea072676c Remove string value from ScanExpressionResult. (#213)
Only Identifiers use it, so move it into a context member.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-04-30 12:07:55 +09:00
Zoltan Herczeg
bb90eb50e1 Merge parse/scan catchClause and finallyClause. (#212)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-04-26 13:39:24 +09:00
Hyukwoo Park
8850b0103f Implement for-of statement (#205)
* merging for-of and for-in statement
* remove unnecessary bytecodes

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-04-23 15:29:40 +09:00
Zoltan Herczeg
11129d6c91 Merge parse/scan switchStatement, labelledStatement and throwStatement. (#204)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-04-18 19:55:05 +09:00
Zoltan Herczeg
b38439447d Merge parse/scan continueStatement, breakStatement and returnStatement. (#202)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-04-17 10:10:52 +09:00
Peter Marki
2a15e5b55d Add es2015 rest element (#192)
Co-authored-by: Robert Fancsik frobert@inf.u-szeged.hu
Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-04-16 12:01:30 +09:00
Zoltan Herczeg
f92e1993ce Merge parse/scan doWhileStatement, whileStatement and forStatement. (#196)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-04-15 12:34:34 +09:00
Robert Fancsik
ae28733902 Implement spread operator (#168)
Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-04-12 09:24:56 +09:00
Zoltan Herczeg
36db704afe Merge parse/scan variableDeclaration, emptyStatement and ifStatement. (#189)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-04-09 10:22:00 +09:00
Zoltan Herczeg
6c1c5f2d19 Merge parse/scan expression, statementListItem and block. (#183)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-04-08 14:12:05 +09:00
Zoltan Herczeg
3d756cfed6 Merge parse/scan conditionalExpression and assignmentExpression. (#178)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-04-03 14:56:05 +09:00
Zoltan Herczeg
d9d152dfa2 Merge parse/scan updateExpression and unaryExpression. (#175)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-04-02 14:13:46 +09:00
Patrick Kim
1476a5ef11 Fix memory leak in Parser. (#166)
PassRefPtr::leakRef don't decrease refCount. but PassRefPtr::ctor increase refCount

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-03-26 20:39:48 +09:00
Zoltan Herczeg
e228baf428 Merge parse/scan leftHandSideExpressionAllowCall and leftHandSideExpression. (#163)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-03-26 17:00:37 +09:00
Zoltan Herczeg
d9e877a35e Merge parse/scan groupExpression and newExpression. (#158) (#160)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-03-25 15:55:01 +09:00
Zoltan Herczeg
087a3fc2d6 Merge parse/scan objectProperty and objectInitializer. (#158)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-03-22 13:35:40 +09:00
Robert Fancsik
291edc0a10 Merge ParseFunctionDeclaration and ParseFunctionExpression to reduce code duplication (#155)
Signed-off-by: Robert Fancsik <frobert@inf.u-szeged.hu>
2019-03-20 16:24:30 +09:00
Zoltan Herczeg
728ca7cb0f Merge parse/scan pattern, spreadElement and arrayInitializer. (#150)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-03-20 13:30:27 +09:00
Zoltan Herczeg
beaa26988b Start merging parsing/scanning. (#148)
There is a lot of code duplication for parser and scanner.
Source code duplications can be reduced by templates without sacrificing performance.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-03-15 20:07:49 +09:00
Robert Fancsik
e4dac958d0 Implement the class language element part I. (#141)
Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-03-15 19:59:39 +09:00
Robert Sipka
4b7720ce90 Check that the callee node pointer is not nullptr (#137)
Fixes #131

Signed-off-by: Robert Sipka <rsipka.uszeged@partner.samsung.com>
2019-03-11 12:01:09 +09:00
Zoltan Herczeg
3ed483090f Simplify error throwing in parser. (#134)
Remove unnecessary functions, simplify interface.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-03-11 12:00:06 +09:00
Tóth Béla
84df61d40b Reduce Cognitive Complexity in src/esprima.cpp (#113)
Reducing complexities reported by Sonarcloud, and refactoring possible later issue code.

https://sonarcloud.io/project/issues?id=pando-project_escargot&resolved=false&rules=cpp%3AS3776&severities=CRITICAL&sinceLeakPeriod=true&types=CODE_SMELL#

Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2019-03-06 12:39:19 +09:00
Peter Marki
2ad365189d Use initializer lists where possible (#105)
https://sonarcloud.io/organizations/pando-project/rules?open=cpp%3AS3230&rule_key=cpp%3AS3230

Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-02-26 14:28:05 +09:00
Daniella Barsony
56b7748c67 Reduce code smells (#82)
Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2019-02-19 15:48:48 +09:00
Zoltan Herczeg
29ac4731c9 Move white space and new line checkers into the Lexer. (#81)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-02-13 08:19:28 +09:00
Zoltan Herczeg
dc30cd3035 Move ScannerResult into Scanner. (#77)
This way several functions can be moved into the private section.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-01-31 18:16:26 +09:00
Zoltan Herczeg
5d5162ccca Remove tolerant parsing. (#75)
A JS engine must not accept an invalid JS code so tolerant
parsing is removed from the parser and configuration.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-01-30 14:47:57 +09:00
Hyukwoo Park
3dec40df2e Support Method Property in Object Initialization [ES2015] (#67)
* Support for method notation in object property definitions

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
2019-01-23 14:06:37 +09:00
Peter Marki
16010c33e1 Throw exceptions by value and catch by reference (#62)
Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-01-23 11:50:52 +09:00
Zoltan Herczeg
de84be2e9e Remove curlyStack structure. (#59)
Instead of maintaining a structure in memory simply re-scan the
right brace when a template is parsed.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-01-22 18:15:17 +09:00
Zoltan Herczeg
09b45e47b4 Move Lexer (Scanner) out of parser. (#55)
Currently the parser is a very large file and hard to maintain. This patch is
the first which splits it into smaller files.

During the move some style fixes are applied. The identifer start
detection is improved as well.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-01-17 15:36:14 +09:00