Index: dart/sdk/lib/_internal/lib/js_helper.dart |
diff --git a/dart/sdk/lib/_internal/lib/js_helper.dart b/dart/sdk/lib/_internal/lib/js_helper.dart |
index 507e89b59ca1481ef67033c3cb4221bc38bcd52a..b92e62f02f8dbb7db7ef82a9bfb406b0aefa5561 100644 |
--- a/dart/sdk/lib/_internal/lib/js_helper.dart |
+++ b/dart/sdk/lib/_internal/lib/js_helper.dart |
@@ -1420,7 +1420,13 @@ unwrapException(ex) { |
* Called by generated code to fetch the stack trace from an |
* exception. Should never return null. |
*/ |
-StackTrace getTraceFromException(exception) => new _StackTrace(exception); |
+StackTrace getTraceFromException(exception) { |
+ if (exception == null) return new _StackTrace(exception); |
+ _StackTrace trace = JS('_StackTrace|Null', r'#.$cachedTrace', exception); |
+ if (trace != null) return trace; |
+ trace = new _StackTrace(exception); |
+ return JS('_StackTrace', r'#.$cachedTrace = #', exception, trace); |
+} |
class _StackTrace implements StackTrace { |
var _exception; |