Ignore:
Timestamp:
Jan 18, 2014, 9:55:07 AM (11 years ago)
Author:
[email protected]
Message:

Adding UnlinkedCodeBlock::opDebugBytecodeOffsetForLineAndColumn()..
https://bugs.webkit.org/show_bug.cgi?id=127127.

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
UnlinkedCodeBlock::opDebugBytecodeOffsetForLineAndColumn().

(JSC::CodeBlock::opDebugBytecodeOffsetForLineAndColumn):

  • 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::LineColumnPair::LineColumnPair):
(JSC::LineColumnInfo::operator ==):
(JSC::LineColumnInfo::operator !=):
(JSC::LineColumnInfo::operator <=):
(JSC::LineColumnInfo::operator >):
(JSC::LineColumnInfo::operator >=):

  • bytecode/LineInfo.h: Removed.
  • bytecode/UnlinkedCodeBlock.cpp:

(JSC::UnlinkedCodeBlock::decodeExpressionRangeLineAndColumn):

  • Factored this out of expressionRangeForBytecodeOffset() so that it can be called from multiple places.

(JSC::dumpLineColumnEntry):
(JSC::UnlinkedCodeBlock::dumpExpressionRangeInfo):
(JSC::UnlinkedCodeBlock::dumpOpDebugLineColumnInfoList):

  • Some dumpers for debugging use only.

(JSC::UnlinkedCodeBlock::expressionRangeForBytecodeOffset):
(JSC::UnlinkedCodeBlock::opDebugBytecodeOffsetForLineAndColumn):

  • 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.

(JSC::compareLineColumnInfo):
(JSC::UnlinkedCodeBlock::opDebugLineColumnInfoList):

  • Creates the sorted opDebugLineColumnInfoList on demand. This list is stored in the UnlinkedCodeBlock's rareData.
  • bytecode/UnlinkedCodeBlock.h:
File:
1 edited

Legend:

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

    r162139 r162256  
    11/*
    2  * Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Apple Inc. All rights reserved.
    33 * Copyright (C) 2008 Cameron Zwarich <[email protected]>
    44 *
     
    6666#include "LLIntCallLinkInfo.h"
    6767#include "LazyOperandValueProfile.h"
    68 #include "LineInfo.h"
    6968#include "ProfilerCompilation.h"
    7069#include "RegExpObject.h"
     
    176175    void expressionRangeForBytecodeOffset(unsigned bytecodeOffset, int& divot,
    177176                                          int& startOffset, int& endOffset, unsigned& line, unsigned& column);
     177    unsigned opDebugBytecodeOffsetForLineAndColumn(unsigned& line, unsigned& column);
    178178
    179179#if ENABLE(JIT)
Note: See TracChangeset for help on using the changeset viewer.