Commit Graph

747 Commits

Author SHA1 Message Date
Leszek Swirski
5e725a2b43 [parser] Don't desugar destructuring declarations.
Emit a single destructuring assignment for destructuring declarations,
which can be desugared by the bytecode generator. This allows us to
remove destructuring desugaring from the parser (specifically, the
pattern rewriter) entirely.

The pattern "rewriter" is now only responsible for walking the
destructuring pattern to declare variables, mark them assigned, and
potentially rewrite scopes for the edge case of parameters with a sloppy
eval.

Note that since the rewriter is no longer rewriting, we have to flip the
VariableProxy copying logic for var re-lookup, so that we now pass the
new VariableProxy to the variable declaration and leave the original
unresolved (rather than passing the original through and rewriting to a
new unresolved VariableProxy).

This change does have some effect on breakpoint locations, due to some
of the available information changing between the parser and bytecode
generator, however the new locations appear to be more consistent
between assignments and declarations.

Change-Id: I3a58dd0a387d2bfb8e5e9e22dde0acc5f440cb82
Reviewed-on: https://chromium-review.googlesource.com/c/1382462
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58670}
2019-01-09 14:09:23 +00:00
Sathya Gunasekaran
f417b4aad8 [class] Fix early error for duplicate private fields
Bug: v8:8656
Change-Id: I86f00d377ac99a065c4ecf02abed08ec4feb3686
Reviewed-on: https://chromium-review.googlesource.com/c/1401214
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58650}
2019-01-09 00:53:05 +00:00
Leszek Swirski
00a2481a24 [ignition] Move destructuring assignments to bytecode generation
Instead of de-sugaring destructuring assignment in the parser (using the
pattern rewriter), pass the Object/ArrayLiterals through to the bytecode
generator, which can desugar them in-place.

This allows us to decrease the amount of AST node creation, and improve
the generated bytecode using domain-specific knowledge. As a side effect
we partially fix an old execution ordering spec bug.

Currently only implemented for assignments, not declarations, as the
latter has some additional complexity.

Bug: v8:4951
Change-Id: I3d69d232bea2968ef20df68a74014d9e05808cfe
Reviewed-on: https://chromium-review.googlesource.com/c/1375660
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58512}
2019-01-03 09:41:27 +00:00
Sathya Gunasekaran
15a7059412 [class] Parse static private fields
Bug: v8:5368
Change-Id: I0f6edc028baf009b81612ecc4be9a70c3621bc4e
Reviewed-on: https://chromium-review.googlesource.com/c/1385528
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58416}
2018-12-20 20:58:43 +00:00
Ross McIlroy
11a4da99d2 [Deflake] Fix data-race relating to accessing FLAG_* on worker thread during background compile
The parser object can now be created on a worker thread, therefore we shouldn't access
global FLAGs during the constructor. Instead move them to the ParseInfo constructor
and set the parser fields based on these. Also avoid accessing always_opt flags in
bytecode-flags - instead accessing it in ParseInfo and propagating to the bytecode
generator.

Also gets rid of unused kUntrustedCodeMitigations flag in UnoptimizedCompilationInfo

BUG=v8:8582

Change-Id: I6e6fdc8cc7865803cb5f334f652abc0e3e4cb3ce
Reviewed-on: https://chromium-review.googlesource.com/c/1375918
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58316}
2018-12-18 12:49:23 +00:00
Camillo Bruni
2ba5c10db1 [scope] Use contains_asm_module_ bit to bypass recursive checks
Parser::MaybeResetCharacterStream calls Scope::ContainsAsmModule which
recursively checks whether a Scope is an asm module or any of its
sub-scopes. This is sub-optimal for deeply nested scopes and many
functions which do not contain any asm modules.

Drive-by-fix:
- rename Scope::asm_module to Scope::is_asm_module


Change-Id: I922270c608b54c6525f0672ead4aca90f57a6551
Reviewed-on: https://chromium-review.googlesource.com/c/1360636
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58288}
2018-12-17 15:48:59 +00:00
Mike Stanton
4ab8c906e1 [Cleanup] String::GetChars() should take a DisallowHeapAllocation ref.
Building on https://chromium-review.googlesource.com/c/v8/v8/+/1349243,
which asserted on calls to GetChars() that weren't in a
DisallowHeapAllocation scope, this CL takes a reference to the scope
in order to provide static protection in all builds.


