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 3009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3020 // If the isolate library is not used, we just generate code | 3020 // If the isolate library is not used, we just generate code |
3021 // to fetch the Leg's current isolate. | 3021 // to fetch the Leg's current isolate. |
3022 String name = backend.namer.CURRENT_ISOLATE; | 3022 String name = backend.namer.CURRENT_ISOLATE; |
3023 push(new HForeign(new DartString.literal(name), | 3023 push(new HForeign(new DartString.literal(name), |
3024 const LiteralDartString('var'), | 3024 const LiteralDartString('var'), |
3025 <HInstruction>[])); | 3025 <HInstruction>[])); |
3026 } else { | 3026 } else { |
3027 // Call a helper method from the isolate library. The isolate | 3027 // Call a helper method from the isolate library. The isolate |
3028 // library uses its own isolate structure, that encapsulates | 3028 // library uses its own isolate structure, that encapsulates |
3029 // Leg's isolate. | 3029 // Leg's isolate. |
3030 Element element = compiler.isolateHelperLibrary.find( | 3030 Element element = compiler.isolateLibrary.find( |
3031 const SourceString('_currentIsolate')); | 3031 const SourceString('_currentIsolate')); |
3032 if (element == null) { | 3032 if (element == null) { |
3033 compiler.cancel( | 3033 compiler.cancel( |
3034 'Isolate library and compiler mismatch', node: node); | 3034 'Isolate library and compiler mismatch', node: node); |
3035 } | 3035 } |
3036 pushInvokeHelper0(element); | 3036 pushInvokeHelper0(element); |
3037 } | 3037 } |
3038 } | 3038 } |
3039 | 3039 |
3040 void handleForeignJsCallInIsolate(Send node) { | 3040 void handleForeignJsCallInIsolate(Send node) { |
3041 Link<Node> link = node.arguments; | 3041 Link<Node> link = node.arguments; |
3042 if (!compiler.hasIsolateSupport()) { | 3042 if (!compiler.hasIsolateSupport()) { |
3043 // If the isolate library is not used, we just invoke the | 3043 // If the isolate library is not used, we just invoke the |
3044 // closure. | 3044 // closure. |
3045 visit(link.tail.head); | 3045 visit(link.tail.head); |
3046 Selector selector = new Selector.callClosure(0); | 3046 Selector selector = new Selector.callClosure(0); |
3047 push(new HInvokeClosure(selector, <HInstruction>[pop()])); | 3047 push(new HInvokeClosure(selector, <HInstruction>[pop()])); |
3048 } else { | 3048 } else { |
3049 // Call a helper method from the isolate library. | 3049 // Call a helper method from the isolate library. |
3050 Element element = compiler.isolateHelperLibrary.find( | 3050 Element element = compiler.isolateLibrary.find( |
3051 const SourceString('_callInIsolate')); | 3051 const SourceString('_callInIsolate')); |
3052 if (element == null) { | 3052 if (element == null) { |
3053 compiler.cancel( | 3053 compiler.cancel( |
3054 'Isolate library and compiler mismatch', node: node); | 3054 'Isolate library and compiler mismatch', node: node); |
3055 } | 3055 } |
3056 HStatic target = new HStatic(element); | 3056 HStatic target = new HStatic(element); |
3057 add(target); | 3057 add(target); |
3058 List<HInstruction> inputs = <HInstruction>[target]; | 3058 List<HInstruction> inputs = <HInstruction>[target]; |
3059 addGenericSendArgumentsToList(link, inputs); | 3059 addGenericSendArgumentsToList(link, inputs); |
3060 push(new HInvokeStatic(inputs)); | 3060 push(new HInvokeStatic(inputs)); |
(...skipping 1978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5039 new HSubGraphBlockInformation(elseBranch.graph)); | 5039 new HSubGraphBlockInformation(elseBranch.graph)); |
5040 | 5040 |
5041 HBasicBlock conditionStartBlock = conditionBranch.block; | 5041 HBasicBlock conditionStartBlock = conditionBranch.block; |
5042 conditionStartBlock.setBlockFlow(info, joinBlock); | 5042 conditionStartBlock.setBlockFlow(info, joinBlock); |
5043 SubGraph conditionGraph = conditionBranch.graph; | 5043 SubGraph conditionGraph = conditionBranch.graph; |
5044 HIf branch = conditionGraph.end.last; | 5044 HIf branch = conditionGraph.end.last; |
5045 assert(branch is HIf); | 5045 assert(branch is HIf); |
5046 branch.blockInformation = conditionStartBlock.blockFlow; | 5046 branch.blockInformation = conditionStartBlock.blockFlow; |
5047 } | 5047 } |
5048 } | 5048 } |
OLD | NEW |