From fa037d1602d396499eedc84510b4e7ea511dab15 Mon Sep 17 00:00:00 2001 From: "haitao.feng@intel.com" Date: Tue, 23 Jul 2013 13:30:44 +0000 Subject: [PATCH] Revert "Addressed danno's comments" and "Introduce kRegisterSize, kPCOnStackSize and kFPOnStackSize constants" BUG=None R=jkummerow@chromium.org Review URL: https://codereview.chromium.org/19483007 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15824 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/arm/deoptimizer-arm.cc | 11 -------- src/deoptimizer.cc | 52 +++++++++++++++++------------------- src/deoptimizer.h | 4 --- src/frames.cc | 2 +- src/frames.h | 9 +++---- src/globals.h | 15 +++++------ src/ia32/deoptimizer-ia32.cc | 11 -------- src/lithium.cc | 2 +- src/mips/deoptimizer-mips.cc | 11 -------- src/x64/deoptimizer-x64.cc | 11 -------- 10 files changed, 37 insertions(+), 91 deletions(-) diff --git a/src/arm/deoptimizer-arm.cc b/src/arm/deoptimizer-arm.cc index 363ea0c78d..780bafb755 100644 --- a/src/arm/deoptimizer-arm.cc +++ b/src/arm/deoptimizer-arm.cc @@ -635,17 +635,6 @@ void Deoptimizer::TableEntryGenerator::GeneratePrologue() { __ bind(&done); } - -void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) { - SetFrameSlot(offset, value); -} - - -void FrameDescription::SetCallerFp(unsigned offset, intptr_t value) { - SetFrameSlot(offset, value); -} - - #undef __ } } // namespace v8::internal diff --git a/src/deoptimizer.cc b/src/deoptimizer.cc index 72cf3c0fb5..fd7c2829ad 100644 --- a/src/deoptimizer.cc +++ b/src/deoptimizer.cc @@ -900,15 +900,15 @@ void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, // input frame. For all subsequent output frames, it can be read from the // previous one. This frame's pc can be computed from the non-optimized // function code and AST id of the bailout. - output_offset -= kPCOnStackSize; - input_offset -= kPCOnStackSize; + output_offset -= kPointerSize; + input_offset -= kPointerSize; intptr_t value; if (is_bottommost) { value = input_->GetFrameSlot(input_offset); } else { value = output_[frame_index - 1]->GetPc(); } - output_frame->SetCallerPc(output_offset, value); + output_frame->SetFrameSlot(output_offset, value); if (trace_) { PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" V8PRIxPTR " ; caller's pc\n", @@ -919,14 +919,14 @@ void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, // as in the input frame. For all subsequent output frames, it can be // read from the previous one. Also compute and set this frame's frame // pointer. - output_offset -= kFPOnStackSize; - input_offset -= kFPOnStackSize; + output_offset -= kPointerSize; + input_offset -= kPointerSize; if (is_bottommost) { value = input_->GetFrameSlot(input_offset); } else { value = output_[frame_index - 1]->GetFp(); } - output_frame->SetCallerFp(output_offset, value); + output_frame->SetFrameSlot(output_offset, value); intptr_t fp_value = top_address + output_offset; ASSERT(!is_bottommost || (input_->GetRegister(fp_reg.code()) + has_alignment_padding_ * kPointerSize) == fp_value); @@ -1049,9 +1049,9 @@ void Deoptimizer::DoComputeArgumentsAdaptorFrame(TranslationIterator* iterator, } // Read caller's PC from the previous frame. - output_offset -= kPCOnStackSize; + output_offset -= kPointerSize; intptr_t callers_pc = output_[frame_index - 1]->GetPc(); - output_frame->SetCallerPc(output_offset, callers_pc); + output_frame->SetFrameSlot(output_offset, callers_pc); if (trace_) { PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" V8PRIxPTR " ; caller's pc\n", @@ -1059,9 +1059,9 @@ void Deoptimizer::DoComputeArgumentsAdaptorFrame(TranslationIterator* iterator, } // Read caller's FP from the previous frame, and set this frame's FP. - output_offset -= kFPOnStackSize; + output_offset -= kPointerSize; intptr_t value = output_[frame_index - 1]->GetFp(); - output_frame->SetCallerFp(output_offset, value); + output_frame->SetFrameSlot(output_offset, value); intptr_t fp_value = top_address + output_offset; output_frame->SetFp(fp_value); if (trace_) { @@ -1152,9 +1152,9 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, } // Read caller's PC from the previous frame. - output_offset -= kPCOnStackSize; + output_offset -= kPointerSize; intptr_t callers_pc = output_[frame_index - 1]->GetPc(); - output_frame->SetCallerPc(output_offset, callers_pc); + output_frame->SetFrameSlot(output_offset, callers_pc); if (trace_) { PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" V8PRIxPTR " ; caller's pc\n", @@ -1162,9 +1162,9 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, } // Read caller's FP from the previous frame, and set this frame's FP. - output_offset -= kFPOnStackSize; + output_offset -= kPointerSize; intptr_t value = output_[frame_index - 1]->GetFp(); - output_frame->SetCallerFp(output_offset, value); + output_frame->SetFrameSlot(output_offset, value); intptr_t fp_value = top_address + output_offset; output_frame->SetFp(fp_value); if (trace_) { @@ -1265,9 +1265,7 @@ void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator, // MacroAssembler::EnterFrame). For a setter stub frame we need one additional // entry for the implicit return value, see // StoreStubCompiler::CompileStoreViaSetter. - unsigned fixed_frame_entries = (kPCOnStackSize / kPointerSize) + - (kFPOnStackSize / kPointerSize) + 3 + - (is_setter_stub_frame ? 1 : 0); + unsigned fixed_frame_entries = 1 + 4 + (is_setter_stub_frame ? 1 : 0); unsigned fixed_frame_size = fixed_frame_entries * kPointerSize; unsigned output_frame_size = height_in_bytes + fixed_frame_size; @@ -1289,9 +1287,9 @@ void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator, unsigned output_offset = output_frame_size; // Read caller's PC from the previous frame. - output_offset -= kPCOnStackSize; + output_offset -= kPointerSize; intptr_t callers_pc = output_[frame_index - 1]->GetPc(); - output_frame->SetCallerPc(output_offset, callers_pc); + output_frame->SetFrameSlot(output_offset, callers_pc); if (trace_) { PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR " ; caller's pc\n", @@ -1299,9 +1297,9 @@ void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator, } // Read caller's FP from the previous frame, and set this frame's FP. - output_offset -= kFPOnStackSize; + output_offset -= kPointerSize; intptr_t value = output_[frame_index - 1]->GetFp(); - output_frame->SetCallerFp(output_offset, value); + output_frame->SetFrameSlot(output_offset, value); intptr_t fp_value = top_address + output_offset; output_frame->SetFp(fp_value); if (trace_) { @@ -1437,10 +1435,10 @@ void Deoptimizer::DoComputeCompiledStubFrame(TranslationIterator* iterator, output_frame->SetTop(top_address); // Read caller's PC (JSFunction continuation) from the input frame. - unsigned input_frame_offset = input_frame_size - kPCOnStackSize; - unsigned output_frame_offset = output_frame_size - kFPOnStackSize; + unsigned input_frame_offset = input_frame_size - kPointerSize; + unsigned output_frame_offset = output_frame_size - kPointerSize; intptr_t value = input_->GetFrameSlot(input_frame_offset); - output_frame->SetCallerPc(output_frame_offset, value); + output_frame->SetFrameSlot(output_frame_offset, value); if (trace_) { PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" V8PRIxPTR " ; caller's pc\n", @@ -1448,10 +1446,10 @@ void Deoptimizer::DoComputeCompiledStubFrame(TranslationIterator* iterator, } // Read caller's FP from the input frame, and set this frame's FP. - input_frame_offset -= kFPOnStackSize; + input_frame_offset -= kPointerSize; value = input_->GetFrameSlot(input_frame_offset); - output_frame_offset -= kFPOnStackSize; - output_frame->SetCallerFp(output_frame_offset, value); + output_frame_offset -= kPointerSize; + output_frame->SetFrameSlot(output_frame_offset, value); intptr_t frame_ptr = input_->GetRegister(fp_reg.code()); output_frame->SetRegister(fp_reg.code(), frame_ptr); output_frame->SetFp(frame_ptr); diff --git a/src/deoptimizer.h b/src/deoptimizer.h index b29c1cba02..d28be236ed 100644 --- a/src/deoptimizer.h +++ b/src/deoptimizer.h @@ -510,10 +510,6 @@ class FrameDescription { *GetFrameSlotPointer(offset) = value; } - void SetCallerPc(unsigned offset, intptr_t value); - - void SetCallerFp(unsigned offset, intptr_t value); - intptr_t GetRegister(unsigned n) const { ASSERT(n < ARRAY_SIZE(registers_)); return registers_[n]; diff --git a/src/frames.cc b/src/frames.cc index faaab58382..890e77ad63 100644 --- a/src/frames.cc +++ b/src/frames.cc @@ -540,7 +540,7 @@ void ExitFrame::FillState(Address fp, Address sp, State* state) { state->sp = sp; state->fp = fp; state->pc_address = ResolveReturnAddressLocation( - reinterpret_cast(sp - 1 * kPCOnStackSize)); + reinterpret_cast(sp - 1 * kPointerSize)); } diff --git a/src/frames.h b/src/frames.h index 259dab5bbb..7e667a6acd 100644 --- a/src/frames.h +++ b/src/frames.h @@ -92,7 +92,7 @@ class StackHandlerConstants : public AllStatic { static const int kContextOffset = 3 * kPointerSize; static const int kFPOffset = 4 * kPointerSize; - static const int kSize = kFPOffset + kFPOnStackSize; + static const int kSize = kFPOffset + kPointerSize; static const int kSlotCount = kSize >> kPointerSizeLog2; }; @@ -168,14 +168,13 @@ class StandardFrameConstants : public AllStatic { // context and function. // StandardFrame::IterateExpressions assumes that kContextOffset is the last // object pointer. - static const int kFixedFrameSize = kPCOnStackSize + kFPOnStackSize + - 2 * kPointerSize; + static const int kFixedFrameSize = 4 * kPointerSize; static const int kExpressionsOffset = -3 * kPointerSize; static const int kMarkerOffset = -2 * kPointerSize; 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 kCallerPCOffset = +1 * kPointerSize; + static const int kCallerSPOffset = +2 * kPointerSize; }; diff --git a/src/globals.h b/src/globals.h index 26fd53114c..e695e94d4e 100644 --- a/src/globals.h +++ b/src/globals.h @@ -239,15 +239,12 @@ const int kMinInt = -kMaxInt - 1; const uint32_t kMaxUInt32 = 0xFFFFFFFFu; -const int kCharSize = sizeof(char); // NOLINT -const int kShortSize = sizeof(short); // NOLINT -const int kIntSize = sizeof(int); // NOLINT -const int kDoubleSize = sizeof(double); // NOLINT -const int kIntptrSize = sizeof(intptr_t); // NOLINT -const int kPointerSize = sizeof(void*); // NOLINT -const int kRegisterSize = kPointerSize; -const int kPCOnStackSize = kRegisterSize; -const int kFPOnStackSize = kRegisterSize; +const int kCharSize = sizeof(char); // NOLINT +const int kShortSize = sizeof(short); // NOLINT +const int kIntSize = sizeof(int); // NOLINT +const int kDoubleSize = sizeof(double); // NOLINT +const int kIntptrSize = sizeof(intptr_t); // NOLINT +const int kPointerSize = sizeof(void*); // NOLINT const int kDoubleSizeLog2 = 3; diff --git a/src/ia32/deoptimizer-ia32.cc b/src/ia32/deoptimizer-ia32.cc index fcacaf5377..505cd4fc1c 100644 --- a/src/ia32/deoptimizer-ia32.cc +++ b/src/ia32/deoptimizer-ia32.cc @@ -741,17 +741,6 @@ void Deoptimizer::TableEntryGenerator::GeneratePrologue() { __ bind(&done); } - -void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) { - SetFrameSlot(offset, value); -} - - -void FrameDescription::SetCallerFp(unsigned offset, intptr_t value) { - SetFrameSlot(offset, value); -} - - #undef __ diff --git a/src/lithium.cc b/src/lithium.cc index e9c3531e38..3df8d6cc29 100644 --- a/src/lithium.cc +++ b/src/lithium.cc @@ -270,7 +270,7 @@ int StackSlotOffset(int index) { return -(index + 3) * kPointerSize; } else { // Incoming parameter. Skip the return address. - return -(index + 1) * kPointerSize + kFPOnStackSize + kPCOnStackSize; + return -(index - 1) * kPointerSize; } } diff --git a/src/mips/deoptimizer-mips.cc b/src/mips/deoptimizer-mips.cc index 402f0f5c98..840462e43f 100644 --- a/src/mips/deoptimizer-mips.cc +++ b/src/mips/deoptimizer-mips.cc @@ -648,17 +648,6 @@ void Deoptimizer::TableEntryGenerator::GeneratePrologue() { count() * table_entry_size_); } - -void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) { - SetFrameSlot(offset, value); -} - - -void FrameDescription::SetCallerFp(unsigned offset, intptr_t value) { - SetFrameSlot(offset, value); -} - - #undef __ diff --git a/src/x64/deoptimizer-x64.cc b/src/x64/deoptimizer-x64.cc index a41cddfbd6..d7a73d75c9 100644 --- a/src/x64/deoptimizer-x64.cc +++ b/src/x64/deoptimizer-x64.cc @@ -610,17 +610,6 @@ void Deoptimizer::TableEntryGenerator::GeneratePrologue() { __ bind(&done); } - -void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) { - SetFrameSlot(offset, value); -} - - -void FrameDescription::SetCallerFp(unsigned offset, intptr_t value) { - SetFrameSlot(offset, value); -} - - #undef __