Commit 473f8336 authored by whesse@chromium.org's avatar whesse@chromium.org

Change return type of FrameDescription::GetFrameSize to avoid unneeded type casts.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8500 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 05c73983
...@@ -550,7 +550,7 @@ void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) { ...@@ -550,7 +550,7 @@ void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) {
} }
// Fill the frame content from the actual data on the frame. // Fill the frame content from the actual data on the frame.
for (intptr_t i = 0; i < input_->GetFrameSize(); i += kPointerSize) { for (unsigned i = 0; i < input_->GetFrameSize(); i += kPointerSize) {
input_->SetFrameSlot(i, Memory::uint32_at(tos + i)); input_->SetFrameSlot(i, Memory::uint32_at(tos + i));
} }
} }
......
...@@ -161,7 +161,7 @@ DeoptimizedFrameInfo* Deoptimizer::DebuggerInspectableFrame( ...@@ -161,7 +161,7 @@ DeoptimizedFrameInfo* Deoptimizer::DebuggerInspectableFrame(
// Get the "simulated" top and size for the requested frame. // Get the "simulated" top and size for the requested frame.
Address top = Address top =
reinterpret_cast<Address>(deoptimizer->output_[frame_index]->GetTop()); reinterpret_cast<Address>(deoptimizer->output_[frame_index]->GetTop());
intptr_t size = unsigned size =
deoptimizer->output_[frame_index]->GetFrameSize() / kPointerSize; deoptimizer->output_[frame_index]->GetFrameSize() / kPointerSize;
// Done with the GC-unsafe frame descriptions. This re-enables allocation. // Done with the GC-unsafe frame descriptions. This re-enables allocation.
...@@ -1114,13 +1114,13 @@ unsigned FrameDescription::GetOffsetFromSlotIndex(Deoptimizer* deoptimizer, ...@@ -1114,13 +1114,13 @@ unsigned FrameDescription::GetOffsetFromSlotIndex(Deoptimizer* deoptimizer,
if (slot_index >= 0) { if (slot_index >= 0) {
// Local or spill slots. Skip the fixed part of the frame // Local or spill slots. Skip the fixed part of the frame
// including all arguments. // including all arguments.
unsigned base = static_cast<unsigned>( unsigned base =
GetFrameSize() - deoptimizer->ComputeFixedSize(GetFunction())); GetFrameSize() - deoptimizer->ComputeFixedSize(GetFunction());
return base - ((slot_index + 1) * kPointerSize); return base - ((slot_index + 1) * kPointerSize);
} else { } else {
// Incoming parameter. // Incoming parameter.
unsigned base = static_cast<unsigned>(GetFrameSize() - unsigned base = GetFrameSize() -
deoptimizer->ComputeIncomingArgumentSize(GetFunction())); deoptimizer->ComputeIncomingArgumentSize(GetFunction());
return base - ((slot_index + 1) * kPointerSize); return base - ((slot_index + 1) * kPointerSize);
} }
} }
...@@ -1128,8 +1128,8 @@ unsigned FrameDescription::GetOffsetFromSlotIndex(Deoptimizer* deoptimizer, ...@@ -1128,8 +1128,8 @@ unsigned FrameDescription::GetOffsetFromSlotIndex(Deoptimizer* deoptimizer,
unsigned FrameDescription::GetExpressionCount(Deoptimizer* deoptimizer) { unsigned FrameDescription::GetExpressionCount(Deoptimizer* deoptimizer) {
ASSERT_EQ(Code::FUNCTION, kind_); ASSERT_EQ(Code::FUNCTION, kind_);
intptr_t size = GetFrameSize() - deoptimizer->ComputeFixedSize(GetFunction()); unsigned size = GetFrameSize() - deoptimizer->ComputeFixedSize(GetFunction());
return static_cast<unsigned>(size / kPointerSize); return size / kPointerSize;
} }
......
...@@ -340,7 +340,10 @@ class FrameDescription { ...@@ -340,7 +340,10 @@ class FrameDescription {
free(description); free(description);
} }
intptr_t GetFrameSize() const { return frame_size_; } uint32_t GetFrameSize() const {
ASSERT(static_cast<uint32_t>(frame_size_) == frame_size_);
return static_cast<uint32_t>(frame_size_);
}
JSFunction* GetFunction() const { return function_; } JSFunction* GetFunction() const { return function_; }
...@@ -434,6 +437,9 @@ class FrameDescription { ...@@ -434,6 +437,9 @@ class FrameDescription {
private: private:
static const uint32_t kZapUint32 = 0xbeeddead; static const uint32_t kZapUint32 = 0xbeeddead;
// Frame_size_ must hold a uint32_t value. It is only a uintptr_t to
// keep the variable-size array frame_content_ of type intptr_t at
// the end of the structure aligned.
uintptr_t frame_size_; // Number of bytes. uintptr_t frame_size_; // Number of bytes.
JSFunction* function_; JSFunction* function_;
intptr_t registers_[Register::kNumRegisters]; intptr_t registers_[Register::kNumRegisters];
......
...@@ -621,7 +621,7 @@ void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) { ...@@ -621,7 +621,7 @@ void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) {
} }
// Fill the frame content from the actual data on the frame. // Fill the frame content from the actual data on the frame.
for (intptr_t i = 0; i < input_->GetFrameSize(); i += kPointerSize) { for (unsigned i = 0; i < input_->GetFrameSize(); i += kPointerSize) {
input_->SetFrameSlot(i, Memory::uint32_at(tos + i)); input_->SetFrameSlot(i, Memory::uint32_at(tos + i));
} }
} }
......
...@@ -316,7 +316,7 @@ void Deoptimizer::DoComputeOsrOutputFrame() { ...@@ -316,7 +316,7 @@ void Deoptimizer::DoComputeOsrOutputFrame() {
USE(height_in_bytes); USE(height_in_bytes);
unsigned fixed_size = ComputeFixedSize(function_); unsigned fixed_size = ComputeFixedSize(function_);
unsigned input_frame_size = static_cast<unsigned>(input_->GetFrameSize()); unsigned input_frame_size = input_->GetFrameSize();
ASSERT(fixed_size + height_in_bytes == input_frame_size); ASSERT(fixed_size + height_in_bytes == input_frame_size);
unsigned stack_slot_size = optimized_code_->stack_slots() * kPointerSize; unsigned stack_slot_size = optimized_code_->stack_slots() * kPointerSize;
...@@ -451,7 +451,7 @@ void Deoptimizer::DoComputeFrame(TranslationIterator* iterator, ...@@ -451,7 +451,7 @@ void Deoptimizer::DoComputeFrame(TranslationIterator* iterator,
// The 'fixed' part of the frame consists of the incoming parameters and // The 'fixed' part of the frame consists of the incoming parameters and
// the part described by JavaScriptFrameConstants. // the part described by JavaScriptFrameConstants.
unsigned fixed_frame_size = ComputeFixedSize(function); unsigned fixed_frame_size = ComputeFixedSize(function);
unsigned input_frame_size = static_cast<unsigned>(input_->GetFrameSize()); unsigned input_frame_size = input_->GetFrameSize();
unsigned output_frame_size = height_in_bytes + fixed_frame_size; unsigned output_frame_size = height_in_bytes + fixed_frame_size;
// Allocate and store the output frame description. // Allocate and store the output frame description.
...@@ -616,7 +616,7 @@ void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) { ...@@ -616,7 +616,7 @@ void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) {
} }
// Fill the frame content from the actual data on the frame. // Fill the frame content from the actual data on the frame.
for (intptr_t i = 0; i < input_->GetFrameSize(); i += kPointerSize) { for (unsigned i = 0; i < input_->GetFrameSize(); i += kPointerSize) {
input_->SetFrameSlot(i, Memory::uint64_at(tos + i)); input_->SetFrameSlot(i, Memory::uint64_at(tos + i));
} }
} }
......
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