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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
index cca5f7b06477020bf2f21580b9c850083414f057..ec3ff7349cd1e47f8731353484302628e8d80531 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
@@ -193,7 +193,7 @@ abstract class JumpCollector {
}
/// True if a jump inserted now will escape from a try block.
- ///
+ ///
/// Concretely, this is true when [enterTry] has been called without
/// its corresponding [leaveTry] call.
bool get isEscapingTry => _boxedTryVariables.isNotEmpty;
@@ -546,7 +546,8 @@ class IrBuilder {
/// Creates a [ir.MutableVariable] for the given local.
void makeMutableVariable(Local local) {
- mutableVariables[local] = new ir.MutableVariable(local);
+ mutableVariables[local] =
+ new ir.MutableVariable(local);
}
/// Remove an [ir.MutableVariable] for a local.
@@ -2439,8 +2440,8 @@ class IrBuilder {
return addPrimitive(new ir.GetField(receiver, target));
}
- void buildFieldSet(ir.Primitive receiver,
- FieldElement target,
+ void buildFieldSet(ir.Primitive receiver,
+ FieldElement target,
ir.Primitive value) {
add(new ir.SetField(receiver, target, value));
}
@@ -2581,21 +2582,19 @@ class IrBuilder {
NativeBehavior behavior,
{Element dependency}) {
types.TypeMask type = program.getTypeMaskForForeign(behavior);
- if (codeTemplate.isExpression) {
- return _continueWithExpression((k) => new ir.ForeignCode(
+ ir.Primitive result = _continueWithExpression((k) => new ir.ForeignCode(
codeTemplate,
type,
arguments,
behavior,
- continuation: k,
+ k,
dependency: dependency));
- } else {
- assert(isOpen);
- add(new ir.ForeignCode(codeTemplate, type, arguments, behavior,
- dependency: dependency));
+ if (!codeTemplate.isExpression) {
+ // Close the term if this is a "throw" expression.
+ add(new ir.Unreachable());
_current = null;
- return null;
}
+ return result;
}
/// Creates a type test or type cast of [value] against [type].
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698