| 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/universe.dart' show Selector; | 9 import '../universe/universe.dart' show Selector; |
| 10 import '../types/types.dart' show TypeMask; | 10 import '../types/types.dart' show TypeMask; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 Primitive makeOne() => makeConstant(new IntConstantValue(1)); | 105 Primitive makeOne() => makeConstant(new IntConstantValue(1)); |
| 106 Primitive makeNull() => makeConstant(new NullConstantValue()); | 106 Primitive makeNull() => makeConstant(new NullConstantValue()); |
| 107 Primitive makeTrue() => makeConstant(new TrueConstantValue()); | 107 Primitive makeTrue() => makeConstant(new TrueConstantValue()); |
| 108 Primitive makeFalse() => makeConstant(new FalseConstantValue()); | 108 Primitive makeFalse() => makeConstant(new FalseConstantValue()); |
| 109 | 109 |
| 110 /// Invoke a built-in operator. | 110 /// Invoke a built-in operator. |
| 111 Primitive applyBuiltin(BuiltinOperator op, List<Primitive> args) { | 111 Primitive applyBuiltin(BuiltinOperator op, List<Primitive> args) { |
| 112 return letPrim(new ApplyBuiltinOperator(op, args, sourceInformation)); | 112 return letPrim(new ApplyBuiltinOperator(op, args, sourceInformation)); |
| 113 } | 113 } |
| 114 | 114 |
| 115 Primitive invokeBuiltin(BuiltinMethod method, |
| 116 Primitive receiver, |
| 117 List<Primitive> arguments, |
| 118 {bool receiverIsNotNull: false}) { |
| 119 ApplyBuiltinMethod apply = |
| 120 new ApplyBuiltinMethod(method, receiver, arguments, sourceInformation); |
| 121 apply.receiverIsNotNull = receiverIsNotNull; |
| 122 return letPrim(apply); |
| 123 } |
| 124 |
| 115 /// Inserts an invocation. binds its continuation, and returns the | 125 /// Inserts an invocation. binds its continuation, and returns the |
| 116 /// continuation parameter (i.e. the return value of the invocation). | 126 /// continuation parameter (i.e. the return value of the invocation). |
| 117 /// | 127 /// |
| 118 /// The continuation body becomes the new hole. | 128 /// The continuation body becomes the new hole. |
| 119 Parameter invokeMethod(Primitive receiver, | 129 Parameter invokeMethod(Primitive receiver, |
| 120 Selector selector, | 130 Selector selector, |
| 121 TypeMask mask, | 131 TypeMask mask, |
| 122 List<Primitive> arguments) { | 132 List<Primitive> arguments) { |
| 123 Continuation cont = new Continuation(<Parameter>[new Parameter(null)]); | 133 Continuation cont = new Continuation(<Parameter>[new Parameter(null)]); |
| 124 InvokeMethod invoke = | 134 InvokeMethod invoke = |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 letPrim(new SetMutable(variable, value)); | 291 letPrim(new SetMutable(variable, value)); |
| 282 } | 292 } |
| 283 | 293 |
| 284 /// Declare a new mutable variable. | 294 /// Declare a new mutable variable. |
| 285 void letMutable(MutableVariable variable, Primitive initialValue) { | 295 void letMutable(MutableVariable variable, Primitive initialValue) { |
| 286 LetMutable let = new LetMutable(variable, initialValue); | 296 LetMutable let = new LetMutable(variable, initialValue); |
| 287 put(let); | 297 put(let); |
| 288 context = let; | 298 context = let; |
| 289 } | 299 } |
| 290 } | 300 } |
| OLD | NEW |