Index: test/cctest/test-log-stack-tracer.cc |
diff --git a/test/cctest/test-log-stack-tracer.cc b/test/cctest/test-log-stack-tracer.cc |
index 7c3567c140bf2bb4da366f79f3c61e5dca0a3f61..04509987e663c8bbd00128cbff21fe155d071673 100644 |
--- a/test/cctest/test-log-stack-tracer.cc |
+++ b/test/cctest/test-log-stack-tracer.cc |
@@ -134,8 +134,16 @@ Address TraceExtension::GetFP(const v8::FunctionCallbackInfo<v8::Value>& args) { |
#if defined(V8_HOST_ARCH_32_BIT) |
Address fp = *reinterpret_cast<Address*>(*args[0]); |
#elif defined(V8_HOST_ARCH_64_BIT) |
+#if !V8_USE_31_BITS_SMI_VALUE |
int64_t low_bits = *reinterpret_cast<uint64_t*>(*args[0]) >> 32; |
int64_t high_bits = *reinterpret_cast<uint64_t*>(*args[1]); |
+#else |
+ // Low 33 bits ([32, 0]), the least two bits are zero. |
+ int64_t low_bits = ((*reinterpret_cast<uint64_t*>(*args[0])) & 0xffffffff) |
+ << 1; |
+ // High 32 bits ([63, 32]), 32th bit has been set by low_bits. |
+ int64_t high_bits = *reinterpret_cast<uint64_t*>(*args[1]) << 32; |
+#endif |
Address fp = reinterpret_cast<Address>(high_bits | low_bits); |
#else |
#error Host architecture is neither 32-bit nor 64-bit. |
@@ -213,8 +221,15 @@ static void construct_call(const v8::FunctionCallbackInfo<v8::Value>& args) { |
args.This()->Set(v8_str("low_bits"), v8_num(low_bits >> 1)); |
#elif defined(V8_HOST_ARCH_64_BIT) |
uint64_t fp = reinterpret_cast<uint64_t>(calling_frame->fp()); |
+#if !V8_USE_31_BITS_SMI_VALUE |
int32_t low_bits = static_cast<int32_t>(fp & 0xffffffff); |
int32_t high_bits = static_cast<int32_t>(fp >> 32); |
+#else |
+ // Middle 31-bits ([32, 2]), the least two bits are always 0 for FP. |
+ int32_t low_bits = static_cast<int32_t>((fp >> 2) & 0xffffffff); |
+ // High 31-bits ([63, 33]). |
+ int32_t high_bits = static_cast<int32_t>(fp >> 33); |
+#endif |
args.This()->Set(v8_str("low_bits"), v8_num(low_bits)); |
args.This()->Set(v8_str("high_bits"), v8_num(high_bits)); |
#else |