| 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 2476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2487 if (Elements.isStaticOrTopLevelField(element)) { | 2487 if (Elements.isStaticOrTopLevelField(element)) { |
| 2488 Constant value; | 2488 Constant value; |
| 2489 if (element.isField() && !element.isAssignable()) { | 2489 if (element.isField() && !element.isAssignable()) { |
| 2490 // A static final or const. Get its constant value and inline it if | 2490 // A static final or const. Get its constant value and inline it if |
| 2491 // the value can be compiled eagerly. | 2491 // the value can be compiled eagerly. |
| 2492 value = compileVariable(element); | 2492 value = compileVariable(element); |
| 2493 } | 2493 } |
| 2494 if (value != null) { | 2494 if (value != null) { |
| 2495 stack.add(graph.addConstant(value)); | 2495 stack.add(graph.addConstant(value)); |
| 2496 } else if (element.isField() && isLazilyInitialized(element)) { | 2496 } else if (element.isField() && isLazilyInitialized(element)) { |
| 2497 push(new HLazyStatic(element)); | 2497 HInstruction instruction = new HLazyStatic(element); |
| 2498 instruction.instructionType = |
| 2499 new HType.inferredTypeForElement(element, compiler); |
| 2500 push(instruction); |
| 2498 } else { | 2501 } else { |
| 2499 if (element.isGetter()) { | 2502 if (element.isGetter()) { |
| 2500 Selector selector = elements.getSelector(send); | 2503 Selector selector = elements.getSelector(send); |
| 2501 if (tryInlineMethod( | 2504 if (tryInlineMethod( |
| 2502 element, selector, const Link<Node>(), null, send)) { | 2505 element, selector, const Link<Node>(), null, send)) { |
| 2503 return; | 2506 return; |
| 2504 } | 2507 } |
| 2505 } | 2508 } |
| 2506 // TODO(5346): Try to avoid the need for calling [declaration] before | 2509 // TODO(5346): Try to avoid the need for calling [declaration] before |
| 2507 // creating an [HStatic]. | 2510 // creating an [HStatic]. |
| 2508 push(new HStatic(element.declaration)); | 2511 HInstruction instruction = new HStatic(element.declaration); |
| 2509 if (element.isGetter()) { | 2512 if (element.isGetter()) { |
| 2510 push(new HInvokeStatic(<HInstruction>[pop()], HType.UNKNOWN)); | 2513 add(instruction); |
| 2514 push(new HInvokeStatic( |
| 2515 <HInstruction>[instruction], |
| 2516 new HType.inferredReturnTypeForElement(element, compiler))); |
| 2517 } else { |
| 2518 instruction.instructionType = |
| 2519 new HType.inferredTypeForElement(element, compiler); |
| 2520 push(instruction); |
| 2511 } | 2521 } |
| 2512 } | 2522 } |
| 2513 } else if (Elements.isInstanceSend(send, elements)) { | 2523 } else if (Elements.isInstanceSend(send, elements)) { |
| 2514 HInstruction receiver = generateInstanceSendReceiver(send); | 2524 HInstruction receiver = generateInstanceSendReceiver(send); |
| 2515 generateInstanceGetterWithCompiledReceiver( | 2525 generateInstanceGetterWithCompiledReceiver( |
| 2516 send, elements.getSelector(send), receiver); | 2526 send, elements.getSelector(send), receiver); |
| 2517 } else if (Elements.isStaticOrTopLevelFunction(element)) { | 2527 } else if (Elements.isStaticOrTopLevelFunction(element)) { |
| 2518 // TODO(5346): Try to avoid the need for calling [declaration] before | 2528 // TODO(5346): Try to avoid the need for calling [declaration] before |
| 2519 // creating an [HStatic]. | 2529 // creating an [HStatic]. |
| 2520 push(new HStatic(element.declaration)); | 2530 push(new HStatic(element.declaration)); |
| (...skipping 2717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5238 new HSubGraphBlockInformation(elseBranch.graph)); | 5248 new HSubGraphBlockInformation(elseBranch.graph)); |
| 5239 | 5249 |
| 5240 HBasicBlock conditionStartBlock = conditionBranch.block; | 5250 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 5241 conditionStartBlock.setBlockFlow(info, joinBlock); | 5251 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 5242 SubGraph conditionGraph = conditionBranch.graph; | 5252 SubGraph conditionGraph = conditionBranch.graph; |
| 5243 HIf branch = conditionGraph.end.last; | 5253 HIf branch = conditionGraph.end.last; |
| 5244 assert(branch is HIf); | 5254 assert(branch is HIf); |
| 5245 branch.blockInformation = conditionStartBlock.blockFlow; | 5255 branch.blockInformation = conditionStartBlock.blockFlow; |
| 5246 } | 5256 } |
| 5247 } | 5257 } |
| OLD | NEW |