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..192e88e66019a91163c77dc8ff4503892d94a42c 100644 |
--- a/test/cctest/test-log-stack-tracer.cc |
+++ b/test/cctest/test-log-stack-tracer.cc |
@@ -134,8 +134,17 @@ 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) |
- int64_t low_bits = *reinterpret_cast<uint64_t*>(*args[0]) >> 32; |
- int64_t high_bits = *reinterpret_cast<uint64_t*>(*args[1]); |
+ int64_t low_bits, high_bits; |
+ if (v8::internal::kSmiValueSize == 32) { |
+ low_bits = *reinterpret_cast<uint64_t*>(*args[0]) >> 32; |
+ high_bits = *reinterpret_cast<uint64_t*>(*args[1]); |
+ } else { |
+ ASSERT(v8::internal::kSmiValueSize == 31); |
+ // Low 33 bits ([32, 0]), the least two bits are zero. |
+ low_bits = ((*reinterpret_cast<uint64_t*>(*args[0])) & 0xffffffff) << 1; |
+ // High 32 bits ([63, 32]), 32th bit has been set by low_bits. |
+ high_bits = *reinterpret_cast<uint64_t*>(*args[1]) << 32; |
+ } |
Address fp = reinterpret_cast<Address>(high_bits | low_bits); |
#else |
#error Host architecture is neither 32-bit nor 64-bit. |
@@ -213,8 +222,17 @@ 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()); |
- int32_t low_bits = static_cast<int32_t>(fp & 0xffffffff); |
- int32_t high_bits = static_cast<int32_t>(fp >> 32); |
+ int32_t low_bits, high_bits; |
+ if (v8::internal::kSmiValueSize == 32) { |
+ low_bits = static_cast<int32_t>(fp & 0xffffffff); |
+ high_bits = static_cast<int32_t>(fp >> 32); |
+ } else { |
+ ASSERT(v8::internal::kSmiValueSize == 31); |
+ // Middle 31-bits ([32, 2]), the least two bits are always 0 for FP. |
+ low_bits = static_cast<int32_t>((fp >> 2) & 0xffffffff); |
+ // High 31-bits ([63, 33]). |
+ high_bits = static_cast<int32_t>(fp >> 33); |
+ } |
args.This()->Set(v8_str("low_bits"), v8_num(low_bits)); |
args.This()->Set(v8_str("high_bits"), v8_num(high_bits)); |
#else |