Modified: trunk/Source/_javascript_Core/ChangeLog (218349 => 218350)
--- trunk/Source/_javascript_Core/ChangeLog 2017-06-15 19:49:40 UTC (rev 218349)
+++ trunk/Source/_javascript_Core/ChangeLog 2017-06-15 20:02:22 UTC (rev 218350)
@@ -1,3 +1,25 @@
+2017-06-15 Keith Miller <keith_mil...@apple.com>
+
+ Add logging to MachineStackMarker to try to diagnose crashes in the wild
+ https://bugs.webkit.org/show_bug.cgi?id=173427
+
+ Reviewed by Mark Lam.
+
+ This patch adds some logging to the MachineStackMarker constructor
+ to help figure out where we are seeing crashes. Since macOS does
+ not support os_log_info my hope is that if we set all the callee
+ save registers before making any calls in the C++ code we can
+ figure out which calls is the source of the crash. We also, set
+ all the caller save registers before returning in case some
+ weirdness is happening in the Heap constructor.
+
+ This logging should not matter from a performance perspective. We
+ only create MachineStackMarkers when we are creating a new VM,
+ which is already expensive.
+
+ * heap/MachineStackMarker.cpp:
+ (JSC::MachineThreads::MachineThreads):
+
2017-06-15 Yusuke Suzuki <utatane....@gmail.com>
[JSC] Implement Object.assign in C++
Modified: trunk/Source/_javascript_Core/heap/MachineStackMarker.cpp (218349 => 218350)
--- trunk/Source/_javascript_Core/heap/MachineStackMarker.cpp 2017-06-15 19:49:40 UTC (rev 218349)
+++ trunk/Source/_javascript_Core/heap/MachineStackMarker.cpp 2017-06-15 20:02:22 UTC (rev 218350)
@@ -97,13 +97,49 @@
});
return *manager;
}
-
+
+#if CPU(X86_64) && OS(DARWIN)
+#define FILL_CALLEE_SAVES_FOR_CRASH_INFO(number) \
+ asm volatile( \
+ "movq $0xc0defefe000000" number ", %%rbx;" \
+ "movq $0xc0defefe000000" number ", %%r12;" \
+ "movq $0xc0defefe000000" number ", %%r13;" \
+ "movq $0xc0defefe000000" number ", %%r14;" \
+ "movq $0xc0defefe000000" number ", %%r15;" \
+ : \
+ : \
+ : "%rbx", "%r12", "%r13", "%r14", "%r15" \
+ );
+
+#define FILL_CALLER_SAVES_FOR_CRASH_INFO(number) \
+ asm volatile( \
+ "movq $0xc0defefe000000" number ", %%rax;" \
+ "movq $0xc0defefe000000" number ", %%rdi;" \
+ "movq $0xc0defefe000000" number ", %%rsi;" \
+ "movq $0xc0defefe000000" number ", %%rdx;" \
+ "movq $0xc0defefe000000" number ", %%rcx;" \
+ "movq $0xc0defefe000000" number ", %%r8;" \
+ "movq $0xc0defefe000000" number ", %%r9;" \
+ "movq $0xc0defefe000000" number ", %%r10;" \
+ "movq $0xc0defefe000000" number ", %%r11;" \
+ : \
+ : \
+ : "%rax", "%rdi", "%rsi", "%rdx", "%rcx", "%r8", "%r9", "%r10", "%r11" \
+ );
+#else
+#define FILL_CALLEE_SAVES_FOR_CRASH_INFO(number)
+#define FILL_CALLER_SAVES_FOR_CRASH_INFO(number)
+#endif
+
MachineThreads::MachineThreads()
: m_registeredThreads()
, m_threadSpecificForMachineThreads(0)
{
+ FILL_CALLEE_SAVES_FOR_CRASH_INFO("01");
threadSpecificKeyCreate(&m_threadSpecificForMachineThreads, removeThread);
+ FILL_CALLEE_SAVES_FOR_CRASH_INFO("02");
activeMachineThreadsManager().add(this);
+ FILL_CALLER_SAVES_FOR_CRASH_INFO("03");
}
MachineThreads::~MachineThreads()