Simplifications to frames.h and frames.cc.

Move unnecessarily public methods from frames.h into .cc file.
Remove dead StackFrame::SetCallerFp().

R=mstarzinger@chromium.org

Bug: 
Change-Id: I7b66a430cfb01bb38046c9e92f504134ba8316a3
Reviewed-on: https://chromium-review.googlesource.com/602271
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Ben Titzer <titzer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47181}
This commit is contained in:
Ben L. Titzer 2017-08-04 15:27:49 +02:00 committed by Commit Bot
parent d3d074e12a
commit dc34289bae
3 changed files with 27 additions and 72 deletions

View File

@ -40,18 +40,6 @@ inline StackHandler* StackFrame::top_handler() const {
}
inline Code* StackFrame::LookupCode() const {
// TODO(jgruber): This should really check that pc is within the returned
// code's instruction range [instruction_start(), instruction_end()[.
return GetContainingCode(isolate(), pc());
}
inline Code* StackFrame::GetContainingCode(Isolate* isolate, Address pc) {
return isolate->inner_pointer_to_code_cache()->GetCacheEntry(pc)->code;
}
inline Address* StackFrame::ResolveReturnAddressLocation(Address* pc_address) {
if (return_address_location_resolver_ == NULL) {
return pc_address;

View File

@ -390,28 +390,18 @@ void SafeStackFrameIterator::Advance() {
// -------------------------------------------------------------------------
Code* StackFrame::GetSafepointData(Isolate* isolate,
Address inner_pointer,
SafepointEntry* safepoint_entry,
unsigned* stack_slots) {
InnerPointerToCodeCache::InnerPointerToCodeCacheEntry* entry =
isolate->inner_pointer_to_code_cache()->GetCacheEntry(inner_pointer);
if (!entry->safepoint_entry.is_valid()) {
entry->safepoint_entry = entry->code->GetSafepointEntry(inner_pointer);
DCHECK(entry->safepoint_entry.is_valid());
} else {
DCHECK(entry->safepoint_entry.Equals(
entry->code->GetSafepointEntry(inner_pointer)));
}
// Fill in the results and return the code.
Code* code = entry->code;
*safepoint_entry = entry->safepoint_entry;
*stack_slots = code->stack_slots();
return code;
namespace {
Code* GetContainingCode(Isolate* isolate, Address pc) {
return isolate->inner_pointer_to_code_cache()->GetCacheEntry(pc)->code;
}
} // namespace
Code* StackFrame::LookupCode() const {
Code* result = GetContainingCode(isolate(), pc());
DCHECK_GE(pc(), result->instruction_start());
DCHECK_LT(pc(), result->instruction_end());
return result;
}
#ifdef DEBUG
static bool GcSafeCodeContains(HeapObject* object, Address addr);
@ -567,12 +557,6 @@ void EntryFrame::ComputeCallerState(State* state) const {
}
void EntryFrame::SetCallerFp(Address caller_fp) {
const int offset = EntryFrameConstants::kCallerFPOffset;
Memory::Address_at(this->fp() + offset) = caller_fp;
}
StackFrame::Type EntryFrame::GetCallerState(State* state) const {
const int offset = EntryFrameConstants::kCallerFPOffset;
Address fp = Memory::Address_at(this->fp() + offset);
@ -608,10 +592,6 @@ void ExitFrame::ComputeCallerState(State* state) const {
}
void ExitFrame::SetCallerFp(Address caller_fp) {
Memory::Address_at(fp() + ExitFrameConstants::kCallerFPOffset) = caller_fp;
}
void ExitFrame::Iterate(RootVisitor* v) const {
// The arguments are traversed as part of the expression stack of
// the calling frame.
@ -785,11 +765,6 @@ void StandardFrame::ComputeCallerState(State* state) const {
}
void StandardFrame::SetCallerFp(Address caller_fp) {
Memory::Address_at(fp() + StandardFrameConstants::kCallerFPOffset) =
caller_fp;
}
bool StandardFrame::IsConstructor() const { return false; }
void StandardFrame::Summarize(List<FrameSummary>* functions,
@ -803,11 +778,21 @@ void StandardFrame::IterateCompiledFrame(RootVisitor* v) const {
// possibly find pointers in optimized frames in that state.
DCHECK(can_access_heap_objects());
// Compute the safepoint information.
unsigned stack_slots = 0;
SafepointEntry safepoint_entry;
Code* code = StackFrame::GetSafepointData(
isolate(), pc(), &safepoint_entry, &stack_slots);
// Find the code and compute the safepoint information.
Address inner_pointer = pc();
InnerPointerToCodeCache::InnerPointerToCodeCacheEntry* entry =
isolate()->inner_pointer_to_code_cache()->GetCacheEntry(inner_pointer);
if (!entry->safepoint_entry.is_valid()) {
entry->safepoint_entry = entry->code->GetSafepointEntry(inner_pointer);
DCHECK(entry->safepoint_entry.is_valid());
} else {
DCHECK(entry->safepoint_entry.Equals(
entry->code->GetSafepointEntry(inner_pointer)));
}
Code* code = entry->code;
SafepointEntry safepoint_entry = entry->safepoint_entry;
unsigned stack_slots = code->stack_slots();
unsigned slot_space = stack_slots * kPointerSize;
// Determine the fixed header and spill slot area size.

View File

@ -247,8 +247,6 @@ class StackFrame BASE_EMBEDDED {
*constant_pool_address() = constant_pool;
}
virtual void SetCallerFp(Address caller_fp) = 0;
Address* pc_address() const { return state_.pc_address; }
Address* constant_pool_address() const {
@ -268,19 +266,8 @@ class StackFrame BASE_EMBEDDED {
// This method could be called during marking phase of GC.
virtual Code* unchecked_code() const = 0;
// Get the code associated with this frame.
inline Code* LookupCode() const;
// Get the code object that contains the given pc.
static inline Code* GetContainingCode(Isolate* isolate, Address pc);
// Get the code object containing the given pc and fill in the
// safepoint entry and the number of stack slots. The pc must be at
// a safepoint.
static Code* GetSafepointData(Isolate* isolate,
Address pc,
SafepointEntry* safepoint_entry,
unsigned* stack_slots);
// Search for the code associated with this frame.
Code* LookupCode() const;
virtual void Iterate(RootVisitor* v) const = 0;
static void IteratePc(RootVisitor* v, Address* pc_address,
@ -355,7 +342,6 @@ class EntryFrame: public StackFrame {
DCHECK(frame->is_entry());
return static_cast<EntryFrame*>(frame);
}
void SetCallerFp(Address caller_fp) override;
protected:
inline explicit EntryFrame(StackFrameIteratorBase* iterator);
@ -403,8 +389,6 @@ class ExitFrame: public StackFrame {
// Garbage collection support.
void Iterate(RootVisitor* v) const override;
void SetCallerFp(Address caller_fp) override;
static ExitFrame* cast(StackFrame* frame) {
DCHECK(frame->is_exit());
return static_cast<ExitFrame*>(frame);
@ -644,8 +628,6 @@ class StandardFrame : public StackFrame {
virtual Object* GetParameter(int index) const;
virtual int ComputeParametersCount() const;
void SetCallerFp(Address caller_fp) override;
// Check if this frame is a constructor frame invoked through 'new'.
virtual bool IsConstructor() const;