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

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

Issue 12299008: Stop resolving all of js_helper unconditionally. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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 part of ssa; 5 part of ssa;
6 6
7 /** 7 /**
8 * A special element for the extra parameter taken by intercepted 8 * A special element for the extra parameter taken by intercepted
9 * methods. We need to override [Element.computeType] because our 9 * methods. We need to override [Element.computeType] because our
10 * optimizers may look at its declared type. 10 * optimizers may look at its declared type.
(...skipping 2637 matching lines...) Expand 10 before | Expand all | Expand 10 after
2648 stack.add(graph.addConstantBool(true, constantSystem)); 2648 stack.add(graph.addConstantBool(true, constantSystem));
2649 return; 2649 return;
2650 } 2650 }
2651 2651
2652 HInstruction instruction; 2652 HInstruction instruction;
2653 if (type.element.isTypeVariable() || 2653 if (type.element.isTypeVariable() ||
2654 RuntimeTypeInformation.hasTypeArguments(type)) { 2654 RuntimeTypeInformation.hasTypeArguments(type)) {
2655 2655
2656 void argumentsCheck() { 2656 void argumentsCheck() {
2657 HInstruction typeInfo = getRuntimeTypeInfo(expression); 2657 HInstruction typeInfo = getRuntimeTypeInfo(expression);
2658 Element helper = 2658 Element helper = backend.getCheckArguments();
2659 compiler.findHelper(const SourceString('checkArguments'));
2660 HInstruction helperCall = new HStatic(helper); 2659 HInstruction helperCall = new HStatic(helper);
2661 add(helperCall); 2660 add(helperCall);
2662 List<HInstruction> representations = 2661 List<HInstruction> representations =
2663 buildTypeArgumentRepresentations(type); 2662 buildTypeArgumentRepresentations(type);
2664 Element element = type.element; 2663 Element element = type.element;
2665 String substitution = backend.namer.substitutionName(element); 2664 String substitution = backend.namer.substitutionName(element);
2666 if (backend.emitter.nativeEmitter.requiresNativeIsCheck(element)) { 2665 if (backend.emitter.nativeEmitter.requiresNativeIsCheck(element)) {
2667 substitution = '$substitution()'; 2666 substitution = '$substitution()';
2668 } 2667 }
2669 HInstruction fieldGet = 2668 HInstruction fieldGet =
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
3062 HStatic target = new HStatic(element); 3061 HStatic target = new HStatic(element);
3063 add(target); 3062 add(target);
3064 HInstruction self = localsHandler.readThis(); 3063 HInstruction self = localsHandler.readThis();
3065 Constant nameConstant = constantSystem.createString( 3064 Constant nameConstant = constantSystem.createString(
3066 new DartString.literal(name.slowToString()), node); 3065 new DartString.literal(name.slowToString()), node);
3067 3066
3068 String internalName = backend.namer.invocationName(selector); 3067 String internalName = backend.namer.invocationName(selector);
3069 Constant internalNameConstant = 3068 Constant internalNameConstant =
3070 constantSystem.createString(new DartString.literal(internalName), node); 3069 constantSystem.createString(new DartString.literal(internalName), node);
3071 3070
3072 Element createInvocationMirror = 3071 Element createInvocationMirror = backend.getCreateInvocationMirror();
3073 compiler.findHelper(Compiler.CREATE_INVOCATION_MIRROR);
3074 3072
3075 var arguments = new List<HInstruction>(); 3073 var arguments = new List<HInstruction>();
3076 if (node.argumentsNode != null) { 3074 if (node.argumentsNode != null) {
3077 addGenericSendArgumentsToList(node.arguments, arguments); 3075 addGenericSendArgumentsToList(node.arguments, arguments);
3078 } 3076 }
3079 var argumentsInstruction = new HLiteralList(arguments); 3077 var argumentsInstruction = new HLiteralList(arguments);
3080 add(argumentsInstruction); 3078 add(argumentsInstruction);
3081 3079
3082 var argumentNames = new List<HInstruction>(); 3080 var argumentNames = new List<HInstruction>();
3083 for (SourceString argumentName in selector.namedArguments) { 3081 for (SourceString argumentName in selector.namedArguments) {
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
3449 generateError(node, 3447 generateError(node,
3450 message, 3448 message,
3451 backend.getThrowAbstractClassInstantiationError()); 3449 backend.getThrowAbstractClassInstantiationError());
3452 } 3450 }
3453 3451
3454 void generateThrowNoSuchMethod(Node diagnosticNode, 3452 void generateThrowNoSuchMethod(Node diagnosticNode,
3455 String methodName, 3453 String methodName,
3456 {Link<Node> argumentNodes, 3454 {Link<Node> argumentNodes,
3457 List<HInstruction> argumentValues, 3455 List<HInstruction> argumentValues,
3458 List<String> existingArguments}) { 3456 List<String> existingArguments}) {
3459 Element helper = 3457 Element helper = backend.getThrowNoSuchMethod();
3460 compiler.findHelper(const SourceString('throwNoSuchMethod'));
3461 Constant receiverConstant = 3458 Constant receiverConstant =
3462 constantSystem.createString(new DartString.empty(), diagnosticNode); 3459 constantSystem.createString(new DartString.empty(), diagnosticNode);
3463 HInstruction receiver = graph.addConstant(receiverConstant); 3460 HInstruction receiver = graph.addConstant(receiverConstant);
3464 DartString dartString = new DartString.literal(methodName); 3461 DartString dartString = new DartString.literal(methodName);
3465 Constant nameConstant = 3462 Constant nameConstant =
3466 constantSystem.createString(dartString, diagnosticNode); 3463 constantSystem.createString(dartString, diagnosticNode);
3467 HInstruction name = graph.addConstant(nameConstant); 3464 HInstruction name = graph.addConstant(nameConstant);
3468 if (argumentValues == null) { 3465 if (argumentValues == null) {
3469 argumentValues = <HInstruction>[]; 3466 argumentValues = <HInstruction>[];
3470 argumentNodes.forEach((argumentNode) { 3467 argumentNodes.forEach((argumentNode) {
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
4179 HBasicBlock expressionEnd = current; 4176 HBasicBlock expressionEnd = current;
4180 4177
4181 HSwitch switchInstruction = new HSwitch(<HInstruction>[expression]); 4178 HSwitch switchInstruction = new HSwitch(<HInstruction>[expression]);
4182 HBasicBlock expressionBlock = close(switchInstruction); 4179 HBasicBlock expressionBlock = close(switchInstruction);
4183 JumpHandler jumpHandler = createJumpHandler(node); 4180 JumpHandler jumpHandler = createJumpHandler(node);
4184 LocalsHandler savedLocals = localsHandler; 4181 LocalsHandler savedLocals = localsHandler;
4185 4182
4186 List<List<Constant>> matchExpressions = <List<Constant>>[]; 4183 List<List<Constant>> matchExpressions = <List<Constant>>[];
4187 List<HStatementInformation> statements = <HStatementInformation>[]; 4184 List<HStatementInformation> statements = <HStatementInformation>[];
4188 bool hasDefault = false; 4185 bool hasDefault = false;
4189 Element getFallThroughErrorElement = 4186 Element getFallThroughErrorElement = backend.getFallThroughError();
4190 compiler.findHelper(const SourceString("getFallThroughError"));
4191 HasNextIterator<Node> caseIterator = 4187 HasNextIterator<Node> caseIterator =
4192 new HasNextIterator<Node>(node.cases.iterator); 4188 new HasNextIterator<Node>(node.cases.iterator);
4193 while (caseIterator.hasNext) { 4189 while (caseIterator.hasNext) {
4194 SwitchCase switchCase = caseIterator.next(); 4190 SwitchCase switchCase = caseIterator.next();
4195 List<Constant> caseConstants = <Constant>[]; 4191 List<Constant> caseConstants = <Constant>[];
4196 HBasicBlock block = graph.addNewBlock(); 4192 HBasicBlock block = graph.addNewBlock();
4197 for (Node labelOrCase in switchCase.labelsAndCases) { 4193 for (Node labelOrCase in switchCase.labelsAndCases) {
4198 if (labelOrCase is CaseMatch) { 4194 if (labelOrCase is CaseMatch) {
4199 Constant constant = constants[labelOrCase]; 4195 Constant constant = constants[labelOrCase];
4200 caseConstants.add(constant); 4196 caseConstants.add(constant);
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
5076 new HSubGraphBlockInformation(elseBranch.graph)); 5072 new HSubGraphBlockInformation(elseBranch.graph));
5077 5073
5078 HBasicBlock conditionStartBlock = conditionBranch.block; 5074 HBasicBlock conditionStartBlock = conditionBranch.block;
5079 conditionStartBlock.setBlockFlow(info, joinBlock); 5075 conditionStartBlock.setBlockFlow(info, joinBlock);
5080 SubGraph conditionGraph = conditionBranch.graph; 5076 SubGraph conditionGraph = conditionBranch.graph;
5081 HIf branch = conditionGraph.end.last; 5077 HIf branch = conditionGraph.end.last;
5082 assert(branch is HIf); 5078 assert(branch is HIf);
5083 branch.blockInformation = conditionStartBlock.blockFlow; 5079 branch.blockInformation = conditionStartBlock.blockFlow;
5084 } 5080 }
5085 } 5081 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698