Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Unified Diff: src/deoptimizer.h

Issue 14631016: MIPS: Fix unaligned address of double. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/deoptimizer.h
diff --git a/src/deoptimizer.h b/src/deoptimizer.h
index edf6c504f1c1340ae9345dd510a7dbc8c34d5f11..2ce4fd2c2d1777a547e15e939b48629fe9d23d9b 100644
--- a/src/deoptimizer.h
+++ b/src/deoptimizer.h
@@ -38,6 +38,22 @@
namespace v8 {
namespace internal {
Jakob Kummerow 2013/05/10 10:06:28 nit: two empty newlines between top-level things,
palfia 2013/05/17 17:24:32 Done.
+// Prevent gcc from using load-double (mips ldc1) on (possibly)
+// non-64-bit aligned address.
+static inline double read_double_value(Address p) {
+#ifndef V8_TARGET_ARCH_MIPS
danno 2013/05/10 10:15:55 I think it's better to use the platform independen
palfia 2013/05/17 17:24:32 Done.
+ return Memory::double_at(p)
+#else // V8_TARGET_ARCH_MIPS
+ union conversion {
+ double d;
+ uint32_t u[2];
+ } c;
danno 2013/05/10 10:15:55 And if you do that, you will need to make sure tha
+ c.u[0] = (*reinterpret_cast<uint32_t*>(p));
Jakob Kummerow 2013/05/10 10:06:28 nit: don't need the outer parentheses.
palfia 2013/05/17 17:24:32 Done.
+ c.u[1] = (*reinterpret_cast<uint32_t*>(p + 4));
+ return c.d;
+#endif // V8_TARGET_ARCH_MIPS
+}
+
class FrameDescription;
class TranslationIterator;
class DeoptimizingCodeListNode;
@@ -492,19 +508,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) {
@@ -800,7 +804,7 @@ class SlotRef BASE_EMBEDDED {
}
case DOUBLE: {
- double value = Memory::double_at(addr_);
+ double value = read_double_value(addr_);
return isolate->factory()->NewNumber(value);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698