Revision: 21906
Author:   [email protected]
Date:     Fri Jun 20 23:02:36 2014 UTC
Log:      MIPS: Fix big-endian after r21774/r21803.

Fix big-endian ordering of InstanceType and BitField by always loading
the pair as a 16-bit value, even in the API accessor. Clean up some
assertions.

[email protected], [email protected]

Review URL: https://codereview.chromium.org/334403003
http://code.google.com/p/v8/source/detail?r=21906

Modified:
 /branches/bleeding_edge/include/v8.h
 /branches/bleeding_edge/src/hydrogen-instructions.h
 /branches/bleeding_edge/src/objects.h

=======================================
--- /branches/bleeding_edge/include/v8.h        Fri Jun 20 07:44:05 2014 UTC
+++ /branches/bleeding_edge/include/v8.h        Fri Jun 20 23:02:36 2014 UTC
@@ -5523,7 +5523,8 @@
   // These values match non-compiler-dependent values defined within
   // the implementation of v8.
   static const int kHeapObjectMapOffset = 0;
- static const int kMapInstanceTypeOffset = 1 * kApiPointerSize + kApiIntSize;
+  static const int kMapInstanceTypeAndBitFieldOffset =
+      1 * kApiPointerSize + kApiIntSize;
   static const int kStringResourceOffset = 3 * kApiPointerSize;

   static const int kOddballKindOffset = 3 * kApiPointerSize;
@@ -5601,7 +5602,9 @@
   V8_INLINE static int GetInstanceType(const internal::Object* obj) {
     typedef internal::Object O;
     O* map = ReadField<O*>(obj, kHeapObjectMapOffset);
-    return ReadField<uint8_t>(map, kMapInstanceTypeOffset);
+    // Map::InstanceType is defined so that it will always be loaded into
+    // the LS 8 bits of one 16-bit word, regardless of endianess.
+ return ReadField<uint16_t>(map, kMapInstanceTypeAndBitFieldOffset) & 0xff;
   }

   V8_INLINE static int GetOddballKind(const internal::Object* obj) {
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Fri Jun 20 11:26:17 2014 UTC +++ /branches/bleeding_edge/src/hydrogen-instructions.h Fri Jun 20 23:02:36 2014 UTC
@@ -6094,10 +6094,12 @@
   }

   static HObjectAccess ForMapInstanceTypeAndBitField() {
-    STATIC_ASSERT((Map::kInstanceTypeOffset & 1) == 0);
-    STATIC_ASSERT(Map::kBitFieldOffset == Map::kInstanceTypeOffset + 1);
+    STATIC_ASSERT((Map::kInstanceTypeAndBitFieldOffset & 1) == 0);
+    // Ensure the two fields share one 16-bit word, endian-independent.
+    STATIC_ASSERT((Map::kBitFieldOffset & ~1) ==
+                  (Map::kInstanceTypeOffset & ~1));
     return HObjectAccess(kInobject,
-                         Map::kInstanceTypeOffset,
+                         Map::kInstanceTypeAndBitFieldOffset,
                          Representation::UInteger16());
   }

=======================================
--- /branches/bleeding_edge/src/objects.h       Fri Jun 20 20:52:57 2014 UTC
+++ /branches/bleeding_edge/src/objects.h       Fri Jun 20 23:02:36 2014 UTC
@@ -6704,17 +6704,20 @@
 #if V8_TARGET_LITTLE_ENDIAN
// Order instance type and bit field together such that they can be loaded // together as a 16-bit word with instance type in the lower 8 bits regardless
-  // of endianess.
+ // of endianess. Also provide endian-independent offset to that 16-bit word.
   static const int kInstanceTypeOffset = kInstanceAttributesOffset + 0;
   static const int kBitFieldOffset = kInstanceAttributesOffset + 1;
 #else
   static const int kBitFieldOffset = kInstanceAttributesOffset + 0;
   static const int kInstanceTypeOffset = kInstanceAttributesOffset + 1;
 #endif
+  static const int kInstanceTypeAndBitFieldOffset =
+      kInstanceAttributesOffset + 0;
   static const int kBitField2Offset = kInstanceAttributesOffset + 2;
static const int kUnusedPropertyFieldsOffset = kInstanceAttributesOffset + 3;

-  STATIC_ASSERT(kInstanceTypeOffset == Internals::kMapInstanceTypeOffset);
+  STATIC_ASSERT(kInstanceTypeAndBitFieldOffset ==
+                Internals::kMapInstanceTypeAndBitFieldOffset);

   // Bit positions for bit field.
   static const int kHasNonInstancePrototype = 0;

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to