Ignore:
Timestamp:
Dec 12, 2008, 2:48:53 PM (16 years ago)
Author:
[email protected]
Message:

2008-12-12 Cameron Zwarich <[email protected]>

Reviewed by Sam Weinig.

Bug 22828: Do not inspect bytecode instruction stream for op_get_by_id exception information
<https://bugs.webkit.org/show_bug.cgi?id=22828>

In order to remove the bytecode instruction stream after generating
native code, all inspection of bytecode instructions at runtime must
be removed. One particular instance of this is the special handling of
exceptions thrown by the op_get_by_id emitted directly before an
op_construct or an op_instanceof. This patch moves that information to
an auxiliary data structure in CodeBlock.

  • bytecode/CodeBlock.cpp: (JSC::CodeBlock::getByIdExceptionInfoForBytecodeOffset):
  • bytecode/CodeBlock.h: (JSC::CodeBlock::addGetByIdExceptionInfo):
  • bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitConstruct):
  • bytecompiler/BytecodeGenerator.h: (JSC::BytecodeGenerator::emitGetByIdExceptionInfo):
  • parser/Nodes.cpp: (JSC::InstanceOfNode::emitBytecode):
  • runtime/ExceptionHelpers.cpp: (JSC::createNotAnObjectError):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/bytecode/CodeBlock.cpp

    r39252 r39255  
    14071407}
    14081408
     1409bool CodeBlock::getByIdExceptionInfoForBytecodeOffset(unsigned bytecodeOffset, OpcodeID& opcodeID)
     1410{
     1411    ASSERT(bytecodeOffset < m_instructions.size());
     1412
     1413    if (!m_getByIdExceptionInfo.size())
     1414        return false;
     1415
     1416    int low = 0;
     1417    int high = m_getByIdExceptionInfo.size();
     1418    while (low < high) {
     1419        int mid = low + (high - low) / 2;
     1420        if (m_getByIdExceptionInfo[mid].bytecodeOffset <= bytecodeOffset)
     1421            low = mid + 1;
     1422        else
     1423            high = mid;
     1424    }
     1425
     1426    if (!low)
     1427        return false;
     1428
     1429    opcodeID = m_getByIdExceptionInfo[low - 1].isOpConstruct ? op_construct : op_instanceof;
     1430    return true;
     1431}
     1432
    14091433void CodeBlock::shrinkToFit()
    14101434{
Note: See TracChangeset for help on using the changeset viewer.