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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 LetCont let = new LetCont(cont, null); | 263 LetCont let = new LetCont(cont, null); |
264 put(let); | 264 put(let); |
265 context = let; | 265 context = let; |
266 } | 266 } |
267 | 267 |
268 /// Inlines [target] at the current position, substituting the provided | 268 /// Inlines [target] at the current position, substituting the provided |
269 /// arguments. | 269 /// arguments. |
270 /// | 270 /// |
271 /// Returns a primitive containing the function's return value. | 271 /// Returns a primitive containing the function's return value. |
272 /// | 272 /// |
273 /// The new hole is the the point after [target] has returned. The fragment | 273 /// The new hole is the point after [target] has returned. The fragment |
274 /// remains open, even if [target] never returns. | 274 /// remains open, even if [target] never returns. |
275 /// | 275 /// |
276 /// The [target] function is destroyed and should not be reused. | 276 /// The [target] function is destroyed and should not be reused. |
277 Primitive inlineFunction( | 277 Primitive inlineFunction( |
278 FunctionDefinition target, Primitive receiver, List<Primitive> arguments, | 278 FunctionDefinition target, Primitive receiver, List<Primitive> arguments, |
279 {Entity hint, Primitive interceptor}) { | 279 {Entity hint, Primitive interceptor}) { |
280 if (interceptor != null) { | 280 if (interceptor != null) { |
281 target.interceptorParameter.replaceUsesWith(interceptor); | 281 target.interceptorParameter.replaceUsesWith(interceptor); |
282 } | 282 } |
283 if (receiver != null) { | 283 if (receiver != null) { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 while (prim.firstRef != null) { | 365 while (prim.firstRef != null) { |
366 Refinement refine = prim.firstRef.parent; | 366 Refinement refine = prim.firstRef.parent; |
367 destroyRefinementsOfDeadPrimitive(refine); | 367 destroyRefinementsOfDeadPrimitive(refine); |
368 LetPrim letPrim = refine.parent; | 368 LetPrim letPrim = refine.parent; |
369 InteriorNode parent = letPrim.parent; | 369 InteriorNode parent = letPrim.parent; |
370 parent.body = letPrim.body; | 370 parent.body = letPrim.body; |
371 letPrim.body.parent = parent; | 371 letPrim.body.parent = parent; |
372 prim.firstRef.unlink(); | 372 prim.firstRef.unlink(); |
373 } | 373 } |
374 } | 374 } |
OLD | NEW |