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

Side by Side Diff: sdk/lib/_internal/compiler/js_lib/js_helper.dart

Issue 1152023004: dart2js: reuse stack trace on rethrow (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 | « no previous file | tests/compiler/dart2js_extra/identical_trace_test.dart » ('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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library _js_helper; 5 library _js_helper;
6 6
7 import 'dart:_async_await_error_codes' as async_error_codes; 7 import 'dart:_async_await_error_codes' as async_error_codes;
8 8
9 import 'dart:_js_embedded_names' show 9 import 'dart:_js_embedded_names' show
10 DEFERRED_LIBRARY_URIS, 10 DEFERRED_LIBRARY_URIS,
(...skipping 2034 matching lines...) Expand 10 before | Expand all | Expand 10 after
2045 } 2045 }
2046 2046
2047 /** 2047 /**
2048 * Called by generated code to fetch the stack trace from an 2048 * Called by generated code to fetch the stack trace from an
2049 * exception. Should never return null. 2049 * exception. Should never return null.
2050 */ 2050 */
2051 StackTrace getTraceFromException(exception) { 2051 StackTrace getTraceFromException(exception) {
2052 if (exception is ExceptionAndStackTrace) { 2052 if (exception is ExceptionAndStackTrace) {
2053 return exception.stackTrace; 2053 return exception.stackTrace;
2054 } 2054 }
2055 return new _StackTrace(exception); 2055 if (exception == null) return new _StackTrace(exception);
2056 _StackTrace trace = JS('_StackTrace|Null', r'#.$cachedTrace', exception);
2057 if (trace != null) return trace;
2058 trace = new _StackTrace(exception);
2059 return JS('_StackTrace', r'#.$cachedTrace = #', exception, trace);
2056 } 2060 }
2057 2061
2058 class _StackTrace implements StackTrace { 2062 class _StackTrace implements StackTrace {
2059 var _exception; 2063 var _exception;
2060 String _trace; 2064 String _trace;
2061 _StackTrace(this._exception); 2065 _StackTrace(this._exception);
2062 2066
2063 String toString() { 2067 String toString() {
2064 if (_trace != null) return JS('String', '#', _trace); 2068 if (_trace != null) return JS('String', '#', _trace);
2065 2069
(...skipping 2023 matching lines...) Expand 10 before | Expand all | Expand 10 after
4089 // This is a function that will return a helper function that does the 4093 // This is a function that will return a helper function that does the
4090 // iteration of the sync*. 4094 // iteration of the sync*.
4091 // 4095 //
4092 // Each invocation should give a body with fresh state. 4096 // Each invocation should give a body with fresh state.
4093 final dynamic /* js function */ _outerHelper; 4097 final dynamic /* js function */ _outerHelper;
4094 4098
4095 SyncStarIterable(this._outerHelper); 4099 SyncStarIterable(this._outerHelper);
4096 4100
4097 Iterator get iterator => new SyncStarIterator(JS('', '#()', _outerHelper)); 4101 Iterator get iterator => new SyncStarIterator(JS('', '#()', _outerHelper));
4098 } 4102 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js_extra/identical_trace_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698