12019-09-24 Yury Semikhatsky <yurys@chromium.org>
2
3 Web Inspector: tests under LayoutTests/inspector/debugger are flaky
4 https://bugs.webkit.org/show_bug.cgi?id=137131
5 <rdar://problem/18461335>
6
7 Reviewed by NOBODY (OOPS!).
8
9 Changed breakpoint resolution logic to make it consistent across platforms and
10 better handle the case when there are several DebuggerPausePositions at the same
11 offset (but with different types).
12
13 * bytecode/CodeBlock.cpp:
14 (JSC::CodeBlock::hasOpDebugForLineAndColumn):
15 * bytecode/CodeBlock.h:
16 * debugger/Breakpoint.h: Removed Breakpoint::unspecifiedColumn, Optional<unsigned>
17 is used instead where needed. It allows to avoid code that relies on (int)UINT_MAX => -1
18 conversion.
19
20 * debugger/Debugger.cpp:
21 (JSC::Debugger::resolveBreakpoint): clarified that in the map columns are 0-based.
22 * debugger/DebuggerParseData.cpp:
23 (JSC::DebuggerPausePositions::breakpointLocationForLineColumn): replaced custom
24 binary search with std::lower_bound. If there are several pause positions at the
25 same offset they will be sorted by the type and the algorithm is guaranteed to see
26 leftmost one first.
27
28 (JSC::DebuggerPausePositions::sort): use type as secondary ordering component.
29 * debugger/DebuggerParseData.h: Rearranged type constants so that Enter < Pause < Leave
30 this change along with sorting by type should guarantee that in case of several pause
31 positions at the same line Enter goes before Pause before Leave and the breakpoint
32 resolution will yield result similar to that when each pause locations has different
33 position.
34
35 * inspector/protocol/Debugger.json: clarified that positions are 0-based.
36 * parser/ParserTokens.h:
37 (JSC::JSTextPosition::column const): added helper method for computing column.
38