Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Issue 13450007: Refactor parser mode configuration for correctness (Closed)

Created:
7 years, 8 months ago by wingo
Modified:
7 years, 8 months ago
Base URL:
git://github.com/v8/v8.git@master
Visibility:
Public.

Description

Refactor parser mode configuration for correctness This patch refactors the parser and preparser interface to be more readable and type-safe. It has no behavior changes. Previously, parsers and preparsers were configured via bitfield called parser_flags in the Parser constructor, and flags in PreParser::PreParseProgram, ParserApi::Parse, and ParserApi::PreParse. This was error-prone in practice: six call sites passed incorrectly typed values to this interface (a boolean FLAG value, a boolean false and a boolean true value). None of these errors were caught by the compiler because it's just an "int". The parser flags interface was also awkward because it encoded a language mode, but the language mode was only used to turn on harmony scoping or not -- it wasn't used to actually set the parser's language mode. Fundamentally these errors came in because of the desire for a procedural parser interface, in ParserApi. Because we need to be able to configure the parser in various ways, the flags argument got added; but no one understood how to use the flags properly. Also they were only used by constructors: callers packed bits, and the constructors unpacked them into booleans on the parser or preparser. The solution is to allow parser construction, configuration, and invocation to be separated. This patch does that. It passes the existing tests. BUG= Committed: http://code.google.com/p/v8/source/detail?r=14151

Patch Set 1 #

Total comments: 10

Patch Set 2 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+214 lines, -240 lines) Patch
M src/api.cc View 2 chunks +3 lines, -3 lines 0 comments Download
M src/compiler.cc View 3 chunks +11 lines, -10 lines 0 comments Download
M src/hydrogen.cc View 1 chunk +1 line, -2 lines 0 comments Download
M src/liveedit.cc View 1 chunk +1 line, -1 line 0 comments Download
M src/parser.h View 1 5 chunks +37 lines, -15 lines 0 comments Download
M src/parser.cc View 1 13 chunks +60 lines, -90 lines 0 comments Download
M src/preparser.h View 1 4 chunks +31 lines, -40 lines 0 comments Download
M src/preparser.cc View 1 chunk +1 line, -1 line 0 comments Download
M src/preparser-api.cc View 1 1 chunk +3 lines, -5 lines 0 comments Download
M src/runtime.cc View 1 chunk +2 lines, -2 lines 0 comments Download
M src/scanner.h View 1 chunk +0 lines, -20 lines 0 comments Download
M test/cctest/test-parsing.cc View 1 10 chunks +64 lines, -51 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
wingo
I wrote you a novel in the commit log. Enjoy!
7 years, 8 months ago (2013-04-05 08:48:35 UTC) #1
Michael Starzinger
Looking good. Mostly nits. https://codereview.chromium.org/13450007/diff/1/src/parser.cc File src/parser.cc (right): https://codereview.chromium.org/13450007/diff/1/src/parser.cc#newcode5927 src/parser.cc:5927: return DoPreParse(source, &recorder); There doesn't ...
7 years, 8 months ago (2013-04-05 10:30:33 UTC) #2
wingo
https://codereview.chromium.org/13450007/diff/1/src/parser.cc File src/parser.cc (right): https://codereview.chromium.org/13450007/diff/1/src/parser.cc#newcode5927 src/parser.cc:5927: return DoPreParse(source, &recorder); On 2013/04/05 10:30:33, Michael Starzinger wrote: ...
7 years, 8 months ago (2013-04-05 12:00:14 UTC) #3
Michael Starzinger
LGTM. I'll land this.
7 years, 8 months ago (2013-04-05 12:09:26 UTC) #4
Michael Starzinger
7 years, 8 months ago (2013-04-05 13:01:23 UTC) #5
Message was sent while issue was closed.
Committed patchset #2 manually as r14151 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698