Chromium Code Reviews| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 return compiler.findHelper(const SourceString('indexSet')); | 86 return compiler.findHelper(const SourceString('indexSet')); |
| 87 } | 87 } |
| 88 | 88 |
| 89 Element getEqualsNullInterceptor() { | 89 Element getEqualsNullInterceptor() { |
| 90 return compiler.findHelper(const SourceString('eqNull')); | 90 return compiler.findHelper(const SourceString('eqNull')); |
| 91 } | 91 } |
| 92 | 92 |
| 93 Element getExceptionUnwrapper() { | 93 Element getExceptionUnwrapper() { |
| 94 return compiler.findHelper(const SourceString('unwrapException')); | 94 return compiler.findHelper(const SourceString('unwrapException')); |
| 95 } | 95 } |
| 96 | |
| 97 Element getMapMaker() { | |
| 98 return compiler.findHelper(const SourceString('makeLiteralMap')); | |
| 99 } | |
| 96 } | 100 } |
| 97 | 101 |
| 98 class SsaBuilderTask extends CompilerTask { | 102 class SsaBuilderTask extends CompilerTask { |
| 99 SsaBuilderTask(Compiler compiler) | 103 SsaBuilderTask(Compiler compiler) |
| 100 : super(compiler), interceptors = new Interceptors(compiler); | 104 : super(compiler), interceptors = new Interceptors(compiler); |
| 101 String get name() => 'SSA builder'; | 105 String get name() => 'SSA builder'; |
| 102 Interceptors interceptors; | 106 Interceptors interceptors; |
| 103 | 107 |
| 104 HGraph build(WorkItem work) { | 108 HGraph build(WorkItem work) { |
| 105 return measure(() { | 109 return measure(() { |
| (...skipping 2123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2229 // Mark both entry and exit with the information. You can | 2233 // Mark both entry and exit with the information. You can |
| 2230 // tell which one is which by comparing with blockInfo.start/end. | 2234 // tell which one is which by comparing with blockInfo.start/end. |
| 2231 // It doesn't matter which merge block we use, they won't be generating | 2235 // It doesn't matter which merge block we use, they won't be generating |
| 2232 // any code, so put the end-marker on the last join block. | 2236 // any code, so put the end-marker on the last join block. |
| 2233 entryBlock.labeledBlockInformation = blockInfo; | 2237 entryBlock.labeledBlockInformation = blockInfo; |
| 2234 current.labeledBlockInformation = blockInfo; | 2238 current.labeledBlockInformation = blockInfo; |
| 2235 } | 2239 } |
| 2236 } | 2240 } |
| 2237 | 2241 |
| 2238 visitLiteralMap(LiteralMap node) { | 2242 visitLiteralMap(LiteralMap node) { |
| 2239 generateUnimplemented('literal map not implemented', isExpression: true); | 2243 List<HInstruction> inputs = <HInstruction>[]; |
| 2244 for (Link<Node> link = node.entries.nodes; | |
| 2245 !link.isEmpty(); | |
| 2246 link = link.tail) { | |
| 2247 visit(link.head); | |
| 2248 inputs.addLast(pop()); | |
| 2249 inputs.addLast(pop()); | |
| 2250 } | |
| 2251 push(new HLiteralList(inputs, node.isConst())); | |
| 2252 push(new HStatic(interceptors.getMapMaker())); | |
|
ngeoffray
2012/03/01 08:36:09
Note that you don't really need to push, you could
ahe
2012/03/06 15:34:12
Done.
| |
| 2253 push(new HInvokeStatic(Selector.INVOCATION_1, <HInstruction>[pop(), pop()])) ; | |
|
ngeoffray
2012/03/01 08:36:09
Line too long.
ahe
2012/03/06 15:34:12
Done.
| |
| 2240 } | 2254 } |
| 2241 | 2255 |
| 2242 visitLiteralMapEntry(LiteralMapEntry node) { | 2256 visitLiteralMapEntry(LiteralMapEntry node) { |
| 2243 compiler.unimplemented('SsaBuilder.visitLiteralMapEntry', node: node); | 2257 visit(node.value); |
| 2258 visit(node.key); | |
| 2244 } | 2259 } |
| 2245 | 2260 |
| 2246 visitNamedArgument(NamedArgument node) { | 2261 visitNamedArgument(NamedArgument node) { |
| 2247 visit(node.expression); | 2262 visit(node.expression); |
| 2248 } | 2263 } |
| 2249 | 2264 |
| 2250 visitSwitchStatement(SwitchStatement node) { | 2265 visitSwitchStatement(SwitchStatement node) { |
| 2251 generateUnimplemented('switch statement not implemented'); | 2266 generateUnimplemented('switch statement not implemented'); |
| 2252 } | 2267 } |
| 2253 | 2268 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2366 // Normally, we would call [close] here. However, then we hit | 2381 // Normally, we would call [close] here. However, then we hit |
| 2367 // another unimplemented feature: aborting loop body. Simply | 2382 // another unimplemented feature: aborting loop body. Simply |
| 2368 // calling [add] does not work as it asserts that the instruction | 2383 // calling [add] does not work as it asserts that the instruction |
| 2369 // isn't a control flow instruction. So we inline parts of [add]. | 2384 // isn't a control flow instruction. So we inline parts of [add]. |
| 2370 current.addAfter(current.last, new HThrow(message)); | 2385 current.addAfter(current.last, new HThrow(message)); |
| 2371 if (isExpression) { | 2386 if (isExpression) { |
| 2372 stack.add(graph.addNewLiteralNull()); | 2387 stack.add(graph.addNewLiteralNull()); |
| 2373 } | 2388 } |
| 2374 } | 2389 } |
| 2375 } | 2390 } |
| OLD | NEW |