Ignore:
Timestamp:
Jun 18, 2012, 11:07:28 PM (13 years ago)
Author:
[email protected]
Message:

Source/JavaScriptCore: Changed JSC to always record line number information so that error.stack
and window.onerror() can report proper line numbers.
https://bugs.webkit.org/show_bug.cgi?id=89410

Patch by Mark Lam <[email protected]> on 2012-06-18
Reviewed by Geoffrey Garen.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::CodeBlock):
(JSC::CodeBlock::lineNumberForBytecodeOffset):
(JSC::CodeBlock::shrinkToFit): m_lineInfo is now available unconditionally.

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::addLineInfo):
(JSC::CodeBlock::hasLineInfo): Unused. Now removed.
(JSC::CodeBlock::needsCallReturnIndices):
(CodeBlock):
(RareData): Hoisted m_lineInfo out of m_rareData. m_lineInfo is now
filled in unconditionally.

  • bytecompiler/BytecodeGenerator.h:

(JSC::BytecodeGenerator::addLineInfo):

LayoutTests: Ensure that error.stack and window.onerror always have the appropriate
line numbers of the exception being thrown.
https://bugs.webkit.org/show_bug.cgi?id=89410

Patch by Mark Lam <[email protected]> on 2012-06-18
Reviewed by Geoffrey Garen.

  • fast/js/exception-line-number-expected.txt: Added.
  • fast/js/exception-line-number.html: Added.
  • fast/js/script-tests/exception-line-number.js: Added.

(foo):
(window.onerror):

File:
1 edited

Legend:

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

    r120244 r120676  
    16011601    , m_optimizationDelayCounter(0)
    16021602    , m_reoptimizationRetryCounter(0)
     1603    , m_lineInfo(other.m_lineInfo)
    16031604#if ENABLE(JIT)
    16041605    , m_canCompileWithDFGState(DFG::CapabilityLevelNotSet)
     
    16081609    optimizeAfterWarmUp();
    16091610    jitAfterWarmUp();
    1610    
     1611
    16111612    if (other.m_rareData) {
    16121613        createRareDataIfNecessary();
     
    16191620        m_rareData->m_stringSwitchJumpTables = other.m_rareData->m_stringSwitchJumpTables;
    16201621        m_rareData->m_expressionInfo = other.m_rareData->m_expressionInfo;
    1621         m_rareData->m_lineInfo = other.m_rareData->m_lineInfo;
    16221622    }
    16231623}
     
    21642164    ASSERT(bytecodeOffset < instructions().size());
    21652165
    2166     if (!m_rareData)
    2167         return m_ownerExecutable->source().firstLine();
    2168 
    2169     Vector<LineInfo>& lineInfo = m_rareData->m_lineInfo;
     2166    Vector<LineInfo>& lineInfo = m_lineInfo;
    21702167
    21712168    int low = 0;
     
    22922289    } // else don't shrink these, because we would have already pointed pointers into these tables.
    22932290
     2291    m_lineInfo.shrinkToFit();
    22942292    if (m_rareData) {
    22952293        m_rareData->m_exceptionHandlers.shrinkToFit();
     
    22992297        m_rareData->m_stringSwitchJumpTables.shrinkToFit();
    23002298        m_rareData->m_expressionInfo.shrinkToFit();
    2301         m_rareData->m_lineInfo.shrinkToFit();
    23022299#if ENABLE(JIT)
    23032300        m_rareData->m_callReturnIndexVector.shrinkToFit();
Note: See TracChangeset for help on using the changeset viewer.