From e4cdcc6576479b203714b8d48f9325f5b2c77216 Mon Sep 17 00:00:00 2001 From: "haitao.feng@intel.com" Date: Tue, 30 Jul 2013 23:59:55 +0000 Subject: [PATCH] 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 --- src/arm/frames-arm.h | 5 +++++ src/frames.cc | 10 +++++----- src/frames.h | 3 ++- src/ia32/frames-ia32.h | 5 +++++ src/mips/frames-mips.h | 5 +++++ src/x64/frames-x64.h | 6 ++++++ 6 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/arm/frames-arm.h b/src/arm/frames-arm.h index 19b29b855..d022b414b 100644 --- a/src/arm/frames-arm.h +++ b/src/arm/frames-arm.h @@ -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_ diff --git a/src/frames.cc b/src/frames.cc index 61792a628..c17a9d5f8 100644 --- a/src/frames.cc +++ b/src/frames.cc @@ -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(); diff --git a/src/frames.h b/src/frames.h index 634ff8a7c..2bbbd98ac 100644 --- a/src/frames.h +++ b/src/frames.h @@ -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; }; diff --git a/src/ia32/frames-ia32.h b/src/ia32/frames-ia32.h index 6223748d6..860612510 100644 --- a/src/ia32/frames-ia32.h +++ b/src/ia32/frames-ia32.h @@ -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_ diff --git a/src/mips/frames-mips.h b/src/mips/frames-mips.h index f6f20cd20..437bf3a9f 100644 --- a/src/mips/frames-mips.h +++ b/src/mips/frames-mips.h @@ -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 diff --git a/src/x64/frames-x64.h b/src/x64/frames-x64.h index a24ab5310..2af5a81bb 100644 --- a/src/x64/frames-x64.h +++ b/src/x64/frames-x64.h @@ -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_ -- 2.34.1