| 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 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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 // the next iteration. | 522 // the next iteration. |
| 523 ClosureScope scopeData = closureData.capturingScopes[node]; | 523 ClosureScope scopeData = closureData.capturingScopes[node]; |
| 524 if (scopeData == null) return; | 524 if (scopeData == null) return; |
| 525 if (scopeData.hasBoxedLoopVariables()) { | 525 if (scopeData.hasBoxedLoopVariables()) { |
| 526 updateCaptureBox(scopeData.boxElement, scopeData.boxedLoopVariables); | 526 updateCaptureBox(scopeData.boxElement, scopeData.boxedLoopVariables); |
| 527 } | 527 } |
| 528 } | 528 } |
| 529 | 529 |
| 530 void endLoop(HBasicBlock loopEntry) { | 530 void endLoop(HBasicBlock loopEntry) { |
| 531 loopEntry.forEachPhi((HPhi phi) { | 531 loopEntry.forEachPhi((HPhi phi) { |
| 532 Element element = phi.element; | 532 Element element = phi.sourceElement; |
| 533 HInstruction postLoopDefinition = directLocals[element]; | 533 HInstruction postLoopDefinition = directLocals[element]; |
| 534 phi.addInput(postLoopDefinition); | 534 phi.addInput(postLoopDefinition); |
| 535 }); | 535 }); |
| 536 } | 536 } |
| 537 | 537 |
| 538 /** | 538 /** |
| 539 * Merge [otherLocals] into this locals handler, creating phi-nodes when | 539 * Merge [otherLocals] into this locals handler, creating phi-nodes when |
| 540 * there is a conflict. | 540 * there is a conflict. |
| 541 * If a phi node is necessary, it will use the otherLocals instruction as the | 541 * If a phi node is necessary, it will use the otherLocals instruction as the |
| 542 * first input, and this handler's instruction as the second. | 542 * first input, and this handler's instruction as the second. |
| (...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1729 } else { | 1729 } else { |
| 1730 add(new HStaticStore(element, value)); | 1730 add(new HStaticStore(element, value)); |
| 1731 } | 1731 } |
| 1732 stack.add(value); | 1732 stack.add(value); |
| 1733 } else if (element === null || Elements.isInstanceField(element)) { | 1733 } else if (element === null || Elements.isInstanceField(element)) { |
| 1734 HInstruction receiver = generateInstanceSendReceiver(send); | 1734 HInstruction receiver = generateInstanceSendReceiver(send); |
| 1735 generateInstanceSetterWithCompiledReceiver(send, receiver, value); | 1735 generateInstanceSetterWithCompiledReceiver(send, receiver, value); |
| 1736 } else { | 1736 } else { |
| 1737 localsHandler.updateLocal(element, value); | 1737 localsHandler.updateLocal(element, value); |
| 1738 stack.add(value); | 1738 stack.add(value); |
| 1739 // If the value does not already have a name, give it here. |
| 1740 if (value.sourceElement === null) { |
| 1741 value.sourceElement = element; |
| 1742 } |
| 1739 } | 1743 } |
| 1740 } | 1744 } |
| 1741 | 1745 |
| 1742 visitOperatorSend(node) { | 1746 visitOperatorSend(node) { |
| 1743 assert(node.selector is Operator); | 1747 assert(node.selector is Operator); |
| 1744 Operator op = node.selector; | 1748 Operator op = node.selector; |
| 1745 if (const SourceString("[]") == op.source) { | 1749 if (const SourceString("[]") == op.source) { |
| 1746 HStatic target = new HStatic(interceptors.getIndexInterceptor()); | 1750 HStatic target = new HStatic(interceptors.getIndexInterceptor()); |
| 1747 add(target); | 1751 add(target); |
| 1748 visit(node.receiver); | 1752 visit(node.receiver); |
| (...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3090 false, | 3094 false, |
| 3091 <HInstruction>[target, input])); | 3095 <HInstruction>[target, input])); |
| 3092 return builder.pop(); | 3096 return builder.pop(); |
| 3093 } | 3097 } |
| 3094 | 3098 |
| 3095 HInstruction result() { | 3099 HInstruction result() { |
| 3096 flushLiterals(); | 3100 flushLiterals(); |
| 3097 return prefix; | 3101 return prefix; |
| 3098 } | 3102 } |
| 3099 } | 3103 } |
| OLD | NEW |