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

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

Issue 11348177: Cleanup after the interceptor refactoring work, and add a new SSA instruction for an interceptor, s… (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
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 1511 matching lines...) Expand 10 before | Expand all | Expand 10 after
1522 } 1522 }
1523 } 1523 }
1524 1524
1525 js.Call jsPropertyCall(js.Expression receiver, 1525 js.Call jsPropertyCall(js.Expression receiver,
1526 String fieldName, 1526 String fieldName,
1527 List<js.Expression> arguments) { 1527 List<js.Expression> arguments) {
1528 return new js.Call(new js.PropertyAccess.field(receiver, fieldName), 1528 return new js.Call(new js.PropertyAccess.field(receiver, fieldName),
1529 arguments); 1529 arguments);
1530 } 1530 }
1531 1531
1532 void visitInterceptor(HInterceptor node) {
1533 Element element = backend.getInterceptorMethod;
1534 assert(element != null);
1535 world.registerStaticUse(element);
1536 js.VariableUse interceptor =
1537 new js.VariableUse(backend.namer.isolateAccess(element));
1538 use(node.receiver);
1539 List<js.Expression> arguments = <js.Expression>[pop()];
1540 push(new js.Call(interceptor, arguments), node);
1541 }
1542
1532 visitInvokeDynamicMethod(HInvokeDynamicMethod node) { 1543 visitInvokeDynamicMethod(HInvokeDynamicMethod node) {
1533 use(node.receiver); 1544 use(node.receiver);
1534 js.Expression object = pop(); 1545 js.Expression object = pop();
1535 SourceString name = node.selector.name; 1546 SourceString name = node.selector.name;
1536 String methodName; 1547 String methodName;
1537 List<js.Expression> arguments; 1548 List<js.Expression> arguments;
1538 Element target = node.element; 1549 Element target = node.element;
1539 1550
1540 // Avoid adding the generative constructor name to the list of 1551 // Avoid adding the generative constructor name to the list of
1541 // seen selectors. 1552 // seen selectors.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1644 Selector call = new Selector.callClosureFrom(node.selector); 1655 Selector call = new Selector.callClosureFrom(node.selector);
1645 world.registerDynamicInvocation(call.name, call); 1656 world.registerDynamicInvocation(call.name, call);
1646 // A closure can also be invoked through [HInvokeDynamicMethod] by 1657 // A closure can also be invoked through [HInvokeDynamicMethod] by
1647 // explicitly calling the [:call:] method. Therefore, we must also 1658 // explicitly calling the [:call:] method. Therefore, we must also
1648 // register types here to let the backend invalidate wrong 1659 // register types here to let the backend invalidate wrong
1649 // optimizations. 1660 // optimizations.
1650 backend.registerDynamicInvocation(node, call, types); 1661 backend.registerDynamicInvocation(node, call, types);
1651 } 1662 }
1652 1663
1653 visitInvokeStatic(HInvokeStatic node) { 1664 visitInvokeStatic(HInvokeStatic node) {
1654 if (true && 1665 if (node.typeCode() == HInstruction.INVOKE_STATIC_TYPECODE) {
1655 (node.typeCode() == HInstruction.INVOKE_STATIC_TYPECODE ||
1656 node.typeCode() == HInstruction.INVOKE_INTERCEPTOR_TYPECODE)) {
1657 // Register this invocation to collect the types used at all call sites. 1666 // Register this invocation to collect the types used at all call sites.
1658 backend.registerStaticInvocation(node, types); 1667 backend.registerStaticInvocation(node, types);
1659 } 1668 }
1660 use(node.target); 1669 use(node.target);
1661 push(new js.Call(pop(), visitArguments(node.inputs)), node); 1670 push(new js.Call(pop(), visitArguments(node.inputs)), node);
1662 } 1671 }
1663 1672
1664 visitInvokeSuper(HInvokeSuper node) { 1673 visitInvokeSuper(HInvokeSuper node) {
1665 Element superMethod = node.element; 1674 Element superMethod = node.element;
1666 Element superClass = superMethod.getEnclosingClass(); 1675 Element superClass = superMethod.getEnclosingClass();
(...skipping 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after
3054 if (leftType.canBeNull() && rightType.canBeNull()) { 3063 if (leftType.canBeNull() && rightType.canBeNull()) {
3055 if (left.isConstantNull() || right.isConstantNull() || 3064 if (left.isConstantNull() || right.isConstantNull() ||
3056 (leftType.isPrimitive() && leftType == rightType)) { 3065 (leftType.isPrimitive() && leftType == rightType)) {
3057 return '=='; 3066 return '==';
3058 } 3067 }
3059 return null; 3068 return null;
3060 } else { 3069 } else {
3061 return '==='; 3070 return '===';
3062 } 3071 }
3063 } 3072 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698