| 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 class SsaFunctionCompiler implements FunctionCompiler { | 7 class SsaFunctionCompiler implements FunctionCompiler { |
| 8 SsaCodeGeneratorTask generator; | 8 SsaCodeGeneratorTask generator; |
| 9 SsaBuilderTask builder; | 9 SsaBuilderTask builder; |
| 10 SsaOptimizerTask optimizer; | 10 SsaOptimizerTask optimizer; |
| (...skipping 5406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5417 return new NullJumpHandler(compiler); | 5417 return new NullJumpHandler(compiler); |
| 5418 } | 5418 } |
| 5419 if (isLoopJump && node is ast.SwitchStatement) { | 5419 if (isLoopJump && node is ast.SwitchStatement) { |
| 5420 // Create a special jump handler for loops created for switch statements | 5420 // Create a special jump handler for loops created for switch statements |
| 5421 // with continue statements. | 5421 // with continue statements. |
| 5422 return new SwitchCaseJumpHandler(this, element, node); | 5422 return new SwitchCaseJumpHandler(this, element, node); |
| 5423 } | 5423 } |
| 5424 return new JumpHandler(this, element); | 5424 return new JumpHandler(this, element); |
| 5425 } | 5425 } |
| 5426 | 5426 |
| 5427 visitAsyncForIn(ast.AsyncForIn node) { | 5427 buildAsyncForIn(ast.ForIn node) { |
| 5428 assert(node.isAsync); |
| 5428 // The async-for is implemented with a StreamIterator. | 5429 // The async-for is implemented with a StreamIterator. |
| 5429 HInstruction streamIterator; | 5430 HInstruction streamIterator; |
| 5430 | 5431 |
| 5431 visit(node.expression); | 5432 visit(node.expression); |
| 5432 HInstruction expression = pop(); | 5433 HInstruction expression = pop(); |
| 5433 pushInvokeStatic(node, | 5434 pushInvokeStatic(node, |
| 5434 backend.getStreamIteratorConstructor(), | 5435 backend.getStreamIteratorConstructor(), |
| 5435 [expression, graph.addConstantNull(compiler)]); | 5436 [expression, graph.addConstantNull(compiler)]); |
| 5436 streamIterator = pop(); | 5437 streamIterator = pop(); |
| 5437 | 5438 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5483 buildBody); | 5484 buildBody); |
| 5484 }, () { | 5485 }, () { |
| 5485 pushInvokeDynamic(node, new Selector.call("cancel", null, 0), | 5486 pushInvokeDynamic(node, new Selector.call("cancel", null, 0), |
| 5486 [streamIterator]); | 5487 [streamIterator]); |
| 5487 push(new HAwait(pop(), new TypeMask.subclass(compiler.objectClass, | 5488 push(new HAwait(pop(), new TypeMask.subclass(compiler.objectClass, |
| 5488 compiler.world))); | 5489 compiler.world))); |
| 5489 pop(); | 5490 pop(); |
| 5490 }); | 5491 }); |
| 5491 } | 5492 } |
| 5492 | 5493 |
| 5493 visitSyncForIn(ast.SyncForIn node) { | 5494 visitForIn(ast.ForIn node) { |
| 5495 if (node.isAsync) { |
| 5496 return buildAsyncForIn(node); |
| 5497 } |
| 5498 |
| 5494 // Generate a structure equivalent to: | 5499 // Generate a structure equivalent to: |
| 5495 // Iterator<E> $iter = <iterable>.iterator; | 5500 // Iterator<E> $iter = <iterable>.iterator; |
| 5496 // while ($iter.moveNext()) { | 5501 // while ($iter.moveNext()) { |
| 5497 // E <declaredIdentifier> = $iter.current; | 5502 // E <declaredIdentifier> = $iter.current; |
| 5498 // <body> | 5503 // <body> |
| 5499 // } | 5504 // } |
| 5500 | 5505 |
| 5501 // The iterator is shared between initializer, condition and body. | 5506 // The iterator is shared between initializer, condition and body. |
| 5502 HInstruction iterator; | 5507 HInstruction iterator; |
| 5503 void buildInitializer() { | 5508 void buildInitializer() { |
| (...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6949 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 6954 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
| 6950 unaliased.accept(this, builder); | 6955 unaliased.accept(this, builder); |
| 6951 } | 6956 } |
| 6952 | 6957 |
| 6953 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 6958 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
| 6954 JavaScriptBackend backend = builder.compiler.backend; | 6959 JavaScriptBackend backend = builder.compiler.backend; |
| 6955 ClassElement cls = backend.findHelper('DynamicRuntimeType'); | 6960 ClassElement cls = backend.findHelper('DynamicRuntimeType'); |
| 6956 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); | 6961 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); |
| 6957 } | 6962 } |
| 6958 } | 6963 } |
| OLD | NEW |