Bug: v8:8238
Change-Id: I481a1dbbd3ae57eb35c5f828c5e242691635be27
Reviewed-on: https://chromium-review.googlesource.com/c/1354038
Reviewed-by: Marja Hölttä <marja@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Michael Stanton <mvstanton@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58022}
2018-12-04 16:07:46 +00:00
Toon Verwaest
33c6f1203e [parser] Cleanup property name parsing, introduce token flags
- Rename methods,
- Introduce flags for tokens to lookup IsKeyword and IsPropertyName
- Remove "contextual keyword" leftover code.
- Inline ParsePropertyName into ParsePropertyNameOrPrivatePropertyName
  since public is more likely than private.

Change-Id: Ib7633ef3c46889ecafc7a6c929029845bb8ef15c
Reviewed-on: https://chromium-review.googlesource.com/c/1357052
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57993}
2018-12-03 11:43:33 +00:00
Toon Verwaest
dac7aa0f8c [parser] Cleanup token ranges
Remove IdentifierOrEnum and AwaitOrYield and reduce Callable to exclude enum.

Change-Id: Id80c0c5e7a8d4869ab8d841f3b973ea7c0c844cc
Reviewed-on: https://chromium-review.googlesource.com/c/1357044
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57992}
2018-12-03 10:29:59 +00:00
Toon Verwaest
298aefa600 [parser] Restructure identifier classifying
- Rely more heavily on Token::IsValidIdentifier.
- Deal with IsLet() when it's possibly a lexical declaration.
- Remove ENUM from the default IsAnyIdentifier range.
- Always pre-check whether IsAnyIdentifier before classifying identifiers.

Change-Id: I55eae6ff65dc306b466fa29d233c715e85bc3854
Reviewed-on: https://chromium-review.googlesource.com/c/1356514
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57977}
2018-11-30 16:41:39 +00:00
Toon Verwaest
86a5d0c18e [parser] Introduce Token:: IsMember, IsProperty, and IsTemplate
Change-Id: Iadc3d916dcda6f03c467e77fedff6d315dbb67f6
Reviewed-on: https://chromium-review.googlesource.com/c/1352299
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57897}
2018-11-28 10:28:10 +00:00
Toon Verwaest
0851de1023 [parser] Combine UnaryExpression and CountExpression behind single range-check
Change-Id: I8704003f05e74d55e724d669f5bbcef5c2214bf4
Reviewed-on: https://chromium-review.googlesource.com/c/1351018
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57867}
2018-11-27 11:54:41 +00:00
Jakob Kummerow
56e161e811 [ubsan] Port Context to the new design
Bug: v8:3770
Change-Id: I07f48b1ee8814a006e6787ad8261fa8388b4298d
Reviewed-on: https://chromium-review.googlesource.com/c/1345327
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57771}
2018-11-23 11:03:54 +00:00
Joyee Cheung
603bab1e49 [class] parse private methods
This patch implements the parsing of private methods
in the stage 3 proposal https://tc39.github.io/proposal-private-methods

- Adds a --harmony-private-methods flag
- Parse the private methods/accessors

The design doc is in
https://docs.google.com/document/d/1T-Ql6HOIH2U_8YjWkwK2rTfywwb7b3Qe8d3jkz72KwA/edit?usp=sharing

This patch only makes sure the syntax parses, doesn't implement
the semantics.

Bug: v8:8330
Change-Id: I9007b3b3dd6a0df35db7bb14f38f1a38d52bc663
Reviewed-on: https://chromium-review.googlesource.com/c/1329706
Commit-Queue: Joyee Cheung <joyee@igalia.com>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57615}
2018-11-19 17:42:38 +00:00
Toon Verwaest
11a108611e [parser] Better separate scope_info-backed lookup from other lookup
Change-Id: Id81b028629d552e2f3ebbab8bc3ab1f0e9cff3fb
Reviewed-on: https://chromium-review.googlesource.com/c/1337572
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57537}
2018-11-15 12:45:23 +00:00
Leszek Swirski
7aac6bc905 [cleanup] Make unicode predicate cache tables static
Moves the unicode predicate cache tables out of the unicode cache,
and turns them into generic predicates in char-predicates.h which
use static constexpr tables.

