Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 // TODO(karlklose): share the [ParentVisitor]. |
| 6 import '../../cps_ir/optimizers.dart'; | 6 import '../../cps_ir/optimizers.dart'; |
| 7 import '../../constants/expressions.dart'; | 7 import '../../constants/expressions.dart'; |
| 8 import '../../constants/values.dart'; | 8 import '../../constants/values.dart'; |
| 9 import '../../elements/elements.dart' show | 9 import '../../elements/elements.dart' show |
| 10 ClassElement, | 10 ClassElement, |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 255 newReceiver = new Interceptor(receiver, interceptedClasses); | 255 newReceiver = new Interceptor(receiver, interceptedClasses); |
| 256 insertLetPrim(newReceiver, node); | 256 insertLetPrim(newReceiver, node); |
| 257 } | 257 } |
| 258 | 258 |
| 259 node.arguments.insert(0, node.receiver); | 259 node.arguments.insert(0, node.receiver); |
| 260 node.callingConvention = CallingConvention.JS_INTERCEPTED; | 260 node.callingConvention = CallingConvention.JS_INTERCEPTED; |
| 261 assert(node.isValid); | 261 assert(node.isValid); |
| 262 node.receiver = new Reference<Primitive>(newReceiver); | 262 node.receiver = new Reference<Primitive>(newReceiver); |
| 263 } | 263 } |
| 264 | 264 |
| 265 processTypeOperator(TypeOperator node) { | |
|
karlklose
2015/05/22 07:40:49
I think we should do this in the IR builder. Long
asgerf
2015/05/22 12:31:36
I completely agree. There is a strange limbo in th
| |
| 266 // Intercept the receiver to type operators. | |
| 267 // We don't have any type information here, so we use the set of all | |
| 268 // intercepted classes to be safe. | |
| 269 _glue.registerSpecializedGetInterceptor(_glue.interceptedClasses); | |
| 270 Primitive interceptor = | |
| 271 new Interceptor(node.receiver.definition, _glue.interceptedClasses); | |
| 272 insertLetPrim(interceptor, node); | |
| 273 node.receiver.unlink(); | |
| 274 node.receiver = new Reference<Primitive>(interceptor); | |
| 275 } | |
| 276 | |
| 265 processInvokeMethodDirectly(InvokeMethodDirectly node) { | 277 processInvokeMethodDirectly(InvokeMethodDirectly node) { |
| 266 if (_glue.isInterceptedMethod(node.target)) { | 278 if (_glue.isInterceptedMethod(node.target)) { |
| 267 Primitive nullPrim = nullConstant; | 279 Primitive nullPrim = nullConstant; |
| 268 insertLetPrim(nullPrim, node); | 280 insertLetPrim(nullPrim, node); |
| 269 node.arguments.insert(0, node.receiver); | 281 node.arguments.insert(0, node.receiver); |
| 270 // TODO(sra): `null` is not adequate. Interceptors project the class | 282 // TODO(sra): `null` is not adequate. Interceptors project the class |
| 271 // hierarchy onto an interceptor hierarchy. A super call that does a | 283 // hierarchy onto an interceptor hierarchy. A super call that does a |
| 272 // method call will use the javascript 'this' parameter to avoid calling | 284 // method call will use the javascript 'this' parameter to avoid calling |
| 273 // getInterceptor again, so the receiver must be the interceptor (likely | 285 // getInterceptor again, so the receiver must be the interceptor (likely |
| 274 // `this`), not `null`. | 286 // `this`), not `null`. |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 286 new LetPrim(i, | 298 new LetPrim(i, |
| 287 new Branch(new IsTrue(i), | 299 new Branch(new IsTrue(i), |
| 288 node.trueContinuation.definition, | 300 node.trueContinuation.definition, |
| 289 node.falseContinuation.definition))); | 301 node.falseContinuation.definition))); |
| 290 condition.value.unlink(); | 302 condition.value.unlink(); |
| 291 node.trueContinuation.unlink(); | 303 node.trueContinuation.unlink(); |
| 292 node.falseContinuation.unlink(); | 304 node.falseContinuation.unlink(); |
| 293 parent.body = newNode; | 305 parent.body = newNode; |
| 294 } | 306 } |
| 295 } | 307 } |
| OLD | NEW |