summaryrefslogtreecommitdiff
path: root/deps/v8/src/compiler/frame.h
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2018-03-07 08:54:53 +0100
committerMichaël Zasso <targos@protonmail.com>2018-03-07 16:48:52 +0100
commit88786fecff336342a56e6f2e7ff3b286be716e47 (patch)
tree92e6ba5b8ac8dae1a058988d20c9d27bfa654390 /deps/v8/src/compiler/frame.h
parent4e86f9b5ab83cbabf43839385bf383e6a7ef7d19 (diff)
downloadnode-new-88786fecff336342a56e6f2e7ff3b286be716e47.tar.gz
deps: update V8 to 6.5.254.31
PR-URL: https://github.com/nodejs/node/pull/18453 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yang Guo <yangguo@chromium.org> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Diffstat (limited to 'deps/v8/src/compiler/frame.h')
-rw-r--r--deps/v8/src/compiler/frame.h49
1 files changed, 34 insertions, 15 deletions
diff --git a/deps/v8/src/compiler/frame.h b/deps/v8/src/compiler/frame.h
index fe8008913d..f5c36dba17 100644
--- a/deps/v8/src/compiler/frame.h
+++ b/deps/v8/src/compiler/frame.h
@@ -22,7 +22,7 @@ class CallDescriptor;
// into them. Mutable state associated with the frame is stored separately in
// FrameAccessState.
//
-// Frames are divided up into three regions.
+// Frames are divided up into four regions.
// - The first is the fixed header, which always has a constant size and can be
// predicted before code generation begins depending on the type of code being
// generated.
@@ -33,11 +33,15 @@ class CallDescriptor;
// reserved after register allocation, since its size can only be precisely
// determined after register allocation once the number of used callee-saved
// register is certain.
+// - The fourth region is a scratch area for return values from other functions
+// called, if multiple returns cannot all be passed in registers. This region
+// Must be last in a stack frame, so that it is positioned immediately below
+// the stack frame of a callee to store to.
//
// The frame region immediately below the fixed header contains spill slots
// starting at slot 4 for JSFunctions. The callee-saved frame region below that
-// starts at 4+spill_slot_count_. Callee stack slots corresponding to
-// parameters are accessible through negative slot ids.
+// starts at 4+spill_slot_count_. Callee stack slots correspond to
+// parameters that are accessible through negative slot ids.
//
// Every slot of a caller or callee frame is accessible by the register
// allocator and gap resolver with a SpillSlotOperand containing its
@@ -73,7 +77,13 @@ class CallDescriptor;
// |- - - - - - - - -| | |
// | ... | Callee-saved |
// |- - - - - - - - -| | |
-// m+r+3 | callee-saved r | v v
+// m+r+3 | callee-saved r | v |
+// +-----------------+---- |
+// m+r+4 | return 0 | ^ |
+// |- - - - - - - - -| | |
+// | ... | Return |
+// |- - - - - - - - -| | |
+// | return q-1 | v v
// -----+-----------------+----- <-- stack ptr -------------
//
class Frame : public ZoneObject {
@@ -81,8 +91,9 @@ class Frame : public ZoneObject {
explicit Frame(int fixed_frame_size_in_slots);
inline int GetTotalFrameSlotCount() const { return frame_slot_count_; }
-
+ inline int GetFixedSlotCount() const { return fixed_slot_count_; }
inline int GetSpillSlotCount() const { return spill_slot_count_; }
+ inline int GetReturnSlotCount() const { return return_slot_count_; }
void SetAllocatedRegisters(BitVector* regs) {
DCHECK_NULL(allocated_registers_);
@@ -112,19 +123,25 @@ class Frame : public ZoneObject {
}
int AllocateSpillSlot(int width, int alignment = 0) {
+ DCHECK_EQ(frame_slot_count_,
+ fixed_slot_count_ + spill_slot_count_ + return_slot_count_);
int frame_slot_count_before = frame_slot_count_;
- if (alignment <= kPointerSize) {
- AllocateAlignedFrameSlots(width);
- } else {
- // We need to allocate more place for spill slot
- // in case we need an aligned spill slot to be
- // able to properly align start of spill slot
- // and still have enough place to hold all the
- // data
- AllocateAlignedFrameSlots(width + alignment - kPointerSize);
+ if (alignment > kPointerSize) {
+ // Slots are pointer sized, so alignment greater than a pointer size
+ // requires allocating additional slots.
+ width += alignment - kPointerSize;
}
+ AllocateAlignedFrameSlots(width);
spill_slot_count_ += frame_slot_count_ - frame_slot_count_before;
- return frame_slot_count_ - 1;
+ return frame_slot_count_ - return_slot_count_ - 1;
+ }
+
+ void EnsureReturnSlots(int count) {
+ if (count > return_slot_count_) {
+ count -= return_slot_count_;
+ frame_slot_count_ += count;
+ return_slot_count_ += count;
+ }
}
int AlignFrame(int alignment = kDoubleSize);
@@ -152,8 +169,10 @@ class Frame : public ZoneObject {
}
private:
+ int fixed_slot_count_;
int frame_slot_count_;
int spill_slot_count_;
+ int return_slot_count_;
BitVector* allocated_registers_;
BitVector* allocated_double_registers_;