• mark.lam@apple.com's avatar
    Adding UnlinkedCodeBlock::opDebugBytecodeOffsetForLineAndColumn().. · 440584f1
    mark.lam@apple.com authored
    Reviewed by Geoffrey Garen.
    In order to implement bytecode level breakpoints, we need a mechanism
    for computing the best fit op_debug bytecode offset for any valid given
    line and column value in the source. The "best fit" op_debug bytecode
    in this case is defined below in the comment for
    * GNUmakefile.list.am:
    * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
    * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
    * JavaScriptCore.xcodeproj/project.pbxproj:
    * bytecode/CodeBlock.cpp:
    - Convert the line and column to unlinked line and column values and
      pass them to UnlinkedCodeBlock::opDebugBytecodeOffsetForLineAndColumn()
      to do the real work.
    * bytecode/CodeBlock.h:
    * bytecode/LineColumnInfo.h: Added.
    (JSC::LineColumnInfo::operator <):
    (JSC::LineColumnInfo::operator ==):
    (JSC::LineColumnInfo::operator !=):
    (JSC::LineColumnInfo::operator <=):
    (JSC::LineColumnInfo::operator >):
    (JSC::LineColumnInfo::operator >=):
    * bytecode/LineInfo.h: Removed.
    * bytecode/UnlinkedCodeBlock.cpp:
    - Factored this out of expressionRangeForBytecodeOffset() so that it can
      be called from multiple places.
    - Some dumpers for debugging use only.
    - Finds the earliest op_debug bytecode whose line and column matches the
      specified line and column values. If an exact match is not found, then
      finds the nearest op_debug bytecode that precedes the specified line
      and column values. If there are more than one op_debug at that preceding
      line and column value, then the earliest of those op_debug bytecodes will
      be be selected. The offset of the selected bytecode will be returned.
      We want the earliest one because when we have multiple op_debug bytecodes
      that map to a given line and column, a debugger user would expect to break
      on the first one and step through the rest thereafter if needed.
    - Creates the sorted opDebugLineColumnInfoList on demand. This list is
      stored in the UnlinkedCodeBlock's rareData.
    * bytecode/UnlinkedCodeBlock.h:
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162256 268f45cc-cd09-0410-ab3c-d52691b4dbfc
CodeBlock.h 47.6 KB