Commit Graph

135 Commits

Author SHA1 Message Date
arv@chromium.org
74a0d0f373 Fix issue with numeric property names
We were not correctly treating 1.0 as 1, nor 1.20 as 1.2 in accessors.

BUG=v8:3507
LOG=Y
R=marja@chromium.org

Review URL: https://codereview.chromium.org/493173003

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23321 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-08-22 14:40:38 +00:00
marja@chromium.org
ad3a1a99d3 Refactor parser Checkpoints.
Why this is better:

1) Not needing an extra template parameter for Checkpoints ctors. This was
especially confusing since the template parameter was named Parser and Parser is
also used as a type name and is also a concrete type. This CL makes it clear
that ParserTraits::Checkpoint is consturcted with ParserBase<ParserTraits> -
that's the only sensemaking type for the ctor param anyway.

2) This CL makes ParserBase define a Checkpoint base class (which knows how
to create and restore a checkpoint with ParserBase) which
PreParserTraits::Checkpoint and ParserTraits::Checkpoint inherit, and not the
other way around.

This is a more intuitive way to implement the "base functionality + extending
it" concept than the previous solution. The previous solution was to allow
Traits to define a Checkpoint class and make ParserBase<Traits>::ParserCheckpoint
(which defines the base functionality) inherit from it.

3) This CL moves the Checkpoint class definitions out of the SomeTraits::Type
struct; SomeTraits::Type is supposed to be a collection of typedefs and not
contain anything else.

