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

Unified Diff: tests/compiler/dart2js/backend_dart/opt_shrinking_test.dart

Issue 869223003: Revert "Add a shrinking reduction for dead continuation parameters." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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
Index: tests/compiler/dart2js/backend_dart/opt_shrinking_test.dart
diff --git a/tests/compiler/dart2js/backend_dart/opt_shrinking_test.dart b/tests/compiler/dart2js/backend_dart/opt_shrinking_test.dart
index a0c4751282c6665b7eea5ba8602db0f399ba04a4..ccc74f4fb874dfeadafb6c0e175db41bb8cca8af 100644
--- a/tests/compiler/dart2js/backend_dart/opt_shrinking_test.dart
+++ b/tests/compiler/dart2js/backend_dart/opt_shrinking_test.dart
@@ -153,7 +153,7 @@ String BETA_CONT_LIN_OUT = """
String RECURSIVE_BETA_CONT_LIN_IN = """
(FunctionDefinition main () return ()
(LetCont ((rec k0 (v0)
- (InvokeContinuation rec k0 (v0))))
+ (InvokeContinuation* k0 (v0))))
(LetPrim (v1 (Constant (Int 0)))
(InvokeContinuation k0 (v1)))))
""";
@@ -190,105 +190,28 @@ String USED_BETA_CONT_LIN_OUT = """
// Eta-cont: letcont k x = j x in K -> K[j/k].
// IR written by hand.
-//
-// This test is incorrectly named: with the current implementation, there is no
-// eta reduction. Instead, dead-parameter, beta-cont-lin, and dead-val
-// reductions are performed, which in turn creates a second beta-cont-lin
-// reduction.
-//
-// TODO(kmillikin): To test continuation eta reduction, use eta redexes that are
-// not overlapping beta redexes.
+
String ETA_CONT_IN = """
(FunctionDefinition main () return ()
- (LetPrim (v0 (Constant (Int 0)))
- (LetCont ((rec k0 (v1)
- (InvokeContinuation return (v0))))
- (LetCont ((k1 (v2)
- (InvokeContinuation k0 (v2))))
- (LetPrim (v3
+ (LetPrim (v3 (Constant (Int 0)))
+ (LetCont ((rec k1 (v1)
+ (InvokeContinuation return (v3))))
+ (LetCont ((k0 (v0)
+ (InvokeContinuation k1 (v0))))
+ (LetPrim (v4
(CreateFunction
(FunctionDefinition f () return ()
- (InvokeContinuation k0 (v0)))))
- (InvokeContinuation k1 (v0)))))))
+ (InvokeContinuation k1 (v3)))))
+ (InvokeContinuation k0 (v3)))))))
""";
String ETA_CONT_OUT = """
(FunctionDefinition main () return ()
(LetPrim (v0 (Constant (Int 0)))
- (InvokeContinuation return (v0))))
-""";
-
-// Dead-parameter:
-// letcont k x = E0 in E1 -> letcont k () = E0 in E1,
-// if x does not occur free in E0.
-
-// Parameter v1 is unused in k0.
-String DEAD_PARAMETER_IN = """
-(FunctionDefinition main (x) return ()
- (LetCont ((k0 (v0 v1 v2)
- (InvokeStatic foo (v0 v2) return)))
- (LetCont ((k1 ()
- (LetPrim (v3 (Constant (Int 0)))
- (LetPrim (v4 (Constant (Int 1)))
- (LetPrim (v5 (Constant (Int 2)))
- (InvokeContinuation k0 (v3 v4 v5))))))
- (k2 ()
- (LetPrim (v6 (Constant (Int 3)))
- (LetPrim (v7 (Constant (Int 4)))
- (LetPrim (v8 (Constant (Int 5)))
- (InvokeContinuation k0 (v6 v7 v8)))))))
- (Branch (IsTrue x) k1 k2))))
-""";
-String DEAD_PARAMETER_OUT = """
-(FunctionDefinition main (x) return ()
- (LetCont ((k0 (v0 v1)
- (InvokeStatic foo (v0 v1) return)))
- (LetCont ((k1 ()
- (LetPrim (v2 (Constant (Int 0)))
- (LetPrim (v3 (Constant (Int 2)))
- (InvokeContinuation k0 (v2 v3)))))
- (k2 ()
- (LetPrim (v4 (Constant (Int 3)))
- (LetPrim (v5 (Constant (Int 5)))
- (InvokeContinuation k0 (v4 v5))))))
- (Branch (IsTrue x) k1 k2))))
-""";
-
-// Create an eta-cont redex:
-// Dead parameter reductions can create an eta-cont redex by removing unused
-// continuation parameters and thus creating the eta redex.
-String CREATE_ETA_CONT_IN = """
-(FunctionDefinition main (x) return ()
- (LetCont ((rec loop (v0)
- (InvokeContinuation rec loop (v0))))
- (LetCont ((created (v1 v2 v3)
- (InvokeContinuation loop (v2))))
- (LetCont ((then ()
- (LetPrim (v4 (Constant (Int 0)))
- (LetPrim (v5 (Constant (Int 1)))
- (LetPrim (v6 (Constant (Int 2)))
- (InvokeContinuation created (v4 v5 v6))))))
- (else ()
- (LetPrim (v6 (Constant (Int 3)))
- (LetPrim (v7 (Constant (Int 4)))
- (LetPrim (v8 (Constant (Int 5)))
- (InvokeContinuation created (v6 v7 v8)))))))
- (Branch (IsTrue x) then else)))))
-""";
-String CREATE_ETA_CONT_OUT = """
-(FunctionDefinition main (x) return ()
- (LetCont ((rec k0 (v0)
- (InvokeContinuation rec k0 (v0))))
- (LetCont ((k1 ()
- (LetPrim (v1 (Constant (Int 1)))
- (InvokeContinuation k0 (v1))))
- (k2 ()
- (LetPrim (v2 (Constant (Int 4)))
- (InvokeContinuation k0 (v2)))))
- (Branch (IsTrue x) k1 k2))))
+ (LetCont ((k0 (v1)
+ (InvokeContinuation return (v0))))
+ (InvokeContinuation k0 (v0)))))
""";
-
-
// Beta-fun-lin and eta-fun might not apply to us, since
// a. in (InvokeMethod v0 call k0), v0 might carry state, and
// b. there is no way to generate static nested functions that we could
@@ -311,7 +234,7 @@ void testShrinkingReducer(String input, String expectedOutput) {
optimizer.rewrite(f);
String expected = normalizeSExpr(expectedOutput);
- String actual = normalizeSExpr(stringifier.visit(f));
+ String actual = normalizeSExpr(stringifier.visit(f));
Expect.equals(expected, actual);
}
@@ -326,6 +249,4 @@ void main() {
testShrinkingReducer(RECURSIVE_BETA_CONT_LIN_IN, RECURSIVE_BETA_CONT_LIN_OUT);
testShrinkingReducer(USED_BETA_CONT_LIN_IN, USED_BETA_CONT_LIN_OUT);
testShrinkingReducer(ETA_CONT_IN, ETA_CONT_OUT);
- testShrinkingReducer(DEAD_PARAMETER_IN, DEAD_PARAMETER_OUT);
- testShrinkingReducer(CREATE_ETA_CONT_IN, CREATE_ETA_CONT_OUT);
}

Powered by Google App Engine
This is Rietveld 408576698