| 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 3086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3097 // signatures have different elements for parameters. | 3097 // signatures have different elements for parameters. |
| 3098 FunctionElement implementation = function.implementation; | 3098 FunctionElement implementation = function.implementation; |
| 3099 FunctionSignature params = implementation.computeSignature(compiler); | 3099 FunctionSignature params = implementation.computeSignature(compiler); |
| 3100 if (params.optionalParameterCount != 0) { | 3100 if (params.optionalParameterCount != 0) { |
| 3101 compiler.cancel( | 3101 compiler.cancel( |
| 3102 'JS_TO_CLOSURE does not handle closure with optional parameters', | 3102 'JS_TO_CLOSURE does not handle closure with optional parameters', |
| 3103 node: closure); | 3103 node: closure); |
| 3104 } | 3104 } |
| 3105 visit(closure); | 3105 visit(closure); |
| 3106 List<HInstruction> inputs = <HInstruction>[pop()]; | 3106 List<HInstruction> inputs = <HInstruction>[pop()]; |
| 3107 String invocationName = backend.namer.closureInvocationName( | 3107 String invocationName = backend.namer.invocationName( |
| 3108 new Selector.callClosure(params.requiredParameterCount)); | 3108 new Selector.callClosure(params.requiredParameterCount)); |
| 3109 push(new HForeign(new DartString.literal('#.$invocationName'), | 3109 push(new HForeign(new DartString.literal('#.$invocationName'), |
| 3110 const LiteralDartString('var'), | 3110 const LiteralDartString('var'), |
| 3111 inputs)); | 3111 inputs)); |
| 3112 } | 3112 } |
| 3113 | 3113 |
| 3114 void handleForeignSetCurrentIsolate(Send node) { | 3114 void handleForeignSetCurrentIsolate(Send node) { |
| 3115 if (node.arguments.isEmpty || !node.arguments.tail.isEmpty) { | 3115 if (node.arguments.isEmpty || !node.arguments.tail.isEmpty) { |
| 3116 compiler.cancel('Exactly one argument required', | 3116 compiler.cancel('Exactly one argument required', |
| 3117 node: node.argumentsNode); | 3117 node: node.argumentsNode); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3168 // Register the call as dynamic if [:noSuchMethod:] on the super class | 3168 // Register the call as dynamic if [:noSuchMethod:] on the super class |
| 3169 // is _not_ the default implementation from [:Object:]. | 3169 // is _not_ the default implementation from [:Object:]. |
| 3170 compiler.enqueuer.codegen.registerDynamicInvocation(name, selector); | 3170 compiler.enqueuer.codegen.registerDynamicInvocation(name, selector); |
| 3171 } | 3171 } |
| 3172 HStatic target = new HStatic(element); | 3172 HStatic target = new HStatic(element); |
| 3173 add(target); | 3173 add(target); |
| 3174 HInstruction self = localsHandler.readThis(); | 3174 HInstruction self = localsHandler.readThis(); |
| 3175 Constant nameConstant = constantSystem.createString( | 3175 Constant nameConstant = constantSystem.createString( |
| 3176 new DartString.literal(name.slowToString()), node); | 3176 new DartString.literal(name.slowToString()), node); |
| 3177 | 3177 |
| 3178 String internalName = backend.namer.instanceMethodInvocationName( | 3178 String internalName = backend.namer.invocationName(selector); |
| 3179 currentLibrary, name, selector); | |
| 3180 Constant internalNameConstant = | 3179 Constant internalNameConstant = |
| 3181 constantSystem.createString(new DartString.literal(internalName), node); | 3180 constantSystem.createString(new DartString.literal(internalName), node); |
| 3182 | 3181 |
| 3183 Element createInvocationMirror = | 3182 Element createInvocationMirror = |
| 3184 compiler.findHelper(Compiler.CREATE_INVOCATION_MIRROR); | 3183 compiler.findHelper(Compiler.CREATE_INVOCATION_MIRROR); |
| 3185 | 3184 |
| 3186 var arguments = new List<HInstruction>(); | 3185 var arguments = new List<HInstruction>(); |
| 3187 if (node.argumentsNode != null) { | 3186 if (node.argumentsNode != null) { |
| 3188 addGenericSendArgumentsToList(node.arguments, arguments); | 3187 addGenericSendArgumentsToList(node.arguments, arguments); |
| 3189 } | 3188 } |
| (...skipping 1912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5102 new HSubGraphBlockInformation(elseBranch.graph)); | 5101 new HSubGraphBlockInformation(elseBranch.graph)); |
| 5103 | 5102 |
| 5104 HBasicBlock conditionStartBlock = conditionBranch.block; | 5103 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 5105 conditionStartBlock.setBlockFlow(info, joinBlock); | 5104 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 5106 SubGraph conditionGraph = conditionBranch.graph; | 5105 SubGraph conditionGraph = conditionBranch.graph; |
| 5107 HIf branch = conditionGraph.end.last; | 5106 HIf branch = conditionGraph.end.last; |
| 5108 assert(branch is HIf); | 5107 assert(branch is HIf); |
| 5109 branch.blockInformation = conditionStartBlock.blockFlow; | 5108 branch.blockInformation = conditionStartBlock.blockFlow; |
| 5110 } | 5109 } |
| 5111 } | 5110 } |
| OLD | NEW |