Revision: 11110
Author:   [email protected]
Date:     Thu Mar 22 08:27:47 2012
Log: Merge r11075 from bleeding_edge to 3.8 branch: Revert dynamic frame alignment.

Marking aligned frames with a marker can produce false positives since
an optimized frame spill slot may be mistakenly seen as a marker value.

It also breaks the debugger reproducably: Tested when enabling alignment
for all functions and running the debugger unit tests.

BUG=v8:2009
TEST=no crashes in EarleyBoyer
Review URL: https://chromiumcodereview.appspot.com/9716028
http://code.google.com/p/v8/source/detail?r=11110

Modified:
 /branches/3.8/src/deoptimizer.cc
 /branches/3.8/src/deoptimizer.h
 /branches/3.8/src/heap.cc
 /branches/3.8/src/heap.h
 /branches/3.8/src/ia32/deoptimizer-ia32.cc
 /branches/3.8/src/ia32/lithium-codegen-ia32.cc
 /branches/3.8/src/ia32/lithium-codegen-ia32.h
 /branches/3.8/src/ia32/lithium-ia32.cc
 /branches/3.8/src/ia32/lithium-ia32.h
 /branches/3.8/src/objects-debug.cc
 /branches/3.8/src/objects.h
 /branches/3.8/src/version.cc

=======================================
--- /branches/3.8/src/deoptimizer.cc    Wed Feb 29 09:08:47 2012
+++ /branches/3.8/src/deoptimizer.cc    Thu Mar 22 08:27:47 2012
@@ -350,8 +350,6 @@
       output_count_(0),
       jsframe_count_(0),
       output_(NULL),
