Revision: 17036
Author:   [email protected]
Date:     Tue Oct  1 09:44:35 2013 UTC
Log:      Cleanup in IC patching.

BUG=
[email protected]

Review URL: https://chromiumcodereview.appspot.com/25001005
http://code.google.com/p/v8/source/detail?r=17036

Modified:
 /branches/bleeding_edge/src/ic.cc
 /branches/bleeding_edge/src/objects-inl.h
 /branches/bleeding_edge/src/objects.h

=======================================
--- /branches/bleeding_edge/src/ic.cc   Tue Oct  1 09:36:34 2013 UTC
+++ /branches/bleeding_edge/src/ic.cc   Tue Oct  1 09:44:35 2013 UTC
@@ -182,9 +182,7 @@
 static bool TryRemoveInvalidPrototypeDependentStub(Code* target,
                                                    Object* receiver,
                                                    Object* name) {
-  if (target->is_keyed_load_stub() ||
-      target->is_keyed_call_stub() ||
-      target->is_keyed_store_stub()) {
+  if (target->is_keyed_stub()) {
     // Determine whether the failure is due to a name failure.
     if (!name->IsName()) return false;
     Name* stub_name = target->FindFirstName();
@@ -1102,46 +1100,44 @@
       UpdateMonomorphicIC(receiver, code, name);
       break;
     case MONOMORPHIC:
-      // Only move to megamorphic if the target changes.
-      if (target() != *code) {
-        if (target()->is_load_stub() || target()->is_store_stub()) {
-          bool is_same_handler = false;
-          {
-            DisallowHeapAllocation no_allocation;
-            Code* old_handler = target()->FindFirstHandler();
-            is_same_handler = old_handler == *code;
-          }
-          if (is_same_handler
-              && IsTransitionedMapOfMonomorphicTarget(receiver->map())) {
-            UpdateMonomorphicIC(receiver, code, name);
-            break;
-          }
-          if (UpdatePolymorphicIC(state, receiver, name, code)) {
-            break;
-          }
-
-          CopyICToMegamorphicCache(name);
+      ASSERT(target() != *code);
+      if (!target()->is_keyed_stub()) {
+        bool is_same_handler = false;
+        {
+          DisallowHeapAllocation no_allocation;
+          Code* old_handler = target()->FindFirstHandler();
+          is_same_handler = old_handler == *code;
+        }
+        if (is_same_handler
+            && IsTransitionedMapOfMonomorphicTarget(receiver->map())) {
+          UpdateMonomorphicIC(receiver, code, name);
+          break;
+        }
+        if (UpdatePolymorphicIC(state, receiver, name, code)) {
+          break;
         }

-        UpdateMegamorphicCache(receiver->map(), *name, *code);
-        set_target(*megamorphic_stub());
+        CopyICToMegamorphicCache(name);
       }
+
+      UpdateMegamorphicCache(receiver->map(), *name, *code);
+      set_target(*megamorphic_stub());
       break;
     case MEGAMORPHIC:
       UpdateMegamorphicCache(receiver->map(), *name, *code);
       break;
     case POLYMORPHIC:
-      if (target()->is_load_stub() || target()->is_store_stub()) {
+      if (target()->is_keyed_stub()) {
+ // When trying to patch a polymorphic keyed stub with anything other
+        // than another polymorphic stub, go generic.
+        set_target(*generic_stub());
+      } else {
         if (UpdatePolymorphicIC(state, receiver, name, code)) {
           break;
         }
         CopyICToMegamorphicCache(name);
         UpdateMegamorphicCache(receiver->map(), *name, *code);
         set_target(*megamorphic_stub());
-      } else {
-        // When trying to patch a polymorphic keyed load/store element stub
-        // with anything other than another polymorphic stub, go generic.
-        set_target(*generic_stub());
       }
       break;
     case DEBUG_STUB:
=======================================
--- /branches/bleeding_edge/src/objects-inl.h   Tue Oct  1 09:30:07 2013 UTC
+++ /branches/bleeding_edge/src/objects-inl.h   Tue Oct  1 09:44:35 2013 UTC
@@ -4026,6 +4026,11 @@
     default: return false;
   }
 }
+
+
+bool Code::is_keyed_stub() {
+ return is_keyed_load_stub() || is_keyed_store_stub() || is_keyed_call_stub();
+}


 bool Code::is_debug_stub() {
=======================================
--- /branches/bleeding_edge/src/objects.h       Tue Oct  1 09:30:07 2013 UTC
+++ /branches/bleeding_edge/src/objects.h       Tue Oct  1 09:44:35 2013 UTC
@@ -4895,6 +4895,7 @@
   inline bool is_compare_ic_stub() { return kind() == COMPARE_IC; }
   inline bool is_compare_nil_ic_stub() { return kind() == COMPARE_NIL_IC; }
   inline bool is_to_boolean_ic_stub() { return kind() == TO_BOOLEAN_IC; }
+  inline bool is_keyed_stub();

   // [major_key]: For kind STUB or BINARY_OP_IC, the major key.
   inline int major_key();

--
--
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/groups/opt_out.

Reply via email to