• mstarzinger@chromium.org's avatar
    Fix yield inside with · 885fd2f4
    mstarzinger@chromium.org authored
    This patch makes it so that suspending generators always saves the
    context.  Previously we erroneously assumed that if the operand stack
    was empty, that the context would be unchanged, but that is not the case
    with "with".
    
    Fixing this brought out an interesting bug in the variable allocator.
    Yield inside with will reference a context-allocated temporary holding
    the generator object.  Before the fix, this object was looked up in the
    with context instead of the function context, because with contexts were
    not being simulated during full-codegen.  Previously this was OK as all
    variables would be given LOOKUP allocation instead of CONTEXT, but the
    context-allocated temporary invalidated this assumption.  The fix is to
    simulate the context chain more accurately in full-codegen.
    
    R=mstarzinger@chromium.org
    BUG=v8:2355
    TEST=mjsunit/harmony/generators-iteration
    
    Review URL: https://codereview.chromium.org/14416011
    
    Patch from Andy Wingo <wingo@igalia.com>.
    
    git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14454 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
    885fd2f4
full-codegen.cc 50.2 KB