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

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

Issue 24145009: Revert r27739. Two tests fail. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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 | sdk/lib/_internal/compiler/implementation/types/type_graph_inferrer.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) 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 3259 matching lines...) Expand 10 before | Expand all | Expand 10 after
3270 } else { 3270 } else {
3271 throw "Unknown foreign: ${selector}"; 3271 throw "Unknown foreign: ${selector}";
3272 } 3272 }
3273 } 3273 }
3274 3274
3275 generateSuperNoSuchMethodSend(Send node, 3275 generateSuperNoSuchMethodSend(Send node,
3276 Selector selector, 3276 Selector selector,
3277 List<HInstruction> arguments) { 3277 List<HInstruction> arguments) {
3278 SourceString name = selector.name; 3278 SourceString name = selector.name;
3279 3279
3280 ClassElement cls = currentNonClosureClass; 3280 ClassElement cls = currentElement.getEnclosingClass();
3281 Element element = cls.lookupSuperMember(Compiler.NO_SUCH_METHOD); 3281 Element element = cls.lookupSuperMember(Compiler.NO_SUCH_METHOD);
3282 if (element.enclosingElement.declaration != compiler.objectClass) { 3282 if (element.enclosingElement.declaration != compiler.objectClass) {
3283 // Register the call as dynamic if [noSuchMethod] on the super 3283 // Register the call as dynamic if [noSuchMethod] on the super
3284 // class is _not_ the default implementation from [Object], in 3284 // class is _not_ the default implementation from [Object], in
3285 // case the [noSuchMethod] implementation calls 3285 // case the [noSuchMethod] implementation calls
3286 // [JSInvocationMirror._invokeOn]. 3286 // [JSInvocationMirror._invokeOn].
3287 compiler.enqueuer.codegen.registerSelectorUse(selector); 3287 compiler.enqueuer.codegen.registerSelectorUse(selector);
3288 } 3288 }
3289 String publicName = name.slowToString();
3290 if (selector.isSetter()) publicName += '=';
3291
3292 Constant nameConstant = constantSystem.createString( 3289 Constant nameConstant = constantSystem.createString(
3293 new DartString.literal(publicName), node); 3290 new DartString.literal(name.slowToString()), node);
3294 3291
3295 String internalName = backend.namer.invocationName(selector); 3292 String internalName = backend.namer.invocationName(selector);
3296 Constant internalNameConstant = 3293 Constant internalNameConstant =
3297 constantSystem.createString(new DartString.literal(internalName), node); 3294 constantSystem.createString(new DartString.literal(internalName), node);
3298 3295
3299 Element createInvocationMirror = backend.getCreateInvocationMirror(); 3296 Element createInvocationMirror = backend.getCreateInvocationMirror();
3300 var argumentsInstruction = buildLiteralList(arguments); 3297 var argumentsInstruction = buildLiteralList(arguments);
3301 add(argumentsInstruction); 3298 add(argumentsInstruction);
3302 3299
3303 var argumentNames = new List<HInstruction>(); 3300 var argumentNames = new List<HInstruction>();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
3341 List<HInstruction> arguments = <HInstruction>[]; 3338 List<HInstruction> arguments = <HInstruction>[];
3342 if (!node.isPropertyAccess) { 3339 if (!node.isPropertyAccess) {
3343 addGenericSendArgumentsToList(node.arguments, arguments); 3340 addGenericSendArgumentsToList(node.arguments, arguments);
3344 } 3341 }
3345 return generateSuperNoSuchMethodSend(node, selector, arguments); 3342 return generateSuperNoSuchMethodSend(node, selector, arguments);
3346 } 3343 }
3347 List<HInstruction> inputs = <HInstruction>[]; 3344 List<HInstruction> inputs = <HInstruction>[];
3348 if (node.isPropertyAccess) { 3345 if (node.isPropertyAccess) {
3349 push(buildInvokeSuper(selector, element, inputs)); 3346 push(buildInvokeSuper(selector, element, inputs));
3350 } else if (element.isFunction() || element.isGenerativeConstructor()) { 3347 } else if (element.isFunction() || element.isGenerativeConstructor()) {
3351 if (selector.applies(element, compiler)) { 3348 // TODO(5347): Try to avoid the need for calling [implementation] before
3352 // TODO(5347): Try to avoid the need for calling [implementation] before 3349 // calling [addStaticSendArgumentsToList].
3353 // calling [addStaticSendArgumentsToList]. 3350 FunctionElement function = element.implementation;
3354 FunctionElement function = element.implementation; 3351 bool succeeded = addStaticSendArgumentsToList(selector, node.arguments,
3355 bool succeeded = addStaticSendArgumentsToList(selector, node.arguments, 3352 function, inputs);
3356 function, inputs); 3353 if (!succeeded) {
3357 assert(succeeded);
3358 push(buildInvokeSuper(selector, element, inputs));
3359 } else if (element.isGenerativeConstructor()) {
3360 generateWrongArgumentCountError(node, element, node.arguments); 3354 generateWrongArgumentCountError(node, element, node.arguments);
3361 } else { 3355 } else {
3362 addGenericSendArgumentsToList(node.arguments, inputs); 3356 push(buildInvokeSuper(selector, element, inputs));
3363 generateSuperNoSuchMethodSend(node, selector, inputs);
3364 } 3357 }
3365 } else { 3358 } else {
3366 HInstruction target = buildInvokeSuper(selector, element, inputs); 3359 HInstruction target = buildInvokeSuper(selector, element, inputs);
3367 add(target); 3360 add(target);
3368 inputs = <HInstruction>[target]; 3361 inputs = <HInstruction>[target];
3369 addDynamicSendArgumentsToList(node, inputs); 3362 addDynamicSendArgumentsToList(node, inputs);
3370 Selector closureSelector = new Selector.callClosureFrom(selector); 3363 Selector closureSelector = new Selector.callClosureFrom(selector);
3371 push(new HInvokeClosure(closureSelector, inputs)); 3364 push(new HInvokeClosure(closureSelector, inputs));
3372 } 3365 }
3373 } 3366 }
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
3929 inputs.add(invokeInterceptor(receiver)); 3922 inputs.add(invokeInterceptor(receiver));
3930 } 3923 }
3931 inputs.add(receiver); 3924 inputs.add(receiver);
3932 inputs.addAll(arguments); 3925 inputs.addAll(arguments);
3933 HInstruction instruction = new HInvokeSuper( 3926 HInstruction instruction = new HInvokeSuper(
3934 element, 3927 element,
3935 currentNonClosureClass, 3928 currentNonClosureClass,
3936 selector, 3929 selector,
3937 inputs, 3930 inputs,
3938 isSetter: selector.isSetter() || selector.isIndexSet()); 3931 isSetter: selector.isSetter() || selector.isIndexSet());
3939 if (selector.isGetter()) { 3932 instruction.instructionType =
3940 instruction.instructionType = 3933 new HType.inferredReturnTypeForElement(element, compiler);
3941 new HType.inferredTypeForElement(element, compiler);
3942 } else {
3943 instruction.instructionType =
3944 new HType.inferredReturnTypeForElement(element, compiler);
3945 }
3946 instruction.sideEffects = compiler.world.getSideEffectsOfElement(element); 3934 instruction.sideEffects = compiler.world.getSideEffectsOfElement(element);
3947 return instruction; 3935 return instruction;
3948 } 3936 }
3949 3937
3950 void handleComplexOperatorSend(SendSet node, 3938 void handleComplexOperatorSend(SendSet node,
3951 HInstruction receiver, 3939 HInstruction receiver,
3952 Link<Node> arguments) { 3940 Link<Node> arguments) {
3953 HInstruction rhs; 3941 HInstruction rhs;
3954 if (node.isPrefix || node.isPostfix) { 3942 if (node.isPrefix || node.isPostfix) {
3955 rhs = graph.addConstantInt(1, compiler); 3943 rhs = graph.addConstantInt(1, compiler);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
4009 handleComplexOperatorSend(node, getterInstruction, arguments); 3997 handleComplexOperatorSend(node, getterInstruction, arguments);
4010 setterInputs.add(pop()); 3998 setterInputs.add(pop());
4011 3999
4012 if (node.isPostfix) { 4000 if (node.isPostfix) {
4013 result = getterInstruction; 4001 result = getterInstruction;
4014 } else { 4002 } else {
4015 result = setterInputs.last; 4003 result = setterInputs.last;
4016 } 4004 }
4017 } 4005 }
4018 Selector setterSelector = elements.getSelector(node); 4006 Selector setterSelector = elements.getSelector(node);
4019 if (Elements.isUnresolved(element) 4007 if (Elements.isUnresolved(element)) {
4020 || !setterSelector.applies(element, compiler)) {
4021 generateSuperNoSuchMethodSend( 4008 generateSuperNoSuchMethodSend(
4022 node, setterSelector, setterInputs); 4009 node, setterSelector, setterInputs);
4023 pop(); 4010 pop();
4024 } else { 4011 } else {
4025 add(buildInvokeSuper(setterSelector, element, setterInputs)); 4012 add(buildInvokeSuper(setterSelector, element, setterInputs));
4026 } 4013 }
4027 stack.add(result); 4014 stack.add(result);
4028 } else if (node.isIndex) { 4015 } else if (node.isIndex) {
4029 if (const SourceString("=") == op.source) { 4016 if (const SourceString("=") == op.source) {
4030 visitDynamicSend(node); 4017 visitDynamicSend(node);
(...skipping 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after
5554 new HSubGraphBlockInformation(elseBranch.graph)); 5541 new HSubGraphBlockInformation(elseBranch.graph));
5555 5542
5556 HBasicBlock conditionStartBlock = conditionBranch.block; 5543 HBasicBlock conditionStartBlock = conditionBranch.block;
5557 conditionStartBlock.setBlockFlow(info, joinBlock); 5544 conditionStartBlock.setBlockFlow(info, joinBlock);
5558 SubGraph conditionGraph = conditionBranch.graph; 5545 SubGraph conditionGraph = conditionBranch.graph;
5559 HIf branch = conditionGraph.end.last; 5546 HIf branch = conditionGraph.end.last;
5560 assert(branch is HIf); 5547 assert(branch is HIf);
5561 branch.blockInformation = conditionStartBlock.blockFlow; 5548 branch.blockInformation = conditionStartBlock.blockFlow;
5562 } 5549 }
5563 } 5550 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/types/type_graph_inferrer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698