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

Side by Side Diff: lib/compiler/implementation/ssa/builder.dart

Issue 10832351: Reuse static getter function when invoking non-function statics. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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
« no previous file with comments | « no previous file | no next file » | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 class Interceptors { 5 class Interceptors {
6 Compiler compiler; 6 Compiler compiler;
7 Interceptors(Compiler this.compiler); 7 Interceptors(Compiler this.compiler);
8 8
9 SourceString mapOperatorToMethodName(Operator op) { 9 SourceString mapOperatorToMethodName(Operator op) {
10 String name = op.source.stringValue; 10 String name = op.source.stringValue;
(...skipping 2334 matching lines...) Expand 10 before | Expand all | Expand 10 after
2345 } 2345 }
2346 } 2346 }
2347 2347
2348 visitStaticSend(Send node) { 2348 visitStaticSend(Send node) {
2349 Selector selector = elements.getSelector(node); 2349 Selector selector = elements.getSelector(node);
2350 Element element = elements[node]; 2350 Element element = elements[node];
2351 if (element === compiler.assertMethod && !compiler.enableUserAssertions) { 2351 if (element === compiler.assertMethod && !compiler.enableUserAssertions) {
2352 stack.add(graph.addConstantNull()); 2352 stack.add(graph.addConstantNull());
2353 return; 2353 return;
2354 } 2354 }
2355 compiler.ensure(element.kind !== ElementKind.GENERATIVE_CONSTRUCTOR); 2355 compiler.ensure(!element.isGenerativeConstructor());
2356 HInstruction target = new HStatic(element); 2356 if (element.isFunction()) {
2357 add(target); 2357 HInstruction target = new HStatic(element);
2358 var inputs = <HInstruction>[]; 2358 add(target);
2359 inputs.add(target); 2359 var inputs = <HInstruction>[target];
2360 if (element.kind == ElementKind.FUNCTION) {
2361 bool succeeded = addStaticSendArgumentsToList(selector, node.arguments, 2360 bool succeeded = addStaticSendArgumentsToList(selector, node.arguments,
2362 element, inputs); 2361 element, inputs);
2363 if (!succeeded) { 2362 if (!succeeded) {
2364 // TODO(ngeoffray): Match the VM behavior and throw an 2363 // TODO(ngeoffray): Match the VM behavior and throw an
2365 // exception at runtime. 2364 // exception at runtime.
2366 compiler.cancel('Unimplemented non-matching static call', node: node); 2365 compiler.cancel('Unimplemented non-matching static call', node: node);
2367 } 2366 }
2368 pushWithPosition(new HInvokeStatic(inputs), node); 2367 pushWithPosition(new HInvokeStatic(inputs), node);
2369 } else { 2368 } else {
2370 if (element.kind == ElementKind.GETTER) { 2369 generateGetter(node, element);
2371 target = new HInvokeStatic(inputs); 2370 List<HInstruction> inputs = <HInstruction>[pop()];
2372 add(target);
2373 inputs = <HInstruction>[target];
2374 }
2375 addDynamicSendArgumentsToList(node, inputs); 2371 addDynamicSendArgumentsToList(node, inputs);
2376 pushWithPosition(new HInvokeClosure(selector, inputs), node); 2372 pushWithPosition(new HInvokeClosure(selector, inputs), node);
2377 } 2373 }
2378 } 2374 }
2379 2375
2380 visitGetterSend(Send node) { 2376 visitGetterSend(Send node) {
2381 generateGetter(node, elements[node]); 2377 generateGetter(node, elements[node]);
2382 } 2378 }
2383 2379
2384 // TODO(antonm): migrate rest of SsaBuilder to internalError. 2380 // TODO(antonm): migrate rest of SsaBuilder to internalError.
(...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after
3625 new HSubGraphBlockInformation(elseBranch.graph)); 3621 new HSubGraphBlockInformation(elseBranch.graph));
3626 3622
3627 HBasicBlock conditionStartBlock = conditionBranch.block; 3623 HBasicBlock conditionStartBlock = conditionBranch.block;
3628 conditionStartBlock.setBlockFlow(info, joinBlock); 3624 conditionStartBlock.setBlockFlow(info, joinBlock);
3629 SubGraph conditionGraph = conditionBranch.graph; 3625 SubGraph conditionGraph = conditionBranch.graph;
3630 HIf branch = conditionGraph.end.last; 3626 HIf branch = conditionGraph.end.last;
3631 assert(branch is HIf); 3627 assert(branch is HIf);
3632 branch.blockInformation = conditionStartBlock.blockFlow; 3628 branch.blockInformation = conditionStartBlock.blockFlow;
3633 } 3629 }
3634 } 3630 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698