This drops the per-isolate cost of unicode caches, and removes the
need for accessing the unicode cache from most files. It does remove
the mutability of the cache, which means that there may be regressions
when parsing non-ASCII identifiers. Most likely the benefits to ASCII
identifiers/keywords will outweigh any non-ASCII costs.

Change-Id: I9a7a8b7c9b22d3e9ede824ab4e27f133ce20a399
Reviewed-on: https://chromium-review.googlesource.com/c/1335564
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57506}
2018-11-14 15:33:45 +00:00
Toon Verwaest
1f66512f45 [parser] Remove final remaining contextual keywords
Change-Id: I9c022d8d1aa363168546303516b5b3ee6196fdb5
Reviewed-on: https://chromium-review.googlesource.com/c/1333412
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57475}
2018-11-13 14:39:21 +00:00
Toon Verwaest
58988c6c63 [parser] Remove broken/half-implemented do-expressions
The current implementation isn't very helpful anyway if we ever really want
this.

Change-Id: Iad4132734980937aee462a1613d47887383585a0
Reviewed-on: https://chromium-review.googlesource.com/c/1328928
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57388}
2018-11-09 13:22:56 +00:00
Toon Verwaest
b407d27450 [parser] Further restructure ParseAssignmentExpression
This better separates non-arrow/assignment from the alternative, and
destructuring assignment from other types of assignment to avoid unnecessary
and duplicate branches.

Change-Id: I51c59f86c705646c02f182c9719700c558297e4a
Reviewed-on: https://chromium-review.googlesource.com/c/1328921
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57385}
2018-11-09 12:36:19 +00:00
Toon Verwaest
9d27ec3aac [parser] Introduce FailureExpression to return instead of nullptr
That allows us to keep on running further without explicit RETURN_IF

Bug: v8:8363, v8:7926
Change-Id: If1424a1dae656ac725a8443b09ea1b8cc25dfcb1
Reviewed-on: https://chromium-review.googlesource.com/c/1322953
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57319}
2018-11-07 16:45:10 +00:00
Toon Verwaest
20ce2c6f87 [parser] Use ScopedPtrList for more statement lists
In particular FunctionLiteral body. Now clients cannot use
function_literal->body() == nullptr anymore to figure out whether it was
preparsed; but have to check the eager compile hint.

Change-Id: Ia0d3a6b51c6fb7e803157e98a9d224224e03c8a7
Reviewed-on: https://chromium-review.googlesource.com/c/1317811
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57246}
2018-11-05 16:21:28 +00:00
Sathya Gunasekaran
c65dbd5153 [class] Rewrite destructuring assignment in class field initializers
Bug: v8:5751, chromium:899537
Change-Id: I4c072727dffc9381a81eb8711c4114220345914d
Reviewed-on: https://chromium-review.googlesource.com/c/1304538
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57141}
2018-10-30 16:34:04 +00:00
Toon Verwaest
236b8e9ca1 [parser] Refactor ParseMemberExpression
- Use token-range checks
- Delay ValidateExpression until after the loop
- Only queue classifier errors at the beginning
- Only inline Token-range check rather than the entire
  ParseMemberExpressionContinuation to reduce binary size.

Change-Id: Ib81ce071851fe5c13b4bb405cd883df7a82c84c9
Reviewed-on: https://chromium-review.googlesource.com/c/1286677
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56783}
2018-10-18 15:40:28 +00:00
Toon Verwaest
c732801267 [parser] Introduce a range for automatic semicolon insertion tokens
Change-Id: Ib41ddbf15c6f9395b747b78c081e466a9f2e44bd
Reviewed-on: https://chromium-review.googlesource.com/c/1286682
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56779}
2018-10-18 14:12:33 +00:00
Toon Verwaest
e1c6fa8878 [parser] Token-range-check for callable identifier tokens
This also fixes the tokens that are identified as called identifiers.

Change-Id: I4a2179b98214f9018c8c07c0ab27f878cdae13cf
Bug: v8:6513
Reviewed-on: https://chromium-review.googlesource.com/c/1286338
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56719}
2018-10-17 10:21:44 +00:00
Toon Verwaest
ee9ac86ad9 [parser] Restructure ParseLeftHandSide
- use a token-range to quickly identify LHS continuation
- queue binding pattern errors only once
- outline LHS continuation to reduce memory overhead from aggressive inlining (30kb)

