Chromium Code Reviews

Unified Diff: tool/input_sdk/patch/core_patch.dart

Issue 1927813002: Land fix to StackTrace.current performance already landed in dart2js. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « lib/runtime/dart_sdk.js ('k') | tool/sdk_expected_errors.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tool/input_sdk/patch/core_patch.dart
diff --git a/tool/input_sdk/patch/core_patch.dart b/tool/input_sdk/patch/core_patch.dart
index d557375c54b5bf3662b5ce40c99891fcc627bc14..52ddebdc8205f0098a60387800b92fa3c3ca3566 100644
--- a/tool/input_sdk/patch/core_patch.dart
+++ b/tool/input_sdk/patch/core_patch.dart
@@ -12,7 +12,8 @@ import 'dart:_js_helper' show patch,
JSSyntaxRegExp,
Primitives,
stringJoinUnchecked,
- objectHashCode;
+ objectHashCode,
+ getTraceFromException;
import 'dart:_foreign_helper' show JS;
@@ -458,16 +459,14 @@ class StackTrace {
@patch
@NoInline()
static StackTrace get current {
- var error = JS('', 'new Error()');
- var stack = JS('String|Null', '#.stack', error);
- if (stack is String) return new StackTrace.fromString(stack);
if (JS('', 'Error.captureStackTrace') != null) {
+ var error = JS('', 'new Error()');
JS('void', 'Error.captureStackTrace(#)', error);
- var stack = JS('String|Null', '#.stack', error);
- if (stack is String) return new StackTrace.fromString(stack);
+ return getTraceFromException(error);
}
+ // Fallback if Error.captureStackTrace does not exist.
try {
- throw 0;
+ throw '';
} catch (_, stackTrace) {
return stackTrace;
}
« no previous file with comments | « lib/runtime/dart_sdk.js ('k') | tool/sdk_expected_errors.txt » ('j') | no next file with comments »

Powered by Google App Engine