Commit 3925045f authored by sgjesse@chromium.org's avatar sgjesse@chromium.org

Don't rely on C++ object padding across platforms

The use of sizeof on FrameDescription to get to the additional allocated memory for the frame content relies on the padding of the FrameDescription. On IA32 Linux the FrameDescription is not padded but on ARM Linux it is padded to become 8 byte aligned. With a snapshot generated with the ARM simulator on IA32 Linux that contains one or more of the deoptimization tables the deoptimization did not work as the access to the frame content was one off between the C++ code and the generated code.

R=ager@chromium.org
Review URL: http://codereview.chromium.org/6744004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7369 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 0c6fbad8
......@@ -326,7 +326,9 @@ class FrameDescription {
JSFunction* function);
void* operator new(size_t size, uint32_t frame_size) {
return malloc(size + frame_size);
// Subtracts kPointerSize, as the member frame_content_ already supplies
// the first element of the area to store the frame.
return malloc(size + frame_size - kPointerSize);
}
void operator delete(void* description) {
......@@ -410,7 +412,7 @@ class FrameDescription {
}
static int frame_content_offset() {
return sizeof(FrameDescription);
return OFFSET_OF(FrameDescription, frame_content_);
}
private:
......@@ -429,6 +431,10 @@ class FrameDescription {
// deoptimizing.
intptr_t continuation_;
// This must be at the end of the object as the object is allocated larger
// than it's definition indicate to extend this array.
intptr_t frame_content_[1];
intptr_t* GetFrameSlotPointer(unsigned offset) {
ASSERT(offset < frame_size_);
return reinterpret_cast<intptr_t*>(
......
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