Title: [227445] branches/safari-605-branch/Source
- Revision
- 227445
- Author
- [email protected]
- Date
- 2018-01-23 14:30:11 -0800 (Tue, 23 Jan 2018)
Log Message
Cherry-pick r227424. rdar://problem/36791625
Modified Paths
Diff
Modified: branches/safari-605-branch/Source/_javascript_Core/ChangeLog (227444 => 227445)
--- branches/safari-605-branch/Source/_javascript_Core/ChangeLog 2018-01-23 22:30:08 UTC (rev 227444)
+++ branches/safari-605-branch/Source/_javascript_Core/ChangeLog 2018-01-23 22:30:11 UTC (rev 227445)
@@ -1,3 +1,23 @@
+2018-01-23 Jason Marcell <[email protected]>
+
+ Cherry-pick r227424. rdar://problem/36791625
+
+ 2018-01-23 Filip Pizlo <[email protected]>
+
+ JSC should use a speculation fence on VM entry/exit
+ https://bugs.webkit.org/show_bug.cgi?id=181991
+
+ Reviewed by JF Bastien and Mark Lam.
+
+ This adds a WTF::speculationFence on VM entry and exit.
+
+ For a microbenchmark that just calls a native function (supplied via an Objective-C block) in a
+ tight loop from JS is a 0% regression on x86 and a 11% regression on ARM64.
+
+ * runtime/JSLock.cpp:
+ (JSC::JSLock::didAcquireLock):
+ (JSC::JSLock::willReleaseLock):
+
2018-01-22 Jason Marcell <[email protected]>
Cherry-pick r227341. rdar://problem/36746038
Modified: branches/safari-605-branch/Source/_javascript_Core/runtime/JSLock.cpp (227444 => 227445)
--- branches/safari-605-branch/Source/_javascript_Core/runtime/JSLock.cpp 2018-01-23 22:30:08 UTC (rev 227444)
+++ branches/safari-605-branch/Source/_javascript_Core/runtime/JSLock.cpp 2018-01-23 22:30:11 UTC (rev 227445)
@@ -123,6 +123,8 @@
void JSLock::didAcquireLock()
{
+ WTF::speculationFence();
+
// FIXME: What should happen to the per-thread identifier table if we don't have a VM?
if (!m_vm)
return;
@@ -191,6 +193,8 @@
void JSLock::willReleaseLock()
{
+ WTF::speculationFence();
+
RefPtr<VM> vm = m_vm;
if (vm) {
vm->drainMicrotasks();
Modified: branches/safari-605-branch/Source/WTF/ChangeLog (227444 => 227445)
--- branches/safari-605-branch/Source/WTF/ChangeLog 2018-01-23 22:30:08 UTC (rev 227444)
+++ branches/safari-605-branch/Source/WTF/ChangeLog 2018-01-23 22:30:11 UTC (rev 227445)
@@ -1,3 +1,21 @@
+2018-01-23 Jason Marcell <[email protected]>
+
+ Cherry-pick r227424. rdar://problem/36791625
+
+ 2018-01-23 Filip Pizlo <[email protected]>
+
+ JSC should use a speculation fence on VM entry/exit
+ https://bugs.webkit.org/show_bug.cgi?id=181991
+
+ Reviewed by JF Bastien and Mark Lam.
+
+ Implement speculationFence as lfence on x86 and isb on ARM64. I'm not sure if isb is
+ appropriate for all ARM64's.
+
+ * wtf/Atomics.h:
+ (WTF::speculationFence):
+ (WTF::x86_lfence):
+
2018-01-22 Jason Marcell <[email protected]>
Cherry-pick r227174. rdar://problem/36723030
Modified: branches/safari-605-branch/Source/WTF/wtf/Atomics.h (227444 => 227445)
--- branches/safari-605-branch/Source/WTF/wtf/Atomics.h 2018-01-23 22:30:08 UTC (rev 227444)
+++ branches/safari-605-branch/Source/WTF/wtf/Atomics.h 2018-01-23 22:30:11 UTC (rev 227445)
@@ -276,9 +276,17 @@
inline void memoryBarrierAfterLock() { arm_dmb(); }
inline void memoryBarrierBeforeUnlock() { arm_dmb(); }
inline void crossModifyingCodeFence() { arm_isb(); }
+inline void speculationFence() { arm_isb(); }
#elif CPU(X86) || CPU(X86_64)
+inline void x86_lfence()
+{
+#if !OS(WINDOWS)
+ asm volatile("lfence" ::: "memory");
+#endif
+}
+
inline void x86_ortop()
{
#if OS(WINDOWS)
@@ -326,6 +334,7 @@
inline void memoryBarrierAfterLock() { compilerFence(); }
inline void memoryBarrierBeforeUnlock() { compilerFence(); }
inline void crossModifyingCodeFence() { x86_cpuid(); }
+inline void speculationFence() { x86_lfence(); }
#else
@@ -336,6 +345,7 @@
inline void memoryBarrierAfterLock() { std::atomic_thread_fence(std::memory_order_seq_cst); }
inline void memoryBarrierBeforeUnlock() { std::atomic_thread_fence(std::memory_order_seq_cst); }
inline void crossModifyingCodeFence() { std::atomic_thread_fence(std::memory_order_seq_cst); } // Probably not strong enough.
+inline void speculationFence() { } // Probably not strong enough.
#endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes