Reviewers: danno, palfia, kilvadyb, dusmil,
Message:
PTAL. I'm not thrilled with using the compiler big/little endian
definitions in
v8.h, but the usual v8 definitions are not valid there. And since we play
with
the offset of the instance type, and it is exposed thru the API, I don't see
much choice. I'm open to better suggestions.
Also, please check this for MS C compatibility. I don't have a platform to
test
that. All the gcc's (x86, arm, arm64) support this, as does clang on the
mac.
Description:
MIPS: Fix big-endian after r21774/r21803.
Fix big-endian ordering of InstanceType and BitField in two more places.
Per original commit, these two byte values share the same 16-bit word
load and the InstanceType should be in LS bits on either endianess, so
offsets must be altered at compile-time.
InstanceType is exposed thru API, so we require endian offset adjustment
there as well. V8_TARGET_LITTLE/BIG_ENDIAN is not valid there. Use compiler
endianness definition.
BUG=
Please review this at https://codereview.chromium.org/334403003/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+13, -0 lines):
M include/v8.h
M src/hydrogen-instructions.h
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index
2739e070b634cac24804eb2e8813a7d451b13fb0..93fea484f2661f8aa2e7eea74e4c118aeeac7b26
100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -5517,7 +5517,12 @@ class Internals {
// These values match non-compiler-dependent values defined within
// the implementation of v8.
static const int kHeapObjectMapOffset = 0;
+#if defined (__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
+ static const int kMapInstanceTypeOffset =
+ 1 * kApiPointerSize + kApiIntSize + 1;
+#else
static const int kMapInstanceTypeOffset = 1 * kApiPointerSize +
kApiIntSize;
+#endif
static const int kStringResourceOffset = 3 * kApiPointerSize;
static const int kOddballKindOffset = 3 * kApiPointerSize;
Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index
f1720f444247d83635c84d00a99cf2457ee0022e..97ec1584ac896db245b6c7888b3f3f61c62847c3
100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -6091,11 +6091,19 @@ class HObjectAccess V8_FINAL {
}
static HObjectAccess ForMapInstanceTypeAndBitField() {
+#if V8_TARGET_LITTLE_ENDIAN
STATIC_ASSERT((Map::kInstanceTypeOffset & 1) == 0);
STATIC_ASSERT(Map::kBitFieldOffset == Map::kInstanceTypeOffset + 1);
return HObjectAccess(kInobject,
Map::kInstanceTypeOffset,
Representation::UInteger16());
+#else
+ STATIC_ASSERT((Map::kBitFieldOffset & 1) == 0);
+ STATIC_ASSERT(Map::kInstanceTypeOffset == Map::kBitFieldOffset + 1);
+ return HObjectAccess(kInobject,
+ Map::kBitFieldOffset,
+ Representation::UInteger16());
+#endif
}
static HObjectAccess ForPropertyCellValue() {
--
--
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.