Skip to content
  • ggaren@apple.com's avatar
    2011-06-21 Geoffrey Garen <ggaren@apple.com> · 829e3bbe
    ggaren@apple.com authored
            Reviewed by Oliver Hunt.
    
            Moved 'const' off the global-variable-as-local-variable crack pipe
            https://bugs.webkit.org/show_bug.cgi?id=63105
            
            This is necessary for moving the rest of the code off of same.
            
            Many problems remain in our handling of const. I have fixed none of them.
    
            * bytecompiler/BytecodeGenerator.h:
            (JSC::BytecodeGenerator::scopeChain): New accessor, needed to enable
            const to directly implement its unique scoping rules.
    
            * bytecompiler/NodesCodegen.cpp:
            (JSC::PrefixResolveNode::emitBytecode): Do specify that our resolve is
            for writing, so we don't overwrite const variables.
    
            (JSC::ConstDeclNode::emitCodeSingle): Don't assume that all declared const
            variables are available as local variables, since this won't be the case
            once global variables are not available as local variables. Instead, use
            put_scoped_var in the case where there is no local variable. Like a local
            variable, put_scoped_var succeeds even though const properties are
            read-only, since put_scoped_var skips read-only checks. (Yay?)
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@89392 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    829e3bbe