Checkpoints were introduced in r22925 ( https://codereview.chromium.org/443903003 ).

BUG=
R=wingo@igalia.com

Review URL: https://codereview.chromium.org/485473004

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23266 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-08-21 09:22:08 +00:00
wingo@igalia.com
cebddb662e Enable ES6 iteration by default
This enables for-of, as well as @@iterator implementations for strings
and arrays.

R=rossberg@chromium.org
BUG=v8:2214
LOG=Y

Review URL: https://codereview.chromium.org/446023002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22980 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-08-07 16:42:14 +00:00
bmeurer@chromium.org
d07a2eb806 Rename ASSERT* to DCHECK*.
This way we don't clash with the ASSERT* macros
defined by GoogleTest, and we are one step closer
to being able to replace our homegrown base/ with
base/ from Chrome.

R=jochen@chromium.org, svenpanne@chromium.org

Review URL: https://codereview.chromium.org/430503007

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22812 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-08-04 11:34:54 +00:00
rossberg@chromium.org
8023c9f564 Implement basic code generation for arrow functions
Implements code generation for arrow functions by desugaring them into
a FunctionLiteral. For the moment, a normal FUNCTION_SCOPE is used, so
"this" and "arguments" behave as in normal functions. Implementing the
correct scoping rules is to be done later on.

BUG=v8:2700
LOG=
R=rossberg@chromium.org

Review URL: https://codereview.chromium.org/382893003

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22495 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-07-21 09:58:01 +00:00
rossberg@chromium.org
e274edc8b8 Make let usable as an identifier in ES6 sloppy mode.
All of our mjsunit suite now runs through with --harmony-scoping enabled, up to expected failures (tests checking syntax errors for const/function in strict mode).

R=marja@chromium.org, ulan@chromium.org
BUG=v8:2198
LOG=Y

Review URL: https://codereview.chromium.org/378303003

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22323 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-07-10 14:06:37 +00:00
jochen@chromium.org
a4506cd3f2 Move platform abstraction to base library
Also split v8-core independent methods from checks.h to base/logging.h and
merge v8checks with the rest of checks.

The CPU::FlushICache method is moved to CpuFeatures::FlushICache

RoundUp and related methods are moved to base/macros.h

Remove all layering violations from src/libplatform

BUG=none
R=jkummerow@chromium.org
LOG=n

Review URL: https://codereview.chromium.org/358363002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22092 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-06-30 13:25:46 +00:00
mstarzinger@chromium.org
fec6e62dfb Check alpha-sorting of includes during presubmit.
R=rossberg@chromium.org

Review URL: https://codereview.chromium.org/333013002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21894 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-06-20 08:40:11 +00:00
marja@chromium.org
5bbc92dee0 Throw syntax error when a getter/setter has the wrong number of params
We used to allow any number of parameters in getters and setters to
match JSC. This is a violation of ES5.1 and both SpiderMonkey and
Chakra throw on these syntax errors.

BUG=v8:3371
LOG=Y
R=marja@chromium.org

Review URL: https://codereview.chromium.org/329413002

Patch from Erik Arvidsson <arv@chromium.org>.

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21868 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-06-17 07:23:26 +00:00
jochen@chromium.org
56a486c322 Use full include paths everywhere
- this avoids using relative include paths which are forbidden by the style guide
- makes the code more readable since it's clear which header is meant
- allows for starting to use checkdeps

BUG=none
R=jkummerow@chromium.org, danno@chromium.org
LOG=n

Review URL: https://codereview.chromium.org/304153016

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21625 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-06-03 08:12:43 +00:00
marja@chromium.org
11b8551f60 Parser / PreParser: Simplify error message arguments.
In some places, we pretended that there can be multiple arguments, though in
practice there was only one. In other places (most importantly, PreParser), we
only handled one argument. (This means that we were not able to produce a
multi-argument error inside a lazy function anyway.)

This CL makes it clear that there is ever only one argument.

R=ulan@chromium.org
BUG=

Review URL: https://codereview.chromium.org/273653002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21324 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-05-15 09:44:57 +00:00
bmeurer@chromium.org
d4b533d41b Bulk update of Google copyright headers in source files.
R=svenpanne@chromium.org

Review URL: https://codereview.chromium.org/259183002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@21035 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-04-29 06:42:26 +00:00
marja@chromium.org
ed1d232d5d Parser cleanup: PreParser doesn't need to produce symbol data any more.
State of the art:
- Chromium doesn't do a separate preparsing phase any more.
- We start parsing with Parser, and when it sees a lazy function, it falls back
to PreParser for that function.
- The symbol data should contain symbols which are *outside* lazy functions.
- So Parser should always produce symbol data, and PreParser should never.
- Because it's this simple now, we don't need to keep track of "should
produce symbol data" (i.e., whether we're inside a lazy func or not).

R=ulan@chromium.org
BUG=

Review URL: https://codereview.chromium.org/222123003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20707 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-04-14 08:49:23 +00:00
rossberg@chromium.org
2fda95eb80 Make stray 'return' an early error
As required by the spec, and implemented by other browsers.

(Plus minor clean-up for redeclaration TypeErrors.)

R=marja@chromium.org
BUG=
LOG=Y

Review URL: https://codereview.chromium.org/220473014

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20434 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-04-02 12:38:01 +00:00
rossberg@chromium.org
45118bfdfb Make invalid LHSs that are calls late errors
Necessary for web legacy compatibility.

Also fold in additional strict mode checks into LHS checks.
Minor constness clean-ups on the way.

R=marja@chromium.org
BUG=chromium:358346
LOG=Y

Review URL: https://codereview.chromium.org/217823003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20428 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-04-02 11:03:05 +00:00
marja@chromium.org
eecaef41d9 PreParser fix: propagate reference erros properly.
For example, invalid left hand sides are reference errors. PreParser didn't use
to produce this error ever, so the code for propagating reference errors
properly was missing, and reference errors turned into syntax errors.

R=rossberg@chromium.org
BUG=

Review URL: https://codereview.chromium.org/220233006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20408 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-04-01 14:17:43 +00:00
marja@chromium.org
b4d617e48d Parser fix: check allow_harmony_scoping() instead of FLAG_harmony_scoping.
Without this fix, ParserBase::set_allow_harmony_scoping() and the
kAllowHarmonyScoping in test-parsing.cc don't have any effect, and we end up not
running the tests with harmony scoping allowed.

R=rossberg@chromium.org
BUG=

Review URL: https://codereview.chromium.org/209993002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20200 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-24 14:41:55 +00:00
marja@chromium.org
25260c2b9a PreParser cleanup: no need to track with-ness of scopes.
Historically, we used to track the "with-ness" of a scope differently; not
creating a with scope, but setting a property on the scope (see
https://codereview.chromium.org/5166006 ). For laziness decisions, checking the
with-ness should be unnecessary: the current scope is function scope, and if the
outer scope is global scope, there's surely no with scope in between.

R=ulan@chromium.org
BUG=

Review URL: https://codereview.chromium.org/209863004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20189 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-24 12:16:09 +00:00
marja@chromium.org
e79ff8275c Move new expression parsing funcs to ParserBase.
Functions moved: ParseMemberWithNewPrefixesExpression, ParseMemberExpression,
ParseMemberExpressionContinuation.

Now all Parse*Expression functions are in ParserBase.

R=mstarzinger@chromium.org
BUG=

Review URL: https://codereview.chromium.org/207633003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20153 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-21 10:34:51 +00:00
marja@chromium.org
7708d4a22d Move ParseLeftHandSideExpression to ParserBase.
Includes cleanups:
- Reorganized functions in PreParserFactory to be in the logical order.
- De-hackified things PreParser doesn't need to track, such as IsCall & IsCallNew.

R=mstarzinger@chromium.org
BUG=

Review URL: https://codereview.chromium.org/206433003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20150 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-21 09:51:33 +00:00
marja@chromium.org
8452030817 Move ParsePostfixExpression into ParserBase.
+ enable a test which checks that Parser and PreParser produce the "invalid left
hand side" errors consistently.

R=mstarzinger@chromium.org
BUG=

Review URL: https://codereview.chromium.org/202333004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20149 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-21 09:46:18 +00:00
marja@chromium.org
d017e6ce54 Make PreParser track valid left hand sides.
Notes:
- This makes PreParser produce invalid_lhs_in_assignment and
invalid_lhs_in_prefix_op. Other errors will follow as the corresponding funcs
move to ParserBase.
- PreParserExpression::IsStrictFunction and StrictFunction() are not needed any
more -> removed them.

R=rossberg@chromium.org
BUG=

Review URL: https://codereview.chromium.org/196343033

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20125 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-20 13:18:15 +00:00
marja@chromium.org
e9717833f9 Move ParseUnaryExpression into ParserBase and add tests.
This also makes PreParser produce the strict_delete error the same way as
Parser (see test).

R=rossberg@chromium.org
BUG=

Review URL: https://codereview.chromium.org/203193004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20079 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-19 14:08:47 +00:00
marja@chromium.org
c04dd3fb7f Revert "Move ParseUnaryExpression into ParserBase and add tests."
This reverts revision 20077.

Reason: build fail on some compilers.

BUG=
TBR=marja@chromium.org,rossberg@chromium.org

Review URL: https://codereview.chromium.org/203413009

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20078 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-19 13:58:15 +00:00
marja@chromium.org
f4ef82309a Move ParseUnaryExpression into ParserBase and add tests.
This also makes PreParser produce the strict_delete error the same way as
Parser (see test).

R=rossberg@chromium.org
BUG=

Review URL: https://codereview.chromium.org/203193004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20077 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-19 13:42:41 +00:00
marja@chromium.org
9b94d12fd7 Move ParseBinaryExpression to ParserBase.
R=mstarzinger@chromium.org
BUG=v8:3126
LOG=N

Review URL: https://codereview.chromium.org/196933005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19997 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-17 13:54:42 +00:00
marja@chromium.org
6cf32b134a Move ParseConditionalExpression to ParserBase.
R=mstarzinger@chromium.org
BUG=v8:3126
LOG=N

Review URL: https://codereview.chromium.org/198053002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19994 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-17 13:36:39 +00:00
rossberg@chromium.org
c3c185c173 Make invalid LHSs a parse-time (reference) error
This is required by the spec. It also prevents crashes resulting from the attempt to read type feedback for the RHS of an invalid assignment which full codegen never actually allocated info for.

To do: check properly in preparser already.

R=marja@chromium.org, mstarzinger@chromium.org
BUG=351658
LOG=Y

Review URL: https://codereview.chromium.org/200473003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19976 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-17 10:21:01 +00:00
marja@chromium.org
ee46e648ec Move ParseYieldExpression to ParserBase.
R=mstarzinger@chromium.org
BUG=v8:3126
LOG=N

Review URL: https://codereview.chromium.org/197353003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19921 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-14 09:51:22 +00:00
marja@chromium.org
a89f68c6cd Move ParseAssignmentExpression to ParserBase.
R=mstarzinger@chromium.org, mstarzinger
BUG=v8:3126
LOG=N

Committed: https://code.google.com/p/v8/source/detail?r=19908

Review URL: https://codereview.chromium.org/197653002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19920 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-14 09:43:04 +00:00
marja@chromium.org
7c66ec9319 Revert "Move ParseAssignmentExpression to ParserBase."
This reverts revision 19908.

Reason: clang doesn't like it.

BUG=

Review URL: https://codereview.chromium.org/199233003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19909 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-13 16:11:26 +00:00
marja@chromium.org
9cc39f5a66 Move ParseAssignmentExpression to ParserBase.
R=mstarzinger@chromium.org, mstarzinger
BUG=v8:3126
LOG=N

Review URL: https://codereview.chromium.org/197653002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19908 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-13 16:06:08 +00:00
dcarney@chromium.org
869db33cbb Only call to LogSymbol when needed.
R=marja@chromium.org

BUG=

Review URL: https://codereview.chromium.org/198903002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19892 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-13 11:56:13 +00:00
dcarney@chromium.org
750ab88341 move remaining uses of scanner literals into scanner
R=marja@chromium.org

BUG=

Review URL: https://codereview.chromium.org/198713002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19880 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-13 08:29:31 +00:00
dcarney@chromium.org
87e77085a6 Move most scanner buffer accesses into scanner.
R=marja@chromium.org

BUG=

Review URL: https://codereview.chromium.org/197103002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19849 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-12 14:03:25 +00:00
marja@chromium.org
534245c9a5 Move ParseArguments to ParserBase and add tests.
Notes:
- PreParser didn't produce "too_many_arguments"; now it does.
- The argument count in the error message was wrong; fixed it.

BUG=v8:3126
LOG=N
R=ulan@chromium.org

Review URL: https://codereview.chromium.org/194503004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19812 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-11 16:30:47 +00:00
marja@chromium.org
cf820126b9 Move ParseObjectLiteral to ParserBase.
BUG=v8:3126
LOG=N
R=ulan@chromium.org

Review URL: https://codereview.chromium.org/192993002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19805 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-11 15:40:41 +00:00
rossberg@chromium.org
8e3f3cee9e Eliminate extended mode, and other modes clean-up
- Merge LanguageMode and StrictModeFlag enums
- Make harmony-scoping depend only on strict mode
- Free some bits on the way
- Plus additional clean-up and renaming

R=ulan@chromium.org
BUG=

Review URL: https://codereview.chromium.org/181543002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19800 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-11 14:41:22 +00:00
rossberg@chromium.org
3f702d4bf9 Mode clean-up pt 1: rename classic/non-strict mode to sloppy mode
R=mstarzinger@chromium.org
BUG=

Review URL: https://codereview.chromium.org/177683002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19799 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-11 14:39:08 +00:00
marja@chromium.org
988d5fe509 Parser & preparser unification: make the ParseFunctionLiteral APIs the same.
R=mstarzinger@chromium.org
BUG=

Review URL: https://codereview.chromium.org/190853011

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19763 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-10 15:19:20 +00:00
marja@chromium.org
1b7055cf54 Unify (Pre)Parser::ParseObjectLiteral and add tests.
Notes:
- The regexp in the ParseObjectLiteralComment was wrong, made it less wrong (
it's still wrong since trailing commas are not required / allowed).
- Change in logic: In case we have "get somekeyword() { }", the "somekeyword"
was not logged as a symbol by PreParser and not expected in the preparser data
by Parser. This is unnecessary complication; in other contexts where keywords
are allowed as identifiers, they are logged as symbols (see
ParseIdentifierName).

BUG=v8:3126
LOG=N
R=ulan@chromium.org

Review URL: https://codereview.chromium.org/173273006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19750 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-10 11:42:17 +00:00
marja@chromium.org
0a01afda76 Re-enable Parser::symbol_cache_ (after a long time!)
The Parser never used the symbol stream produced by the PreParser for anything
useful, due to a bug introduced 3.5 years ago by
https://codereview.chromium.org/3356010/diff/7001/src/parser.cc.

The bug is that calling Initialize on symbol_cache_ doesn't change its
length. So the length remains 0, and the "if" in Parser::LookupSymbol is always
true, and Parser::LookupCachedSymbol is never called and symbol_cache_ never
filled.

This bug also masked a bug that the symbol stream produced by PreParser doesn't
match what Parser wants to consume. The repro case is the following:

var myo = {if: 4}; print(myo.if);

PreParser doesn't log a symbol for the first "if", but in the corresponding
place, Parser consumes one symbol from the symbol stream. Since the consumed
symbols were never really used, this mismatch went unnoticed.

This CL also fixes that bug.

BUG=
R=ulan@chromium.org

Review URL: https://codereview.chromium.org/172753002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19505 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-02-20 11:35:37 +00:00
marja@chromium.org
ec18b79fac Add comments about lazy parsing and lazy compilation.
Also rename is_lazily_compiled in (Pre)Parser; it really means "is lazily
parsed" and doesn't correspond to the lazy compilation decision.

R=svenpanne@chromium.org
BUG=

Review URL: https://codereview.chromium.org/169223009

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19492 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-02-19 14:50:33 +00:00
marja@chromium.org
5b9465c2fc (Pre)Parser: Move ParseExpression and ParseArrayLiteral to ParserBase.
Notes:
- The functions already did the same thing -> no changes in logic.
- One less glue function needed now.

R=ulan@chromium.org
BUG=v8:3126
LOG=N

Review URL: https://codereview.chromium.org/169853002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19469 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-02-19 08:56:11 +00:00
marja@chromium.org
73c4a61848 (Pre)Parser: Simplify NewExpression handling (fixed).
Notes:
- We use simple recursion to keep track of how many "new" operators we have seen
  and where.
- This makes the self-baked stack class PositionStack in parser.cc unnecessary.
- Now the logic is also unified between Parser and PreParser.
- This is a fixed version of r19386.

R=ulan@chromium.org
BUG=v8:3126
LOG=N

Review URL: https://codereview.chromium.org/168583008

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19417 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-02-17 15:40:51 +00:00
marja@chromium.org
0323bf9cd7 Revert "(Pre)Parser: Simplify NewExpression handling."
This reverts revision 19386.

Reason: Mozilla failures.

BUG=
TBR=ulan@chromium.org,marja@chromium.org

Review URL: https://codereview.chromium.org/164183006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19388 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-02-14 16:08:14 +00:00
marja@chromium.org
c532977da3 (Pre)Parser: Simplify NewExpression handling.
Notes:
- We use simple recursion to keep track of how many "new" operators we have seen
  and where.
- This makes the self-baked stack class PositionStack in parser.cc unnecessary.
- Now the logic is also unified between Parser and PreParser.
- It might have been a copy-paste artifact (ParseLeftHandSideExpression ->
  ParseMemberWithNewPrefixesExpression) that the logic was so complicated
  before.

R=ulan@chromium.org
BUG=v8:3126
LOG=N

Review URL: https://codereview.chromium.org/166943002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19386 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-02-14 15:33:10 +00:00
marja@chromium.org
cd50687b41 (Pre)Parser: Move ParsePrimaryExpression to ParserBase.
Notes:
- To be able to move the recursive descent functions to ParserBase one at a
time, we temporarily need routing functions from traits to Parser/PreParser,
since the recursive descent functions form a cyclic structure.
- PreParser used to always allow intrinsic syntax. After this CL, it depends on
allow_natives_syntax() which was already in ParserBase.
- This CL also decouples (Pre)ParserTraits better from (Pre)Parser, passing more
information as parameters, so that the Traits don't need to get it from
(Pre)Parser.
R=ulan@chromium.org
BUG=v8:3126
LOG=N

Review URL: https://codereview.chromium.org/163333003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19374 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-02-14 11:24:26 +00:00
marja@chromium.org
cad32c1917 (Pre)Parser: Move FunctionState, BlockState and Scope handling to ParserBase.
Notes:
- This removes Parser::FunctionState and PreParser::FunctionState and adds
ParserBase::FunctionState etc.
- Also the scope stacks and function state stacks are moved to ParserBase.
- PreParser::FunctionState didn't add and subtract
JSFunction::kLiteralsPrefixSize (unlike Parser::FunctionState). Since the
actual value of NextMaterializedLiteralIndex is not used in the Preparser,
this change is valid.
- Traits no longer need functions like is_classic_mode(), since now there is a
 unified way of getting the information from the FunctionState / Scope.

R=ulan@chromium.org
BUG=v8:3126
LOG=N

Review URL: https://codereview.chromium.org/135213007

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19361 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-02-13 16:17:55 +00:00
marja@chromium.org
10ae9eb247 Refactor scope and function state tracking in (Pre)Parser.
Notes:
- PreParser::Scope was a weird combination of Parser::FunctionState and
  Scope. Split it into two (PreParser::FunctionState and PreParser::Scope). This
  is necessary for unifying the Parser and the PreParser.
- Scopes take care of language mode and tracking "with".
- FunctionStates take care of counting material literal indexes, properties
  etc. and tracking generators.
- PreParser::Scope::InsideWith was a hack to make a FunctionState-like object
  take care of tracking "with". It's now the responsibility fo PreParser::Scope
  and Scope.
- PreParser::ScopeType is unnecessarly, there is already a ScopeType enum in
v8globals.h.
- Renamed scope stack variables so that they're consistent in Parser and PreParser.
- Parser::FunctionState and Parser::BlockState had an unnecessary dependency to
  the Parser; they only need a couple of things from Parser. Broke the
  dependency.

R=ulan@chromium.org
BUG=v8:3126
LOG=N

Review URL: https://codereview.chromium.org/148293011

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19319 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-02-12 12:02:07 +00:00