| 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 2147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2158 pushInvokeHelper0(element); | 2158 pushInvokeHelper0(element); |
| 2159 } | 2159 } |
| 2160 } | 2160 } |
| 2161 | 2161 |
| 2162 void handleForeignJsCallInIsolate(Send node) { | 2162 void handleForeignJsCallInIsolate(Send node) { |
| 2163 Link<Node> link = node.arguments; | 2163 Link<Node> link = node.arguments; |
| 2164 if (!compiler.hasIsolateSupport()) { | 2164 if (!compiler.hasIsolateSupport()) { |
| 2165 // If the isolate library is not used, we just invoke the | 2165 // If the isolate library is not used, we just invoke the |
| 2166 // closure. | 2166 // closure. |
| 2167 visit(link.tail.head); | 2167 visit(link.tail.head); |
| 2168 Selector selector = new Selector.callAny(0); | 2168 Selector selector = new Selector.callClosure(0); |
| 2169 push(new HInvokeClosure(selector, <HInstruction>[pop()])); | 2169 push(new HInvokeClosure(selector, <HInstruction>[pop()])); |
| 2170 } else { | 2170 } else { |
| 2171 // Call a helper method from the isolate library. | 2171 // Call a helper method from the isolate library. |
| 2172 Element element = compiler.isolateLibrary.find( | 2172 Element element = compiler.isolateLibrary.find( |
| 2173 const SourceString('_callInIsolate')); | 2173 const SourceString('_callInIsolate')); |
| 2174 if (element === null) { | 2174 if (element === null) { |
| 2175 compiler.cancel( | 2175 compiler.cancel( |
| 2176 'Isolate library and compiler mismatch', node: node); | 2176 'Isolate library and compiler mismatch', node: node); |
| 2177 } | 2177 } |
| 2178 HStatic target = new HStatic(element); | 2178 HStatic target = new HStatic(element); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2198 FunctionElement function = element; | 2198 FunctionElement function = element; |
| 2199 FunctionSignature params = function.computeSignature(compiler); | 2199 FunctionSignature params = function.computeSignature(compiler); |
| 2200 if (params.optionalParameterCount !== 0) { | 2200 if (params.optionalParameterCount !== 0) { |
| 2201 compiler.cancel( | 2201 compiler.cancel( |
| 2202 'JS_TO_CLOSURE does not handle closure with optional parameters', | 2202 'JS_TO_CLOSURE does not handle closure with optional parameters', |
| 2203 node: closure); | 2203 node: closure); |
| 2204 } | 2204 } |
| 2205 visit(closure); | 2205 visit(closure); |
| 2206 List<HInstruction> inputs = <HInstruction>[pop()]; | 2206 List<HInstruction> inputs = <HInstruction>[pop()]; |
| 2207 String invocationName = compiler.namer.closureInvocationName( | 2207 String invocationName = compiler.namer.closureInvocationName( |
| 2208 new Selector.callAny(params.requiredParameterCount)); | 2208 new Selector.callClosure(params.requiredParameterCount)); |
| 2209 push(new HForeign(new DartString.literal('#.$invocationName'), | 2209 push(new HForeign(new DartString.literal('#.$invocationName'), |
| 2210 const LiteralDartString('var'), | 2210 const LiteralDartString('var'), |
| 2211 inputs)); | 2211 inputs)); |
| 2212 } | 2212 } |
| 2213 | 2213 |
| 2214 visitForeignSend(Send node) { | 2214 visitForeignSend(Send node) { |
| 2215 Element element = elements[node]; | 2215 Element element = elements[node]; |
| 2216 if (element.name == const SourceString('JS')) { | 2216 if (element.name == const SourceString('JS')) { |
| 2217 handleForeignJs(node); | 2217 handleForeignJs(node); |
| 2218 } else if (element.name == const SourceString('UNINTERCEPTED')) { | 2218 } else if (element.name == const SourceString('UNINTERCEPTED')) { |
| (...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3621 new HSubGraphBlockInformation(elseBranch.graph)); | 3621 new HSubGraphBlockInformation(elseBranch.graph)); |
| 3622 | 3622 |
| 3623 HBasicBlock conditionStartBlock = conditionBranch.block; | 3623 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 3624 conditionStartBlock.setBlockFlow(info, joinBlock); | 3624 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 3625 SubGraph conditionGraph = conditionBranch.graph; | 3625 SubGraph conditionGraph = conditionBranch.graph; |
| 3626 HIf branch = conditionGraph.end.last; | 3626 HIf branch = conditionGraph.end.last; |
| 3627 assert(branch is HIf); | 3627 assert(branch is HIf); |
| 3628 branch.blockInformation = conditionStartBlock.blockFlow; | 3628 branch.blockInformation = conditionStartBlock.blockFlow; |
| 3629 } | 3629 } |
| 3630 } | 3630 } |
| OLD | NEW |