Commit b6b57605 authored by plind44@gmail.com's avatar plind44@gmail.com

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.

R=danno@chromium.org, mtbrandy@gmail.com

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21906 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 57d0b53e
......@@ -5523,7 +5523,8 @@ class Internals {
// 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 @@ class Internals {
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) {
......
......@@ -6094,10 +6094,12 @@ class HObjectAccess V8_FINAL {
}
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());
}
......
......@@ -6704,17 +6704,20 @@ class Map: public HeapObject {
#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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment