OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library tree_ir_builder; | 5 library tree_ir_builder; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../constants/values.dart'; | 8 import '../constants/values.dart'; |
9 import '../cps_ir/cps_ir_nodes.dart' as cps_ir; | 9 import '../cps_ir/cps_ir_nodes.dart' as cps_ir; |
10 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 getVariableUse(node.value)); | 574 getVariableUse(node.value)); |
575 } | 575 } |
576 | 576 |
577 Expression visitInvokeStatic(cps_ir.InvokeStatic node) { | 577 Expression visitInvokeStatic(cps_ir.InvokeStatic node) { |
578 List<Expression> arguments = translateArguments(node.arguments); | 578 List<Expression> arguments = translateArguments(node.arguments); |
579 return new InvokeStatic(node.target, node.selector, arguments, | 579 return new InvokeStatic(node.target, node.selector, arguments, |
580 node.sourceInformation); | 580 node.sourceInformation); |
581 } | 581 } |
582 | 582 |
583 Expression visitInvokeMethod(cps_ir.InvokeMethod node) { | 583 Expression visitInvokeMethod(cps_ir.InvokeMethod node) { |
| 584 if (node.callingConvention == cps_ir.CallingConvention.OneShotIntercepted) { |
| 585 List<Expression> arguments = new List.generate( |
| 586 1 + node.arguments.length, |
| 587 (n) => getVariableUse(n == 0 ? node.receiver : node.arguments[n - 1]), |
| 588 growable: false); |
| 589 return new OneShotInterceptor(node.selector, node.mask, arguments, |
| 590 node.sourceInformation); |
| 591 } |
584 InvokeMethod invoke = new InvokeMethod( | 592 InvokeMethod invoke = new InvokeMethod( |
585 getVariableUse(node.receiver), | 593 getVariableUse(node.receiver), |
586 node.selector, | 594 node.selector, |
587 node.mask, | 595 node.mask, |
588 translateArguments(node.arguments), | 596 translateArguments(node.arguments), |
589 node.sourceInformation); | 597 node.sourceInformation); |
590 // Sometimes we know the Dart receiver is non-null because it has been | 598 // Sometimes we know the Dart receiver is non-null because it has been |
591 // refined, which implies that the JS receiver also can not be null at the | 599 // refined, which implies that the JS receiver also can not be null at the |
592 // use-site. Interceptors are not refined, so this information is not | 600 // use-site. Interceptors are not refined, so this information is not |
593 // always available on the JS receiver. | 601 // always available on the JS receiver. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 internalError(CURRENT_ELEMENT_SPANNABLE, 'Unexpected IR node: $node'); | 699 internalError(CURRENT_ELEMENT_SPANNABLE, 'Unexpected IR node: $node'); |
692 } | 700 } |
693 | 701 |
694 visitFunctionDefinition(cps_ir.FunctionDefinition node) { | 702 visitFunctionDefinition(cps_ir.FunctionDefinition node) { |
695 unexpectedNode(node); | 703 unexpectedNode(node); |
696 } | 704 } |
697 visitParameter(cps_ir.Parameter node) => unexpectedNode(node); | 705 visitParameter(cps_ir.Parameter node) => unexpectedNode(node); |
698 visitContinuation(cps_ir.Continuation node) => unexpectedNode(node); | 706 visitContinuation(cps_ir.Continuation node) => unexpectedNode(node); |
699 visitMutableVariable(cps_ir.MutableVariable node) => unexpectedNode(node); | 707 visitMutableVariable(cps_ir.MutableVariable node) => unexpectedNode(node); |
700 } | 708 } |
OLD | NEW |