Title: [265313] trunk
Revision
265313
Author
[email protected]
Date
2020-08-05 17:24:47 -0700 (Wed, 05 Aug 2020)

Log Message

Fix returnEarlyFromInfiniteLoopsForFuzzing in DFG and validateDoesGC
https://bugs.webkit.org/show_bug.cgi?id=215194
<rdar://problem/66158641>

Reviewed by Mark Lam.

JSTests:

* stress/validate-does-gc-with-return-early-from-infinite-loop-2.js: Added.
(vm.useJIT):

Source/_javascript_Core:

I already fixed this same issue in the FTL in r264330, but I forgot
to do it in the DFG.

* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):

Modified Paths

Added Paths

Diff

Modified: trunk/JSTests/ChangeLog (265312 => 265313)


--- trunk/JSTests/ChangeLog	2020-08-05 23:54:45 UTC (rev 265312)
+++ trunk/JSTests/ChangeLog	2020-08-06 00:24:47 UTC (rev 265313)
@@ -1,3 +1,14 @@
+2020-08-05  Saam Barati  <[email protected]>
+
+        Fix returnEarlyFromInfiniteLoopsForFuzzing in DFG and validateDoesGC
+        https://bugs.webkit.org/show_bug.cgi?id=215194
+        <rdar://problem/66158641>
+
+        Reviewed by Mark Lam.
+
+        * stress/validate-does-gc-with-return-early-from-infinite-loop-2.js: Added.
+        (vm.useJIT):
+
 2020-08-05  Yusuke Suzuki  <[email protected]>
 
         Unreviewed, skip private field test

Added: trunk/JSTests/stress/validate-does-gc-with-return-early-from-infinite-loop-2.js (0 => 265313)


--- trunk/JSTests/stress/validate-does-gc-with-return-early-from-infinite-loop-2.js	                        (rev 0)
+++ trunk/JSTests/stress/validate-does-gc-with-return-early-from-infinite-loop-2.js	2020-08-06 00:24:47 UTC (rev 265313)
@@ -0,0 +1,6 @@
+//@ skip if $architecture != "arm64" and $architecture != "x86-64"
+//@ runDefault("--returnEarlyFromInfiniteLoopsForFuzzing=true", "--earlyReturnFromInfiniteLoopsLimit=100000", "--useConcurrentJIT=false", "--useFTLJIT=false", "--validateDoesGC=true")
+
+if ($vm.useJIT()) {
+    while(1){}
+}

Modified: trunk/Source/_javascript_Core/ChangeLog (265312 => 265313)


--- trunk/Source/_javascript_Core/ChangeLog	2020-08-05 23:54:45 UTC (rev 265312)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-08-06 00:24:47 UTC (rev 265313)
@@ -1,3 +1,17 @@
+2020-08-05  Saam Barati  <[email protected]>
+
+        Fix returnEarlyFromInfiniteLoopsForFuzzing in DFG and validateDoesGC
+        https://bugs.webkit.org/show_bug.cgi?id=215194
+        <rdar://problem/66158641>
+
+        Reviewed by Mark Lam.
+
+        I already fixed this same issue in the FTL in r264330, but I forgot
+        to do it in the DFG.
+
+        * dfg/DFGSpeculativeJIT64.cpp:
+        (JSC::DFG::SpeculativeJIT::compile):
+
 2020-08-05  Keith Miller  <[email protected]>
 
         The various AllowList options should be able to take the function name inline

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp (265312 => 265313)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp	2020-08-05 23:54:45 UTC (rev 265312)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp	2020-08-06 00:24:47 UTC (rev 265313)
@@ -4979,6 +4979,14 @@
                 m_jit.load64(ptr, GPRInfo::regT0);
                 auto skipEarlyReturn = m_jit.branch64(CCallHelpers::Below, GPRInfo::regT0, CCallHelpers::TrustedImm64(Options::earlyReturnFromInfiniteLoopsLimit()));
 
+                if constexpr (validateDFGDoesGC) {
+                    if (Options::validateDoesGC()) {
+                        // We need to mock what a Return does: claims to GC.
+                        m_jit.move(CCallHelpers::TrustedImmPtr(vm().heap.addressOfDoesGC()), GPRInfo::regT0);
+                        m_jit.store32(CCallHelpers::TrustedImm32(DoesGCCheck::encode(true, DoesGCCheck::Special::Uninitialized)), CCallHelpers::Address(GPRInfo::regT0));
+                    }
+                }
+
                 m_jit.popToRestore(GPRInfo::regT0);
                 m_jit.move(CCallHelpers::TrustedImm64(JSValue::encode(jsUndefined())), GPRInfo::returnValueGPR);
                 m_jit.emitRestoreCalleeSaves();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to