Fix Frame::AlignSavedCalleeRegisterSlots
authorjacob.bramley <jacob.bramley@arm.com>
Tue, 29 Sep 2015 07:48:43 +0000 (00:48 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 29 Sep 2015 07:49:00 +0000 (07:49 +0000)
The return value is expected to be the number of padding slots added to the frame. However, the original logic would return -1 if padding was required, so insufficient stack space would be reserved.

This function now returns either 0 or 1, as the existing calling code expects.

BUG=

Review URL: https://codereview.chromium.org/1369303002

Cr-Commit-Position: refs/heads/master@{#30994}

src/compiler/frame.h

index aa823b6..0b06678 100644 (file)
@@ -110,9 +110,9 @@ class Frame : public ZoneObject {
 
   int AlignSavedCalleeRegisterSlots() {
     DCHECK_EQ(0, spilled_callee_register_slot_count_);
-    int frame_slot_count_before = frame_slot_count_;
-    frame_slot_count_ = RoundUp(frame_slot_count_, 2);
-    return frame_slot_count_before - frame_slot_count_;
+    int delta = frame_slot_count_ & 1;
+    frame_slot_count_ += delta;
+    return delta;
   }
 
   void AllocateSavedCalleeRegisterSlots(int count) {