| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 cps_ir.cps_fragment; | 5 library cps_ir.cps_fragment; |
| 6 | 6 |
| 7 import 'cps_ir_nodes.dart'; | 7 import 'cps_ir_nodes.dart'; |
| 8 import '../constants/values.dart'; | 8 import '../constants/values.dart'; |
| 9 import '../universe/selector.dart' show Selector; | 9 import '../universe/selector.dart' show Selector; |
| 10 import '../types/types.dart' show TypeMask; | 10 import '../types/types.dart' show TypeMask; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 List<Primitive> arguments, | 123 List<Primitive> arguments, |
| 124 {bool receiverIsNotNull: false}) { | 124 {bool receiverIsNotNull: false}) { |
| 125 ApplyBuiltinMethod apply = | 125 ApplyBuiltinMethod apply = |
| 126 new ApplyBuiltinMethod(method, receiver, arguments, sourceInformation); | 126 new ApplyBuiltinMethod(method, receiver, arguments, sourceInformation); |
| 127 apply.receiverIsNotNull = receiverIsNotNull; | 127 apply.receiverIsNotNull = receiverIsNotNull; |
| 128 return letPrim(apply); | 128 return letPrim(apply); |
| 129 } | 129 } |
| 130 | 130 |
| 131 /// Inserts an invocation and returns a primitive holding the returned value. | 131 /// Inserts an invocation and returns a primitive holding the returned value. |
| 132 Primitive invokeMethod(Primitive receiver, | 132 Primitive invokeMethod(Primitive receiver, |
| 133 Selector selector, | 133 Selector selector, |
| 134 TypeMask mask, | 134 TypeMask mask, |
| 135 List<Primitive> arguments) { | 135 List<Primitive> arguments, |
| 136 return letPrim(new InvokeMethod(receiver, selector, mask, arguments, | 136 [CallingConvention callingConvention = CallingConvention.Normal]) { |
| 137 sourceInformation)); | 137 InvokeMethod invoke = |
| 138 new InvokeMethod(receiver, selector, mask, arguments, sourceInformation) |
| 139 ..callingConvention = callingConvention; |
| 140 return letPrim(invoke); |
| 138 } | 141 } |
| 139 | 142 |
| 140 /// Inserts an invocation and returns a primitive holding the returned value. | 143 /// Inserts an invocation and returns a primitive holding the returned value. |
| 141 Primitive invokeStatic(FunctionElement target, List<Primitive> arguments) { | 144 Primitive invokeStatic(FunctionElement target, List<Primitive> arguments) { |
| 142 return letPrim(new InvokeStatic(target, new Selector.fromElement(target), | 145 return letPrim(new InvokeStatic(target, new Selector.fromElement(target), |
| 143 arguments, sourceInformation)); | 146 arguments, sourceInformation)); |
| 144 } | 147 } |
| 145 | 148 |
| 146 /// Inserts an invocation to a static function that throws an error. | 149 /// Inserts an invocation to a static function that throws an error. |
| 147 /// | 150 /// |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 } | 342 } |
| 340 } | 343 } |
| 341 | 344 |
| 342 /// Removes [node], unlinking all its references and replaces it with [newNode]. | 345 /// Removes [node], unlinking all its references and replaces it with [newNode]. |
| 343 void destroyAndReplace(Expression node, Expression newNode) { | 346 void destroyAndReplace(Expression node, Expression newNode) { |
| 344 InteriorNode parent = node.parent; | 347 InteriorNode parent = node.parent; |
| 345 RemovalVisitor.remove(node); | 348 RemovalVisitor.remove(node); |
| 346 parent.body = newNode; | 349 parent.body = newNode; |
| 347 newNode.parent = parent; | 350 newNode.parent = parent; |
| 348 } | 351 } |
| OLD | NEW |