Simplify the IA32 exception handler block by removing the unused code

pointer and parameter pointer slots.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2123 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent d7cccf6b
......@@ -68,13 +68,7 @@ inline bool StackHandler::includes(Address address) const {
inline void StackHandler::Iterate(ObjectVisitor* v) const {
// Stack handlers do not contain any pointers that need to be
// traversed. The only field that have to worry about is the code
// field which is unused and should always be uninitialized.
#ifdef DEBUG
const int offset = StackHandlerConstants::kCodeOffset;
Object* code = Memory::Object_at(address() + offset);
ASSERT(Smi::cast(code)->value() == StackHandler::kCodeNotPresent);
#endif
// traversed.
}
......
......@@ -6935,16 +6935,16 @@ void CallFunctionStub::Generate(MacroAssembler* masm) {
void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) {
ASSERT(StackHandlerConstants::kSize == 6 * kPointerSize); // adjust this code
// Adjust this code if not the case.
ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize);
ExternalReference handler_address(Top::k_handler_address);
__ mov(edx, Operand::StaticVariable(handler_address));
__ mov(ecx, Operand(edx, -1 * kPointerSize)); // get next in chain
// Get next in chain.
__ mov(ecx, Operand(edx, StackHandlerConstants::kAddressDisplacement));
__ mov(Operand::StaticVariable(handler_address), ecx);
__ mov(esp, Operand(edx));
__ pop(edi);
__ pop(ebp);
__ pop(edx); // remove code pointer
__ pop(edx); // remove state
__ pop(edx); // Remove state.
// Before returning we restore the context from the frame pointer if not NULL.
// The frame pointer is NULL in the exception handler of a JS entry frame.
......@@ -7040,6 +7040,9 @@ void CEntryStub::GenerateCore(MacroAssembler* masm,
void CEntryStub::GenerateThrowOutOfMemory(MacroAssembler* masm) {
// Adjust this code if not the case.
ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize);
// Fetch top stack handler.
ExternalReference handler_address(Top::k_handler_address);
__ mov(edx, Operand::StaticVariable(handler_address));
......@@ -7080,9 +7083,7 @@ void CEntryStub::GenerateThrowOutOfMemory(MacroAssembler* masm) {
__ xor_(esi, Operand(esi));
// Restore registers from handler.
__ pop(edi); // PP
__ pop(ebp); // FP
__ pop(edx); // Code
__ pop(edx); // State
__ ret(0);
......
......@@ -55,14 +55,10 @@ typedef Object* JSCallerSavedBuffer[kNumJSCallerSaved];
class StackHandlerConstants : public AllStatic {
public:
static const int kNextOffset = 0 * kPointerSize;
static const int kPPOffset = 1 * kPointerSize;
static const int kFPOffset = 2 * kPointerSize;
static const int kFPOffset = 1 * kPointerSize;
// TODO(1233780): Get rid of the code slot in stack handlers.
static const int kCodeOffset = 3 * kPointerSize;
static const int kStateOffset = 4 * kPointerSize;
static const int kPCOffset = 5 * kPointerSize;
static const int kStateOffset = 2 * kPointerSize;
static const int kPCOffset = 3 * kPointerSize;
static const int kAddressDisplacement = -1 * kPointerSize;
static const int kSize = kPCOffset + kPointerSize;
......@@ -136,157 +132,6 @@ inline Object* JavaScriptFrame::function_slot_object() const {
}
// ----------------------------------------------------
// C Entry frames:
// lower | Stack |
// addresses | ^ |
// | | |
// | |
// +-------------+
// | entry_pc |
// +-------------+ <--+ entry_sp
// . |
// . |
// . |
// +-------------+ |
// -3 | entry_sp --+----+
// e +-------------+
// n -2 | C function |
// t +-------------+
// r -1 | caller_pp |
// y +-------------+ <--- fp (frame pointer, ebp)
// 0 | caller_fp |
// f +-------------+
// r 1 | caller_pc |
// a +-------------+ <--- caller_sp (stack pointer, esp)
// m 2 | |
// e | arguments |
// | |
// +- - - - - - -+
// | argument0 |
// +=============+
// | |
// | caller |
// higher | expressions |
// addresses | |
// Proper JS frames:
// lower | Stack |
// addresses | ^ |
// | | |
// | |
// ----------- +=============+ <--- sp (stack pointer, esp)
// | function |
// +-------------+
// | |
// | expressions |
// | |
// +-------------+
// a | |
// c | locals |
// t | |
// i +- - - - - - -+ <---
// v -4 | local0 | ^
// a +-------------+ |
// t -3 | code | |
// i +-------------+ |
// o -2 | context | | kLocal0Offset
// n +-------------+ |
// -1 | caller_pp | v
// f +-------------+ <--- fp (frame pointer, ebp)
// r 0 | caller_fp |
// a +-------------+
// m 1 | caller_pc |
// e +-------------+ <--- caller_sp (incl. parameters)
// 2 | |
// | parameters |
// | |
// +- - - - - - -+ <---
// -2 | parameter0 | ^
// +-------------+ | kParam0Offset
// -1 | receiver | v
// ----------- +=============+ <--- pp (parameter pointer, edi)
// 0 | function |
// +-------------+
// | |
// | caller |
// higher | expressions |
// addresses | |
// JS entry frames: When calling from C to JS, we construct two extra
// frames: An entry frame (C) and a trampoline frame (JS). The
// following pictures shows the two frames:
// lower | Stack |
// addresses | ^ |
// | | |
// | |
// ----------- +=============+ <--- sp (stack pointer, esp)
// | |
// | parameters |
// t | |
// r +- - - - - - -+
// a | parameter0 |
// m +-------------+
// p | receiver |
// o +-------------+ <---
// l | function | ^
// i +-------------+ |
// n -3 | code | | kLocal0Offset
// e +-------------+
// -2 | NULL | context is always NULL
// +-------------+
// f -1 | NULL | caller pp is always NULL for entry frames
// r +-------------+ <--- fp (frame pointer, ebp)
// a 0 | caller fp |
// m +-------------+
// e 1 | caller pc |
// +-------------+ <--- caller_sp (incl. parameters)
// | 0 |
// ----------- +=============+ <--- pp (parameter pointer, edi)
// | 0 |
// +-------------+ <---
// . ^
// . | try-handler (HandlerOffsets::kSize)
// . v
// +-------------+ <---
// -5 | next top pp |
// +-------------+
// e -4 | next top fp |
// n +-------------+ <---
// t -3 | ebx | ^
// r +-------------+ |
// y -2 | esi | | callee-saved registers
// +-------------+ |
// -1 | edi | v
// f +-------------+ <--- fp
// r 0 | caller fp |
// a +-------------+ pp == NULL (parameter pointer)
// m 1 | caller pc |
// e +-------------+ <--- caller sp
// 2 | code entry | ^
// +-------------+ |
// 3 | function | |
// +-------------+ | arguments passed from C code
// 4 | receiver | |
// +-------------+ |
// 5 | argc | |
// +-------------+ |
// 6 | argv | v
// +-------------+ <---
// | |
// higher | |
// addresses | |
} } // namespace v8::internal
#endif // V8_IA32_FRAMES_IA32_H_
......@@ -448,7 +448,8 @@ void MacroAssembler::LeaveExitFrame(StackFrame::Type type) {
void MacroAssembler::PushTryHandler(CodeLocation try_location,
HandlerType type) {
ASSERT(StackHandlerConstants::kSize == 6 * kPointerSize); // adjust this code
// Adjust this code if not the case.
ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize);
// The pc (return address) is already on TOS.
if (try_location == IN_JAVASCRIPT) {
if (type == TRY_CATCH_HANDLER) {
......@@ -456,9 +457,7 @@ void MacroAssembler::PushTryHandler(CodeLocation try_location,
} else {
push(Immediate(StackHandler::TRY_FINALLY));
}
push(Immediate(Smi::FromInt(StackHandler::kCodeNotPresent)));
push(ebp);
push(edi);
} else {
ASSERT(try_location == IN_JS_ENTRY);
// The parameter pointer is meaningless here and ebp does not
......@@ -466,9 +465,7 @@ void MacroAssembler::PushTryHandler(CodeLocation try_location,
// expect the code throwing an exception to check ebp before
// dereferencing it to restore the context.
push(Immediate(StackHandler::ENTRY));
push(Immediate(Smi::FromInt(StackHandler::kCodeNotPresent)));
push(Immediate(0)); // NULL frame pointer
push(Immediate(0)); // NULL parameter pointer
}
// Cached TOS.
mov(eax, Operand::StaticVariable(ExternalReference(Top::k_handler_address)));
......
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