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

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: Final tweaks 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
Index: src/compiler/linkage.cc
diff --git a/src/compiler/linkage.cc b/src/compiler/linkage.cc
index 2c6d2a8ae41430da5d01ed82aea4cb35ffcadcfe..e598c3b938c2969195b2f1b18546586be58eaa76 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,18 @@ 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 = (Frame::kFixedSlotCount - 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 * (Frame::kFixedSlotCount -
+ frame->GetTotalFrameSlotCount());
+ return FrameOffset::FromStackPointer(offset - offsetSpToFp);
}
}
@@ -497,7 +489,7 @@ 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 + Frame::kJSFixedSlotCount;
return LinkageLocation::ForCalleeFrameSlot(spill_index);
} else {
// Parameter. Use the assigned location from the incoming call descriptor.

Powered by Google App Engine
This is Rietveld 408576698