Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (230039 => 230040)
--- trunk/Source/_javascript_Core/ChangeLog 2018-03-28 18:55:40 UTC (rev 230039)
+++ trunk/Source/_javascript_Core/ChangeLog 2018-03-28 20:05:43 UTC (rev 230040)
@@ -1,3 +1,22 @@
+2018-03-28 Mark Lam <[email protected]>
+
+ Enhance ARM64 probe to support pointer profiling.
+ https://bugs.webkit.org/show_bug.cgi?id=184069
+ <rdar://problem/38939879>
+
+ Reviewed by JF Bastien.
+
+ * assembler/MacroAssemblerARM64.cpp:
+ (JSC::MacroAssembler::probe):
+ * assembler/MacroAssemblerX86Common.h:
+ (JSC::MacroAssemblerX86Common::popPair):
+ (JSC::MacroAssemblerX86Common::pushPair):
+ * assembler/testmasm.cpp:
+ (JSC::testProbeReadsArgumentRegisters):
+ (JSC::testProbeWritesArgumentRegisters):
+ * runtime/PtrTag.h:
+ (JSC::tagForPtr):
+
2018-03-28 Robin Morisset <[email protected]>
appendQuotedJSONString stops on arithmetic overflow instead of propagating it upwards
Modified: trunk/Source/_javascript_Core/assembler/MacroAssemblerARM64.cpp (230039 => 230040)
--- trunk/Source/_javascript_Core/assembler/MacroAssemblerARM64.cpp 2018-03-28 18:55:40 UTC (rev 230039)
+++ trunk/Source/_javascript_Core/assembler/MacroAssemblerARM64.cpp 2018-03-28 20:05:43 UTC (rev 230040)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -371,7 +371,7 @@
// Note: we haven't changed the value of fp. Hence, it is still pointing to the frame of
// the caller of the probe (which is what we want in order to play nice with debuggers e.g. lldb).
"mov x0, sp" "\n" // Set the Probe::State* arg.
- "blr x28" "\n" // Call the probe handler.
+ CALL_WITH_PTRTAG("blr", "x28", CFunctionPtrTag) // Call the probe handler.
// Make sure the Probe::State is entirely below the result stack pointer so
// that register values are still preserved when we call the initializeStack
@@ -407,7 +407,7 @@
"cbz x2, " LOCAL_LABEL_STRING(ctiMasmProbeTrampolineRestoreRegisters) "\n"
"mov x0, x27" "\n" // Set the Probe::State* arg.
- "blr x2" "\n" // Call the initializeStackFunction (loaded into x2 above).
+ CALL_WITH_PTRTAG("blr", "x2", CFunctionPtrTag) // Call the initializeStackFunction (loaded into x2 above).
LOCAL_LABEL_STRING(ctiMasmProbeTrampolineRestoreRegisters) ":" "\n"
@@ -517,7 +517,7 @@
move(TrustedImmPtr(reinterpret_cast<void*>(Probe::executeProbe)), x28);
move(TrustedImmPtr(reinterpret_cast<void*>(function)), x24);
move(TrustedImmPtr(arg), x25);
- m_assembler.blr(x26);
+ call(x26, CFunctionPtrTag);
// ctiMasmProbeTrampoline should have restored every register except for lr and the sp.
load64(Address(sp, offsetof(LRRestorationRecord, lr)), lr);
Modified: trunk/Source/_javascript_Core/assembler/MacroAssemblerX86Common.h (230039 => 230040)
--- trunk/Source/_javascript_Core/assembler/MacroAssemblerX86Common.h 2018-03-28 18:55:40 UTC (rev 230039)
+++ trunk/Source/_javascript_Core/assembler/MacroAssemblerX86Common.h 2018-03-28 20:05:43 UTC (rev 230040)
@@ -2133,7 +2133,18 @@
m_assembler.push_i32(imm.m_value);
}
+ void popPair(RegisterID dest1, RegisterID dest2)
+ {
+ pop(dest2);
+ pop(dest1);
+ }
+ void pushPair(RegisterID src1, RegisterID src2)
+ {
+ push(src1);
+ push(src2);
+ }
+
// Register move operations:
//
// Move values in registers.
Modified: trunk/Source/_javascript_Core/assembler/testmasm.cpp (230039 => 230040)
--- trunk/Source/_javascript_Core/assembler/testmasm.cpp 2018-03-28 18:55:40 UTC (rev 230039)
+++ trunk/Source/_javascript_Core/assembler/testmasm.cpp 2018-03-28 20:05:43 UTC (rev 230040)
@@ -234,10 +234,8 @@
compileAndRun<void>([&] (CCallHelpers& jit) {
jit.emitFunctionPrologue();
- jit.push(GPRInfo::argumentGPR0);
- jit.push(GPRInfo::argumentGPR1);
- jit.push(GPRInfo::argumentGPR2);
- jit.push(GPRInfo::argumentGPR3);
+ jit.pushPair(GPRInfo::argumentGPR0, GPRInfo::argumentGPR1);
+ jit.pushPair(GPRInfo::argumentGPR2, GPRInfo::argumentGPR3);
jit.move(CCallHelpers::TrustedImm32(testWord32(0)), GPRInfo::argumentGPR0);
jit.convertInt32ToDouble(GPRInfo::argumentGPR0, FPRInfo::fpRegT0);
@@ -267,10 +265,8 @@
CHECK_EQ(cpu.fpr(FPRInfo::fpRegT1), testWord32(1));
});
- jit.pop(GPRInfo::argumentGPR3);
- jit.pop(GPRInfo::argumentGPR2);
- jit.pop(GPRInfo::argumentGPR1);
- jit.pop(GPRInfo::argumentGPR0);
+ jit.popPair(GPRInfo::argumentGPR2, GPRInfo::argumentGPR3);
+ jit.popPair(GPRInfo::argumentGPR0, GPRInfo::argumentGPR1);
jit.emitFunctionEpilogue();
jit.ret();
@@ -287,10 +283,8 @@
compileAndRun<void>([&] (CCallHelpers& jit) {
jit.emitFunctionPrologue();
- jit.push(GPRInfo::argumentGPR0);
- jit.push(GPRInfo::argumentGPR1);
- jit.push(GPRInfo::argumentGPR2);
- jit.push(GPRInfo::argumentGPR3);
+ jit.pushPair(GPRInfo::argumentGPR0, GPRInfo::argumentGPR1);
+ jit.pushPair(GPRInfo::argumentGPR2, GPRInfo::argumentGPR3);
// Pre-initialize with non-expected values.
#if USE(JSVALUE64)
@@ -333,10 +327,8 @@
CHECK_EQ(cpu.fpr<uint64_t>(FPRInfo::fpRegT1), testWord64(1));
});
- jit.pop(GPRInfo::argumentGPR3);
- jit.pop(GPRInfo::argumentGPR2);
- jit.pop(GPRInfo::argumentGPR1);
- jit.pop(GPRInfo::argumentGPR0);
+ jit.popPair(GPRInfo::argumentGPR2, GPRInfo::argumentGPR3);
+ jit.popPair(GPRInfo::argumentGPR0, GPRInfo::argumentGPR1);
jit.emitFunctionEpilogue();
jit.ret();
Modified: trunk/Source/_javascript_Core/runtime/PtrTag.h (230039 => 230040)
--- trunk/Source/_javascript_Core/runtime/PtrTag.h 2018-03-28 18:55:40 UTC (rev 230039)
+++ trunk/Source/_javascript_Core/runtime/PtrTag.h 2018-03-28 20:05:43 UTC (rev 230040)
@@ -70,6 +70,8 @@
#if !USE(POINTER_PROFILING)
inline uintptr_t nextPtrTagID() { return 0; }
+inline const char* tagForPtr(const void*) { return "<no tag>"; }
+
template<typename... Arguments>
inline constexpr PtrTag ptrTag(Arguments&&...) { return NoPtrTag; }
@@ -119,6 +121,9 @@
template<typename PtrType> void assertIsTaggedWith(PtrType, PtrTag) { }
template<typename PtrType> void assertIsNullOrTaggedWith(PtrType, PtrTag) { }
+#define CALL_WITH_PTRTAG(callInstructionString, targetRegisterString, tag) \
+ callInstructionString " " targetRegisterString "\n"
+
#endif // !USE(POINTER_PROFILING)
} // namespace JSC