• marja@chromium.org's avatar
    Re-enable Parser::symbol_cache_ (after a long time!) · 0a01afda
    marja@chromium.org authored
    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
    0a01afda
cctest.h 13.3 KB