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

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

Issue 10854158: Make selector registration in the resolver and code generator more explicit. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. 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
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 2147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2158 pushInvokeHelper0(element); 2158 pushInvokeHelper0(element);
2159 } 2159 }
2160 } 2160 }
2161 2161
2162 void handleForeignJsCallInIsolate(Send node) { 2162 void handleForeignJsCallInIsolate(Send node) {
2163 Link<Node> link = node.arguments; 2163 Link<Node> link = node.arguments;
2164 if (!compiler.hasIsolateSupport()) { 2164 if (!compiler.hasIsolateSupport()) {
2165 // If the isolate library is not used, we just invoke the 2165 // If the isolate library is not used, we just invoke the
2166 // closure. 2166 // closure.
2167 visit(link.tail.head); 2167 visit(link.tail.head);
2168 Selector selector = new Selector.callAny(0); 2168 Selector selector = new Selector.callClosure(0);
2169 push(new HInvokeClosure(selector, <HInstruction>[pop()])); 2169 push(new HInvokeClosure(selector, <HInstruction>[pop()]));
2170 } else { 2170 } else {
2171 // Call a helper method from the isolate library. 2171 // Call a helper method from the isolate library.
2172 Element element = compiler.isolateLibrary.find( 2172 Element element = compiler.isolateLibrary.find(
2173 const SourceString('_callInIsolate')); 2173 const SourceString('_callInIsolate'));
2174 if (element === null) { 2174 if (element === null) {
2175 compiler.cancel( 2175 compiler.cancel(
2176 'Isolate library and compiler mismatch', node: node); 2176 'Isolate library and compiler mismatch', node: node);
2177 } 2177 }
2178 HStatic target = new HStatic(element); 2178 HStatic target = new HStatic(element);
(...skipping 19 matching lines...) Expand all
2198 FunctionElement function = element; 2198 FunctionElement function = element;
2199 FunctionSignature params = function.computeSignature(compiler); 2199 FunctionSignature params = function.computeSignature(compiler);
2200 if (params.optionalParameterCount !== 0) { 2200 if (params.optionalParameterCount !== 0) {
2201 compiler.cancel( 2201 compiler.cancel(
2202 'JS_TO_CLOSURE does not handle closure with optional parameters', 2202 'JS_TO_CLOSURE does not handle closure with optional parameters',
2203 node: closure); 2203 node: closure);
2204 } 2204 }
2205 visit(closure); 2205 visit(closure);
2206 List<HInstruction> inputs = <HInstruction>[pop()]; 2206 List<HInstruction> inputs = <HInstruction>[pop()];
2207 String invocationName = compiler.namer.closureInvocationName( 2207 String invocationName = compiler.namer.closureInvocationName(
2208 new Selector.callAny(params.requiredParameterCount)); 2208 new Selector.callClosure(params.requiredParameterCount));
2209 push(new HForeign(new DartString.literal('#.$invocationName'), 2209 push(new HForeign(new DartString.literal('#.$invocationName'),
2210 const LiteralDartString('var'), 2210 const LiteralDartString('var'),
2211 inputs)); 2211 inputs));
2212 } 2212 }
2213 2213
2214 visitForeignSend(Send node) { 2214 visitForeignSend(Send node) {
2215 Element element = elements[node]; 2215 Element element = elements[node];
2216 if (element.name == const SourceString('JS')) { 2216 if (element.name == const SourceString('JS')) {
2217 handleForeignJs(node); 2217 handleForeignJs(node);
2218 } else if (element.name == const SourceString('UNINTERCEPTED')) { 2218 } else if (element.name == const SourceString('UNINTERCEPTED')) {
(...skipping 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after
3625 new HSubGraphBlockInformation(elseBranch.graph)); 3625 new HSubGraphBlockInformation(elseBranch.graph));
3626 3626
3627 HBasicBlock conditionStartBlock = conditionBranch.block; 3627 HBasicBlock conditionStartBlock = conditionBranch.block;
3628 conditionStartBlock.setBlockFlow(info, joinBlock); 3628 conditionStartBlock.setBlockFlow(info, joinBlock);
3629 SubGraph conditionGraph = conditionBranch.graph; 3629 SubGraph conditionGraph = conditionBranch.graph;
3630 HIf branch = conditionGraph.end.last; 3630 HIf branch = conditionGraph.end.last;
3631 assert(branch is HIf); 3631 assert(branch is HIf);
3632 branch.blockInformation = conditionStartBlock.blockFlow; 3632 branch.blockInformation = conditionStartBlock.blockFlow;
3633 } 3633 }
3634 } 3634 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698