Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: pkg/compiler/lib/src/ssa/builder.dart

Issue 1069983005: Model 'await for' as an explicit node in tree and fix its handling. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix failing assertion rebase Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/compiler/lib/src/scanner/listener.dart ('k') | pkg/compiler/lib/src/ssa/nodes.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 buildAsyncForIn(ast.ForIn node) { 5427 visitAsyncForIn(ast.AsyncForIn node) {
5428 assert(node.isAsync);
5429 // The async-for is implemented with a StreamIterator. 5428 // The async-for is implemented with a StreamIterator.
5430 HInstruction streamIterator; 5429 HInstruction streamIterator;
5431 5430
5432 visit(node.expression); 5431 visit(node.expression);
5433 HInstruction expression = pop(); 5432 HInstruction expression = pop();
5434 pushInvokeStatic(node, 5433 pushInvokeStatic(node,
5435 backend.getStreamIteratorConstructor(), 5434 backend.getStreamIteratorConstructor(),
5436 [expression, graph.addConstantNull(compiler)]); 5435 [expression, graph.addConstantNull(compiler)]);
5437 streamIterator = pop(); 5436 streamIterator = pop();
5438 5437
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
5484 buildBody); 5483 buildBody);
5485 }, () { 5484 }, () {
5486 pushInvokeDynamic(node, new Selector.call("cancel", null, 0), 5485 pushInvokeDynamic(node, new Selector.call("cancel", null, 0),
5487 [streamIterator]); 5486 [streamIterator]);
5488 push(new HAwait(pop(), new TypeMask.subclass(compiler.objectClass, 5487 push(new HAwait(pop(), new TypeMask.subclass(compiler.objectClass,
5489 compiler.world))); 5488 compiler.world)));
5490 pop(); 5489 pop();
5491 }); 5490 });
5492 } 5491 }
5493 5492
5494 visitForIn(ast.ForIn node) { 5493 visitSyncForIn(ast.SyncForIn node) {
5495 if (node.isAsync) {
5496 return buildAsyncForIn(node);
5497 }
5498
5499 // Generate a structure equivalent to: 5494 // Generate a structure equivalent to:
5500 // Iterator<E> $iter = <iterable>.iterator; 5495 // Iterator<E> $iter = <iterable>.iterator;
5501 // while ($iter.moveNext()) { 5496 // while ($iter.moveNext()) {
5502 // E <declaredIdentifier> = $iter.current; 5497 // E <declaredIdentifier> = $iter.current;
5503 // <body> 5498 // <body>
5504 // } 5499 // }
5505 5500
5506 // The iterator is shared between initializer, condition and body. 5501 // The iterator is shared between initializer, condition and body.
5507 HInstruction iterator; 5502 HInstruction iterator;
5508 void buildInitializer() { 5503 void buildInitializer() {
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
6954 if (unaliased is TypedefType) throw 'unable to unalias $type'; 6949 if (unaliased is TypedefType) throw 'unable to unalias $type';
6955 unaliased.accept(this, builder); 6950 unaliased.accept(this, builder);
6956 } 6951 }
6957 6952
6958 void visitDynamicType(DynamicType type, SsaBuilder builder) { 6953 void visitDynamicType(DynamicType type, SsaBuilder builder) {
6959 JavaScriptBackend backend = builder.compiler.backend; 6954 JavaScriptBackend backend = builder.compiler.backend;
6960 ClassElement cls = backend.findHelper('DynamicRuntimeType'); 6955 ClassElement cls = backend.findHelper('DynamicRuntimeType');
6961 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); 6956 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld)));
6962 } 6957 }
6963 } 6958 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/scanner/listener.dart ('k') | pkg/compiler/lib/src/ssa/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698