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

Unified Diff: pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart

Issue 2545923002: Keep only a single active stack trace, enables traces for thrown non-exceptions (Closed)
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/dev_compiler/test/browser/language_tests.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
index 392abf0b7fdee463d0d79b81dedd46cf8676a5ed..0e3acaf539e93fd4692da3833e2ab2b24491be9b 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
@@ -552,25 +552,20 @@ assert_(condition) => JS(
if (!$condition) $throwAssertionError();
})()''');
-final _stack = JS('', 'new WeakMap()');
+var _stack = null;
@JSExportName('throw')
throw_(obj) => JS(
'',
'''(() => {
- if ($obj != null && (typeof $obj == 'object' || typeof $obj == 'function')) {
- // TODO(jmesserly): couldn't we store the most recent stack in a single
- // variable? There should only be one active stack trace. That would
- // allow it to work for things like strings and numbers.
- $_stack.set($obj, new Error());
- }
- throw $obj;
+ $_stack = new Error();
vsm 2016/12/02 16:50:12 DBC How about saving the thrown obj also and sani
+ throw $obj;
})()''');
getError(exception) => JS(
'',
'''(() => {
- var stack = $_stack.get($exception);
- return stack !== void 0 ? stack : $exception;
+ var stack = $_stack;
+ return stack !== null ? stack : $exception;
})()''');
// This is a utility function: it is only intended to be called from dev
« no previous file with comments | « pkg/dev_compiler/test/browser/language_tests.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698