-      frame_alignment_marker_(isolate->heap()->frame_alignment_marker()),
-      has_alignment_padding_(0),
       deferred_heap_numbers_(0) {
   if (FLAG_trace_deopt && type != OSR) {
     if (type == DEBUGGER) {
=======================================
--- /branches/3.8/src/deoptimizer.h     Thu Jan 26 08:03:10 2012
+++ /branches/3.8/src/deoptimizer.h     Thu Mar 22 08:27:47 2012
@@ -220,11 +220,6 @@
     return OFFSET_OF(Deoptimizer, output_count_);
   }
   static int output_offset() { return OFFSET_OF(Deoptimizer, output_); }
-  static int frame_alignment_marker_offset() {
-    return OFFSET_OF(Deoptimizer, frame_alignment_marker_); }
-  static int has_alignment_padding_offset() {
-    return OFFSET_OF(Deoptimizer, has_alignment_padding_);
-  }

   static int GetDeoptimizedCodeCount(Isolate* isolate);

@@ -339,10 +334,6 @@
   // Array of output frame descriptions.
   FrameDescription** output_;

-  // Frames can be dynamically padded on ia32 to align untagged doubles.
-  Object* frame_alignment_marker_;
-  intptr_t has_alignment_padding_;
-
   List<HeapNumberMaterializationDescriptor> deferred_heap_numbers_;

   static const int table_entry_size_;
=======================================
--- /branches/3.8/src/heap.cc   Wed Mar 14 07:24:32 2012
+++ /branches/3.8/src/heap.cc   Thu Mar 22 08:27:47 2012
@@ -2433,34 +2433,26 @@
   set_the_hole_value(Oddball::cast(obj));

   { MaybeObject* maybe_obj = CreateOddball("arguments_marker",
-                                           Smi::FromInt(-2),
+                                           Smi::FromInt(-4),
                                            Oddball::kArgumentMarker);
     if (!maybe_obj->ToObject(&obj)) return false;
   }
   set_arguments_marker(Oddball::cast(obj));

{ MaybeObject* maybe_obj = CreateOddball("no_interceptor_result_sentinel",
-                                           Smi::FromInt(-3),
+                                           Smi::FromInt(-2),
                                            Oddball::kOther);
     if (!maybe_obj->ToObject(&obj)) return false;
   }
   set_no_interceptor_result_sentinel(obj);

   { MaybeObject* maybe_obj = CreateOddball("termination_exception",
-                                           Smi::FromInt(-4),
+                                           Smi::FromInt(-3),
                                            Oddball::kOther);
     if (!maybe_obj->ToObject(&obj)) return false;
   }
   set_termination_exception(obj);

-  { MaybeObject* maybe_obj = CreateOddball("frame_alignment_marker",
-                                           Smi::FromInt(-5),
-                                           Oddball::kOther);
-    if (!maybe_obj->ToObject(&obj)) return false;
-  }
-  set_frame_alignment_marker(Oddball::cast(obj));
-  STATIC_ASSERT(Oddball::kLeastHiddenOddballNumber == -5);
-
   // Allocate the empty string.
   { MaybeObject* maybe_obj = AllocateRawAsciiString(0, TENURED);
     if (!maybe_obj->ToObject(&obj)) return false;
=======================================
--- /branches/3.8/src/heap.h    Tue Mar  6 06:48:47 2012
+++ /branches/3.8/src/heap.h    Thu Mar 22 08:27:47 2012
@@ -84,7 +84,6 @@
V(String, empty_string, EmptyString) \ V(DescriptorArray, empty_descriptor_array, EmptyDescriptorArray) \ V(Smi, stack_limit, StackLimit) \ - V(Oddball, frame_alignment_marker, FrameAlignmentMarker) \ V(Oddball, arguments_marker, ArgumentsMarker) \ /* The first 32 roots above this line should be boring from a GC point of */ \ /* view. This means they are never in new space and never on a page that */ \
=======================================
--- /branches/3.8/src/ia32/deoptimizer-ia32.cc  Wed Jan 25 23:37:54 2012
+++ /branches/3.8/src/ia32/deoptimizer-ia32.cc  Thu Mar 22 08:27:47 2012
@@ -406,14 +406,7 @@
     output_[0]->SetPc(reinterpret_cast<uint32_t>(from_));
   } else {
     // Set up the frame pointer and the context pointer.
-    // All OSR stack frames are dynamically aligned to an 8-byte boundary.
-    int frame_pointer = input_->GetRegister(ebp.code());
-    if ((frame_pointer & 0x4) == 0) {
- // Return address at FP + 4 should be aligned, so FP mod 8 should be 4.
-      frame_pointer -= kPointerSize;
-      has_alignment_padding_ = 1;
-    }
-    output_[0]->SetRegister(ebp.code(), frame_pointer);
+    output_[0]->SetRegister(ebp.code(), input_->GetRegister(ebp.code()));
     output_[0]->SetRegister(esi.code(), input_->GetRegister(esi.code()));

     unsigned pc_offset = data->OsrPcOffset()->value();
@@ -575,11 +568,9 @@
   // top address and the current frame's size.
   uint32_t top_address;
   if (is_bottommost) {
- // If the optimized frame had alignment padding, adjust the frame pointer
-    // to point to the new position of the old frame pointer after padding
- // is removed. Subtract 2 * kPointerSize for the context and function slots.
-    top_address = input_->GetRegister(ebp.code()) - (2 * kPointerSize) -
-        height_in_bytes + has_alignment_padding_ * kPointerSize;
+    // 2 = context and function in the frame.
+    top_address =
+ input_->GetRegister(ebp.code()) - (2 * kPointerSize) - height_in_bytes;
   } else {
     top_address = output_[frame_index - 1]->GetTop() - output_frame_size;
   }
@@ -630,9 +621,7 @@
   }
   output_frame->SetFrameSlot(output_offset, value);
   intptr_t fp_value = top_address + output_offset;
-  ASSERT(!is_bottommost ||
- input_->GetRegister(ebp.code()) + has_alignment_padding_ * kPointerSize
-      == fp_value);
+  ASSERT(!is_bottommost || input_->GetRegister(ebp.code()) == fp_value);
   output_frame->SetFp(fp_value);
   if (is_topmost) output_frame->SetRegister(ebp.code(), fp_value);
   if (FLAG_trace_deopt) {
@@ -821,17 +810,6 @@
   __ cmp(ecx, esp);
   __ j(not_equal, &pop_loop);

-  // If frame was dynamically aligned, pop padding.
-  Label sentinel, sentinel_done;
-  __ pop(ecx);
-  __ cmp(ecx, Operand(eax, Deoptimizer::frame_alignment_marker_offset()));
-  __ j(equal, &sentinel);
-  __ push(ecx);
-  __ jmp(&sentinel_done);
-  __ bind(&sentinel);
-  __ mov(Operand(eax, Deoptimizer::has_alignment_padding_offset()),
-         Immediate(1));
-  __ bind(&sentinel_done);
   // Compute the output frame in the deoptimizer.
   __ push(eax);
   __ PrepareCallCFunction(1, ebx);
@@ -843,17 +821,6 @@
   }
   __ pop(eax);

-  if (type() == OSR) {
-    // If alignment padding is added, push the sentinel.
-    Label no_osr_padding;
-    __ cmp(Operand(eax, Deoptimizer::has_alignment_padding_offset()),
-           Immediate(0));
-    __ j(equal, &no_osr_padding, Label::kNear);
-    __ push(Operand(eax, Deoptimizer::frame_alignment_marker_offset()));
-    __ bind(&no_osr_padding);
-  }
-
-
   // Replace the current frame with the output frames.
   Label outer_push_loop, inner_push_loop;
   // Outer loop state: eax = current FrameDescription**, edx = one past the
=======================================
--- /branches/3.8/src/ia32/lithium-codegen-ia32.cc      Thu Feb 16 07:14:49 2012
+++ /branches/3.8/src/ia32/lithium-codegen-ia32.cc      Thu Mar 22 08:27:47 2012
@@ -79,9 +79,6 @@
   // the frame (that is done in GeneratePrologue).
   FrameScope frame_scope(masm_, StackFrame::MANUAL);

-  dynamic_frame_alignment_ = chunk()->num_double_slots() > 2 ||
-                             info()->osr_ast_id() != AstNode::kNoNumber;
-
   return GeneratePrologue() &&
       GenerateBody() &&
       GenerateDeferredCode() &&
@@ -155,29 +152,6 @@
            Immediate(isolate()->factory()->undefined_value()));
     __ bind(&ok);
   }
