Revert of [debugger] correctly find source position of implicit return statement. (patchset #1 id:1 of https://codereview.chromium.org/1521953003/ )

Reason for revert:
Layout test failures: https://chromegw.corp.google.com/i/client.v8.fyi/builders/V8-Blink%20Mac/builds/2732/steps/webkit_tests%20%28with%20patch%29/logs/stdio

Original issue's description:
> [debugger] correctly find source position of implicit return statement.
>
> The parser reads one character beyond EOF to have an additional source
> position that the rewriter can use to insert the implicit return
> statement at the end of a script. If we break at that return statement,
> we need to be able to translate the source position to line and
> column number.
>
> R=jkummerow@chromium.org
>
> Committed: https://crrev.com/0b1076a68e1eadba260cec8afc5acec618561c28
> Cr-Commit-Position: refs/heads/master@{#32825}

TBR=jkummerow@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1526583002

Cr-Commit-Position: refs/heads/master@{#32829}
This commit is contained in:
yangguo 2015-12-14 02:25:43 -08:00 committed by Commit bot
parent 089edbfa97
commit 5a0233f6de
2 changed files with 8 additions and 14 deletions

View File

@ -11352,13 +11352,11 @@ static void CalculateLineEndsImpl(Isolate* isolate,
if (cache->IsLineTerminatorSequence(current, next)) line_ends->Add(i); if (cache->IsLineTerminatorSequence(current, next)) line_ends->Add(i);
} }
if (include_ending_line) { if (src_len > 0 && cache->IsLineTerminatorSequence(src[src_len - 1], 0)) {
// Include one character beyond the end of script. The rewriter uses that
// position for the implicit return statement.
line_ends->Add(src_len);
} else if (src_len > 0 &&
cache->IsLineTerminatorSequence(src[src_len - 1], 0)) {
line_ends->Add(src_len - 1); line_ends->Add(src_len - 1);
} else if (include_ending_line) {
// Even if the last line misses a line end, it is counted.
line_ends->Add(src_len);
} }
} }

View File

@ -63,9 +63,9 @@ var comment_lines = 28;
// This is the last position in the entire file (note: this equals // This is the last position in the entire file (note: this equals
// file size of <debug-sourceinfo.js> - 1, since starting at 0). // file size of <debug-sourceinfo.js> - 1, since starting at 0).
var last_position = 11529; var last_position = 11337;
// This is the last line of entire file (note: starting at 0). // This is the last line of entire file (note: starting at 0).
var last_line = 269; var last_line = 265;
// This is the last column of last line (note: starting at 0 and +1, due // This is the last column of last line (note: starting at 0 and +1, due
// to trailing <LF>). // to trailing <LF>).
var last_column = 1; var last_column = 1;
@ -244,22 +244,18 @@ assertEquals(70 + start_c, Debug.findFunctionSourceLocation(c, 6, 0).position);
assertEquals(0 + start_d, Debug.findFunctionSourceLocation(d, 0, 0).position); assertEquals(0 + start_d, Debug.findFunctionSourceLocation(d, 0, 0).position);
assertEquals(6 + start_d, Debug.findFunctionSourceLocation(d, 1, 0).position); assertEquals(6 + start_d, Debug.findFunctionSourceLocation(d, 1, 0).position);
for (i = 1; i <= num_lines_d; i++) { for (i = 1; i <= num_lines_d; i++) {
assertEquals(6 + (i * line_length_d) + start_d, assertEquals(6 + (i * line_length_d) + start_d, Debug.findFunctionSourceLocation(d, (i + 1), 0).position);
Debug.findFunctionSourceLocation(d, (i + 1), 0).position);
} }
assertEquals(158 + start_d, Debug.findFunctionSourceLocation(d, 17, 0).position); assertEquals(158 + start_d, Debug.findFunctionSourceLocation(d, 17, 0).position);
// Make sure invalid inputs work properly. // Make sure invalid inputs work properly.
assertEquals(0, script.locationFromPosition(-1).line); assertEquals(0, script.locationFromPosition(-1).line);
assertEquals(null, script.locationFromPosition(last_position + 2)); assertEquals(null, script.locationFromPosition(last_position + 1));
// Test last position. // Test last position.
assertEquals(last_position, script.locationFromPosition(last_position).position); assertEquals(last_position, script.locationFromPosition(last_position).position);
assertEquals(last_line, script.locationFromPosition(last_position).line); assertEquals(last_line, script.locationFromPosition(last_position).line);
assertEquals(last_column, script.locationFromPosition(last_position).column); assertEquals(last_column, script.locationFromPosition(last_position).column);
assertEquals(last_line, script.locationFromPosition(last_position + 1).line);
assertEquals(last_column + 1,
script.locationFromPosition(last_position + 1).column);
// Test that script.sourceLine(line) works. // Test that script.sourceLine(line) works.
var location; var location;