| 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 final SsaCodeGeneratorTask generator; | 8 final SsaCodeGeneratorTask generator; |
| 9 final SsaBuilderTask builder; | 9 final SsaBuilderTask builder; |
| 10 final SsaOptimizerTask optimizer; | 10 final SsaOptimizerTask optimizer; |
| (...skipping 7517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7528 // This scheme recognizes for-in on direct lists. It does not recognize all | 7528 // This scheme recognizes for-in on direct lists. It does not recognize all |
| 7529 // uses of ArrayIterator. They still occur when the receiver is an Iterable | 7529 // uses of ArrayIterator. They still occur when the receiver is an Iterable |
| 7530 // with a `get iterator` method that delegate to another Iterable and the | 7530 // with a `get iterator` method that delegate to another Iterable and the |
| 7531 // method is inlined. We would require full scalar replacement in that | 7531 // method is inlined. We would require full scalar replacement in that |
| 7532 // case. | 7532 // case. |
| 7533 | 7533 |
| 7534 Selector selector = Selectors.iterator; | 7534 Selector selector = Selectors.iterator; |
| 7535 TypeMask mask = elements.getIteratorTypeMask(node); | 7535 TypeMask mask = elements.getIteratorTypeMask(node); |
| 7536 | 7536 |
| 7537 ClassWorld classWorld = compiler.world; | 7537 ClassWorld classWorld = compiler.world; |
| 7538 if (mask != null && mask.satisfies(helpers.jsIndexableClass, classWorld)) { | 7538 if (mask != null && |
| 7539 mask.satisfies(helpers.jsIndexableClass, classWorld) && |
| 7540 // String is indexable but not iterable. |
| 7541 !mask.satisfies(helpers.jsStringClass, classWorld)) { |
| 7539 return buildSyncForInIndexable(node, mask); | 7542 return buildSyncForInIndexable(node, mask); |
| 7540 } | 7543 } |
| 7541 buildSyncForInIterator(node); | 7544 buildSyncForInIterator(node); |
| 7542 } | 7545 } |
| 7543 | 7546 |
| 7544 buildSyncForInIterator(ast.SyncForIn node) { | 7547 buildSyncForInIterator(ast.SyncForIn node) { |
| 7545 // Generate a structure equivalent to: | 7548 // Generate a structure equivalent to: |
| 7546 // Iterator<E> $iter = <iterable>.iterator; | 7549 // Iterator<E> $iter = <iterable>.iterator; |
| 7547 // while ($iter.moveNext()) { | 7550 // while ($iter.moveNext()) { |
| 7548 // <declaredIdentifier> = $iter.current; | 7551 // <declaredIdentifier> = $iter.current; |
| (...skipping 1687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9236 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 9239 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
| 9237 unaliased.accept(this, builder); | 9240 unaliased.accept(this, builder); |
| 9238 } | 9241 } |
| 9239 | 9242 |
| 9240 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 9243 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
| 9241 JavaScriptBackend backend = builder.compiler.backend; | 9244 JavaScriptBackend backend = builder.compiler.backend; |
| 9242 ClassElement cls = backend.helpers.DynamicRuntimeType; | 9245 ClassElement cls = backend.helpers.DynamicRuntimeType; |
| 9243 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); | 9246 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); |
| 9244 } | 9247 } |
| 9245 } | 9248 } |
| OLD | NEW |