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

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

Issue 768553002: Add support for (unintercepted) method calls to the cps js emitter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: move jsPropertyCall to js builder. Created 6 years 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
« no previous file with comments | « pkg/compiler/lib/src/js/builder.dart ('k') | pkg/compiler/lib/src/js_backend/codegen/glue.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 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 code_generator; 5 library code_generator;
6 6
7 import 'glue.dart'; 7 import 'glue.dart';
8 8
9 import '../../tree_ir/tree_ir_nodes.dart' as tree_ir; 9 import '../../tree_ir/tree_ir_nodes.dart' as tree_ir;
10 import '../../js/js.dart' as js; 10 import '../../js/js.dart' as js;
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 compileConstant); 178 compileConstant);
179 return new js.Call(elementAccess, compiledArguments); 179 return new js.Call(elementAccess, compiledArguments);
180 } 180 }
181 181
182 @override 182 @override
183 js.Expression visitInvokeConstructor(tree_ir.InvokeConstructor node) { 183 js.Expression visitInvokeConstructor(tree_ir.InvokeConstructor node) {
184 if (node.constant != null) return giveup(node); 184 if (node.constant != null) return giveup(node);
185 return buildStaticInvoke(node.selector, node.target, node.arguments); 185 return buildStaticInvoke(node.selector, node.target, node.arguments);
186 } 186 }
187 187
188 void registerMethodInvoke(tree_ir.InvokeMethod node) {
189 Selector selector = node.selector;
190 // TODO(sigurdm): We should find a better place to register the call.
191 Selector call = new Selector.callClosureFrom(selector);
192 registry.registerDynamicInvocation(call);
193 registry.registerDynamicInvocation(selector);
194 }
195
188 @override 196 @override
189 js.Expression visitInvokeMethod(tree_ir.InvokeMethod node) { 197 js.Expression visitInvokeMethod(tree_ir.InvokeMethod node) {
190 return giveup(node); 198 // TODO(sigurdm): Handle intercepted invocations.
191 // TODO: implement visitInvokeMethod 199 if (glue.isIntercepted(node.selector)) giveup(node);
200 js.Expression receiver = visitExpression(node.receiver);
201
202 List<js.Expression> arguments = visitArguments(node.arguments);
203
204 String methodName = glue.invocationName(node.selector);
205 registerMethodInvoke(node);
206
207 return js.propertyCall(receiver, methodName, arguments);
192 } 208 }
193 209
194 @override 210 @override
195 js.Expression visitInvokeStatic(tree_ir.InvokeStatic node) { 211 js.Expression visitInvokeStatic(tree_ir.InvokeStatic node) {
196 return buildStaticInvoke(node.selector, node.target, node.arguments); 212 return buildStaticInvoke(node.selector, node.target, node.arguments);
197 } 213 }
198 214
199 @override 215 @override
200 js.Expression visitInvokeSuperMethod(tree_ir.InvokeSuperMethod node) { 216 js.Expression visitInvokeSuperMethod(tree_ir.InvokeSuperMethod node) {
201 return giveup(node); 217 return giveup(node);
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 accumulator.add( 391 accumulator.add(
376 buildWhile(new js.LiteralBool(true), node.body, node.label, node)); 392 buildWhile(new js.LiteralBool(true), node.body, node.label, node));
377 } 393 }
378 394
379 @override 395 @override
380 void visitReturn(tree_ir.Return node) { 396 void visitReturn(tree_ir.Return node) {
381 accumulator.add(new js.Return(visitExpression(node.value))); 397 accumulator.add(new js.Return(visitExpression(node.value)));
382 } 398 }
383 399
384 } 400 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js/builder.dart ('k') | pkg/compiler/lib/src/js_backend/codegen/glue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698