Ignore:
Timestamp:
Sep 13, 2012, 5:43:04 PM (13 years ago)
Author:
[email protected]
Message:

Make global const initialisation explicit in the bytecode
https://bugs.webkit.org/show_bug.cgi?id=96711

Reviewed by Gavin Barraclough.

Added op_init_global_const to make initialisation of global const
fields explicit. This will help us keep correct semantics in the
upcoming variable resolution refactoring.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::dump):

  • bytecode/Opcode.h:

(JSC):
(JSC::padOpcodeName):

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::emitInitGlobalConst):
(JSC):

  • bytecompiler/BytecodeGenerator.h:

(BytecodeGenerator):

  • bytecompiler/NodesCodegen.cpp:

(JSC::ConstDeclNode::emitCodeSingle):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::parseBlock):

  • dfg/DFGCapabilities.h:

(JSC::DFG::canCompileOpcode):

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::privateExecute):

  • jit/JIT.cpp:

(JSC::JIT::privateCompileMainPass):
(JSC::JIT::privateCompileSlowCases):

  • llint/LowLevelInterpreter32_64.asm:
  • llint/LowLevelInterpreter64.asm:
Location:
trunk/Source/JavaScriptCore/bytecompiler
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r128400 r128534  
    16581658        return dst;
    16591659
     1660    default:
     1661        ASSERT_NOT_REACHED();
     1662        return 0;
     1663    }
     1664}
     1665
     1666RegisterID* BytecodeGenerator::emitInitGlobalConst(const ResolveResult& resolveResult, const Identifier& identifier, RegisterID* value)
     1667{
     1668    ASSERT(m_codeType == GlobalCode);
     1669    switch (resolveResult.type()) {
     1670    case ResolveResult::IndexedGlobal:
     1671    case ResolveResult::ReadOnlyIndexedGlobal:
     1672        emitOpcode(op_init_global_const);
     1673        instructions().append(resolveResult.registerPointer());
     1674        instructions().append(value->index());
     1675        return value;
     1676
     1677    case ResolveResult::WatchedIndexedGlobal:
     1678        emitOpcode(op_init_global_const_check);
     1679        instructions().append(resolveResult.registerPointer());
     1680        instructions().append(value->index());
     1681        instructions().append(jsCast<JSGlobalObject*>(resolveResult.globalObject())->symbolTable()->get(identifier.impl()).addressOfIsWatched());
     1682        instructions().append(addConstant(identifier));
     1683        return value;
     1684       
    16601685    default:
    16611686        ASSERT_NOT_REACHED();
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h

    r128260 r128534  
    463463        RegisterID* emitGetStaticVar(RegisterID* dst, const ResolveResult&, const Identifier&);
    464464        RegisterID* emitPutStaticVar(const ResolveResult&, const Identifier&, RegisterID* value);
     465        RegisterID* emitInitGlobalConst(const ResolveResult&, const Identifier&, RegisterID* value);
    465466
    466467        RegisterID* emitResolve(RegisterID* dst, const ResolveResult&, const Identifier& property);
  • trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp

    r127958 r128534  
    13881388    RefPtr<RegisterID> value = m_init ? generator.emitNode(m_init) : generator.emitLoad(0, jsUndefined());
    13891389
    1390     if (resolveResult.isStatic())
     1390    if (resolveResult.isStatic()) {
     1391        if (generator.codeType() == GlobalCode)
     1392            return generator.emitInitGlobalConst(resolveResult, m_ident, value.get());
    13911393        return generator.emitPutStaticVar(resolveResult, m_ident, value.get());
    1392    
     1394    }
    13931395    if (generator.codeType() != EvalCode)
    13941396        return value.get();
Note: See TracChangeset for help on using the changeset viewer.