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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/language/bailout_test.dart » ('j') | tests/language/bailout_test.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of ssa; 5 part of ssa;
6 6
7 class SsaCodeGeneratorTask extends CompilerTask { 7 class SsaCodeGeneratorTask extends CompilerTask {
8 8
9 final JavaScriptBackend backend; 9 final JavaScriptBackend backend;
10 10
(...skipping 2594 matching lines...) Expand 10 before | Expand all | Expand 10 after
2605 if (inputLength > maxBailoutParameters) { 2605 if (inputLength > maxBailoutParameters) {
2606 maxBailoutParameters = inputLength; 2606 maxBailoutParameters = inputLength;
2607 } 2607 }
2608 }); 2608 });
2609 } 2609 }
2610 HInstruction input = guard.guarded; 2610 HInstruction input = guard.guarded;
2611 HBailoutTarget target = guard.bailoutTarget; 2611 HBailoutTarget target = guard.bailoutTarget;
2612 Namer namer = backend.namer; 2612 Namer namer = backend.namer;
2613 Element element = work.element; 2613 Element element = work.element;
2614 List<js.Expression> arguments = <js.Expression>[]; 2614 List<js.Expression> arguments = <js.Expression>[];
2615 if (element.isInstanceMember()) {
2616 arguments.add(new js.This());
2617 }
2615 arguments.add(new js.LiteralNumber("${guard.state}")); 2618 arguments.add(new js.LiteralNumber("${guard.state}"));
2616 // TODO(ngeoffray): try to put a variable at a deterministic 2619 // TODO(ngeoffray): try to put a variable at a deterministic
2617 // location, so that multiple bailout calls put the variable at 2620 // location, so that multiple bailout calls put the variable at
2618 // the same parameter index. 2621 // the same parameter index.
2619 int i = 0; 2622 int i = 0;
2620 for (; i < target.inputs.length; i++) { 2623 for (; i < target.inputs.length; i++) {
2621 assert(guard.inputs.indexOf(target.inputs[i]) >= 0); 2624 assert(guard.inputs.indexOf(target.inputs[i]) >= 0);
2622 use(target.inputs[i]); 2625 use(target.inputs[i]);
2623 arguments.add(pop()); 2626 arguments.add(pop());
2624 } 2627 }
2625 2628
2626 js.Expression bailoutTarget; 2629 js.Call call;
2627 if (element.isInstanceMember()) { 2630 if (element.isInstanceMember()) {
2628 // TODO(ngeoffray): This does not work in case we come from a 2631 String className =
2629 // super call. We must make bailout names unique. 2632 backend.namer.isolateAccess(element.getEnclosingClass());
2633 js.VariableUse classReference = new js.VariableUse(className);
2634 js.PropertyAccess prototype =
2635 new js.PropertyAccess.field(classReference, "prototype");
2630 String bailoutName = namer.getBailoutName(element); 2636 String bailoutName = namer.getBailoutName(element);
2631 bailoutTarget = new js.PropertyAccess.field(new js.This(), bailoutName); 2637 js.PropertyAccess method =
2638 new js.PropertyAccess.field(prototype, bailoutName);
2639 call = jsPropertyCall(method, "call", arguments);
2632 } else { 2640 } else {
2633 assert(!element.isField()); 2641 assert(!element.isField());
2634 bailoutTarget = new js.VariableUse(namer.isolateBailoutAccess(element)); 2642 js.Expression bailoutTarget
2643 = new js.VariableUse(namer.isolateBailoutAccess(element));
2644 call = new js.Call(bailoutTarget, arguments);
2635 } 2645 }
2636 js.Call call = new js.Call(bailoutTarget, arguments);
2637 attachLocation(call, guard); 2646 attachLocation(call, guard);
2638 return new js.Return(call); 2647 return new js.Return(call);
2639 } 2648 }
2640 2649
2641 void visitTypeGuard(HTypeGuard node) { 2650 void visitTypeGuard(HTypeGuard node) {
2642 HInstruction input = node.guarded; 2651 HInstruction input = node.guarded;
2643 DartType indexingBehavior = 2652 DartType indexingBehavior =
2644 backend.jsIndexingBehaviorInterface.computeType(compiler); 2653 backend.jsIndexingBehaviorInterface.computeType(compiler);
2645 if (node.isInteger(types)) { 2654 if (node.isInteger(types)) {
2646 // if (input is !int) bailout 2655 // if (input is !int) bailout
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
3104 if (leftType.canBeNull() && rightType.canBeNull()) { 3113 if (leftType.canBeNull() && rightType.canBeNull()) {
3105 if (left.isConstantNull() || right.isConstantNull() || 3114 if (left.isConstantNull() || right.isConstantNull() ||
3106 (leftType.isPrimitive() && leftType == rightType)) { 3115 (leftType.isPrimitive() && leftType == rightType)) {
3107 return '=='; 3116 return '==';
3108 } 3117 }
3109 return null; 3118 return null;
3110 } else { 3119 } else {
3111 return '==='; 3120 return '===';
3112 } 3121 }
3113 } 3122 }
OLDNEW
« 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