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

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

Issue 862703002: Implement constructor bodies and initializers in CPS->JS backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed obsolete TODO Created 5 years, 11 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 | Annotate | Revision Log
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 // 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 ClassElement, FieldElement; 9 import '../../elements/elements.dart' show ClassElement, FieldElement;
10 import '../../js_backend/codegen/glue.dart'; 10 import '../../js_backend/codegen/glue.dart';
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 node.arguments.insert(0, node.receiver); 66 node.arguments.insert(0, node.receiver);
67 node.receiver = new Reference<Primitive>(intercepted); 67 node.receiver = new Reference<Primitive>(intercepted);
68 } 68 }
69 69
70 Primitive makeNull() { 70 Primitive makeNull() {
71 NullConstantValue nullConst = new NullConstantValue(); 71 NullConstantValue nullConst = new NullConstantValue();
72 return new Constant(new PrimitiveConstantExpression(nullConst)); 72 return new Constant(new PrimitiveConstantExpression(nullConst));
73 } 73 }
74 74
75 processInvokeMethodDirectly(InvokeMethodDirectly node) { 75 processInvokeMethodDirectly(InvokeMethodDirectly node) {
76 if (_glue.isInterceptedSelector(node.selector)) { 76 if (_glue.isInterceptedMethod(node.target)) {
77 Primitive nullPrim = makeNull(); 77 Primitive nullPrim = makeNull();
78 insertLetPrim(nullPrim, node); 78 insertLetPrim(nullPrim, node);
79 node.arguments.insert(0, node.receiver); 79 node.arguments.insert(0, node.receiver);
80 node.receiver = new Reference<Primitive>(nullPrim); 80 node.receiver = new Reference<Primitive>(nullPrim);
81 } 81 }
82 } 82 }
83 83
84 processBranch(Branch node) { 84 processBranch(Branch node) {
85 // TODO(karlklose): implement the checked mode part of boolean conversion. 85 // TODO(karlklose): implement the checked mode part of boolean conversion.
86 InteriorNode parent = node.parent; 86 InteriorNode parent = node.parent;
87 IsTrue condition = node.condition; 87 IsTrue condition = node.condition;
88 Primitive t = trueConstant; 88 Primitive t = trueConstant;
89 Primitive i = new Identical(condition.value.definition, t); 89 Primitive i = new Identical(condition.value.definition, t);
90 LetPrim newNode = new LetPrim(t, 90 LetPrim newNode = new LetPrim(t,
91 new LetPrim(i, 91 new LetPrim(i,
92 new Branch(new IsTrue(i), 92 new Branch(new IsTrue(i),
93 node.trueContinuation.definition, 93 node.trueContinuation.definition,
94 node.falseContinuation.definition))); 94 node.falseContinuation.definition)));
95 condition.value.unlink(); 95 condition.value.unlink();
96 node.trueContinuation.unlink(); 96 node.trueContinuation.unlink();
97 node.falseContinuation.unlink(); 97 node.falseContinuation.unlink();
98 parent.body = newNode; 98 parent.body = newNode;
99 } 99 }
100 } 100 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698