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 3054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3065 HStatic target = new HStatic(element); | 3065 HStatic target = new HStatic(element); |
3066 add(target); | 3066 add(target); |
3067 List<HInstruction> inputs = <HInstruction>[target]; | 3067 List<HInstruction> inputs = <HInstruction>[target]; |
3068 addGenericSendArgumentsToList(link, inputs); | 3068 addGenericSendArgumentsToList(link, inputs); |
3069 push(new HInvokeStatic(inputs)); | 3069 push(new HInvokeStatic(inputs)); |
3070 } | 3070 } |
3071 } | 3071 } |
3072 | 3072 |
3073 FunctionSignature handleForeignRawFunctionRef(Send node, String name) { | 3073 FunctionSignature handleForeignRawFunctionRef(Send node, String name) { |
3074 if (node.arguments.isEmpty || !node.arguments.tail.isEmpty) { | 3074 if (node.arguments.isEmpty || !node.arguments.tail.isEmpty) { |
3075 compiler.cancel('$name requires exactly one argument', | 3075 compiler.cancel('"$name" requires exactly one argument', |
3076 node: node.argumentsNode); | 3076 node: node.argumentsNode); |
3077 } | 3077 } |
3078 Node closure = node.arguments.head; | 3078 Node closure = node.arguments.head; |
3079 Element element = elements[closure]; | 3079 Element element = elements[closure]; |
3080 if (!Elements.isStaticOrTopLevelFunction(element)) { | 3080 if (!Elements.isStaticOrTopLevelFunction(element)) { |
3081 compiler.cancel( | 3081 compiler.cancel( |
3082 '$name requires a static or top-level method', | 3082 '"$name" requires a static or top-level method', |
3083 node: closure); | 3083 node: closure); |
3084 } | 3084 } |
3085 FunctionElement function = element; | 3085 FunctionElement function = element; |
3086 // TODO(johnniwinther): Try to eliminate the need to distinguish declaration | 3086 // TODO(johnniwinther): Try to eliminate the need to distinguish declaration |
3087 // and implementation signatures. Currently it is need because the | 3087 // and implementation signatures. Currently it is need because the |
3088 // signatures have different elements for parameters. | 3088 // signatures have different elements for parameters. |
3089 FunctionElement implementation = function.implementation; | 3089 FunctionElement implementation = function.implementation; |
3090 FunctionSignature params = implementation.computeSignature(compiler); | 3090 FunctionSignature params = implementation.computeSignature(compiler); |
3091 if (params.optionalParameterCount != 0) { | 3091 if (params.optionalParameterCount != 0) { |
3092 compiler.cancel( | 3092 compiler.cancel( |
3093 '$name does not handle closure with optional parameters', | 3093 '"$name" does not handle closure with optional parameters', |
3094 node: closure); | 3094 node: closure); |
3095 } | 3095 } |
3096 visit(closure); | 3096 visit(closure); |
3097 return params; | 3097 return params; |
3098 } | 3098 } |
3099 | 3099 |
3100 void handleForeignDartClosureToJs(Send node, String name) { | 3100 void handleForeignDartClosureToJs(Send node, String name) { |
3101 FunctionSignature params = handleForeignRawFunctionRef(node, name); | 3101 FunctionSignature params = handleForeignRawFunctionRef(node, name); |
3102 List<HInstruction> inputs = <HInstruction>[pop()]; | 3102 List<HInstruction> inputs = <HInstruction>[pop()]; |
3103 String invocationName = backend.namer.invocationName( | 3103 String invocationName = backend.namer.invocationName( |
(...skipping 1991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5095 new HSubGraphBlockInformation(elseBranch.graph)); | 5095 new HSubGraphBlockInformation(elseBranch.graph)); |
5096 | 5096 |
5097 HBasicBlock conditionStartBlock = conditionBranch.block; | 5097 HBasicBlock conditionStartBlock = conditionBranch.block; |
5098 conditionStartBlock.setBlockFlow(info, joinBlock); | 5098 conditionStartBlock.setBlockFlow(info, joinBlock); |
5099 SubGraph conditionGraph = conditionBranch.graph; | 5099 SubGraph conditionGraph = conditionBranch.graph; |
5100 HIf branch = conditionGraph.end.last; | 5100 HIf branch = conditionGraph.end.last; |
5101 assert(branch is HIf); | 5101 assert(branch is HIf); |
5102 branch.blockInformation = conditionStartBlock.blockFlow; | 5102 branch.blockInformation = conditionStartBlock.blockFlow; |
5103 } | 5103 } |
5104 } | 5104 } |
OLD | NEW |