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

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

Issue 17389003: interceptedNames should include all interceptor method generated, not just the ones called. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments Created 7 years, 6 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 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 1532 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 } 1543 }
1544 // If [JSInvocationMirror._invokeOn] has been called, we must not create a 1544 // If [JSInvocationMirror._invokeOn] has been called, we must not create a
1545 // typed selector based on the receiver type. 1545 // typed selector based on the receiver type.
1546 if (backend.compiler.enabledInvokeOn) { 1546 if (backend.compiler.enabledInvokeOn) {
1547 return selector.asUntyped; 1547 return selector.asUntyped;
1548 } 1548 }
1549 HType receiverType = node.getDartReceiver(compiler).instructionType; 1549 HType receiverType = node.getDartReceiver(compiler).instructionType;
1550 return receiverType.refine(selector, compiler); 1550 return receiverType.refine(selector, compiler);
1551 } 1551 }
1552 1552
1553 void registerInvoke(HInvokeDynamic node, Selector selector) {
1554 if (node.isInterceptedCall) {
1555 backend.addInterceptedSelector(selector);
1556 }
1557 }
1558
1559 void registerMethodInvoke(HInvokeDynamic node) { 1553 void registerMethodInvoke(HInvokeDynamic node) {
1560 Selector selector = getOptimizedSelectorFor(node, node.selector); 1554 Selector selector = getOptimizedSelectorFor(node, node.selector);
1561 1555
1562 // If we don't know what we're calling or if we are calling a getter, 1556 // If we don't know what we're calling or if we are calling a getter,
1563 // we need to register that fact that we may be calling a closure 1557 // we need to register that fact that we may be calling a closure
1564 // with the same arguments. 1558 // with the same arguments.
1565 Element target = node.element; 1559 Element target = node.element;
1566 if (target == null || target.isGetter()) { 1560 if (target == null || target.isGetter()) {
1567 // TODO(kasperl): If we have a typed selector for the call, we 1561 // TODO(kasperl): If we have a typed selector for the call, we
1568 // may know something about the types of closures that need 1562 // may know something about the types of closures that need
1569 // the specific closure call method. 1563 // the specific closure call method.
1570 Selector call = new Selector.callClosureFrom(selector); 1564 Selector call = new Selector.callClosureFrom(selector);
1571 world.registerDynamicInvocation(call.name, call); 1565 world.registerDynamicInvocation(call.name, call);
1572 } 1566 }
1573 1567
1574 if (target != null) { 1568 if (target != null) {
1575 // If we know we're calling a specific method, register that 1569 // If we know we're calling a specific method, register that
1576 // method only. 1570 // method only.
1577 world.registerDynamicInvocationOf(target, selector); 1571 world.registerDynamicInvocationOf(target, selector);
1578 } else { 1572 } else {
1579 SourceString name = node.selector.name; 1573 SourceString name = node.selector.name;
1580 world.registerDynamicInvocation(name, selector); 1574 world.registerDynamicInvocation(name, selector);
1581 } 1575 }
1582 registerInvoke(node, selector);
1583 } 1576 }
1584 1577
1585 void registerSetter(HInvokeDynamic node) { 1578 void registerSetter(HInvokeDynamic node) {
1586 Selector selector = getOptimizedSelectorFor(node, node.selector); 1579 Selector selector = getOptimizedSelectorFor(node, node.selector);
1587 world.registerDynamicSetter(selector.name, selector); 1580 world.registerDynamicSetter(selector.name, selector);
1588 HType valueType = node.isInterceptedCall 1581 HType valueType = node.isInterceptedCall
1589 ? node.inputs[2].instructionType 1582 ? node.inputs[2].instructionType
1590 : node.inputs[1].instructionType; 1583 : node.inputs[1].instructionType;
1591 registerInvoke(node, selector);
1592 } 1584 }
1593 1585
1594 void registerGetter(HInvokeDynamic node) { 1586 void registerGetter(HInvokeDynamic node) {
1595 Selector selector = getOptimizedSelectorFor(node, node.selector); 1587 Selector selector = getOptimizedSelectorFor(node, node.selector);
1596 world.registerDynamicGetter(selector.name, selector); 1588 world.registerDynamicGetter(selector.name, selector);
1597 world.registerInstantiatedClass( 1589 world.registerInstantiatedClass(
1598 compiler.functionClass, work.resolutionTree); 1590 compiler.functionClass, work.resolutionTree);
1599 registerInvoke(node, selector);
1600 } 1591 }
1601 1592
1602 visitInvokeDynamicSetter(HInvokeDynamicSetter node) { 1593 visitInvokeDynamicSetter(HInvokeDynamicSetter node) {
1603 use(node.receiver); 1594 use(node.receiver);
1604 String name = backend.namer.invocationName(node.selector); 1595 String name = backend.namer.invocationName(node.selector);
1605 push(jsPropertyCall(pop(), name, visitArguments(node.inputs)), node); 1596 push(jsPropertyCall(pop(), name, visitArguments(node.inputs)), node);
1606 registerSetter(node); 1597 registerSetter(node);
1607 } 1598 }
1608 1599
1609 visitInvokeDynamicGetter(HInvokeDynamicGetter node) { 1600 visitInvokeDynamicGetter(HInvokeDynamicGetter node) {
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after
3021 if (leftType.canBeNull() && rightType.canBeNull()) { 3012 if (leftType.canBeNull() && rightType.canBeNull()) {
3022 if (left.isConstantNull() || right.isConstantNull() || 3013 if (left.isConstantNull() || right.isConstantNull() ||
3023 (leftType.isPrimitive(compiler) && leftType == rightType)) { 3014 (leftType.isPrimitive(compiler) && leftType == rightType)) {
3024 return '=='; 3015 return '==';
3025 } 3016 }
3026 return null; 3017 return null;
3027 } else { 3018 } else {
3028 return '==='; 3019 return '===';
3029 } 3020 }
3030 } 3021 }
OLDNEW
« no previous file with comments | « dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart ('k') | dart/tests/lib/mirrors/is_odd_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698