-
-  if (dynamic_frame_alignment_) {
-    Label do_not_pad, align_loop;
-    STATIC_ASSERT(kDoubleSize == 2 * kPointerSize);
-    // Align esp to a multiple of 2 * kPointerSize.
-    __ test(esp, Immediate(kPointerSize));
-    __ j(zero, &do_not_pad, Label::kNear);
-    __ push(Immediate(0));
-    __ mov(ebx, esp);
-    // Copy arguments, receiver, and return address.
-    __ mov(ecx, Immediate(scope()->num_parameters() + 2));
-
-    __ bind(&align_loop);
-    __ mov(eax, Operand(ebx, 1 * kPointerSize));
-    __ mov(Operand(ebx, 0), eax);
-    __ add(Operand(ebx), Immediate(kPointerSize));
-    __ dec(ecx);
-    __ j(not_zero, &align_loop, Label::kNear);
-    __ mov(Operand(ebx, 0),
-           Immediate(isolate()->factory()->frame_alignment_marker()));
-
-    __ bind(&do_not_pad);
-  }

   __ push(ebp);  // Caller's frame pointer.
   __ mov(ebp, esp);
@@ -2080,17 +2054,6 @@
   }
   __ mov(esp, ebp);
   __ pop(ebp);
-  if (dynamic_frame_alignment_) {
-    Label aligned;
-    // Frame alignment marker (padding) is below arguments,
-    // and receiver, so its return-address-relative offset is
-    // (num_arguments + 2) words.
-    __ cmp(Operand(esp, (GetParameterCount() + 2) * kPointerSize),
-           Immediate(factory()->frame_alignment_marker()));
-    __ j(not_equal, &aligned);
-    __ Ret((GetParameterCount() + 2) * kPointerSize, ecx);
-    __ bind(&aligned);
-  }
   __ Ret((GetParameterCount() + 1) * kPointerSize, ecx);
 }

=======================================
--- /branches/3.8/src/ia32/lithium-codegen-ia32.h       Mon Jan 16 03:42:08 2012
+++ /branches/3.8/src/ia32/lithium-codegen-ia32.h       Thu Mar 22 08:27:47 2012
@@ -58,7 +58,6 @@
         inlined_function_count_(0),
         scope_(info->scope()),
         status_(UNUSED),
-        dynamic_frame_alignment_(false),
         deferred_(8),
         osr_pc_offset_(-1),
         last_lazy_deopt_pc_(0),
@@ -143,10 +142,6 @@
   StrictModeFlag strict_mode_flag() const {
     return info()->is_classic_mode() ? kNonStrictMode : kStrictMode;
   }
