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

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

Issue 11052011: Fix some warnings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 if (kind !== ElementKind.FIELD) { 189 if (kind !== ElementKind.FIELD) {
190 bool inLoop = functionsCalledInLoop.contains(element.declaration); 190 bool inLoop = functionsCalledInLoop.contains(element.declaration);
191 if (!inLoop) { 191 if (!inLoop) {
192 Selector selector = selectorsCalledInLoop[element.name]; 192 Selector selector = selectorsCalledInLoop[element.name];
193 inLoop = selector !== null && selector.applies(element, compiler); 193 inLoop = selector !== null && selector.applies(element, compiler);
194 } 194 }
195 graph.calledInLoop = inLoop; 195 graph.calledInLoop = inLoop;
196 196
197 // If there is an estimate of the parameter types assume these types 197 // If there is an estimate of the parameter types assume these types
198 // when compiling. 198 // when compiling.
199 FunctionElement function = element;
ahe 2012/10/03 14:56:33 The test above could fail for things that aren't f
karlklose 2012/10/04 08:50:00 I added a TODO and an else branch that throws an i
199 OptionalParameterTypes defaultValueTypes = null; 200 OptionalParameterTypes defaultValueTypes = null;
200 FunctionSignature signature = element.computeSignature(compiler); 201 FunctionSignature signature = function.computeSignature(compiler);
201 if (signature.optionalParameterCount > 0) { 202 if (signature.optionalParameterCount > 0) {
202 defaultValueTypes = 203 defaultValueTypes =
203 new OptionalParameterTypes(signature.optionalParameterCount); 204 new OptionalParameterTypes(signature.optionalParameterCount);
204 int index = 0; 205 int index = 0;
205 signature.forEachOptionalParameter((Element parameter) { 206 signature.forEachOptionalParameter((Element parameter) {
206 Constant defaultValue = compiler.compileVariable(parameter); 207 Constant defaultValue = compiler.compileVariable(parameter);
207 HType type = HGraph.mapConstantTypeToSsaType(defaultValue); 208 HType type = HGraph.mapConstantTypeToSsaType(defaultValue);
208 defaultValueTypes.update(index, parameter.name, type); 209 defaultValueTypes.update(index, parameter.name, type);
209 index++; 210 index++;
210 }); 211 });
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 // TODO(ahe): The constructor name is statically resolved. See 1328 // TODO(ahe): The constructor name is statically resolved. See
1328 // SsaCodeGenerator.visitInvokeDynamicMethod. Is there a cleaner 1329 // SsaCodeGenerator.visitInvokeDynamicMethod. Is there a cleaner
1329 // way to do this? 1330 // way to do this?
1330 SourceString name = 1331 SourceString name =
1331 new SourceString(backend.namer.getName(body.declaration)); 1332 new SourceString(backend.namer.getName(body.declaration));
1332 // TODO(kasperl): This seems fishy. We shouldn't be inventing all 1333 // TODO(kasperl): This seems fishy. We shouldn't be inventing all
1333 // these selectors. Maybe the resolver can do more of the work 1334 // these selectors. Maybe the resolver can do more of the work
1334 // for us here? 1335 // for us here?
1335 LibraryElement library = body.getLibrary(); 1336 LibraryElement library = body.getLibrary();
1336 Selector selector = new Selector.call(name, library, arity); 1337 Selector selector = new Selector.call(name, library, arity);
1337 HInstruction invoke = new HInvokeDynamicMethod(selector, bodyCallInputs); 1338 HInvokeDynamic invoke =
1339 new HInvokeDynamicMethod(selector, bodyCallInputs);
1338 invoke.element = body; 1340 invoke.element = body;
1339 add(invoke); 1341 add(invoke);
1340 } 1342 }
1341 close(new HReturn(newObject)).addSuccessor(graph.exit); 1343 close(new HReturn(newObject)).addSuccessor(graph.exit);
1342 return closeFunction(); 1344 return closeFunction();
1343 } 1345 }
1344 1346
1345 void addParameterCheckInstruction(Element element) { 1347 void addParameterCheckInstruction(Element element) {
1346 // This is the code we emit for a parameter that is being checked 1348 // This is the code we emit for a parameter that is being checked
1347 // on whether it was given at value at the call site: 1349 // on whether it was given at value at the call site:
(...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after
2607 Element element = elements[closure]; 2609 Element element = elements[closure];
2608 if (!Elements.isStaticOrTopLevelFunction(element)) { 2610 if (!Elements.isStaticOrTopLevelFunction(element)) {
2609 compiler.cancel( 2611 compiler.cancel(
2610 'JS_TO_CLOSURE requires a static or top-level method', 2612 'JS_TO_CLOSURE requires a static or top-level method',
2611 node: closure); 2613 node: closure);
2612 } 2614 }
2613 FunctionElement function = element; 2615 FunctionElement function = element;
2614 // TODO(johnniwinther): Try to eliminate the need to distinguish declaration 2616 // TODO(johnniwinther): Try to eliminate the need to distinguish declaration
2615 // and implementation signatures. Currently it is need because the 2617 // and implementation signatures. Currently it is need because the
2616 // signatures have different elements for parameters. 2618 // signatures have different elements for parameters.
2617 FunctionSignature params 2619 FunctionElement implementation = function.implementation;
2618 = function.implementation.computeSignature(compiler); 2620 FunctionSignature params = implementation.computeSignature(compiler);
2619 if (params.optionalParameterCount !== 0) { 2621 if (params.optionalParameterCount !== 0) {
2620 compiler.cancel( 2622 compiler.cancel(
2621 'JS_TO_CLOSURE does not handle closure with optional parameters', 2623 'JS_TO_CLOSURE does not handle closure with optional parameters',
2622 node: closure); 2624 node: closure);
2623 } 2625 }
2624 visit(closure); 2626 visit(closure);
2625 List<HInstruction> inputs = <HInstruction>[pop()]; 2627 List<HInstruction> inputs = <HInstruction>[pop()];
2626 String invocationName = backend.namer.closureInvocationName( 2628 String invocationName = backend.namer.closureInvocationName(
2627 new Selector.callClosure(params.requiredParameterCount)); 2629 new Selector.callClosure(params.requiredParameterCount));
2628 push(new HForeign(new DartString.literal('#.$invocationName'), 2630 push(new HForeign(new DartString.literal('#.$invocationName'),
(...skipping 1749 matching lines...) Expand 10 before | Expand all | Expand 10 after
4378 new HSubGraphBlockInformation(elseBranch.graph)); 4380 new HSubGraphBlockInformation(elseBranch.graph));
4379 4381
4380 HBasicBlock conditionStartBlock = conditionBranch.block; 4382 HBasicBlock conditionStartBlock = conditionBranch.block;
4381 conditionStartBlock.setBlockFlow(info, joinBlock); 4383 conditionStartBlock.setBlockFlow(info, joinBlock);
4382 SubGraph conditionGraph = conditionBranch.graph; 4384 SubGraph conditionGraph = conditionBranch.graph;
4383 HIf branch = conditionGraph.end.last; 4385 HIf branch = conditionGraph.end.last;
4384 assert(branch is HIf); 4386 assert(branch is HIf);
4385 branch.blockInformation = conditionStartBlock.blockFlow; 4387 branch.blockInformation = conditionStartBlock.blockFlow;
4386 } 4388 }
4387 } 4389 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698