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

Side by Side Diff: tests/compiler/dart2js/sourcemaps/stacktrace_test.dart

Issue 2654023003: Add no-info mappings at start of out.js and after mapped functions (Closed)
Patch Set: Created 3 years, 10 months 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 | « tests/compiler/dart2js/sourcemaps/sourcemap_visualizer.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:convert'; 6 import 'dart:convert';
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 import 'package:async_helper/async_helper.dart'; 9 import 'package:async_helper/async_helper.dart';
10 import 'package:compiler/compiler_new.dart'; 10 import 'package:compiler/compiler_new.dart';
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 try { 109 try {
110 @{2:test}throw '$EXCEPTION_MARKER'; 110 @{2:test}throw '$EXCEPTION_MARKER';
111 } on String catch (e) { 111 } on String catch (e) {
112 rethrow; 112 rethrow;
113 } 113 }
114 } 114 }
115 ''', 115 ''',
116 ''' 116 '''
117 import 'package:expect/expect.dart'; 117 import 'package:expect/expect.dart';
118 main() { 118 main() {
119 @{1:main}test(new Class());
120 }
121 @NoInline()
122 test(c) {
123 @{2:test}c.field.method();
Johnni Winther 2017/01/25 10:44:20 Previously the stack trace for this would wrongful
Siggi Cherem (dart-lang) 2017/01/25 16:15:09 What did the frames look like before? I'm guessin
Johnni Winther 2017/01/26 09:59:14 It had multiple occurrences of the 'test' frame (f
124 }
125 class Class {
126 var field;
127 }
128 ''',
129 '''
130 import 'package:expect/expect.dart';
131 main() {
119 // This call is no longer on the stack when the error is thrown. 132 // This call is no longer on the stack when the error is thrown.
120 @{:main}test(); 133 @{:main}test();
121 } 134 }
122 @NoInline() 135 @NoInline()
123 test() async { 136 test() async {
124 @{1:test}throw '$EXCEPTION_MARKER'; 137 @{1:test}throw '$EXCEPTION_MARKER';
125 } 138 }
126 ''', 139 ''',
127 ''' 140 '''
128 import 'package:expect/expect.dart'; 141 import 'package:expect/expect.dart';
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 print("Running d8 $output"); 314 print("Running d8 $output");
302 ProcessResult runResult = Process.runSync(d8executable, 315 ProcessResult runResult = Process.runSync(d8executable,
303 ['sdk/lib/_internal/js_runtime/lib/preambles/d8.js', output]); 316 ['sdk/lib/_internal/js_runtime/lib/preambles/d8.js', output]);
304 String out = '${runResult.stderr}\n${runResult.stdout}'; 317 String out = '${runResult.stderr}\n${runResult.stdout}';
305 if (verbose) { 318 if (verbose) {
306 print('d8 output:'); 319 print('d8 output:');
307 print(out); 320 print(out);
308 } 321 }
309 List<String> lines = out.split(new RegExp(r'(\r|\n|\r\n)')); 322 List<String> lines = out.split(new RegExp(r'(\r|\n|\r\n)'));
310 List<StackTraceLine> jsStackTrace = <StackTraceLine>[]; 323 List<StackTraceLine> jsStackTrace = <StackTraceLine>[];
311 bool seenMarker = false;
312 for (String line in lines) { 324 for (String line in lines) {
313 if (seenMarker) { 325 if (line.startsWith(' at ')) {
314 line = line.trim(); 326 jsStackTrace.add(new StackTraceLine.fromText(line));
315 if (line.startsWith('at ')) {
316 jsStackTrace.add(new StackTraceLine.fromText(line));
317 }
318 } else if (line == EXCEPTION_MARKER) {
319 seenMarker = true;
320 } 327 }
321 } 328 }
322 329
323 List<StackTraceLine> dartStackTrace = <StackTraceLine>[]; 330 List<StackTraceLine> dartStackTrace = <StackTraceLine>[];
324 for (StackTraceLine line in jsStackTrace) { 331 for (StackTraceLine line in jsStackTrace) {
325 TargetEntry targetEntry = _findColumn(line.lineNo - 1, line.columnNo - 1, 332 TargetEntry targetEntry = _findColumn(line.lineNo - 1, line.columnNo - 1,
326 _findLine(sourceMap, line.lineNo - 1)); 333 _findLine(sourceMap, line.lineNo - 1));
327 if (targetEntry == null) { 334 if (targetEntry == null || targetEntry.sourceUrlId == null) {
328 dartStackTrace.add(line); 335 dartStackTrace.add(line);
329 } else { 336 } else {
330 String methodName; 337 String methodName;
331 if (targetEntry.sourceNameId != 0) { 338 if (targetEntry.sourceNameId != null) {
332 methodName = sourceMap.names[targetEntry.sourceNameId]; 339 methodName = sourceMap.names[targetEntry.sourceNameId];
333 } 340 }
334 String fileName; 341 String fileName;
335 if (targetEntry.sourceUrlId != 0) { 342 if (targetEntry.sourceUrlId != null) {
336 fileName = sourceMap.urls[targetEntry.sourceUrlId]; 343 fileName = sourceMap.urls[targetEntry.sourceUrlId];
337 } 344 }
338 dartStackTrace.add(new StackTraceLine(methodName, fileName, 345 dartStackTrace.add(new StackTraceLine(methodName, fileName,
339 targetEntry.sourceLine + 1, targetEntry.sourceColumn + 1)); 346 targetEntry.sourceLine + 1, targetEntry.sourceColumn + 1));
340 } 347 }
341 } 348 }
342 349
343 int expectedIndex = 0; 350 int expectedIndex = 0;
344 List<StackTraceLine> unexpectedLines = <StackTraceLine>[]; 351 List<StackTraceLine> unexpectedLines = <StackTraceLine>[];
345 for (StackTraceLine line in dartStackTrace) { 352 for (StackTraceLine line in dartStackTrace) {
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 String get d8executable { 502 String get d8executable {
496 if (Platform.isWindows) { 503 if (Platform.isWindows) {
497 return 'third_party/d8/windows/d8.exe'; 504 return 'third_party/d8/windows/d8.exe';
498 } else if (Platform.isLinux) { 505 } else if (Platform.isLinux) {
499 return 'third_party/d8/linux/d8'; 506 return 'third_party/d8/linux/d8';
500 } else if (Platform.isMacOS) { 507 } else if (Platform.isMacOS) {
501 return 'third_party/d8/macos/d8'; 508 return 'third_party/d8/macos/d8';
502 } 509 }
503 throw new UnsupportedError('Unsupported platform.'); 510 throw new UnsupportedError('Unsupported platform.');
504 } 511 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/sourcemaps/sourcemap_visualizer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698