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

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

Issue 1155463005: dart2js cps: Remove dart2dart from cps pipeline and clean up. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Skip tests specific to the dart backend Created 5 years, 6 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
« no previous file with comments | « pkg/compiler/lib/src/js_backend/codegen/task.dart ('k') | pkg/compiler/lib/src/tracer.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // TODO(karlklose): share the [ParentVisitor]. 5 import '../../cps_ir/optimizers.dart' show ParentVisitor;
6 import '../../cps_ir/optimizers.dart';
7 import '../../constants/expressions.dart'; 6 import '../../constants/expressions.dart';
8 import '../../constants/values.dart'; 7 import '../../constants/values.dart';
9 import '../../elements/elements.dart' show 8 import '../../elements/elements.dart' show
10 ClassElement, 9 ClassElement,
11 FieldElement, 10 FieldElement,
12 FunctionElement, 11 FunctionElement,
13 Local, 12 Local,
14 ExecutableElement; 13 ExecutableElement;
15 import '../../js_backend/codegen/glue.dart'; 14 import '../../js_backend/codegen/glue.dart';
16 import '../../dart2jslib.dart' show Selector, World; 15 import '../../dart2jslib.dart' show Selector, World;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // body; 116 // body;
118 // 117 //
119 // with 118 // with
120 // 119 //
121 // if (identical(arg, null)) 120 // if (identical(arg, null))
122 // return false; 121 // return false;
123 // else 122 // else
124 // body; 123 // body;
125 // 124 //
126 Continuation originalBody = new Continuation(<Parameter>[]); 125 Continuation originalBody = new Continuation(<Parameter>[]);
127 originalBody.body = function.body.body; 126 originalBody.body = function.body;
128 127
129 Continuation returnFalse = new Continuation(<Parameter>[]); 128 Continuation returnFalse = new Continuation(<Parameter>[]);
130 Primitive falsePrimitive = falseConstant; 129 Primitive falsePrimitive = falseConstant;
131 returnFalse.body = 130 returnFalse.body =
132 new LetPrim(falsePrimitive, 131 new LetPrim(falsePrimitive,
133 new InvokeContinuation( 132 new InvokeContinuation(
134 function.body.returnContinuation, <Primitive>[falsePrimitive])); 133 function.returnContinuation, <Primitive>[falsePrimitive]));
135 134
136 Primitive nullPrimitive = nullConstant; 135 Primitive nullPrimitive = nullConstant;
137 Primitive test = new Identical(function.parameters.single, nullPrimitive); 136 Primitive test = new Identical(function.parameters.single, nullPrimitive);
138 137
139 Expression newBody = 138 Expression newBody =
140 new LetCont.many(<Continuation>[returnFalse, originalBody], 139 new LetCont.many(<Continuation>[returnFalse, originalBody],
141 new LetPrim(nullPrimitive, 140 new LetPrim(nullPrimitive,
142 new LetPrim(test, 141 new LetPrim(test,
143 new Branch( 142 new Branch(
144 new IsTrue(test), 143 new IsTrue(test),
145 returnFalse, 144 returnFalse,
146 originalBody)))); 145 originalBody))));
147 function.body.body = newBody; 146 function.body = newBody;
148 } 147 }
149 148
150 /// Insert a static call to [function] at the point of [node] with result 149 /// Insert a static call to [function] at the point of [node] with result
151 /// [result]. 150 /// [result].
152 /// 151 ///
153 /// Rewrite [node] to 152 /// Rewrite [node] to
154 /// 153 ///
155 /// let cont continuation(result) = node 154 /// let cont continuation(result) = node
156 /// in invoke function arguments continuation 155 /// in invoke function arguments continuation
157 void insertStaticCall(FunctionElement function, List<Primitive> arguments, 156 void insertStaticCall(FunctionElement function, List<Primitive> arguments,
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 // TODO(sra): Move the computation of interceptedClasses to a much later 249 // TODO(sra): Move the computation of interceptedClasses to a much later
251 // phase and take into account the remaining uses of the interceptor. 250 // phase and take into account the remaining uses of the interceptor.
252 Set<ClassElement> interceptedClasses = 251 Set<ClassElement> interceptedClasses =
253 _glue.getInterceptedClassesOn(selector); 252 _glue.getInterceptedClassesOn(selector);
254 _glue.registerSpecializedGetInterceptor(interceptedClasses); 253 _glue.registerSpecializedGetInterceptor(interceptedClasses);
255 newReceiver = new Interceptor(receiver, interceptedClasses); 254 newReceiver = new Interceptor(receiver, interceptedClasses);
256 insertLetPrim(newReceiver, node); 255 insertLetPrim(newReceiver, node);
257 } 256 }
258 257
259 node.arguments.insert(0, node.receiver); 258 node.arguments.insert(0, node.receiver);
260 node.callingConvention = CallingConvention.JS_INTERCEPTED;
261 assert(node.isValid);
262 node.receiver = new Reference<Primitive>(newReceiver); 259 node.receiver = new Reference<Primitive>(newReceiver);
263 } 260 }
264 261
265 processInvokeMethodDirectly(InvokeMethodDirectly node) { 262 processInvokeMethodDirectly(InvokeMethodDirectly node) {
266 if (_glue.isInterceptedMethod(node.target)) { 263 if (_glue.isInterceptedMethod(node.target)) {
267 Primitive nullPrim = nullConstant; 264 Primitive nullPrim = nullConstant;
268 insertLetPrim(nullPrim, node); 265 insertLetPrim(nullPrim, node);
269 node.arguments.insert(0, node.receiver); 266 node.arguments.insert(0, node.receiver);
270 // TODO(sra): `null` is not adequate. Interceptors project the class 267 // TODO(sra): `null` is not adequate. Interceptors project the class
271 // hierarchy onto an interceptor hierarchy. A super call that does a 268 // hierarchy onto an interceptor hierarchy. A super call that does a
(...skipping 18 matching lines...) Expand all
290 condition.value.unlink(); 287 condition.value.unlink();
291 node.trueContinuation.unlink(); 288 node.trueContinuation.unlink();
292 node.falseContinuation.unlink(); 289 node.falseContinuation.unlink();
293 parent.body = newNode; 290 parent.body = newNode;
294 } 291 }
295 292
296 processInterceptor(Interceptor node) { 293 processInterceptor(Interceptor node) {
297 _glue.registerSpecializedGetInterceptor(node.interceptedClasses); 294 _glue.registerSpecializedGetInterceptor(node.interceptedClasses);
298 } 295 }
299 } 296 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/codegen/task.dart ('k') | pkg/compiler/lib/src/tracer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698