Reviewers: danno,

Message:
PTAL

Description:
Allow NORMAL ICs to go polymorphic.

Please review this at https://chromiumcodereview.appspot.com/19005002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/ic.cc


Index: src/ic.cc
diff --git a/src/ic.cc b/src/ic.cc
index dc15194ec94432419b73f1d8c74bcad458e5c305..983081098d957ba53bdfb9e360d3a0c198c9df66 100644
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -978,12 +978,6 @@ bool IC::UpdatePolymorphicIC(State state,
                              Handle<String> name,
                              Handle<Code> code,
                              StrictModeFlag strict_mode) {
-  if (code->type() == Code::NORMAL) return false;
-  if (target()->ic_state() == MONOMORPHIC &&
-      target()->type() == Code::NORMAL) {
-    return false;
-  }
-
   MapHandleList receiver_maps;
   CodeHandleList handlers;

@@ -992,7 +986,12 @@ bool IC::UpdatePolymorphicIC(State state,
   Handle<Map> new_receiver_map(receiver->map());
   {
     DisallowHeapAllocation no_gc;
-    target()->FindAllMaps(&receiver_maps);
+    if (target()->ic_state() == POLYMORPHIC ||
+        (target()->ic_state() == MONOMORPHIC &&
+         target()->type() != Code::NORMAL)) {
+      target()->FindAllMaps(&receiver_maps);
+    }
+
     int number_of_maps = receiver_maps.length();
     number_of_valid_maps = number_of_maps;

@@ -1012,12 +1011,9 @@ bool IC::UpdatePolymorphicIC(State state,

     if (number_of_valid_maps >= 4) return false;

- // Only allow 0 maps in case target() was reset to UNINITIALIZED by the GC.
-    // In that case, allow the IC to go back monomorphic.
-    if (number_of_maps == 0 && target()->ic_state() != UNINITIALIZED) {
-      return false;
+    if (number_of_maps > 0) {
+      target()->FindAllCode(&handlers, receiver_maps.length());
     }
-    target()->FindAllCode(&handlers, receiver_maps.length());
   }

   number_of_valid_maps++;
@@ -1161,6 +1157,8 @@ void IC::PatchCache(State state,
             break;
           }

+          OS::DebugBreak();
+
           if (target()->type() != Code::NORMAL) {
             CopyICToMegamorphicCache(name);
           }


--
--
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