Ignore:
Timestamp:
Sep 26, 2013, 10:50:46 AM (12 years ago)
Author:
[email protected]
Message:

VirtualRegister should be a class
https://bugs.webkit.org/show_bug.cgi?id=121732

Reviewed by Geoffrey Garen.

This is a refactoring change. Changed VirtualRegister from an enum to a class.
Moved Operands::operandIsArgument(), operandToArgument(), argumentToOperand()
and the similar functions for locals to VirtualRegister class.

This is in preparation for changing the offset for the first local register from
0 to -1. This is needed since most native calling conventions have the architected
frame pointer (e.g. %rbp for X86) point at the slot that stores the previous frame
pointer. Local values start below that address.

  • bytecode/CodeBlock.cpp:
  • bytecode/CodeBlock.h:
  • bytecode/Instruction.h:
  • bytecode/LazyOperandValueProfile.h:
  • bytecode/MethodOfGettingAValueProfile.cpp:
  • bytecode/Operands.h:
  • bytecode/UnlinkedCodeBlock.cpp:
  • bytecode/UnlinkedCodeBlock.h:
  • bytecode/ValueRecovery.h:
  • bytecode/VirtualRegister.h:
  • bytecompiler/BytecodeGenerator.cpp:
  • bytecompiler/BytecodeGenerator.h:
  • bytecompiler/RegisterID.h:
  • debugger/DebuggerCallFrame.cpp:
  • dfg/DFGAbstractHeap.h:
  • dfg/DFGAbstractInterpreterInlines.h:
  • dfg/DFGArgumentPosition.h:
  • dfg/DFGArgumentsSimplificationPhase.cpp:
  • dfg/DFGByteCodeParser.cpp:
  • dfg/DFGCFGSimplificationPhase.cpp:
  • dfg/DFGCPSRethreadingPhase.cpp:
  • dfg/DFGCapabilities.cpp:
  • dfg/DFGConstantFoldingPhase.cpp:
  • dfg/DFGFlushLivenessAnalysisPhase.cpp:
  • dfg/DFGGraph.cpp:
  • dfg/DFGGraph.h:
  • dfg/DFGJITCode.cpp:
  • dfg/DFGNode.h:
  • dfg/DFGOSREntry.cpp:
  • dfg/DFGOSREntrypointCreationPhase.cpp:
  • dfg/DFGOSRExit.h:
  • dfg/DFGOSRExitCompiler32_64.cpp:
  • dfg/DFGOSRExitCompiler64.cpp:
  • dfg/DFGRegisterBank.h:
  • dfg/DFGScoreBoard.h:
  • dfg/DFGSpeculativeJIT.cpp:
  • dfg/DFGSpeculativeJIT.h:
  • dfg/DFGSpeculativeJIT64.cpp:
  • dfg/DFGValidate.cpp:
  • dfg/DFGValueRecoveryOverride.h:
  • dfg/DFGVariableAccessData.h:
  • dfg/DFGVariableEvent.h:
  • dfg/DFGVariableEventStream.cpp:
  • dfg/DFGVirtualRegisterAllocationPhase.cpp:
  • ftl/FTLExitArgumentForOperand.h:
  • ftl/FTLLink.cpp:
  • ftl/FTLLowerDFGToLLVM.cpp:
  • ftl/FTLOSREntry.cpp:
  • ftl/FTLOSRExit.cpp:
  • ftl/FTLOSRExit.h:
  • ftl/FTLOSRExitCompiler.cpp:
  • interpreter/CallFrame.h:
  • interpreter/Interpreter.cpp:
  • jit/AssemblyHelpers.h:
  • jit/JIT.h:
  • jit/JITCall.cpp:
  • jit/JITInlines.h:
  • jit/JITOpcodes.cpp:
  • jit/JITOpcodes32_64.cpp:
  • jit/JITStubs.cpp:
  • llint/LLIntSlowPaths.cpp:
  • profiler/ProfilerBytecodeSequence.cpp:
  • runtime/CommonSlowPaths.cpp:
  • runtime/JSActivation.cpp:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

    r156237 r156474  
    4949    , m_arguments(jit.codeBlock()->numParameters())
    5050    , m_variables(jit.graph().m_localVars)
    51     , m_lastSetOperand(std::numeric_limits<int>::max())
     51    , m_lastSetOperand(VirtualRegister())
    5252    , m_state(m_jit.graph())
    5353    , m_interpreter(m_jit.graph(), m_state)
     
    11841184    for (gpr_iterator iter = m_gprs.begin(); iter != m_gprs.end(); ++iter) {
    11851185        VirtualRegister virtualRegister = iter.name();
    1186         if (virtualRegister == InvalidVirtualRegister)
     1186        if (!virtualRegister.isValid())
    11871187            continue;
    11881188
     
    12101210    for (fpr_iterator iter = m_fprs.begin(); iter != m_fprs.end(); ++iter) {
    12111211        VirtualRegister virtualRegister = iter.name();
    1212         if (virtualRegister == InvalidVirtualRegister)
     1212        if (!virtualRegister.isValid())
    12131213            continue;
    12141214
     
    15391539        noticeOSRBirth(child->child1().node());
    15401540   
    1541     m_stream->appendAndLog(VariableEvent::movHint(MinifiedID(child), node->local()));
     1541    m_stream->appendAndLog(VariableEvent::movHint(MinifiedID(child), node->local().offset()));
    15421542}
    15431543
     
    15571557    for (int i = 0; i < argumentCountIncludingThis; ++i) {
    15581558        ValueRecovery recovery;
    1559         if (codeBlock->isCaptured(argumentToOperand(i)))
     1559        if (codeBlock->isCaptured(virtualRegisterForArgument(i)))
    15601560            recovery = ValueRecovery::alreadyInJSStack();
    15611561        else {
     
    16401640        ValueSource valueSource = ValueSource(ValueInJSStack);
    16411641        m_arguments[i] = valueSource;
    1642         m_stream->appendAndLog(VariableEvent::setLocal(argumentToOperand(i), valueSource.dataFormat()));
     1642        m_stream->appendAndLog(VariableEvent::setLocal(virtualRegisterForArgument(i), valueSource.dataFormat()));
    16431643    }
    16441644   
     
    16601660        m_variables[i] = valueSource;
    16611661        // FIXME: Don't emit SetLocal(Dead). https://bugs.webkit.org/show_bug.cgi?id=108019
    1662         m_stream->appendAndLog(VariableEvent::setLocal(localToOperand(i), valueSource.dataFormat()));
    1663     }
    1664    
    1665     m_lastSetOperand = std::numeric_limits<int>::max();
     1662        m_stream->appendAndLog(VariableEvent::setLocal(virtualRegisterForLocal(i), valueSource.dataFormat()));
     1663    }
     1664   
     1665    m_lastSetOperand = VirtualRegister();
    16661666    m_codeOriginForExitTarget = CodeOrigin();
    16671667    m_codeOriginForExitProfile = CodeOrigin();
Note: See TracChangeset for help on using the changeset viewer.