Ignore:
Timestamp:
Jan 9, 2015, 6:44:56 PM (11 years ago)
Author:
[email protected]
Message:

Breakpoint doesn't fire in this HTML5 game
https://bugs.webkit.org/show_bug.cgi?id=140269

Reviewed by Mark Lam.

Source/JavaScriptCore:

When parsing a single line cached function, use the lineStartOffset of the
location where we found the cached function instead of the cached lineStartOffset.
The cache location's lineStartOffset has not been adjusted for any possible
containing functions.

This change is not needed for multi-line cached functions. Consider the
single line source:

function outer(){function inner1(){doStuff();}; (function inner2() {doMoreStuff()})()}

The first parser pass, we parse and cache inner1() and inner2() with a lineStartOffset
of 0. Later when we parse outer() and find inner1() in the cache, SourceCode start
character is at outer()'s outermost open brace. That is what we should use for
lineStartOffset for inner1(). When done parsing inner1() we set the parsing token
to the saved location for inner1(), including the lineStartOffset of 0. We need
to use the value of lineStartOffset before we started parsing inner1(). That is
what the fix does. When we parse inner2() the lineStartOffset will be correct.

For a multi-line function, the close brace is guaranteed to be on a different line
than the open brace. Hence, its lineStartOffset will not change with the change of
the SourceCode start character

  • parser/Parser.cpp:

(JSC::Parser<LexerType>::parseFunctionInfo):

LayoutTests:

New tests that set breakpoints in functions with various line split
combinations.

  • inspector/debugger/breakpoint-columns-expected.txt: Added.
  • inspector/debugger/breakpoint-columns.html: Added.
  • inspector/debugger/resources/column-breakpoints-1.js: Added.

(columnTest1.x):
(columnTest1):
(columnTest2.x):
(columnTest2.f):
(columnTest3.x):
(columnTest3.f):
(runColumnTest1):
(runColumnTest2):
(runColumnTest3):

  • inspector/debugger/resources/column-breakpoints-2.js: Added.

(columnTest4.x):
(columnTest4.f):
(columnTest5.x):
(columnTest5):
(runColumnTest4):
(runColumnTest5):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r178224 r178232  
     12015-01-09  Michael Saboff  <[email protected]>
     2
     3        Breakpoint doesn't fire in this HTML5 game
     4        https://bugs.webkit.org/show_bug.cgi?id=140269
     5
     6        Reviewed by Mark Lam.
     7
     8        When parsing a single line cached function, use the lineStartOffset of the
     9        location where we found the cached function instead of the cached lineStartOffset.
     10        The cache location's lineStartOffset has not been adjusted for any possible
     11        containing functions.
     12
     13        This change is not needed for multi-line cached functions.  Consider the
     14        single line source:
     15
     16        function outer(){function inner1(){doStuff();}; (function inner2() {doMoreStuff()})()}
     17
     18        The first parser pass, we parse and cache inner1() and inner2() with a lineStartOffset
     19        of 0.  Later when we parse outer() and find inner1() in the cache, SourceCode start
     20        character is at outer()'s outermost open brace.  That is what we should use for
     21        lineStartOffset for inner1().  When done parsing inner1() we set the parsing token
     22        to the saved location for inner1(), including the lineStartOffset of 0.  We need
     23        to use the value of lineStartOffset before we started parsing inner1().  That is
     24        what the fix does.  When we parse inner2() the lineStartOffset will be correct.
     25
     26        For a multi-line function, the close brace is guaranteed to be on a different line
     27        than the open brace.  Hence, its lineStartOffset will not change with the change of
     28        the SourceCode start character
     29
     30        * parser/Parser.cpp:
     31        (JSC::Parser<LexerType>::parseFunctionInfo):
     32
    1332015-01-09  Joseph Pecoraro  <[email protected]>
    234
Note: See TracChangeset for help on using the changeset viewer.