Revision: 22484
Author:   [email protected]
Date:     Fri Jul 18 17:11:52 2014 UTC
Log:      MIPS: Cache IC handlers on the prototype's map if possible.

Port r22483 (6dd09cb)

Original commit message:
Instead of on the receiver's map. Lazily overwrite cached handler if it is
identical to the handler that just missed.

BUG=
[email protected]

Review URL: https://codereview.chromium.org/404813002
http://code.google.com/p/v8/source/detail?r=22484

Modified:
 /branches/bleeding_edge/src/mips/ic-mips.cc
 /branches/bleeding_edge/src/mips/stub-cache-mips.cc
 /branches/bleeding_edge/src/mips64/ic-mips64.cc
 /branches/bleeding_edge/src/mips64/stub-cache-mips64.cc

=======================================
--- /branches/bleeding_edge/src/mips/ic-mips.cc Tue Jul 15 19:00:02 2014 UTC
+++ /branches/bleeding_edge/src/mips/ic-mips.cc Fri Jul 18 17:11:52 2014 UTC
@@ -283,7 +283,8 @@
   ASSERT(name.is(a2));

   // Probe the stub cache.
-  Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC);
+  Code::Flags flags = Code::RemoveTypeAndHolderFromFlags(
+      Code::ComputeHandlerFlags(Code::LOAD_IC));
   masm->isolate()->stub_cache()->GenerateProbe(
       masm, flags, receiver, name, a3, t0, t1, t2);

@@ -1105,7 +1106,8 @@
   ASSERT(ValueRegister().is(a0));

   // Get the receiver from the stack and probe the stub cache.
-  Code::Flags flags = Code::ComputeHandlerFlags(Code::STORE_IC);
+  Code::Flags flags = Code::RemoveTypeAndHolderFromFlags(
+      Code::ComputeHandlerFlags(Code::STORE_IC));
   masm->isolate()->stub_cache()->GenerateProbe(
       masm, flags, receiver, name, a3, t0, t1, t2);

=======================================
--- /branches/bleeding_edge/src/mips/stub-cache-mips.cc Fri Jul 18 09:57:39 2014 UTC +++ /branches/bleeding_edge/src/mips/stub-cache-mips.cc Fri Jul 18 17:11:52 2014 UTC
@@ -885,12 +885,15 @@

       reg = holder_reg;  // From now on the object will be in holder_reg.

-      if (heap()->InNewSpace(*prototype)) {
-        // The prototype is in new space; we cannot store a reference to it
-        // in the code.  Load it from the map.
+      // Two possible reasons for loading the prototype from the map:
+      // (1) Can't store references to new space in code.
+      // (2) Handler is shared for all receivers with the same prototype
+      //     map (but not necessarily the same prototype instance).
+      bool load_prototype_from_map =
+          heap()->InNewSpace(*prototype) || depth == 1;
+      if (load_prototype_from_map) {
         __ lw(reg, FieldMemOperand(map_reg, Map::kPrototypeOffset));
       } else {
-        // The prototype is in old space; load it directly.
         __ li(reg, Operand(prototype));
       }
     }
=======================================
--- /branches/bleeding_edge/src/mips64/ic-mips64.cc Tue Jul 15 19:00:02 2014 UTC +++ /branches/bleeding_edge/src/mips64/ic-mips64.cc Fri Jul 18 17:11:52 2014 UTC
@@ -283,7 +283,8 @@
   ASSERT(name.is(a2));

   // Probe the stub cache.
-  Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC);
+  Code::Flags flags = Code::RemoveTypeAndHolderFromFlags(
+      Code::ComputeHandlerFlags(Code::LOAD_IC));
   masm->isolate()->stub_cache()->GenerateProbe(
       masm, flags, receiver, name, a3, a4, a5, a6);

@@ -1114,7 +1115,8 @@
   ASSERT(ValueRegister().is(a0));

   // Get the receiver from the stack and probe the stub cache.
-  Code::Flags flags = Code::ComputeHandlerFlags(Code::STORE_IC);
+  Code::Flags flags = Code::RemoveTypeAndHolderFromFlags(
+      Code::ComputeHandlerFlags(Code::STORE_IC));
   masm->isolate()->stub_cache()->GenerateProbe(
       masm, flags, receiver, name, a3, a4, a5, a6);

=======================================
--- /branches/bleeding_edge/src/mips64/stub-cache-mips64.cc Fri Jul 18 09:57:39 2014 UTC +++ /branches/bleeding_edge/src/mips64/stub-cache-mips64.cc Fri Jul 18 17:11:52 2014 UTC
@@ -865,6 +865,12 @@
       reg = holder_reg;  // From now on the object will be in holder_reg.
       __ ld(reg, FieldMemOperand(scratch1, Map::kPrototypeOffset));
     } else {
+      // Two possible reasons for loading the prototype from the map:
+      // (1) Can't store references to new space in code.
+      // (2) Handler is shared for all receivers with the same prototype
+      //     map (but not necessarily the same prototype instance).
+      bool load_prototype_from_map =
+          heap()->InNewSpace(*prototype) || depth == 1;
       Register map_reg = scratch1;
       if (depth != 1 || check == CHECK_ALL_MAPS) {
         // CheckMap implicitly loads the map of |reg| into |map_reg|.
@@ -886,12 +892,9 @@

       reg = holder_reg;  // From now on the object will be in holder_reg.

-      if (heap()->InNewSpace(*prototype)) {
-        // The prototype is in new space; we cannot store a reference to it
-        // in the code.  Load it from the map.
+      if (load_prototype_from_map) {
         __ ld(reg, FieldMemOperand(map_reg, Map::kPrototypeOffset));
       } else {
-        // The prototype is in old space; load it directly.
         __ li(reg, Operand(prototype));
       }
     }

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to