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

Unified Diff: src/compiler/frame.h

Issue 2624183002: [compiler] Allow for StackSlots of arbitrary size (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | src/compiler/instruction-selector.cc » ('j') | src/compiler/machine-operator.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/frame.h
diff --git a/src/compiler/frame.h b/src/compiler/frame.h
index 8d463dfb78d3cc4b22c1160de2c38a71685d2953..fd22234113a2d3c6428a197bc193e1f900fe84f3 100644
--- a/src/compiler/frame.h
+++ b/src/compiler/frame.h
@@ -112,10 +112,10 @@ class Frame : public ZoneObject {
}
int AllocateSpillSlot(int width) {
- int frame_slot_count_before = frame_slot_count_;
- int slot = AllocateAlignedFrameSlot(width);
- spill_slot_count_ += (frame_slot_count_ - frame_slot_count_before);
- return slot;
+ int new_frame_slots = NumAlignedFrameSlots(width);
+ spill_slot_count_ += new_frame_slots;
+ frame_slot_count_ += new_frame_slots;
+ return frame_slot_count_ - 1;
}
int AlignFrame(int alignment = kDoubleSize);
@@ -131,23 +131,15 @@ class Frame : public ZoneObject {
static const int kJSFunctionSlot = 3 + StandardFrameConstants::kCPSlotCount;
private:
- int AllocateAlignedFrameSlot(int width) {
- DCHECK(width == 4 || width == 8 || width == 16);
- if (kPointerSize == 4) {
- // Skip one slot if necessary.
- if (width > kPointerSize) {
- frame_slot_count_++;
- frame_slot_count_ |= 1;
- // 2 extra slots if width == 16.
- frame_slot_count_ += (width & 16) / 8;
- }
- } else {
- // No alignment when slots are 8 bytes.
- DCHECK_EQ(8, kPointerSize);
- // 1 extra slot if width == 16.
- frame_slot_count_ += (width & 16) / 16;
+ int NumAlignedFrameSlots(int width) {
+ int new_frame_slots = (width + kPointerSize - 1) / kPointerSize;
+ // Align to 8 bytes if width is a multiple of 8 bytes.
+ if (kPointerSize == 4 && width >= 8 && (width & 7) == 0 &&
titzer 2017/01/11 15:13:40 Why not just alignSize = (width & 7) == 0 ? 8 : kP
Clemens Hammacher 2017/01/11 15:41:34 It wasn't there before, but sounds like a good ide
+ ((frame_slot_count_ + new_frame_slots) & 1) != 0) {
+ ++new_frame_slots;
}
- return frame_slot_count_++;
+ DCHECK_GT(kMaxInt - frame_slot_count_, new_frame_slots);
+ return new_frame_slots;
}
private:
« no previous file with comments | « no previous file | src/compiler/instruction-selector.cc » ('j') | src/compiler/machine-operator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698