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

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

Issue 11416007: Fix this longstanding bug that luckily did not bite us yet: Use Class.prototype.foo$bailout.call(th… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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 | « no previous file | tests/language/bailout_test.dart » ('j') | tests/language/bailout_test.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/ssa/codegen.dart (revision 14946)
+++ sdk/lib/_internal/compiler/implementation/ssa/codegen.dart (working copy)
@@ -2612,6 +2612,9 @@
Namer namer = backend.namer;
Element element = work.element;
List<js.Expression> arguments = <js.Expression>[];
+ if (element.isInstanceMember()) {
+ arguments.add(new js.This());
+ }
arguments.add(new js.LiteralNumber("${guard.state}"));
// TODO(ngeoffray): try to put a variable at a deterministic
// location, so that multiple bailout calls put the variable at
@@ -2623,17 +2626,23 @@
arguments.add(pop());
}
- js.Expression bailoutTarget;
+ js.Call call;
if (element.isInstanceMember()) {
- // TODO(ngeoffray): This does not work in case we come from a
- // super call. We must make bailout names unique.
+ String className =
+ backend.namer.isolateAccess(element.getEnclosingClass());
+ js.VariableUse classReference = new js.VariableUse(className);
+ js.PropertyAccess prototype =
+ new js.PropertyAccess.field(classReference, "prototype");
String bailoutName = namer.getBailoutName(element);
- bailoutTarget = new js.PropertyAccess.field(new js.This(), bailoutName);
+ js.PropertyAccess method =
+ new js.PropertyAccess.field(prototype, bailoutName);
+ call = jsPropertyCall(method, "call", arguments);
} else {
assert(!element.isField());
- bailoutTarget = new js.VariableUse(namer.isolateBailoutAccess(element));
+ js.Expression bailoutTarget
+ = new js.VariableUse(namer.isolateBailoutAccess(element));
+ call = new js.Call(bailoutTarget, arguments);
}
- js.Call call = new js.Call(bailoutTarget, arguments);
attachLocation(call, guard);
return new js.Return(call);
}
« no previous file with comments | « no previous file | tests/language/bailout_test.dart » ('j') | tests/language/bailout_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698