Reviewers: fschneider,

Description:
When transitioning to megamorphic case place monomorphic stubs into stub cache.

Otherwise if function is optimized immediately after transition type oracle will
be unable to gather enough maps from stub cache and graph builder will emit
HLoadNamedGeneric instead of HLoadNamedPolymorphic.

[email protected]


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

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 c2ee45ec1e5d6843f40254844b1f82d3994582c1..68bc30f3fe248c0c9506e7dca7c77fcf890b97df 100644
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -1017,6 +1017,15 @@ void LoadIC::UpdateCaches(LookupResult* lookup,
       state == MONOMORPHIC_PROTOTYPE_FAILURE) {
     set_target(*code);
   } else if (state == MONOMORPHIC) {
+    // We are transitioning from monomorphic to megamorphic case.
+    // Place the current monomorphic stub and stub compiled for
+    // the receiver into stub cache.
+    Map* map = target()->FindFirstMap();
+    if (map != NULL) {
+      isolate()->stub_cache()->Set(*name, map, target());
+    }
+    isolate()->stub_cache()->Set(*name, receiver->map(), *code);
+
     set_target(*megamorphic_stub());
   } else if (state == MEGAMORPHIC) {
     // Cache code holding map should be consistent with


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

Reply via email to