Author: [email protected]
Date: Fri Feb 27 03:19:31 2009
New Revision: 1386
Modified:
branches/bleeding_edge/src/heap.cc
branches/bleeding_edge/src/objects-debug.cc
branches/bleeding_edge/src/objects-inl.h
branches/bleeding_edge/src/objects.h
Log:
Align code entry points to 32 bytes.
Review URL: http://codereview.chromium.org/27269
Modified: branches/bleeding_edge/src/heap.cc
==============================================================================
--- branches/bleeding_edge/src/heap.cc (original)
+++ branches/bleeding_edge/src/heap.cc Fri Feb 27 03:19:31 2009
@@ -1631,6 +1631,7 @@
int sinfo_size = 0;
if (sinfo != NULL) sinfo_size = sinfo->Serialize(NULL);
int obj_size = Code::SizeFor(body_size, sinfo_size);
+ ASSERT(IsAligned(obj_size, Code::kCodeAlignment));
Object* result;
if (obj_size > MaxHeapObjectSize()) {
result = lo_space_->AllocateRawCode(obj_size);
Modified: branches/bleeding_edge/src/objects-debug.cc
==============================================================================
--- branches/bleeding_edge/src/objects-debug.cc (original)
+++ branches/bleeding_edge/src/objects-debug.cc Fri Feb 27 03:19:31 2009
@@ -665,6 +665,8 @@
void Code::CodeVerify() {
CHECK(ic_flag() == IC_TARGET_IS_ADDRESS);
+ CHECK(IsAligned(reinterpret_cast<intptr_t>(instruction_start()),
+ static_cast<intptr_t>(kCodeAlignment)));
Address last_gc_pc = NULL;
for (RelocIterator it(this); !it.done(); it.next()) {
it.rinfo()->Verify();
Modified: branches/bleeding_edge/src/objects-inl.h
==============================================================================
--- branches/bleeding_edge/src/objects-inl.h (original)
+++ branches/bleeding_edge/src/objects-inl.h Fri Feb 27 03:19:31 2009
@@ -2281,7 +2281,7 @@
byte* Code::relocation_start() {
- return FIELD_ADDR(this, CodeSize() - sinfo_size() - relocation_size());
+ return FIELD_ADDR(this, kHeaderSize + instruction_size());
}
@@ -2297,7 +2297,7 @@
byte* Code::sinfo_start() {
- return FIELD_ADDR(this, CodeSize() - sinfo_size());
+ return FIELD_ADDR(this, kHeaderSize + body_size());
}
Modified: branches/bleeding_edge/src/objects.h
==============================================================================
--- branches/bleeding_edge/src/objects.h (original)
+++ branches/bleeding_edge/src/objects.h Fri Feb 27 03:19:31 2009
@@ -2255,7 +2255,7 @@
static int SizeFor(int body_size, int sinfo_size) {
ASSERT_SIZE_TAG_ALIGNED(body_size);
ASSERT_SIZE_TAG_ALIGNED(sinfo_size);
- return kHeaderSize + body_size + sinfo_size;
+ return RoundUp(kHeaderSize + body_size + sinfo_size, kCodeAlignment);
}
// Locating source position.
@@ -2279,7 +2279,14 @@
static const int kSInfoSizeOffset = kRelocationSizeOffset + kIntSize;
static const int kFlagsOffset = kSInfoSizeOffset + kIntSize;
static const int kKindSpecificFlagsOffset = kFlagsOffset + kIntSize;
- static const int kHeaderSize = kKindSpecificFlagsOffset + kIntSize;
+ // Add filler objects to align the instruction start following right
after
+ // the Code object header.
+ static const int kFiller6Offset = kKindSpecificFlagsOffset + kIntSize;
+ static const int kFiller7Offset = kFiller6Offset + kIntSize;
+ static const int kHeaderSize = kFiller7Offset + kIntSize;
+
+ // Code entry points are aligned to 32 bytes.
+ static const int kCodeAlignment = 32;
// Byte offsets within kKindSpecificFlagsOffset.
static const int kICFlagOffset = kKindSpecificFlagsOffset + 0;
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---