B3::foldPathConstants() needs to execute its insertion set
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Feb 2016 01:06:23 +0000 (01:06 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Feb 2016 01:06:23 +0000 (01:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=154020

Reviewed by Saam Barati.

* b3/B3FoldPathConstants.cpp:
* b3/testb3.cpp:
(JSC::B3::testFoldPathEqual): Added this. It used to crash in validation.
(JSC::B3::run):

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

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/b3/B3FoldPathConstants.cpp
Source/JavaScriptCore/b3/testb3.cpp

index 503c223..1f4d4da 100644 (file)
@@ -1,3 +1,15 @@
+2016-02-08  Filip Pizlo  <fpizlo@apple.com>
+
+        B3::foldPathConstants() needs to execute its insertion set
+        https://bugs.webkit.org/show_bug.cgi?id=154020
+
+        Reviewed by Saam Barati.
+
+        * b3/B3FoldPathConstants.cpp:
+        * b3/testb3.cpp:
+        (JSC::B3::testFoldPathEqual): Added this. It used to crash in validation.
+        (JSC::B3::run):
+
 2016-02-08  Yusuke Suzuki  <utatane.tea@gmail.com>
 
         [JSC] Introduce @isObject bytecode intrinsic and use it instead of JS implemented one
index 0967d2f..919f2da 100644 (file)
@@ -194,6 +194,7 @@ public:
                         child = override.valueNode;
                 }
             }
+            m_insertionSet.execute(block);
         }
 
         if (changed) {
index dc03792..30eaf70 100644 (file)
@@ -10037,6 +10037,34 @@ void testTrivialInfiniteLoop()
     compile(proc);
 }
 
+void testFoldPathEqual()
+{
+    Procedure proc;
+    BasicBlock* root = proc.addBlock();
+    BasicBlock* thenBlock = proc.addBlock();
+    BasicBlock* elseBlock = proc.addBlock();
+
+    Value* arg = root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0);
+
+    root->appendNew<ControlValue>(
+        proc, Branch, Origin(), arg, FrequentedBlock(thenBlock), FrequentedBlock(elseBlock));
+
+    thenBlock->appendNew<ControlValue>(
+        proc, Return, Origin(),
+        thenBlock->appendNew<Value>(
+            proc, Equal, Origin(), arg, thenBlock->appendNew<ConstPtrValue>(proc, Origin(), 0)));
+
+    elseBlock->appendNew<ControlValue>(
+        proc, Return, Origin(),
+        elseBlock->appendNew<Value>(
+            proc, Equal, Origin(), arg, elseBlock->appendNew<ConstPtrValue>(proc, Origin(), 0)));
+
+    auto code = compile(proc);
+    CHECK(invoke<intptr_t>(*code, 0) == 1);
+    CHECK(invoke<intptr_t>(*code, 1) == 0);
+    CHECK(invoke<intptr_t>(*code, 42) == 0);
+}
+
 // Make sure the compiler does not try to optimize anything out.
 NEVER_INLINE double zero()
 {
@@ -11435,10 +11463,9 @@ void run(const char* filter)
     RUN(testSShrShl64(-42000000000, 8, 8));
 
     RUN(testCheckMul64SShr());
-
     RUN(testComputeDivisionMagic<int32_t>(2, -2147483647, 0));
-
     RUN(testTrivialInfiniteLoop());
+    RUN(testFoldPathEqual());
 
     if (tasks.isEmpty())
         usage();