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

Issue 172753002: Re-enable Parser::symbol_cache_ (after a long time!) (Closed)

Created:
6 years, 10 months ago by marja
Modified:
6 years, 10 months ago
Reviewers:
ulan
CC:
v8-dev
Visibility:
Public.

Description

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 Committed: https://code.google.com/p/v8/source/detail?r=19505

Patch Set 1 #

Patch Set 2 : adding safeguards #

Unified diffs Side-by-side diffs Delta from patch set Stats (+56 lines, -6 lines) Patch
M src/parser.cc View 1 1 chunk +6 lines, -6 lines 0 comments Download
M src/preparser.cc View 1 chunk +1 line, -0 lines 0 comments Download
M test/cctest/cctest.h View 1 chunk +12 lines, -0 lines 0 comments Download
M test/cctest/test-parsing.cc View 1 chunk +37 lines, -0 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
marja
ulan, ptal. I'm still pretty o.O about this finding. How come nobody ever noticed?
6 years, 10 months ago (2014-02-19 18:41:26 UTC) #1
marja
Oops wait, there is more. Apparently set_pre_parse_data tries to initialize the symbol cache, but maybe ...
6 years, 10 months ago (2014-02-19 18:48:08 UTC) #2
marja
Gotcha; set_pre_parse data does symbol_cache_.Initialize(data ? data->symbol_count() : 0, zone()); but that doesn't help at ...
6 years, 10 months ago (2014-02-19 19:00:06 UTC) #3
marja
(this is ready for review now)
6 years, 10 months ago (2014-02-20 09:17:05 UTC) #4
ulan
wow, lgtm!
6 years, 10 months ago (2014-02-20 11:03:41 UTC) #5
marja
6 years, 10 months ago (2014-02-20 11:35:44 UTC) #6
Message was sent while issue was closed.
Committed patchset #2 manually as r19505 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698