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

Unified Diff: frog/leg/ssa/builder.dart

Issue 9601014: Support for stack traces in catch blocks. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: frog/leg/ssa/builder.dart
===================================================================
--- frog/leg/ssa/builder.dart (revision 5017)
+++ frog/leg/ssa/builder.dart (working copy)
@@ -93,6 +93,10 @@
Element getExceptionUnwrapper() {
return compiler.findHelper(const SourceString('unwrapException'));
}
+
+ Element getTraceFromException() {
+ return compiler.findHelper(const SourceString('getTraceFromException'));
+ }
}
class SsaBuilderTask extends CompilerTask {
@@ -2368,10 +2372,23 @@
push(new HStatic(interceptors.getExceptionUnwrapper()));
List<HInstruction> inputs = <HInstruction>[pop(), exception];
HInvokeStatic unwrappedException =
- new HInvokeStatic(Selector.INVOCATION_1, inputs);
+ new HInvokeStatic(Selector.INVOCATION_1, inputs);
add(unwrappedException);
tryInstruction.exception = exception;
+
+ bool requiresTrace = false;
+ for (CatchBlock block in node.catchBlocks) {
+ if (block.trace != null) {
+ requiresTrace = true;
+ break;
+ }
+ }
+
+ HInstruction traceInstruction = null;
ahe 2012/03/06 12:24:07 This is unused.
ngeoffray 2012/03/06 12:29:40 Done.
+ if (requiresTrace) {
ahe 2012/03/06 12:24:07 Remove this.
ngeoffray 2012/03/06 12:29:40 Done.
+ }
+
Link<Node> link = node.catchBlocks.nodes;
void pushCondition(CatchBlock catchBlock) {
@@ -2393,9 +2410,16 @@
void visitThen() {
CatchBlock catchBlock = link.head;
link = link.tail;
- VariableDefinitions declaration = catchBlock.formals.nodes.head;
- localsHandler.updateLocal(elements[declaration.definitions.nodes.head],
+ localsHandler.updateLocal(elements[catchBlock.exception],
unwrappedException);
+ Node trace = catchBlock.trace;
+ if (trace != null) {
+ push(new HStatic(interceptors.getTraceFromException()));
+ HInstruction traceInstruction = new HInvokeStatic(
+ Selector.INVOCATION_1, <HInstruction>[pop(), exception]);
+ add(traceInstruction);
+ localsHandler.updateLocal(elements[trace], traceInstruction);
+ }
visit(catchBlock);
}
« no previous file with comments | « frog/leg/lib/js_helper.dart ('k') | frog/leg/ssa/codegen.dart » ('j') | frog/leg/tree/nodes.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698