Changeset 39720 in webkit for trunk/JavaScriptCore/jit


Ignore:
Timestamp:
Jan 8, 2009, 2:51:19 PM (16 years ago)
Author:
[email protected]
Message:

2009-01-08 Sam Weinig <[email protected]>

Reviewed by Oliver Hunt.

Fix for https://bugs.webkit.org/show_bug.cgi?id=23197
Delay creating the PCVector until an exception is thrown
Part of <rdar://problem/6469060>
Don't store exception information for a CodeBlock until first exception is thrown

  • Change the process for re-parsing/re-generating bytecode for exception information to use data from the original CodeBlock (offsets of GlobalResolve instructions) to aid in creating an identical instruction stream on re-parse, instead of padding interchangeable opcodes, which would result in different JITed code.
  • Fix bug where the wrong ScopeChainNode was used when re-parsing/regenerating from within some odd modified scope chains.
  • Lazily create the pcVector by re-JITing the regenerated CodeBlock and stealing the the pcVector from it.

Saves ~2MB on Membuster head.

  • bytecode/CodeBlock.cpp: (JSC::CodeBlock::dump): (JSC::CodeBlock::reparseForExceptionInfoIfNecessary): (JSC::CodeBlock::hasGlobalResolveInstructionAtBytecodeOffset): (JSC::CodeBlock::hasGlobalResolveInfoAtBytecodeOffset):
  • bytecode/CodeBlock.h: (JSC::JITCodeRef::JITCodeRef): (JSC::GlobalResolveInfo::GlobalResolveInfo): (JSC::CodeBlock::getBytecodeIndex): (JSC::CodeBlock::addGlobalResolveInstruction): (JSC::CodeBlock::addGlobalResolveInfo): (JSC::CodeBlock::addFunctionRegisterInfo): (JSC::CodeBlock::hasExceptionInfo): (JSC::CodeBlock::pcVector): (JSC::EvalCodeBlock::EvalCodeBlock): (JSC::EvalCodeBlock::baseScopeDepth):
  • bytecode/Opcode.h:
  • bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::emitResolve): (JSC::BytecodeGenerator::emitGetScopedVar):
  • bytecompiler/BytecodeGenerator.h: (JSC::BytecodeGenerator::setRegeneratingForExceptionInfo):
  • interpreter/Interpreter.cpp: (JSC::bytecodeOffsetForPC): (JSC::Interpreter::unwindCallFrame): (JSC::Interpreter::privateExecute): (JSC::Interpreter::retrieveLastCaller): (JSC::Interpreter::cti_op_instanceof): (JSC::Interpreter::cti_op_call_NotJSFunction): (JSC::Interpreter::cti_op_resolve): (JSC::Interpreter::cti_op_construct_NotJSConstruct): (JSC::Interpreter::cti_op_resolve_func): (JSC::Interpreter::cti_op_resolve_skip): (JSC::Interpreter::cti_op_resolve_global): (JSC::Interpreter::cti_op_resolve_with_base): (JSC::Interpreter::cti_op_throw): (JSC::Interpreter::cti_op_in): (JSC::Interpreter::cti_vm_throw):
  • jit/JIT.cpp: (JSC::JIT::privateCompile):
  • parser/Nodes.cpp: (JSC::EvalNode::generateBytecode): (JSC::EvalNode::bytecodeForExceptionInfoReparse): (JSC::FunctionBodyNode::bytecodeForExceptionInfoReparse):
  • parser/Nodes.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/jit/JIT.cpp

    r39697 r39720  
    15991599    void* code = m_assembler.executableCopy(allocator.get());
    16001600    JITCodeRef codeRef(code, allocator);
    1601  
     1601#ifndef NDEBUG
     1602    codeRef.codeSize = m_assembler.size();
     1603#endif
     1604
    16021605    PatchBuffer patchBuffer(code);
    16031606
     
    16351638    }
    16361639
    1637     m_codeBlock->pcVector().reserveCapacity(m_calls.size());
    16381640    for (Vector<CallRecord>::iterator iter = m_calls.begin(); iter != m_calls.end(); ++iter) {
    16391641        if (iter->to)
    16401642            patchBuffer.link(iter->from, iter->to);
    1641         m_codeBlock->pcVector().append(PC(reinterpret_cast<void**>(patchBuffer.addressOf(iter->from)) - reinterpret_cast<void**>(code), iter->bytecodeIndex));
     1643    }
     1644
     1645    if (m_codeBlock->hasExceptionInfo()) {
     1646        m_codeBlock->pcVector().reserveCapacity(m_calls.size());
     1647        for (Vector<CallRecord>::iterator iter = m_calls.begin(); iter != m_calls.end(); ++iter)
     1648            m_codeBlock->pcVector().append(PC(reinterpret_cast<void**>(patchBuffer.addressOf(iter->from)) - reinterpret_cast<void**>(code), iter->bytecodeIndex));
    16421649    }
    16431650
Note: See TracChangeset for help on using the changeset viewer.