Revision: 10482
Author:   [email protected]
Date:     Tue Jan 24 00:22:55 2012
Log:      Merge r10457 into the 3.7 branch.

This fixes a problem on MIPS when directly patching caller's code without issuing write barrier which violated incremental marking invariants.
Review URL: https://chromiumcodereview.appspot.com/9117023
http://code.google.com/p/v8/source/detail?r=10482

Modified:
 /branches/3.7/src/mips/code-stubs-mips.cc
 /branches/3.7/src/mips/lithium-codegen-mips.cc
 /branches/3.7/src/mips/macro-assembler-mips.cc
 /branches/3.7/src/mips/macro-assembler-mips.h
 /branches/3.7/src/version.cc

=======================================
--- /branches/3.7/src/mips/code-stubs-mips.cc   Fri Dec  9 05:19:57 2011
+++ /branches/3.7/src/mips/code-stubs-mips.cc   Tue Jan 24 00:22:55 2012
@@ -4147,7 +4147,7 @@
   const Register inline_site = t5;
   const Register scratch = a2;

-  const int32_t kDeltaToLoadBoolResult = 4 * kPointerSize;
+  const int32_t kDeltaToLoadBoolResult = 5 * kPointerSize;

   Label slow, loop, is_instance, is_not_instance, not_js_object;

@@ -4191,11 +4191,12 @@
     // Patch the (relocated) inlined map check.

     // The offset was stored in t0 safepoint slot.
-    // (See LCodeGen::DoDeferredLInstanceOfKnownGlobal)
+    // (See LCodeGen::DoDeferredLInstanceOfKnownGlobal).
     __ LoadFromSafepointRegisterSlot(scratch, t0);
     __ Subu(inline_site, ra, scratch);
-    // Patch the relocated value to map.
-    __ PatchRelocatedValue(inline_site, scratch, map);
+    // Get the map location in scratch and patch it.
+    __ GetRelocatedValue(inline_site, scratch, v1);  // v1 used as scratch.
+ __ sw(map, FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset));
   }

   // Register mapping: a3 is object map and t0 is function prototype.
=======================================
--- /branches/3.7/src/mips/lithium-codegen-mips.cc      Wed Jan 11 08:43:07 2012
+++ /branches/3.7/src/mips/lithium-codegen-mips.cc      Tue Jan 24 00:22:55 2012
@@ -1986,7 +1986,10 @@
// We use Factory::the_hole_value() on purpose instead of loading from the
   // root array to force relocation to be able to later patch with
   // the cached map.
-  __ li(at, Operand(factory()->the_hole_value()), true);
+  Handle<JSGlobalPropertyCell> cell =
+      factory()->NewJSGlobalPropertyCell(factory()->the_hole_value());
+  __ li(at, Operand(Handle<Object>(cell)));
+  __ lw(at, FieldMemOperand(at, JSGlobalPropertyCell::kValueOffset));
   __ Branch(&cache_miss, ne, map, Operand(at));
// We use Factory::the_hole_value() on purpose instead of loading from the
   // root array to force relocation to be able to later patch
=======================================
--- /branches/3.7/src/mips/macro-assembler-mips.cc      Wed Nov 23 04:13:52 2011
+++ /branches/3.7/src/mips/macro-assembler-mips.cc      Tue Jan 24 00:22:55 2012
@@ -4699,6 +4699,34 @@
   // Update the I-cache so the new lui and ori can be executed.
   FlushICache(li_location, 2);
 }
+
+void MacroAssembler::GetRelocatedValue(Register li_location,
+                                       Register value,
+                                       Register scratch) {
+  lw(value, MemOperand(li_location));
+  if (emit_debug_code()) {
+    And(value, value, kOpcodeMask);
+    Check(eq, "The instruction should be a lui.",
+        value, Operand(LUI));
+    lw(value, MemOperand(li_location));
+  }
+
+  // value now holds a lui instruction. Extract the immediate.
+  sll(value, value, kImm16Bits);
+
+  lw(scratch, MemOperand(li_location, kInstrSize));
+  if (emit_debug_code()) {
+    And(scratch, scratch, kOpcodeMask);
+    Check(eq, "The instruction should be an ori.",
+        scratch, Operand(ORI));
+    lw(scratch, MemOperand(li_location, kInstrSize));
+  }
+  // "scratch" now holds an ori instruction. Extract the immediate.
+  andi(scratch, scratch, kImm16Mask);
+
+  // Merge the results.
+  or_(value, value, scratch);
+}


 void MacroAssembler::CheckPageFlag(
=======================================
--- /branches/3.7/src/mips/macro-assembler-mips.h       Tue Nov 29 06:28:56 2011
+++ /branches/3.7/src/mips/macro-assembler-mips.h       Tue Jan 24 00:22:55 2012
@@ -1322,6 +1322,10 @@
   void PatchRelocatedValue(Register li_location,
                            Register scratch,
                            Register new_value);
+  // Get the relocatad value (loaded data) from the lui/ori pair.
+  void GetRelocatedValue(Register li_location,
+                         Register value,
+                         Register scratch);

  private:
   void CallCFunctionHelper(Register function,
=======================================
--- /branches/3.7/src/version.cc        Fri Jan 20 11:16:00 2012
+++ /branches/3.7/src/version.cc        Tue Jan 24 00:22:55 2012
@@ -35,7 +35,7 @@
 #define MAJOR_VERSION     3
 #define MINOR_VERSION     7
 #define BUILD_NUMBER      12
-#define PATCH_LEVEL       18
+#define PATCH_LEVEL       19
 // 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