Commit graph

25 commits

Author SHA1 Message Date
Patrick Kim
864973236d Refactoring source code (#356)
* Remove some unused function, variables
* Remove LexicalEnvironment from NativeFunctionObject
* Don't save stack-allocated LexicalEnvironment on ScriptFunctionObject. it may cause memory leak from stack
* Don't store newTarget, ThisBinded value on FunctionEnvironmentRecord if possible(we don't need these values except class functions)

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-08-08 12:20:19 +09:00
Robert Fancsik
3b81c3e572 Optimize/simplify static string initialization (#324)
- Introduce INIT_STATIC_STRING macro to make adding new static string much easier.
 - Introduce AtomicString::initStaticString to append static string to the static string set directly
   without lookup for an already existing name.
 - Add a number list and remove the dtoa function call for the initialization of string numbers.
 - Split the single character initialization to ASCII and Latin1 string part.

Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-07-24 18:16:41 +09:00
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
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
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
Patrick Kim
1004220604 Implement ESCARGOT_TREAT_LET_AS_VAR env variable (#248)
This is bad implementation. but it is needed for some special reason

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
2019-05-13 11:57:47 +09:00
Tóth Béla
69ae9be8d2 Reduce Code Smell issues (#221)
Rewamped a little bit of code, reported by SonarCloud for code smell.
Redudant parenthesis, and empty if statement code blocks.

Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2019-05-08 13:57:15 +09:00
Tóth Béla
31393f2a90 Fix ES6 octal literal parsing (#230)
The code had the place for parsing octal numbers like `0o543` and
`0O543`, but due to an implementation error the code returned with
`Unexpected token ILLEGAL`.

Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2019-05-07 11:22:08 +09:00
Tóth Béla
47dce1c42b Merge collapsible if statements (#171)
Merged Collapsible if statements reported by SonarCloud.
Also unified some code in Lexer, to follow this ruleset.

https://sonarcloud.io/project/issues?branch=travisMoka&id=Achie72_escargot&resolved=false&rules=cpp%3AS1066&severities=MAJOR

Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2019-03-28 16:53:51 +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
Zoltan Herczeg
b5e787f82a Unify reserved word checking. (#139)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-03-14 11:58:28 +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
Peter Marki
9f399d4682 Reduce cognitive code complexity of Scanner::ScannerResult::constructStringLiteral() (#111)
https://sonarcloud.io/project/issues?id=pando-project_escargot&issues=AWijtp3UBmaQb3-uIc8f&open=AWijtp3UBmaQb3-uIc8f

Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-02-28 14:07:09 +09:00
Zoltan Herczeg
6d2b73f818 Simplifiy punctuator parsing and introduce peekChar(). (#106)
Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-02-26 14:28:34 +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
Tóth Béla
dab095397d Extract assignment from sub-expressions (#97)
Sonarcloud reported an issue, namely `Assignments should not be made
from within sub-expressions. This affected only the Lexer, and were fixed.

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

Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2019-02-15 13:46:20 +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
f09fba8cce Remove OctalToDecimalResult from Lexer. (#80)
Instead use a special value to represent invalid octal values.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-02-12 10:12:03 +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
a82b41313b Introduce private section for Lexer. (#74)
Start hiding private helper functions from outside world. Next step
will be hiding private data members.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-01-30 14:47:42 +09:00
Zoltan Herczeg
56868385e1 Remove CharOrEmptyResult structure. (#63)
Introduce EmptyCodePoint constant to represent the empty case.
Also hex conversion is simplified.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-01-24 14:20:36 +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
57b75326d4 Rework isIdentifierPartSlow. (#56)
The new code uses a binary search instead of a very large if statement.

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-01-21 12:24:38 +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