Change-Id: Ic0f3cfc3ea0bd6cedb6cea991a69f55f2bada14a
Reviewed-on: https://chromium-review.googlesource.com/c/1280207
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56633}
2018-10-15 12:36:43 +00:00
Toon Verwaest
79d1b0447e [parser] Move GetUnexpectedTokenMessage to Parser with dummy preparser impl
Now that the preparser doesn't track errors anymore, it also doesn't make sense
to prepare the message.

Change-Id: Ifc69e67f9220be69812257b0fc18b55097236dbd
Reviewed-on: https://chromium-review.googlesource.com/c/1275818
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56574}
2018-10-11 15:37:44 +00:00
Georg Neis
812e768cbe [modules] Implement new syntax: export * as foo from "..."
This is behind a new flag --harmony-namespace-exports.

Bug: v8:8101
Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
Change-Id: I9c252b6de2b08223fcf3296340b78d721471bdb4
Reviewed-on: https://chromium-review.googlesource.com/c/1258004
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56550}
2018-10-11 07:08:33 +00:00
Toon Verwaest
d46467c0d2 [parser] Remove FLAG_preparser_scope_analysis and friends
This flag has been on by default for some time. Once
https://chromium-review.googlesource.com/c/v8/v8/+/1270578 lands we need it to
be able to find duplicate parameters (to be spec-compliant).

Change-Id: I222023d7cd955127d3ecca42283b37063e962c58
Reviewed-on: https://chromium-review.googlesource.com/c/1270581
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56468}
2018-10-09 09:31:03 +00:00
Florian Sattler
7b11480f3b [preparser] Remove ExpressionClassifier error tracking in the PreParser.
PreParser now does not longer track which kind of error occurred.
If we see an error we reparse with the parser and report the error.
Furthermore, this fixes tests in test-parsing.

Change-Id: I1860949fab4d65ff4a5a1b63796c7574494f9d50
Reviewed-on: https://chromium-review.googlesource.com/1231173
Commit-Queue: Florian Sattler <sattlerf@google.com>
Reviewed-by: Adam Klein <adamk@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56281}
2018-09-28 09:17:03 +00:00
Florian Sattler
df5263b0c0 [cleanup] Mark test/ methods in subclasses with override.
Fixing clang-tidy warning.

Bug: v8:8015
Change-Id: I6bd8e0c8c1965f22a3429fda12bc70ae454c39c2
Reviewed-on: https://chromium-review.googlesource.com/1226978
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Florian Sattler <sattlerf@google.com>
Cr-Commit-Position: refs/heads/master@{#55930}
2018-09-17 07:40:00 +00:00
Florian Sattler
a81bd4c05c [cleanup] Refactor code to use boolean literals instead of 0/1.
Fixing clang-tidy warning.

Bug: v8:8015
Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng
Change-Id: Ib48ead467519354715e3bc0e3f718cbdda28f989
Reviewed-on: https://chromium-review.googlesource.com/1225704
Commit-Queue: Florian Sattler <sattlerf@google.com>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55907}
2018-09-14 14:00:40 +00:00
Florian Sattler
b2dac95379 [cleanup] Replace 0 and NULL with nullptr for test files.
Fixing clang-tidy warning.

Bug: v8:8015
Change-Id: I2a7a8c8447d2835205f7a506f04efe4d1801b934
Reviewed-on: https://chromium-review.googlesource.com/1224316
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Florian Sattler <sattlerf@google.com>
Cr-Commit-Position: refs/heads/master@{#55903}
2018-09-14 12:56:00 +00:00
Camillo Bruni
93fea34338 [parser] Use more range checks to reduce branches
- Introduce Token::IsLiteral helper
- Introduce Token::IsStrictReservedWord helper


Drive-by-fix:
- Use "token" instead of "tok" as variable name
- Keep enum order consistent accross files

Change-Id: Ie3b30a62dfbea761a31c32465c0afa681d326710
Reviewed-on: https://chromium-review.googlesource.com/1203952
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55804}
2018-09-11 19:56:10 +00:00
Camillo Bruni
1e0f101ae6 [scanner] Reduce branches for IsIdentifier and IsContextualKeyword
Bug: v8:7926
Change-Id: I1c3b831bb19c70e1e7c99f45ae50dbd1351ce2a7
Reviewed-on: https://chromium-review.googlesource.com/1202105
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55637}
2018-09-05 09:13:01 +00:00
Toon Verwaest
3283875676 [parser] Restore trivial expression grammar shortcuts with range-based condition
Change-Id: I04385d44f6175f7b391fb07ec4f1beb9abd4d22f
Reviewed-on: https://chromium-review.googlesource.com/1194033
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55500}
2018-08-29 16:21:10 +00:00
Toon Verwaest
dd6290d189 [token] Make sure we can simply range-check IsAnyIdentifier
This CL additionally uses IsInRange for token range checks. That only uses one
branch rather than two.

