MIPS: Fix unaligned address of double.

TEST=mjsunit/debug-evaluate-locals-optimized-double

BUG=

Review URL: https://codereview.chromium.org/14631016

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14828 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
palfia@homejinni.com 2013-05-27 17:12:48 +00:00
parent a5f949be2d
commit dd542a2bed

View File

@ -38,6 +38,24 @@
namespace v8 {
namespace internal {
static inline double read_double_value(Address p) {
#ifdef V8_HOST_CAN_READ_UNALIGNED
return Memory::double_at(p);
#else // V8_HOST_CAN_READ_UNALIGNED
// Prevent gcc from using load-double (mips ldc1) on (possibly)
// non-64-bit aligned address.
union conversion {
double d;
uint32_t u[2];
} c;
c.u[0] = *reinterpret_cast<uint32_t*>(p);
c.u[1] = *reinterpret_cast<uint32_t*>(p + 4);
return c.d;
#endif // V8_HOST_CAN_READ_UNALIGNED
}
class FrameDescription;
class TranslationIterator;
class DeoptimizingCodeListNode;
@ -476,19 +494,7 @@ class FrameDescription {
double GetDoubleFrameSlot(unsigned offset) {
intptr_t* ptr = GetFrameSlotPointer(offset);
#if V8_TARGET_ARCH_MIPS
// Prevent gcc from using load-double (mips ldc1) on (possibly)
// non-64-bit aligned double. Uses two lwc1 instructions.
union conversion {
double d;
uint32_t u[2];
} c;
c.u[0] = *reinterpret_cast<uint32_t*>(ptr);
c.u[1] = *(reinterpret_cast<uint32_t*>(ptr) + 1);
return c.d;
#else
return *reinterpret_cast<double*>(ptr);
#endif
return read_double_value(reinterpret_cast<Address>(ptr));
}
void SetFrameSlot(unsigned offset, intptr_t value) {
@ -818,7 +824,7 @@ class SlotRef BASE_EMBEDDED {
}
case DOUBLE: {
double value = Memory::double_at(addr_);
double value = read_double_value(addr_);
return isolate->factory()->NewNumber(value);
}