-  bool dynamic_frame_alignment() const { return dynamic_frame_alignment_; }
-  void set_dynamic_frame_alignment(bool value) {
-    dynamic_frame_alignment_ = value;
-  }

   LChunk* chunk() const { return chunk_; }
   Scope* scope() const { return scope_; }
@@ -331,7 +326,6 @@
   int inlined_function_count_;
   Scope* const scope_;
   Status status_;
-  bool dynamic_frame_alignment_;
   TranslationBuffer translations_;
   ZoneList<LDeferredCode*> deferred_;
   int osr_pc_offset_;
=======================================
--- /branches/3.8/src/ia32/lithium-ia32.cc      Wed Jan 25 23:37:54 2012
+++ /branches/3.8/src/ia32/lithium-ia32.cc      Thu Mar 22 08:27:47 2012
@@ -368,11 +368,7 @@

 int LChunk::GetNextSpillIndex(bool is_double) {
   // Skip a slot if for a double-width slot.
-  if (is_double) {
-    spill_slot_count_ |= 1;  // Make it odd, so incrementing makes it even.
-    spill_slot_count_++;
-    num_double_slots_++;
-  }
+  if (is_double) spill_slot_count_++;
   return spill_slot_count_++;
 }

=======================================
--- /branches/3.8/src/ia32/lithium-ia32.h       Mon Jan 16 03:42:08 2012
+++ /branches/3.8/src/ia32/lithium-ia32.h       Thu Mar 22 08:27:47 2012
@@ -2165,7 +2165,6 @@
       graph_(graph),
       instructions_(32),
       pointer_maps_(8),
-      num_double_slots_(0),
       inlined_closures_(1) { }

   void AddInstruction(LInstruction* instruction, HBasicBlock* block);
@@ -2179,8 +2178,6 @@
   int ParameterAt(int index);
   int GetParameterStackSlot(int index) const;
   int spill_slot_count() const { return spill_slot_count_; }
-  int num_double_slots() const { return num_double_slots_; }
-
   CompilationInfo* info() const { return info_; }
   HGraph* graph() const { return graph_; }
const ZoneList<LInstruction*>* instructions() const { return &instructions_; }
@@ -2222,7 +2219,6 @@
   HGraph* const graph_;
   ZoneList<LInstruction*> instructions_;
   ZoneList<LPointerMap*> pointer_maps_;
-  int num_double_slots_;
   ZoneList<Handle<JSFunction> > inlined_closures_;
 };

=======================================
--- /branches/3.8/src/objects-debug.cc  Thu Jan 19 07:36:35 2012
+++ /branches/3.8/src/objects-debug.cc  Thu Mar 22 08:27:47 2012
@@ -468,8 +468,9 @@
   } else {
     ASSERT(number->IsSmi());
     int value = Smi::cast(number)->value();
-    ASSERT(value <= 1);
     // Hidden oddballs have negative smis.
+    const int kLeastHiddenOddballNumber = -4;
+    ASSERT(value <= 1);
     ASSERT(value >= kLeastHiddenOddballNumber);
   }
 }
=======================================
--- /branches/3.8/src/objects.h Mon Feb 20 08:38:35 2012
+++ /branches/3.8/src/objects.h Thu Mar 22 08:27:47 2012
@@ -7223,9 +7223,6 @@
   static const byte kUndefined = 5;
   static const byte kOther = 6;

-  // The ToNumber value of a hidden oddball is a negative smi.
-  static const int kLeastHiddenOddballNumber = -5;
-
   typedef FixedBodyDescriptor<kToStringOffset,
                               kToNumberOffset + kPointerSize,
                               kSize> BodyDescriptor;
=======================================
--- /branches/3.8/src/version.cc        Wed Mar 14 07:24:32 2012
+++ /branches/3.8/src/version.cc        Thu Mar 22 08:27:47 2012
@@ -35,7 +35,7 @@
 #define MAJOR_VERSION     3
 #define MINOR_VERSION     8
 #define BUILD_NUMBER      9
-#define PATCH_LEVEL       15
+#define PATCH_LEVEL       16
 // Use 1 for candidates and 0 otherwise.
 // (Boolean macro values are not supported by all preprocessors.)
 #define IS_CANDIDATE_VERSION 0

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to