Change-Id: I52c6759ba195b55cb50c2ce9afbdc9b397495633
Reviewed-on: https://chromium-review.googlesource.com/1193875
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55494}
2018-08-29 14:28:34 +00:00
Toon Verwaest
a1995eca83 [scanner] Mark source_ and is_module as const and initialize in constructor
Change-Id: I692ce8dbe3169cfb912647c31a9e8121dc5eff5d
Reviewed-on: https://chromium-review.googlesource.com/1183306
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55268}
2018-08-21 12:46:49 +00:00
Toon Verwaest
fcfd995aa1 [scanner] Go back to untemplatized scanning with buffering
This reverts the following 3 CLs:

Revert "[scanner] Templatize scan functions by encoding"
Revert "[asm] Remove invalid static cast of character stream"
Revert "[scanner] Prepare CharacterStreams for specializing scanner and parser by character type"

The original idea behind this work was to avoid copying, converting and
buffering characters to be scanned by specializing the scanner functions. The
additional benefit was for scanner functions to have a bigger window over the
input. Even though we can get a pretty nice speedup from having a larger
window, in practice this rarely helps. The cost is a larger binary.

Since we can't eagerly convert utf8 to utf16 due to memory overhead, we'd also
need to have a specialized version of the scanner just for utf8. That's pretty
complex, and likely won't be better than simply bulk converting and buffering
utf8 as utf16.

Change-Id: Ic3564683932a0097e3f9f51cd88f62c6ac879dcb
Reviewed-on: https://chromium-review.googlesource.com/1183190
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55258}
2018-08-21 10:52:52 +00:00
Toon Verwaest
378375d2e5 [scanner] Templatize scan functions by encoding
This way we can avoid reencoding everything to utf16 (buffered) and avoid the
overhead of needing to check the encoding for each character individually.

This may result in a minor asm.js scanning regression due to one-byte tokens
possibly being more common.

Change-Id: I90b51c256d56d4f4fa2d235d7e1e58fc01e43f31
Reviewed-on: https://chromium-review.googlesource.com/1172437
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55217}
2018-08-20 13:54:16 +00:00
Toon Verwaest
2d40e2f445 [scanner] Prepare CharacterStreams for specializing scanner and parser by character type
This templatizes CharacterStream by char type, and makes them subclass ScannerStream.
Methods that are widely used by tests are marked virtual on ScannerStream and final on
CharacterStream<T> so the specialized scanner will know what to call. ParseInfo passes
around ScannerStream, but the scanner requires the explicit CharacterStream<T>. Since
AdvanceUntil is templatized by FunctionType, I couldn't mark that virtual; so instead
I adjusted those tests to operate directly on ucs2 (not utf8 since we'll drop that in
the future).

In the end no functionality was changed. Some calls became virtual in tests. This is
mainly just preparation.

Change-Id: I0b4def65d3eb8fa5c806027c7e9123a590ebbdb5
Reviewed-on: https://chromium-review.googlesource.com/1156690
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54848}
2018-08-01 15:11:50 +00:00
Stephan Herhut
6d25cab2c8 [cleanup] Split off api-inl.h from api.h to make latter self contained
api.h had an implicit dependency on objects-inl.h.

Bug: v8:7490
Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng;luci.v8.try:v8_linux_noi18n_rel_ng
Change-Id: I56ef7abefed7205bdbff2aa5f451f1a843bef9f9
Reviewed-on: https://chromium-review.googlesource.com/1145191
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Ben Titzer <titzer@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Stephan Herhut <herhut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54616}
2018-07-23 16:03:49 +00:00
Marja Hölttä
f128acee3b [parser] Fix import in arrow function parameters.
BUG=chromium:852765

