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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_fragment.dart

Issue 1250633002: Add operators test to source_mapping_test. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Cleanup Created 5 years, 5 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
OLDNEW
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 102 }
103 103
104 Primitive makeZero() => makeConstant(new IntConstantValue(0)); 104 Primitive makeZero() => makeConstant(new IntConstantValue(0));
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)); 112 return letPrim(new ApplyBuiltinOperator(op, args, sourceInformation));
113 } 113 }
114 114
115 /// Inserts an invocation. binds its continuation, and returns the 115 /// Inserts an invocation. binds its continuation, and returns the
116 /// continuation parameter (i.e. the return value of the invocation). 116 /// continuation parameter (i.e. the return value of the invocation).
117 /// 117 ///
118 /// The continuation body becomes the new hole. 118 /// The continuation body becomes the new hole.
119 Parameter invokeMethod(Primitive receiver, 119 Parameter invokeMethod(Primitive receiver,
120 Selector selector, 120 Selector selector,
121 TypeMask mask, 121 TypeMask mask,
122 List<Primitive> arguments) { 122 List<Primitive> arguments) {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 /// Returns a fragment whose context is the body of the given continuation. 251 /// Returns a fragment whose context is the body of the given continuation.
252 /// 252 ///
253 /// Does not change the state of this CPS fragment. 253 /// Does not change the state of this CPS fragment.
254 /// 254 ///
255 /// Useful for building the body of a continuation created using [letCont]. 255 /// Useful for building the body of a continuation created using [letCont].
256 CpsFragment insideContinuation(Continuation cont) { 256 CpsFragment insideContinuation(Continuation cont) {
257 return new CpsFragment(sourceInformation, cont); 257 return new CpsFragment(sourceInformation, cont);
258 } 258 }
259 259
260 /// Puts the given fragment into this one. 260 /// Puts the given fragment into this one.
261 /// 261 ///
262 /// If [other] was an open fragment, its hole becomes the new hole 262 /// If [other] was an open fragment, its hole becomes the new hole
263 /// in this fragment. 263 /// in this fragment.
264 /// 264 ///
265 /// [other] is reset to an empty fragment after this. 265 /// [other] is reset to an empty fragment after this.
266 void append(CpsFragment other) { 266 void append(CpsFragment other) {
267 if (other.root == null) return; 267 if (other.root == null) return;
268 put(other.root); 268 put(other.root);
269 context = other.context; 269 context = other.context;
270 other.context = null; 270 other.context = null;
271 other.root = null; 271 other.root = null;
272 } 272 }
273 273
274 /// Reads the value of the given mutable variable. 274 /// Reads the value of the given mutable variable.
275 Primitive getMutable(MutableVariable variable) { 275 Primitive getMutable(MutableVariable variable) {
276 return letPrim(new GetMutableVariable(variable)); 276 return letPrim(new GetMutableVariable(variable));
277 } 277 }
278 278
279 /// Sets the value of the given mutable variable. 279 /// Sets the value of the given mutable variable.
280 void setMutable(MutableVariable variable, Primitive value) { 280 void setMutable(MutableVariable variable, Primitive value) {
281 SetMutableVariable setter = new SetMutableVariable(variable, value); 281 SetMutableVariable setter = new SetMutableVariable(variable, value);
282 put(setter); 282 put(setter);
283 context = setter; 283 context = setter;
284 } 284 }
285 285
286 /// Declare a new mutable variable. 286 /// Declare a new mutable variable.
287 void letMutable(MutableVariable variable, Primitive initialValue) { 287 void letMutable(MutableVariable variable, Primitive initialValue) {
288 LetMutable let = new LetMutable(variable, initialValue); 288 LetMutable let = new LetMutable(variable, initialValue);
289 put(let); 289 put(let);
290 context = let; 290 context = let;
291 } 291 }
292 } 292 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart » ('j') | pkg/compiler/lib/src/io/position_information.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698