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

Side by Side Diff: pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart

Issue 1234753003: dart2js cps: Rewrite mutable variables to continuation parameters. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Add tests and fix an assertion Created 5 years, 5 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library tree_ir_builder; 5 library tree_ir_builder;
6 6
7 import '../dart2jslib.dart' as dart2js; 7 import '../dart2jslib.dart' as dart2js;
8 import '../elements/elements.dart'; 8 import '../elements/elements.dart';
9 import '../cps_ir/cps_ir_nodes.dart' as cps_ir; 9 import '../cps_ir/cps_ir_nodes.dart' as cps_ir;
10 import '../util/util.dart' show CURRENT_ELEMENT_SPANNABLE; 10 import '../util/util.dart' show CURRENT_ELEMENT_SPANNABLE;
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 Statement visitForeignCode(cps_ir.ForeignCode node) { 605 Statement visitForeignCode(cps_ir.ForeignCode node) {
606 if (node.codeTemplate.isExpression) { 606 if (node.codeTemplate.isExpression) {
607 Expression foreignCode = new ForeignExpression( 607 Expression foreignCode = new ForeignExpression(
608 node.codeTemplate, 608 node.codeTemplate,
609 node.type, 609 node.type,
610 node.arguments.map(getVariableUse).toList(growable: false), 610 node.arguments.map(getVariableUse).toList(growable: false),
611 node.nativeBehavior, 611 node.nativeBehavior,
612 node.dependency); 612 node.dependency);
613 return continueWithExpression(node.continuation, foreignCode); 613 return continueWithExpression(node.continuation, foreignCode);
614 } else { 614 } else {
615 assert(node.continuation == null); 615 assert(node.continuation.definition.body is cps_ir.Unreachable);
616 return new ForeignStatement( 616 return new ForeignStatement(
617 node.codeTemplate, 617 node.codeTemplate,
618 node.type, 618 node.type,
619 node.arguments.map(getVariableUse).toList(growable: false), 619 node.arguments.map(getVariableUse).toList(growable: false),
620 node.nativeBehavior, 620 node.nativeBehavior,
621 node.dependency); 621 node.dependency);
622 } 622 }
623 } 623 }
624 624
625 Expression visitGetLength(cps_ir.GetLength node) { 625 Expression visitGetLength(cps_ir.GetLength node) {
626 return new GetLength(getVariableUse(node.object)); 626 return new GetLength(getVariableUse(node.object));
627 } 627 }
628 628
629 Expression visitGetIndex(cps_ir.GetIndex node) { 629 Expression visitGetIndex(cps_ir.GetIndex node) {
630 return new GetIndex(getVariableUse(node.object), 630 return new GetIndex(getVariableUse(node.object),
631 getVariableUse(node.index)); 631 getVariableUse(node.index));
632 } 632 }
633 633
634 Expression visitSetIndex(cps_ir.SetIndex node) { 634 Expression visitSetIndex(cps_ir.SetIndex node) {
635 return new SetIndex(getVariableUse(node.object), 635 return new SetIndex(getVariableUse(node.object),
636 getVariableUse(node.index), 636 getVariableUse(node.index),
637 getVariableUse(node.value)); 637 getVariableUse(node.value));
638 } 638 }
639 } 639 }
640 640
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/codegen/task.dart ('k') | tests/compiler/dart2js/js_backend_cps_ir_control_flow_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698