Change-Id: Iaba84f6e52b08b3aee4c1529701239c049dceb9a
Reviewed-on: https://chromium-review.googlesource.com/1128875
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54450}
2018-07-16 07:57:19 +00:00
Toon Verwaest
5063241306 [scanner] Rewrite character streams by separating underlying bytestreams from buffering.
Additionally now we only scan over flat heap strings.

Change-Id: Ia73c538a3c7923ec66089e16efa529ef3cea2d06
Reviewed-on: https://chromium-review.googlesource.com/1126938
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54258}
2018-07-05 12:59:28 +00:00
Yang Guo
0973a40867 Revert "[scanner] Rewrite character streams by separating underlying bytestreams from buffering."
This reverts commit 5f2f418d47.

Reason for revert: Speculative revert for LayoutTest timeouts

https://ci.chromium.org/buildbot/client.v8.fyi/V8-Blink%20Linux%2064/24596
https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8-Blink%20Linux%2064%20-%20future/4707
https://ci.chromium.org/buildbot/client.v8.fyi/V8-Blink%20Linux%2064%20(dbg)/12467

Original change's description:
> [scanner] Rewrite character streams by separating underlying bytestreams from buffering.
> 
> Additionally now we only scan over flat heap strings.
> 
> Change-Id: Ic449b19aecd7fc3f283a04a3df6a39772d471565
> Reviewed-on: https://chromium-review.googlesource.com/1125854
> Reviewed-by: Marja Hölttä <marja@chromium.org>
> Commit-Queue: Toon Verwaest <verwaest@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#54224}

TBR=marja@chromium.org,verwaest@chromium.org

Change-Id: Ica3026f318a85ec6bb24a38a8cd998f12c146d7e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/1126819
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54231}
2018-07-05 07:37:15 +00:00
Toon Verwaest
5f2f418d47 [scanner] Rewrite character streams by separating underlying bytestreams from buffering.
Additionally now we only scan over flat heap strings.

Change-Id: Ic449b19aecd7fc3f283a04a3df6a39772d471565
Reviewed-on: https://chromium-review.googlesource.com/1125854
Reviewed-by: Marja Hölttä <marja@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54224}
2018-07-04 18:37:08 +00:00
Caitlin Potter
e50f6432cf [parser] propagate async arrow formal parameter error in arrow parameters
Instead of just discarding the expression classifier after parsing an after
parsing an arrow function, accumulate the async arrow formal parameters errors

BUG=v8:7817
R=gsathya@chromium.org, littledan@chromium.org, marja@chromium.org

Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
Change-Id: I0a84a25d7d42f89200b6fbf05eab3d39ab51fb10
Reviewed-on: https://chromium-review.googlesource.com/1113622
Reviewed-by: Daniel Ehrenberg <littledan@chromium.org>
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: Caitlin Potter <caitp@igalia.com>
Cr-Commit-Position: refs/heads/master@{#54034}
2018-06-26 14:34:45 +00:00
Leszek Swirski
83ac43275e [GetIsolate] More low-hanging fruit
Access Isolate* and Heap* wherever already available.

Roughly:
GetIsolate(): -20
GetHeap(): -22
Handle<>(HeapObject): -315
handle(HeapObject): -21

Bug: v8:7786
Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng;luci.v8.try:v8_linux_noi18n_rel_ng
Change-Id: I2da36ed1909d849812a1cb6bf94cb735eedca45b
Reviewed-on: https://chromium-review.googlesource.com/1111707
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53987}
2018-06-23 09:53:20 +00:00
Leszek Swirski
b8cf9627b9 [GetIsolate] Remove GetIsolate from String in src/objects.cc
Bug: v8:7786
Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng;luci.v8.try:v8_linux_noi18n_rel_ng
Change-Id: I98ac4de406630c14280927240e9471049af3e790
Reviewed-on: https://chromium-review.googlesource.com/1108118
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53920}
2018-06-21 11:59:58 +00:00
Toon Verwaest
a5b5f8e970 Reland "[debugger] Rewrite the ScopeIterator/DebugEvaluate to use Scope rather than ScopeInfo for inner scopes."
Change-Id: I0ad97057600d0a0f1dd4c71d5f8245dafb908154
Reviewed-on: https://chromium-review.googlesource.com/1103576
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53781}
2018-06-18 09:25:29 +00:00