Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(328)

Side by Side Diff: src/objects.cc

Issue 1526583002: Revert of [debugger] correctly find source position of implicit return statement. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/debug-sourceinfo.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 11334 matching lines...) Expand 10 before | Expand all | Expand 10 after
11345 Vector<const SourceChar> src, 11345 Vector<const SourceChar> src,
11346 bool include_ending_line) { 11346 bool include_ending_line) {
11347 const int src_len = src.length(); 11347 const int src_len = src.length();
11348 UnicodeCache* cache = isolate->unicode_cache(); 11348 UnicodeCache* cache = isolate->unicode_cache();
11349 for (int i = 0; i < src_len - 1; i++) { 11349 for (int i = 0; i < src_len - 1; i++) {
11350 SourceChar current = src[i]; 11350 SourceChar current = src[i];
11351 SourceChar next = src[i + 1]; 11351 SourceChar next = src[i + 1];
11352 if (cache->IsLineTerminatorSequence(current, next)) line_ends->Add(i); 11352 if (cache->IsLineTerminatorSequence(current, next)) line_ends->Add(i);
11353 } 11353 }
11354 11354
11355 if (include_ending_line) { 11355 if (src_len > 0 && cache->IsLineTerminatorSequence(src[src_len - 1], 0)) {
11356 // Include one character beyond the end of script. The rewriter uses that 11356 line_ends->Add(src_len - 1);
11357 // position for the implicit return statement. 11357 } else if (include_ending_line) {
11358 // Even if the last line misses a line end, it is counted.
11358 line_ends->Add(src_len); 11359 line_ends->Add(src_len);
11359 } else if (src_len > 0 &&
11360 cache->IsLineTerminatorSequence(src[src_len - 1], 0)) {
11361 line_ends->Add(src_len - 1);
11362 } 11360 }
11363 } 11361 }
11364 11362
11365 11363
11366 Handle<FixedArray> String::CalculateLineEnds(Handle<String> src, 11364 Handle<FixedArray> String::CalculateLineEnds(Handle<String> src,
11367 bool include_ending_line) { 11365 bool include_ending_line) {
11368 src = Flatten(src); 11366 src = Flatten(src);
11369 // Rough estimate of line count based on a roughly estimated average 11367 // Rough estimate of line count based on a roughly estimated average
11370 // length of (unpacked) code. 11368 // length of (unpacked) code.
11371 int line_count_estimate = src->length() >> 4; 11369 int line_count_estimate = src->length() >> 4;
(...skipping 7913 matching lines...) Expand 10 before | Expand all | Expand 10 after
19285 if (cell->value() != *new_value) { 19283 if (cell->value() != *new_value) {
19286 cell->set_value(*new_value); 19284 cell->set_value(*new_value);
19287 Isolate* isolate = cell->GetIsolate(); 19285 Isolate* isolate = cell->GetIsolate();
19288 cell->dependent_code()->DeoptimizeDependentCodeGroup( 19286 cell->dependent_code()->DeoptimizeDependentCodeGroup(
19289 isolate, DependentCode::kPropertyCellChangedGroup); 19287 isolate, DependentCode::kPropertyCellChangedGroup);
19290 } 19288 }
19291 } 19289 }
19292 19290
19293 } // namespace internal 19291 } // namespace internal
19294 } // namespace v8 19292 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/debug-sourceinfo.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698