|
|
DescriptionRefactor object/class literal property name parsing
This patch arranges that property names are parsed in a single pass,
reporting the name as well as the type of the property, instead of
parsing qualifiers like 'static' or 'get' initially as names and then
re-parsing. This change is easier to reason about, very slightly (4%)
faster in some cases (although slower in other, less common ones, though
this slowdown will be fixed in an upcoming patch), and is a prerequisite
for separating the parsing of object and class literal properties, which
will become increasingly important as ECMAScript adds more class features.
Committed: https://crrev.com/6dd26c729584024e17a05a2a76b319d4aecdc138
Cr-Commit-Position: refs/heads/master@{#39027}
Patch Set 1 #Patch Set 2 : fix dchecks #Patch Set 3 : make compilers happy #
Total comments: 6
Patch Set 4 : rebase #Patch Set 5 : address comments #
Total comments: 2
Patch Set 6 : more SetPropertyKind #Patch Set 7 : rebase #
Messages
Total messages: 34 (23 generated)
The CQ bit was checked by bakkot@google.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_linux_dbg_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux_dbg_ng/builds/11632) v8_mac_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_mac_rel_ng/builds/7699)
The CQ bit was checked by bakkot@google.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_presubmit on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_presubmit/builds/22636)
The CQ bit was checked by bakkot@google.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_presubmit on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_presubmit/builds/22639)
Description was changed from ========== Refactor object/class literal property name parsing. This patch arranges that property names are parsed in a single pass, reporting the name as well as the type of the property, instead of parsing qualifiers like 'static' or 'get' initially as names and then re-parsing. This change is easier to reason about, very slightly (2%) faster in some cases, and is a prerequisite for separating the parsing of object and class literal properties, which will become increasingly important as ECMAScript adds more class features. ========== to ========== Refactor object/class literal property name parsing This patch arranges that property names are parsed in a single pass, reporting the name as well as the type of the property, instead of parsing qualifiers like 'static' or 'get' initially as names and then re-parsing. This change is easier to reason about, very slightly (2%) faster in some cases, and is a prerequisite for separating the parsing of object and class literal properties, which will become increasingly important as ECMAScript adds more class features. ==========
bakkot@google.com changed reviewers: + littledan@chromium.org, marja@chromium.org
PTAL
Description was changed from ========== Refactor object/class literal property name parsing This patch arranges that property names are parsed in a single pass, reporting the name as well as the type of the property, instead of parsing qualifiers like 'static' or 'get' initially as names and then re-parsing. This change is easier to reason about, very slightly (2%) faster in some cases, and is a prerequisite for separating the parsing of object and class literal properties, which will become increasingly important as ECMAScript adds more class features. ========== to ========== Refactor object/class literal property name parsing This patch arranges that property names are parsed in a single pass, reporting the name as well as the type of the property, instead of parsing qualifiers like 'static' or 'get' initially as names and then re-parsing. This change is easier to reason about, very slightly (4%) faster in some cases, and is a prerequisite for separating the parsing of object and class literal properties, which will become increasingly important as ECMAScript adds more class features. ==========
Description was changed from ========== Refactor object/class literal property name parsing This patch arranges that property names are parsed in a single pass, reporting the name as well as the type of the property, instead of parsing qualifiers like 'static' or 'get' initially as names and then re-parsing. This change is easier to reason about, very slightly (4%) faster in some cases, and is a prerequisite for separating the parsing of object and class literal properties, which will become increasingly important as ECMAScript adds more class features. ========== to ========== Refactor object/class literal property name parsing This patch arranges that property names are parsed in a single pass, reporting the name as well as the type of the property, instead of parsing qualifiers like 'static' or 'get' initially as names and then re-parsing. This change is easier to reason about, very slightly (4%) faster in some cases (although slower in other, less common ones, though this slowdown will be fixed in an upcoming patch), and is a prerequisite for separating the parsing of object and class literal properties, which will become increasingly important as ECMAScript adds more class features. ==========
I like this new logic. A couple minor points. https://codereview.chromium.org/2278153004/diff/40001/src/parsing/parser-base.h File src/parsing/parser-base.h (right): https://codereview.chromium.org/2278153004/diff/40001/src/parsing/parser-base... src/parsing/parser-base.h:1095: enum PropertyKind { Nit: While you're at it, what if you made this a class enum so the namespace isn't polluted? https://codereview.chromium.org/2278153004/diff/40001/src/parsing/parser-base... src/parsing/parser-base.h:1956: break; // This must be an accessor. Any way you can avoid the duplication between this part and lines 1912? Looks like the difference only comes after this switch statement. https://codereview.chromium.org/2278153004/diff/40001/src/parsing/parser-base... src/parsing/parser-base.h:2265: return impl()->EmptyObjectLiteralProperty(); Does the compiler require you to keep this statement in?
https://codereview.chromium.org/2278153004/diff/40001/src/parsing/parser-base.h File src/parsing/parser-base.h (right): https://codereview.chromium.org/2278153004/diff/40001/src/parsing/parser-base... src/parsing/parser-base.h:1095: enum PropertyKind { On 2016/08/27 at 00:09:00, Dan Ehrenberg wrote: > Nit: While you're at it, what if you made this a class enum so the namespace isn't polluted? Ah, good thought. Done. https://codereview.chromium.org/2278153004/diff/40001/src/parsing/parser-base... src/parsing/parser-base.h:1956: break; // This must be an accessor. On 2016/08/27 at 00:09:00, Dan Ehrenberg wrote: > Any way you can avoid the duplication between this part and lines 1912? Looks like the difference only comes after this switch statement. I've factored it out into a method. It's not a huge win, because the control-flow part still takes up some space, and can't be factored out except into a macro. https://codereview.chromium.org/2278153004/diff/40001/src/parsing/parser-base... src/parsing/parser-base.h:2265: return impl()->EmptyObjectLiteralProperty(); On 2016/08/27 at 00:09:00, Dan Ehrenberg wrote: > Does the compiler require you to keep this statement in? Unfortunately yes, at least on some platforms. I initially left it out and it built fine on my machine, but failed the Windows trybots.
lgtm % comment, but pls wait for littledan@'s review before landing. https://codereview.chromium.org/2278153004/diff/80001/src/parsing/parser-base.h File src/parsing/parser-base.h (right): https://codereview.chromium.org/2278153004/diff/80001/src/parsing/parser-base... src/parsing/parser-base.h:1994: if (peek() != Token::COLON && *kind == PropertyKind::kValueProperty) { This is still duplicate logic; can this call SetPropertyKindFromToken? At least that way we'd have the "token -> property kind" correspondence in one place only.
https://codereview.chromium.org/2278153004/diff/80001/src/parsing/parser-base.h File src/parsing/parser-base.h (right): https://codereview.chromium.org/2278153004/diff/80001/src/parsing/parser-base... src/parsing/parser-base.h:1994: if (peek() != Token::COLON && *kind == PropertyKind::kValueProperty) { On 2016/08/29 at 08:07:46, marja wrote: > This is still duplicate logic; can this call SetPropertyKindFromToken? At least that way we'd have the "token -> property kind" correspondence in one place only. Done. It's a little unpleasant, and strictly speaking we still have that correspondence in the "static (" case, but that case should go away if the next patch splitting object and class property parsing goes in.
lgtm
The CQ bit was checked by bakkot@google.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by bakkot@google.com
The patchset sent to the CQ was uploaded after l-g-t-m from marja@chromium.org Link to the patchset: https://codereview.chromium.org/2278153004/#ps120001 (title: "rebase")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Committed patchset #7 (id:120001)
Message was sent while issue was closed.
Description was changed from ========== Refactor object/class literal property name parsing This patch arranges that property names are parsed in a single pass, reporting the name as well as the type of the property, instead of parsing qualifiers like 'static' or 'get' initially as names and then re-parsing. This change is easier to reason about, very slightly (4%) faster in some cases (although slower in other, less common ones, though this slowdown will be fixed in an upcoming patch), and is a prerequisite for separating the parsing of object and class literal properties, which will become increasingly important as ECMAScript adds more class features. ========== to ========== Refactor object/class literal property name parsing This patch arranges that property names are parsed in a single pass, reporting the name as well as the type of the property, instead of parsing qualifiers like 'static' or 'get' initially as names and then re-parsing. This change is easier to reason about, very slightly (4%) faster in some cases (although slower in other, less common ones, though this slowdown will be fixed in an upcoming patch), and is a prerequisite for separating the parsing of object and class literal properties, which will become increasingly important as ECMAScript adds more class features. Committed: https://crrev.com/6dd26c729584024e17a05a2a76b319d4aecdc138 Cr-Commit-Position: refs/heads/master@{#39027} ==========
Message was sent while issue was closed.
Patchset 7 (id:??) landed as https://crrev.com/6dd26c729584024e17a05a2a76b319d4aecdc138 Cr-Commit-Position: refs/heads/master@{#39027}
Message was sent while issue was closed.
A revert of this CL (patchset #7 id:120001) has been created in https://codereview.chromium.org/2295743003/ by adamk@chromium.org. The reason for reverting is: Fails to reject "{*foo: 1}" as an object literal, found by the fuzzer: https://build.chromium.org/p/client.v8/builders/V8%20Fuzzer/builds/12315/step....
Message was sent while issue was closed.
On 2016/08/31 at 00:38:35, adamk wrote: > A revert of this CL (patchset #7 id:120001) has been created in https://codereview.chromium.org/2295743003/ by adamk@chromium.org. > > The reason for reverting is: Fails to reject "{*foo: 1}" as an object literal, found > by the fuzzer: > > https://build.chromium.org/p/client.v8/builders/V8%20Fuzzer/builds/12315/step.... Relanding at https://codereview.chromium.org/2300503002 |