OLD | NEW |
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 3417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3428 argumentNodes: node.arguments); | 3428 argumentNodes: node.arguments); |
3429 return; | 3429 return; |
3430 } | 3430 } |
3431 if (identical(element, compiler.assertMethod) | 3431 if (identical(element, compiler.assertMethod) |
3432 && !compiler.enableUserAssertions) { | 3432 && !compiler.enableUserAssertions) { |
3433 stack.add(graph.addConstantNull(constantSystem)); | 3433 stack.add(graph.addConstantNull(constantSystem)); |
3434 return; | 3434 return; |
3435 } | 3435 } |
3436 compiler.ensure(!element.isGenerativeConstructor()); | 3436 compiler.ensure(!element.isGenerativeConstructor()); |
3437 if (element.isFunction()) { | 3437 if (element.isFunction()) { |
3438 if (tryInlineMethod(element, selector, node.arguments)) { | 3438 bool isIdenticalFunction = element == compiler.identicalFunction; |
| 3439 |
| 3440 if (!isIdenticalFunction |
| 3441 && tryInlineMethod(element, selector, node.arguments)) { |
3439 return; | 3442 return; |
3440 } | 3443 } |
3441 | 3444 |
3442 HInstruction target = new HStatic(element); | 3445 HInstruction target = new HStatic(element); |
3443 add(target); | 3446 add(target); |
3444 var inputs = <HInstruction>[target]; | 3447 var inputs = <HInstruction>[target]; |
3445 // TODO(5347): Try to avoid the need for calling [implementation] before | 3448 // TODO(5347): Try to avoid the need for calling [implementation] before |
3446 // calling [addStaticSendArgumentsToList]. | 3449 // calling [addStaticSendArgumentsToList]. |
3447 bool succeeded = addStaticSendArgumentsToList(selector, node.arguments, | 3450 bool succeeded = addStaticSendArgumentsToList(selector, node.arguments, |
3448 element.implementation, | 3451 element.implementation, |
3449 inputs); | 3452 inputs); |
3450 if (!succeeded) { | 3453 if (!succeeded) { |
3451 generateWrongArgumentCountError(node, element, node.arguments); | 3454 generateWrongArgumentCountError(node, element, node.arguments); |
3452 return; | 3455 return; |
3453 } | 3456 } |
3454 | 3457 |
3455 if (identical(element, compiler.identicalFunction)) { | 3458 if (isIdenticalFunction) { |
3456 pushWithPosition(new HIdentity(target, inputs[1], inputs[2]), node); | 3459 pushWithPosition(new HIdentity(target, inputs[1], inputs[2]), node); |
3457 return; | 3460 return; |
3458 } | 3461 } |
3459 | 3462 |
3460 HInvokeStatic instruction = new HInvokeStatic(inputs); | 3463 HInvokeStatic instruction = new HInvokeStatic(inputs); |
3461 // TODO(ngeoffray): Only do this if knowing the return type is | 3464 // TODO(ngeoffray): Only do this if knowing the return type is |
3462 // useful. | 3465 // useful. |
3463 HType returnType = | 3466 HType returnType = |
3464 builder.backend.optimisticReturnTypesWithRecompilationOnTypeChange( | 3467 builder.backend.optimisticReturnTypesWithRecompilationOnTypeChange( |
3465 work.element, element); | 3468 work.element, element); |
(...skipping 1626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5092 new HSubGraphBlockInformation(elseBranch.graph)); | 5095 new HSubGraphBlockInformation(elseBranch.graph)); |
5093 | 5096 |
5094 HBasicBlock conditionStartBlock = conditionBranch.block; | 5097 HBasicBlock conditionStartBlock = conditionBranch.block; |
5095 conditionStartBlock.setBlockFlow(info, joinBlock); | 5098 conditionStartBlock.setBlockFlow(info, joinBlock); |
5096 SubGraph conditionGraph = conditionBranch.graph; | 5099 SubGraph conditionGraph = conditionBranch.graph; |
5097 HIf branch = conditionGraph.end.last; | 5100 HIf branch = conditionGraph.end.last; |
5098 assert(branch is HIf); | 5101 assert(branch is HIf); |
5099 branch.blockInformation = conditionStartBlock.blockFlow; | 5102 branch.blockInformation = conditionStartBlock.blockFlow; |
5100 } | 5103 } |
5101 } | 5104 } |
OLD | NEW |