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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/codegen.dart

Issue 13947004: dart2js: Allow 'throw' when inlining (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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: sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
index 42f055a7eda9f9a03265b893735585b4d292ce2d..aad5148e5584aeb7fa0582f10f78900b1d9d8161 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
@@ -1995,6 +1995,26 @@ abstract class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
pushStatement(new js.Throw(value));
}
+ visitThrowExpression(HThrowExpression node) {
+ HInstruction argument = node.inputs[0];
+ use(argument);
+
+ Element helper = compiler.findHelper(new SourceString("throwExpression"));
+ world.registerStaticUse(helper);
+
+ // The helper uses the non-throwing helper, so we have to register that
+ // both are used.
+ Element nonThrowingHelper =
+ compiler.findHelper(new SourceString(r"$throw"));
+ world.registerStaticUse(nonThrowingHelper);
ngeoffray 2013/04/10 12:06:39 the compilation of throwExpression will figure tha
erikcorry 2013/04/10 12:52:32 Done.
+
+ js.VariableUse jsHelper =
+ new js.VariableUse(backend.namer.isolateAccess(helper));
+ js.Call value = new js.Call(jsHelper, [pop()]);
+ attachLocation(value, argument);
+ push(value, node);
+ }
+
void visitSwitch(HSwitch node) {
// Switches are handled using [visitSwitchInfo].
}

Powered by Google App Engine
This is Rietveld 408576698