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

Side by Side Diff: pkg/compiler/lib/src/js_backend/codegen/unsugar.dart

Issue 1204733002: dart2js cps: Make Identical a built-in and add Interceptor to Tree IR. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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 library dart2js.unsugar_cps; 1 library dart2js.unsugar_cps;
2 2
3 import '../../cps_ir/cps_ir_nodes.dart'; 3 import '../../cps_ir/cps_ir_nodes.dart';
4 4
5 import '../../cps_ir/optimizers.dart' show ParentVisitor; 5 import '../../cps_ir/optimizers.dart' show ParentVisitor;
6 import '../../constants/expressions.dart'; 6 import '../../constants/expressions.dart';
7 import '../../constants/values.dart'; 7 import '../../constants/values.dart';
8 import '../../elements/elements.dart' show 8 import '../../elements/elements.dart' show
9 ClassElement, 9 ClassElement,
10 FieldElement, 10 FieldElement,
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 originalBody.body = function.body; 118 originalBody.body = function.body;
119 119
120 Continuation returnFalse = new Continuation(<Parameter>[]); 120 Continuation returnFalse = new Continuation(<Parameter>[]);
121 Primitive falsePrimitive = falseConstant; 121 Primitive falsePrimitive = falseConstant;
122 returnFalse.body = 122 returnFalse.body =
123 new LetPrim(falsePrimitive, 123 new LetPrim(falsePrimitive,
124 new InvokeContinuation( 124 new InvokeContinuation(
125 function.returnContinuation, <Primitive>[falsePrimitive])); 125 function.returnContinuation, <Primitive>[falsePrimitive]));
126 126
127 Primitive nullPrimitive = nullConstant; 127 Primitive nullPrimitive = nullConstant;
128 Primitive test = new Identical(function.parameters.single, nullPrimitive); 128 Primitive test = new ApplyBuiltinOperator(
129 BuiltinOperator.Identical,
130 <Primitive>[function.parameters.single, nullPrimitive]);
129 131
130 Expression newBody = 132 Expression newBody =
131 new LetCont.many(<Continuation>[returnFalse, originalBody], 133 new LetCont.many(<Continuation>[returnFalse, originalBody],
132 new LetPrim(nullPrimitive, 134 new LetPrim(nullPrimitive,
133 new LetPrim(test, 135 new LetPrim(test,
134 new Branch( 136 new Branch(
135 new IsTrue(test), 137 new IsTrue(test),
136 returnFalse, 138 returnFalse,
137 originalBody)))); 139 originalBody))));
138 function.body = newBody; 140 function.body = newBody;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 // `this`), not `null`. 265 // `this`), not `null`.
264 node.receiver = new Reference<Primitive>(nullPrim); 266 node.receiver = new Reference<Primitive>(nullPrim);
265 } 267 }
266 } 268 }
267 269
268 processBranch(Branch node) { 270 processBranch(Branch node) {
269 // TODO(karlklose): implement the checked mode part of boolean conversion. 271 // TODO(karlklose): implement the checked mode part of boolean conversion.
270 InteriorNode parent = node.parent; 272 InteriorNode parent = node.parent;
271 IsTrue condition = node.condition; 273 IsTrue condition = node.condition;
272 Primitive t = trueConstant; 274 Primitive t = trueConstant;
273 Primitive i = new Identical(condition.value.definition, t); 275 Primitive i = new ApplyBuiltinOperator(
276 BuiltinOperator.Identical,
277 <Primitive>[condition.value.definition, t]);
274 LetPrim newNode = new LetPrim(t, 278 LetPrim newNode = new LetPrim(t,
275 new LetPrim(i, 279 new LetPrim(i,
276 new Branch(new IsTrue(i), 280 new Branch(new IsTrue(i),
277 node.trueContinuation.definition, 281 node.trueContinuation.definition,
278 node.falseContinuation.definition))); 282 node.falseContinuation.definition)));
279 condition.value.unlink(); 283 condition.value.unlink();
280 node.trueContinuation.unlink(); 284 node.trueContinuation.unlink();
281 node.falseContinuation.unlink(); 285 node.falseContinuation.unlink();
282 parent.body = newNode; 286 parent.body = newNode;
283 } 287 }
284 288
285 processInterceptor(Interceptor node) { 289 processInterceptor(Interceptor node) {
286 _glue.registerSpecializedGetInterceptor(node.interceptedClasses); 290 _glue.registerSpecializedGetInterceptor(node.interceptedClasses);
287 } 291 }
288 } 292 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698