2008-06-30 Cameron Zwarich <cwzwarich@uwaterloo.ca>
authorcwzwarich@webkit.org <cwzwarich@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Jul 2008 01:56:16 +0000 (01:56 +0000)
committercwzwarich@webkit.org <cwzwarich@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Jul 2008 01:56:16 +0000 (01:56 +0000)
        Reviewed by Oliver.

        Bug 19830: REGRESSION (r34883): Google Reader doesn't show up feed list on sidebar
        <https://bugs.webkit.org/show_bug.cgi?id=19830>

        Ensure that we do not eliminate a write to a local register when doing
        peephole optimizations.

        JavaScriptCore:

        * VM/CodeGenerator.cpp:
        (KJS::CodeGenerator::emitJumpIfTrue):
        (KJS::CodeGenerator::emitJumpIfFalse):

        LayoutTests:

        * fast/js/codegen-peephole-locals-expected.txt: Added.
        * fast/js/codegen-peephole-locals.html: Added.
        * fast/js/resources/codegen-peephole-locals.js: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@34903 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/ChangeLog
JavaScriptCore/VM/CodeGenerator.cpp
LayoutTests/ChangeLog
LayoutTests/fast/js/codegen-peephole-locals-expected.txt [new file with mode: 0644]
LayoutTests/fast/js/codegen-peephole-locals.html [new file with mode: 0644]
LayoutTests/fast/js/resources/codegen-peephole-locals.js [new file with mode: 0644]

index 87d9ed34be300e782ff80d79de91e01a8897161b..a36bad2fd22bd9fc9a823bb979bf06c4ae42d023 100644 (file)
@@ -1,3 +1,17 @@
+2008-06-30  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
+
+        Reviewed by Oliver.
+
+        Bug 19830: REGRESSION (r34883): Google Reader doesn't show up feed list on sidebar
+        <https://bugs.webkit.org/show_bug.cgi?id=19830>
+
+        Ensure that we do not eliminate a write to a local register when doing
+        peephole optimizations.
+
+        * VM/CodeGenerator.cpp:
+        (KJS::CodeGenerator::emitJumpIfTrue):
+        (KJS::CodeGenerator::emitJumpIfFalse):
+
 2008-06-30  Sam Weinig  <sam@webkit.org>
 
         Rubber-stamped by Darin Alder.
index 9170821b6f267c1cc3c0bd4959d9536c3ff82601..fe963147a59f8ea58852b756e34ccd2fcb526a0c 100644 (file)
@@ -451,7 +451,7 @@ PassRefPtr<LabelID> CodeGenerator::emitJumpIfTrue(RegisterID* cond, LabelID* tar
         
         retrieveLastBinaryOp(dstIndex, src1Index, src2Index);
         
-        if (cond->index() == dstIndex && !cond->refCount()) {
+        if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) {
             rewindBinaryOp();
             emitOpcode(target->isForwardLabel() ? op_jless : op_loop_if_less);
             instructions().append(src1Index);
@@ -478,7 +478,7 @@ PassRefPtr<LabelID> CodeGenerator::emitJumpIfFalse(RegisterID* cond, LabelID* ta
         
         retrieveLastBinaryOp(dstIndex, src1Index, src2Index);
         
-        if (cond->index() == dstIndex && !cond->refCount()) {
+        if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) {
             rewindBinaryOp();
             emitOpcode(op_jnless);
             instructions().append(src1Index);
index 8b6c2a624fbd4c4d844f9694edaab344e9ec47d0..8ab39d26bf220f38b9c1189fbe6a03033b4b371f 100644 (file)
@@ -1,3 +1,16 @@
+2008-06-30  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
+
+        Reviewed by Oliver.
+
+        Tests for:
+
+        Bug 19830: REGRESSION (r34883): Google Reader doesn't show up feed list on sidebar
+        <https://bugs.webkit.org/show_bug.cgi?id=19830>
+
+        * fast/js/codegen-peephole-locals-expected.txt: Added.
+        * fast/js/codegen-peephole-locals.html: Added.
+        * fast/js/resources/codegen-peephole-locals.js: Added.
+
 2008-06-30  Adele Peterson  <adele@apple.com>
 
         Reviewed by Anders.
diff --git a/LayoutTests/fast/js/codegen-peephole-locals-expected.txt b/LayoutTests/fast/js/codegen-peephole-locals-expected.txt
new file mode 100644 (file)
index 0000000..2a302cb
--- /dev/null
@@ -0,0 +1,17 @@
+Tests whether peephole optimizations on bytecode properly deal with local registers.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS if_less_test() is true
+PASS if_else_less_test() is true
+PASS conditional_less_test() is true
+PASS logical_and_less_test() is true
+PASS logical_or_less_test() is true
+PASS do_while_less_test() is true
+PASS while_less_test() is true
+PASS for_less_test() is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/js/codegen-peephole-locals.html b/LayoutTests/fast/js/codegen-peephole-locals.html
new file mode 100644 (file)
index 0000000..f9a3d89
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="resources/js-test-style.css">
+<script src="resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/codegen-peephole-locals.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/js/resources/codegen-peephole-locals.js b/LayoutTests/fast/js/resources/codegen-peephole-locals.js
new file mode 100644 (file)
index 0000000..3570248
--- /dev/null
@@ -0,0 +1,85 @@
+description(
+"Tests whether peephole optimizations on bytecode properly deal with local registers."
+);
+
+function if_less_test()
+{
+    var a = 0;
+    var b = 2;
+    if (a = 1 < 2)
+        return a == 1;
+}
+
+shouldBeTrue("if_less_test()");
+
+function if_else_less_test()
+{
+    var a = 0;
+    var b = 2;
+    if (a = 1 < 2)
+        return a == 1;
+    else
+        return false;
+}
+
+shouldBeTrue("if_else_less_test()");
+
+function conditional_less_test()
+{
+    var a = 0;
+    var b = 2;
+    return (a = 1 < 2) ? a == 1 : false;
+}
+
+shouldBeTrue("conditional_less_test()");
+
+function logical_and_less_test()
+{
+    var a = 0;
+    var b = 2;
+    return (a = 1 < 2) && a == 1;
+}
+
+shouldBeTrue("logical_and_less_test()");
+
+function logical_or_less_test()
+{
+    var a = 0;
+    var b = 2;
+    var result = (a = 1 < 2) || a == 1;
+    return a == 1;
+}
+
+shouldBeTrue("logical_or_less_test()");
+
+function do_while_less_test()
+{
+    var a = 0;
+    var count = 0;
+    do {
+        if (count == 1)
+            return a == 1;
+        count++;
+    } while (a = 1 < 2)
+}
+
+shouldBeTrue("do_while_less_test()");
+
+function while_less_test()
+{
+    var a = 0;
+    while (a = 1 < 2)
+        return a == 1;
+}
+
+shouldBeTrue("while_less_test()");
+
+function for_less_test()
+{
+    for (var a = 0; a = 1 < 2; )
+        return a == 1;
+}
+
+shouldBeTrue("for_less_test()");
+
+var successfullyParsed = true;