Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(389)

Unified Diff: src/compiler/linkage.cc

Issue 1261923007: [turbofan] Unify referencing of stack slots (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review feedback Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/ia32/code-generator-ia32.cc ('k') | src/compiler/mips/code-generator-mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/linkage.cc
diff --git a/src/compiler/linkage.cc b/src/compiler/linkage.cc
index e6ef59898f9360eec3e3a491fc2bed695580c292..66e5cda7d7536f01431f1bdf9edf4a1b114299b0 100644
--- a/src/compiler/linkage.cc
+++ b/src/compiler/linkage.cc
@@ -5,6 +5,7 @@
#include "src/code-stubs.h"
#include "src/compiler.h"
#include "src/compiler/common-operator.h"
+#include "src/compiler/frame.h"
#include "src/compiler/linkage.h"
#include "src/compiler/node.h"
#include "src/compiler/osr.h"
@@ -190,27 +191,21 @@ CallDescriptor* Linkage::ComputeIncoming(Zone* zone, CompilationInfo* info) {
FrameOffset Linkage::GetFrameOffset(int spill_slot, Frame* frame) const {
- if (frame->GetSpillSlotCount() > 0 || incoming_->IsJSFunctionCall() ||
- incoming_->kind() == CallDescriptor::kCallAddress) {
- int offset;
- int register_save_area_size = frame->GetRegisterSaveAreaSize();
- if (spill_slot >= 0) {
- // Local or spill slot. Skip the frame pointer, function, and
- // context in the fixed part of the frame.
- offset = -(spill_slot + 1) * kPointerSize - register_save_area_size;
- } else {
- // Incoming parameter. Skip the return address.
- offset = -(spill_slot + 1) * kPointerSize + kFPOnStackSize +
- frame->PCOnStackSize();
- }
+ bool has_frame = frame->GetSpillSlotCount() > 0 ||
+ incoming_->IsJSFunctionCall() ||
+ incoming_->kind() == CallDescriptor::kCallAddress;
+ const int offset =
+ (StandardFrameConstants::kFixedSlotCountAboveFp - spill_slot - 1) *
+ kPointerSize;
+ if (has_frame) {
return FrameOffset::FromFramePointer(offset);
} else {
// No frame. Retrieve all parameters relative to stack pointer.
DCHECK(spill_slot < 0); // Must be a parameter.
- int register_save_area_size = frame->GetRegisterSaveAreaSize();
- int offset = register_save_area_size - (spill_slot + 1) * kPointerSize +
- frame->PCOnStackSize();
- return FrameOffset::FromStackPointer(offset);
+ int offsetSpToFp =
+ kPointerSize * (StandardFrameConstants::kFixedSlotCountAboveFp -
+ frame->GetTotalFrameSlotCount());
+ return FrameOffset::FromStackPointer(offset - offsetSpToFp);
}
}
@@ -505,7 +500,8 @@ LinkageLocation Linkage::GetOsrValueLocation(int index) const {
return incoming_->GetInputLocation(context_index);
} else if (index >= first_stack_slot) {
// Local variable stored in this (callee) stack.
- int spill_index = index - first_stack_slot;
+ int spill_index =
+ index - first_stack_slot + StandardFrameConstants::kFixedSlotCount;
return LinkageLocation::ForCalleeFrameSlot(spill_index);
} else {
// Parameter. Use the assigned location from the incoming call descriptor.
« no previous file with comments | « src/compiler/ia32/code-generator-ia32.cc ('k') | src/compiler/mips/code-generator-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698