Introduce the SetFp function in StackHandler

The FP setting is different for X32 than the other platforms as
kFPOnStackSize is double the kPointerSize and we have to clear the
higher 32 bits to 0.

R=danno@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15966 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
haitao.feng@intel.com 2013-07-30 23:59:55 +00:00
parent bfc98bc0c8
commit e4cdcc6576
6 changed files with 28 additions and 6 deletions

View File

@ -171,6 +171,11 @@ inline Object* JavaScriptFrame::function_slot_object() const {
}
inline void StackHandler::SetFp(Address slot, Address fp) {
Memory::Address_at(slot) = fp;
}
} } // namespace v8::internal
#endif // V8_ARM_FRAMES_ARM_H_

View File

@ -1521,9 +1521,9 @@ void StackHandler::Unwind(Isolate* isolate,
FixedArray* array,
int offset,
int previous_handler_offset) const {
STATIC_ASSERT(StackHandlerConstants::kSlotCount == 5);
STATIC_ASSERT(StackHandlerConstants::kSlotCount >= 5);
ASSERT_LE(0, offset);
ASSERT_GE(array->length(), offset + 5);
ASSERT_GE(array->length(), offset + StackHandlerConstants::kSlotCount);
// Unwinding a stack handler into an array chains it in the opposite
// direction, re-using the "next" slot as a "previous" link, so that stack
// handlers can be later re-wound in the correct order. Decode the "state"
@ -1542,9 +1542,9 @@ int StackHandler::Rewind(Isolate* isolate,
FixedArray* array,
int offset,
Address fp) {
STATIC_ASSERT(StackHandlerConstants::kSlotCount == 5);
STATIC_ASSERT(StackHandlerConstants::kSlotCount >= 5);
ASSERT_LE(0, offset);
ASSERT_GE(array->length(), offset + 5);
ASSERT_GE(array->length(), offset + StackHandlerConstants::kSlotCount);
Smi* prev_handler_offset = Smi::cast(array->get(offset));
Code* code = Code::cast(array->get(offset + 1));
Smi* smi_index = Smi::cast(array->get(offset + 2));
@ -1560,7 +1560,7 @@ int StackHandler::Rewind(Isolate* isolate,
Memory::uintptr_at(address() + StackHandlerConstants::kStateOffset) = state;
Memory::Object_at(address() + StackHandlerConstants::kContextOffset) =
context;
Memory::Address_at(address() + StackHandlerConstants::kFPOffset) = fp;
SetFp(address() + StackHandlerConstants::kFPOffset, fp);
*isolate->handler_address() = address();

View File

@ -145,6 +145,7 @@ class StackHandler BASE_EMBEDDED {
inline Object** context_address() const;
inline Object** code_address() const;
inline void SetFp(Address slot, Address fp);
DISALLOW_IMPLICIT_CONSTRUCTORS(StackHandler);
};
@ -176,7 +177,7 @@ class StandardFrameConstants : public AllStatic {
static const int kContextOffset = -1 * kPointerSize;
static const int kCallerFPOffset = 0 * kPointerSize;
static const int kCallerPCOffset = +1 * kFPOnStackSize;
static const int kCallerSPOffset = +2 * kPCOnStackSize;
static const int kCallerSPOffset = kCallerPCOffset + 1 * kPCOnStackSize;
};

View File

@ -136,6 +136,11 @@ inline Object* JavaScriptFrame::function_slot_object() const {
}
inline void StackHandler::SetFp(Address slot, Address fp) {
Memory::Address_at(slot) = fp;
}
} } // namespace v8::internal
#endif // V8_IA32_FRAMES_IA32_H_

View File

@ -230,6 +230,11 @@ inline Object* JavaScriptFrame::function_slot_object() const {
}
inline void StackHandler::SetFp(Address slot, Address fp) {
Memory::Address_at(slot) = fp;
}
} } // namespace v8::internal
#endif

View File

@ -126,6 +126,12 @@ inline Object* JavaScriptFrame::function_slot_object() const {
return Memory::Object_at(fp() + offset);
}
inline void StackHandler::SetFp(Address slot, Address fp) {
Memory::Address_at(slot) = fp;
}
} } // namespace v8::internal
#endif // V8_X64_FRAMES_X64_H_