DFG CFA forgets to notify subsequent phases of found constants if it proves LogicalNot to be a constant
https://bugs.webkit.org/show_bug.cgi?id=89511
<rdar://problem/11700089>

Reviewed by Geoffrey Garen.

Source/JavaScriptCore: 

* dfg/DFGAbstractState.cpp:
(JSC::DFG::AbstractState::execute):

LayoutTests: 

* fast/js/dfg-constant-fold-logical-not-branch-expected.txt: Added.
* fast/js/dfg-constant-fold-logical-not-branch.html: Added.
* fast/js/script-tests/dfg-constant-fold-logical-not-branch.js: Added.
(foo1):
(foo2):
(Stuff):
(Stuff.prototype.thingy):
(Stuff.prototype.otherThingy):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@120767 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/fast/js/script-tests/dfg-constant-fold-logical-not-branch.js b/LayoutTests/fast/js/script-tests/dfg-constant-fold-logical-not-branch.js
new file mode 100644
index 0000000..299aa2e
--- /dev/null
+++ b/LayoutTests/fast/js/script-tests/dfg-constant-fold-logical-not-branch.js
@@ -0,0 +1,32 @@
+description(
+"Tests what happens if we fail to constant fold a LogicalNot that leads into a branch, when the CFA proves that the LogicalNot has a constant value."
+);
+
+function foo1(o) {
+    if (!!o.thingy)
+        return o.thingy(42);
+    else
+        return o.otherThingy(57);
+}
+
+function foo2(o) {
+    if (!o.thingy)
+        return o.otherThingy(42);
+    else
+        return o.thingy(57);
+}
+
+function Stuff() {
+}
+
+Stuff.prototype = {
+    thingy: function(x) { return x + 1; },
+    otherThingy: function(x) { return x - 1; }
+};
+
+for (var i = 0; i < 1000; ++i) {
+    shouldBe("foo1(new Stuff())", "43");
+    shouldBe("foo2(new Stuff())", "58");
+}
+
+