Ignore:
Timestamp:
Jan 10, 2012, 2:08:47 PM (13 years ago)
Author:
[email protected]
Message:

CodeBlock::m_numParameters should be encapsulated
https://bugs.webkit.org/show_bug.cgi?id=75985
<rdar://problem/10671020>

Reviewed by Oliver Hunt.

Encapsulated CodeBlock::m_numParameters and hooked argument profile creation
into it. This appears to be performance neutral.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::CodeBlock):
(JSC::CodeBlock::setNumParameters):
(JSC::CodeBlock::addParameter):

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::numParameters):
(JSC::CodeBlock::addressOfNumParameters):
(JSC::CodeBlock::offsetOfNumParameters):
(JSC::CodeBlock::numberOfArgumentValueProfiles):

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::addParameter):
(JSC::BytecodeGenerator::emitReturn):

  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::AbstractState):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::ByteCodeParser):
(JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::predictArgumentTypes):

  • dfg/DFGJITCompiler.cpp:

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

  • dfg/DFGOperations.cpp:
  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::checkArgumentTypes):

  • dfg/DFGSpeculativeJIT.h:

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

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::slideRegisterWindowForCall):
(JSC::Interpreter::dumpRegisters):
(JSC::Interpreter::execute):
(JSC::Interpreter::prepareForRepeatCall):

  • jit/JIT.cpp:

(JSC::JIT::privateCompile):

  • jit/JITStubs.cpp:

(JSC::arityCheckFor):
(JSC::lazyLinkFor):

  • runtime/Executable.cpp:

(JSC::FunctionExecutable::compileForCallInternal):
(JSC::FunctionExecutable::compileForConstructInternal):

File:
1 edited

Legend:

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

    r104338 r104630  
    371371{
    372372    // This ensures enough space for the worst case scenario of zero arguments passed by the caller.
    373     if (!registerFile->grow(callFrame->registers() + registerOffset + newCodeBlock->m_numParameters + newCodeBlock->m_numCalleeRegisters))
     373    if (!registerFile->grow(callFrame->registers() + registerOffset + newCodeBlock->numParameters() + newCodeBlock->m_numCalleeRegisters))
    374374        return 0;
    375375
    376     if (argumentCountIncludingThis >= newCodeBlock->m_numParameters) {
     376    if (argumentCountIncludingThis >= newCodeBlock->numParameters()) {
    377377        Register* newCallFrame = callFrame->registers() + registerOffset;
    378378        return CallFrame::create(newCallFrame);
     
    380380
    381381    // Too few arguments -- copy arguments, then fill in missing arguments with undefined.
    382     size_t delta = newCodeBlock->m_numParameters - argumentCountIncludingThis;
     382    size_t delta = newCodeBlock->numParameters() - argumentCountIncludingThis;
    383383    CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + registerOffset + delta);
    384384
     
    603603    JSValue v;
    604604
    605     it = callFrame->registers() - RegisterFile::CallFrameHeaderSize - codeBlock->m_numParameters;
     605    it = callFrame->registers() - RegisterFile::CallFrameHeaderSize - codeBlock->numParameters();
    606606    v = (*it).jsValue();
    607607#if USE(JSVALUE32_64)
     
    610610    printf("[this]                     | %10p | %-16s %p \n", it, v.description(), JSValue::encode(v)); ++it;
    611611#endif
    612     end = it + max(codeBlock->m_numParameters - 1, 0); // - 1 to skip "this"
     612    end = it + max(codeBlock->numParameters() - 1, 0); // - 1 to skip "this"
    613613    if (it != end) {
    614614        do {
     
    986986
    987987    Register* oldEnd = m_registerFile.end();
    988     Register* newEnd = oldEnd + codeBlock->m_numParameters + RegisterFile::CallFrameHeaderSize + codeBlock->m_numCalleeRegisters;
     988    Register* newEnd = oldEnd + codeBlock->numParameters() + RegisterFile::CallFrameHeaderSize + codeBlock->m_numCalleeRegisters;
    989989    if (!m_registerFile.grow(newEnd))
    990990        return checkedReturn(throwStackOverflowError(callFrame));
    991991
    992     CallFrame* newCallFrame = CallFrame::create(oldEnd + codeBlock->m_numParameters + RegisterFile::CallFrameHeaderSize);
    993     ASSERT(codeBlock->m_numParameters == 1); // 1 parameter for 'this'.
    994     newCallFrame->init(codeBlock, 0, scopeChain, CallFrame::noCaller(), codeBlock->m_numParameters, 0);
     992    CallFrame* newCallFrame = CallFrame::create(oldEnd + codeBlock->numParameters() + RegisterFile::CallFrameHeaderSize);
     993    ASSERT(codeBlock->numParameters() == 1); // 1 parameter for 'this'.
     994    newCallFrame->init(codeBlock, 0, scopeChain, CallFrame::noCaller(), codeBlock->numParameters(), 0);
    995995    newCallFrame->setThisValue(thisObj);
    996996    TopCallFrameSetter topCallFrame(callFrame->globalData(), newCallFrame);
     
    12571257    newCallFrame->init(codeBlock, 0, scopeChain, callFrame->addHostCallFrameFlag(), argumentCountIncludingThis, function); 
    12581258    scopeChain->globalData->topCallFrame = newCallFrame;
    1259     CallFrameClosure result = { callFrame, newCallFrame, function, functionExecutable, scopeChain->globalData, oldEnd, scopeChain, codeBlock->m_numParameters, argumentCountIncludingThis };
     1259    CallFrameClosure result = { callFrame, newCallFrame, function, functionExecutable, scopeChain->globalData, oldEnd, scopeChain, codeBlock->numParameters(), argumentCountIncludingThis };
    12601260    return result;
    12611261}
     
    13681368    CallFrame* newCallFrame = CallFrame::create(m_registerFile.begin() + globalRegisterOffset);
    13691369
    1370     ASSERT(codeBlock->m_numParameters == 1); // 1 parameter for 'this'.
    1371     newCallFrame->init(codeBlock, 0, scopeChain, callFrame->addHostCallFrameFlag(), codeBlock->m_numParameters, 0);
     1370    ASSERT(codeBlock->numParameters() == 1); // 1 parameter for 'this'.
     1371    newCallFrame->init(codeBlock, 0, scopeChain, callFrame->addHostCallFrameFlag(), codeBlock->numParameters(), 0);
    13721372    newCallFrame->setThisValue(thisValue);
    13731373
Note: See TracChangeset for help on using the changeset viewer.