Ignore:
Timestamp:
Oct 29, 2013, 4:15:09 PM (12 years ago)
Author:
[email protected]
Message:

Change local variable register allocation to start at offset -1
https://bugs.webkit.org/show_bug.cgi?id=123182

Reviewed by Geoffrey Garen.

Adjusted the virtual register mapping down by one slot. Reduced
the CallFrame header slots offsets by one. They now start at 0.
Changed arity fixup to no longer skip passed register slot 0 as this
is now part of the CallFrame header.

  • bytecode/VirtualRegister.h:

(JSC::operandIsLocal):
(JSC::operandIsArgument):
(JSC::VirtualRegister::localToOperand):
(JSC::VirtualRegister::operandToLocal):

Adjusted functions for shift in mapping from local to register offset.

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::findArgumentPositionForLocal):
(JSC::DFG::ByteCodeParser::addCall):
(JSC::DFG::ByteCodeParser::handleInlining):
(JSC::DFG::ByteCodeParser::parseBlock):

  • dfg/DFGVariableEventStream.cpp:

(JSC::DFG::VariableEventStream::reconstruct):

  • dfg/DFGVirtualRegisterAllocationPhase.cpp:

(JSC::DFG::VirtualRegisterAllocationPhase::run):

  • interpreter/CallFrame.h:

(JSC::ExecState::frameExtent):
(JSC::ExecState::offsetFor):

  • interpreter/Interpreter.cpp:

(JSC::loadVarargs):
(JSC::Interpreter::dumpRegisters):
(JSC::Interpreter::executeCall):

  • llint/LLIntData.cpp:

(JSC::LLInt::Data::performAssertions):

  • llint/LowLevelInterpreter.asm: Adjusted math to accomodate for shift in call frame slots.
  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::compileFunction):

  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::SpeculativeJIT::calleeFrameOffset):

  • interpreter/CallFrame.cpp:

(JSC::CallFrame::frameExtentInternal):

  • interpreter/JSStackInlines.h:

(JSC::JSStack::pushFrame):

  • jit/JIT.cpp:

(JSC::JIT::privateCompile):

  • jit/JITOperations.cpp:
  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::llint_slow_path_stack_check):

  • runtime/CommonSlowPaths.h:

(JSC::CommonSlowPaths::arityCheckFor):

Fixed offset calculation to use VirtualRegister and related calculation instead of
doing seperate calculations.

  • interpreter/JSStack.h: Adjusted CallFrame slots down by one. Did some miscellaneous fixing of dumpRegisters() in the process of testing the fixes.
  • jit/ThunkGenerators.cpp:

(JSC::arityFixup):

Changed arity fixup to no longer skip passed register slot 0 as this
is now part of the CallFrame header.

  • llint/LowLevelInterpreter32_64.asm:
  • llint/LowLevelInterpreter64.asm: Changed arity fixup to no longer skip passed register slot 0 as this is now part of the CallFrame header. Updated op_enter processing for the change in local registers.
  • runtime/JSGlobalObject.h: Removed the now unneeded extra slot in the global callframe
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp

    r157746 r158237  
    155155    if (!arguments) { // f.apply(x, arguments), with arguments unmodified.
    156156        unsigned argumentCountIncludingThis = callFrame->argumentCountIncludingThis();
    157         CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + firstFreeRegister - argumentCountIncludingThis - JSStack::CallFrameHeaderSize);
     157        CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + firstFreeRegister - argumentCountIncludingThis - JSStack::CallFrameHeaderSize - 1);
    158158        if (argumentCountIncludingThis > Arguments::MaxArguments + 1 || !stack->grow(newCallFrame->registers())) {
    159159            callFrame->vm().throwException(callFrame, createStackOverflowError(callFrame));
     
    169169
    170170    if (arguments.isUndefinedOrNull()) {
    171         CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + firstFreeRegister - 1 - JSStack::CallFrameHeaderSize);
     171        CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + firstFreeRegister - 1 - JSStack::CallFrameHeaderSize - 1);
    172172        if (!stack->grow(newCallFrame->registers())) {
    173173            callFrame->vm().throwException(callFrame, createStackOverflowError(callFrame));
     
    296296        visitor->computeLineAndColumn(line, unusedColumn);
    297297        dataLogF("[ReturnVPC]                | %10p | %d (line %d)\n", m_it, visitor->bytecodeOffset(), line);
    298         ++m_it;
     298        --m_it;
    299299        return StackVisitor::Done;
    300300    }
     
    316316    const Register* end;
    317317
    318     it = callFrame->registers() + JSStack::CallFrameHeaderSize + callFrame->argumentCountIncludingThis();
    319     end = callFrame->registers() + JSStack::CallFrameHeaderSize;
     318    it = callFrame->registers() + JSStack::ThisArgument + callFrame->argumentCount();
     319    end = callFrame->registers() + JSStack::ThisArgument - 1;
    320320    while (it > end) {
    321321        JSValue v = it->jsValue();
     
    323323        String name = codeBlock->nameForRegister(VirtualRegister(registerNumber));
    324324        dataLogF("[r% 3d %14s]      | %10p | %-16s 0x%lld \n", registerNumber, name.ascii().data(), it, toCString(v).data(), (long long)JSValue::encode(v));
    325         it++;
     325        --it;
    326326    }
    327327   
     
    348348    dataLogF("-----------------------------------------------------------------------------\n");
    349349
    350     int registerCount = 0;
    351 
    352350    end = it - codeBlock->m_numVars;
    353351    if (it != end) {
     
    358356            dataLogF("[r% 3d %14s]      | %10p | %-16s 0x%lld \n", registerNumber, name.ascii().data(), it, toCString(v).data(), (long long)JSValue::encode(v));
    359357            --it;
    360             --registerCount;
    361358        } while (it != end);
    362359    }
    363360    dataLogF("-----------------------------------------------------------------------------\n");
    364361
    365     end = it + codeBlock->m_numCalleeRegisters - codeBlock->m_numVars;
     362    end = it - codeBlock->m_numCalleeRegisters + codeBlock->m_numVars;
    366363    if (it != end) {
    367364        do {
    368365            JSValue v = (*it).jsValue();
    369             dataLogF("[r% 3d]                     | %10p | %-16s 0x%lld \n", registerCount, it, toCString(v).data(), (long long)JSValue::encode(v));
    370             ++it;
    371             ++registerCount;
     366            int registerNumber = it - callFrame->registers();
     367            dataLogF("[r% 3d]                     | %10p | %-16s 0x%lld \n", registerNumber, it, toCString(v).data(), (long long)JSValue::encode(v));
     368            --it;
    372369        } while (it != end);
    373370    }
Note: See TracChangeset for help on using the changeset viewer.