Commit f5966c38 authored by iposva@chromium.org's avatar iposva@chromium.org

Align code entry points to 32 bytes.

Review URL: http://codereview.chromium.org/27269

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1386 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 01dae630
...@@ -1631,6 +1631,7 @@ Object* Heap::CreateCode(const CodeDesc& desc, ...@@ -1631,6 +1631,7 @@ Object* Heap::CreateCode(const CodeDesc& desc,
int sinfo_size = 0; int sinfo_size = 0;
if (sinfo != NULL) sinfo_size = sinfo->Serialize(NULL); if (sinfo != NULL) sinfo_size = sinfo->Serialize(NULL);
int obj_size = Code::SizeFor(body_size, sinfo_size); int obj_size = Code::SizeFor(body_size, sinfo_size);
ASSERT(IsAligned(obj_size, Code::kCodeAlignment));
Object* result; Object* result;
if (obj_size > MaxHeapObjectSize()) { if (obj_size > MaxHeapObjectSize()) {
result = lo_space_->AllocateRawCode(obj_size); result = lo_space_->AllocateRawCode(obj_size);
......
...@@ -665,6 +665,8 @@ void Code::CodePrint() { ...@@ -665,6 +665,8 @@ void Code::CodePrint() {
void Code::CodeVerify() { void Code::CodeVerify() {
CHECK(ic_flag() == IC_TARGET_IS_ADDRESS); 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; Address last_gc_pc = NULL;
for (RelocIterator it(this); !it.done(); it.next()) { for (RelocIterator it(this); !it.done(); it.next()) {
it.rinfo()->Verify(); it.rinfo()->Verify();
......
...@@ -2281,7 +2281,7 @@ int Code::body_size() { ...@@ -2281,7 +2281,7 @@ int Code::body_size() {
byte* Code::relocation_start() { byte* Code::relocation_start() {
return FIELD_ADDR(this, CodeSize() - sinfo_size() - relocation_size()); return FIELD_ADDR(this, kHeaderSize + instruction_size());
} }
...@@ -2297,7 +2297,7 @@ bool Code::contains(byte* pc) { ...@@ -2297,7 +2297,7 @@ bool Code::contains(byte* pc) {
byte* Code::sinfo_start() { byte* Code::sinfo_start() {
return FIELD_ADDR(this, CodeSize() - sinfo_size()); return FIELD_ADDR(this, kHeaderSize + body_size());
} }
......
...@@ -2255,7 +2255,7 @@ class Code: public HeapObject { ...@@ -2255,7 +2255,7 @@ class Code: public HeapObject {
static int SizeFor(int body_size, int sinfo_size) { static int SizeFor(int body_size, int sinfo_size) {
ASSERT_SIZE_TAG_ALIGNED(body_size); ASSERT_SIZE_TAG_ALIGNED(body_size);
ASSERT_SIZE_TAG_ALIGNED(sinfo_size); ASSERT_SIZE_TAG_ALIGNED(sinfo_size);
return kHeaderSize + body_size + sinfo_size; return RoundUp(kHeaderSize + body_size + sinfo_size, kCodeAlignment);
} }
// Locating source position. // Locating source position.
...@@ -2279,7 +2279,14 @@ class Code: public HeapObject { ...@@ -2279,7 +2279,14 @@ class Code: public HeapObject {
static const int kSInfoSizeOffset = kRelocationSizeOffset + kIntSize; static const int kSInfoSizeOffset = kRelocationSizeOffset + kIntSize;
static const int kFlagsOffset = kSInfoSizeOffset + kIntSize; static const int kFlagsOffset = kSInfoSizeOffset + kIntSize;
static const int kKindSpecificFlagsOffset = kFlagsOffset + 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. // Byte offsets within kKindSpecificFlagsOffset.
static const int kICFlagOffset = kKindSpecificFlagsOffset + 0; static const int kICFlagOffset = kKindSpecificFlagsOffset + 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