Revision: 13332
Author:   [email protected]
Date:     Tue Jan  8 04:01:51 2013
Log:      Use POLYMORPHIC for polymorphic Keyed(Load|Store)IC

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

Modified:
 /branches/bleeding_edge/src/arm/stub-cache-arm.cc
 /branches/bleeding_edge/src/ast.cc
 /branches/bleeding_edge/src/ia32/stub-cache-ia32.cc
 /branches/bleeding_edge/src/ic.cc
 /branches/bleeding_edge/src/log.h
 /branches/bleeding_edge/src/mips/stub-cache-mips.cc
 /branches/bleeding_edge/src/objects-visiting-inl.h
 /branches/bleeding_edge/src/type-info.cc
 /branches/bleeding_edge/src/type-info.h
 /branches/bleeding_edge/src/x64/stub-cache-x64.cc

=======================================
--- /branches/bleeding_edge/src/arm/stub-cache-arm.cc Mon Jan 7 01:43:12 2013 +++ /branches/bleeding_edge/src/arm/stub-cache-arm.cc Tue Jan 8 04:01:51 2013
@@ -3327,7 +3327,7 @@
   __ Jump(miss_ic, RelocInfo::CODE_TARGET, al);

   // Return the generated code.
-  return GetCode(Code::NORMAL, factory()->empty_string(), MEGAMORPHIC);
+  return GetCode(Code::NORMAL, factory()->empty_string(), POLYMORPHIC);
 }


@@ -3431,7 +3431,7 @@
   __ Jump(miss_ic, RelocInfo::CODE_TARGET, al);

   // Return the generated code.
-  return GetCode(Code::NORMAL, factory()->empty_string(), MEGAMORPHIC);
+  return GetCode(Code::NORMAL, factory()->empty_string(), POLYMORPHIC);
 }


=======================================
--- /branches/bleeding_edge/src/ast.cc  Tue Dec 18 08:25:45 2012
+++ /branches/bleeding_edge/src/ast.cc  Tue Jan  8 04:01:51 2013
@@ -430,7 +430,7 @@
   } else if (is_monomorphic_) {
     receiver_types_.Add(oracle->LoadMonomorphicReceiverType(this),
                         zone);
-  } else if (oracle->LoadIsMegamorphicWithTypeInfo(this)) {
+  } else if (oracle->LoadIsPolymorphic(this)) {
     receiver_types_.Reserve(kMaxKeyedPolymorphism, zone);
oracle->CollectKeyedReceiverTypes(PropertyFeedbackId(), &receiver_types_);
   }
@@ -452,7 +452,7 @@
   } else if (is_monomorphic_) {
     // Record receiver type for monomorphic keyed stores.
     receiver_types_.Add(oracle->StoreMonomorphicReceiverType(id), zone);
-  } else if (oracle->StoreIsMegamorphicWithTypeInfo(id)) {
+  } else if (oracle->StoreIsPolymorphic(id)) {
     receiver_types_.Reserve(kMaxKeyedPolymorphism, zone);
     oracle->CollectKeyedReceiverTypes(id, &receiver_types_);
   }
@@ -468,7 +468,7 @@
     // Record receiver type for monomorphic keyed stores.
     receiver_types_.Add(
         oracle->StoreMonomorphicReceiverType(id), zone);
-  } else if (oracle->StoreIsMegamorphicWithTypeInfo(id)) {
+  } else if (oracle->StoreIsPolymorphic(id)) {
     receiver_types_.Reserve(kMaxKeyedPolymorphism, zone);
     oracle->CollectKeyedReceiverTypes(id, &receiver_types_);
   }
=======================================
--- /branches/bleeding_edge/src/ia32/stub-cache-ia32.cc Tue Dec 18 08:25:45 2012 +++ /branches/bleeding_edge/src/ia32/stub-cache-ia32.cc Tue Jan 8 04:01:51 2013
@@ -2947,7 +2947,7 @@
   __ jmp(miss_ic, RelocInfo::CODE_TARGET);

   // Return the generated code.
-  return GetCode(Code::NORMAL, factory()->empty_string(), MEGAMORPHIC);
+  return GetCode(Code::NORMAL, factory()->empty_string(), POLYMORPHIC);
 }


@@ -3440,7 +3440,7 @@
   GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);

   // Return the generated code.
-  return GetCode(Code::NORMAL, factory()->empty_string(), MEGAMORPHIC);
+  return GetCode(Code::NORMAL, factory()->empty_string(), POLYMORPHIC);
 }


=======================================
--- /branches/bleeding_edge/src/ic.cc   Mon Jan  7 07:36:26 2013
+++ /branches/bleeding_edge/src/ic.cc   Tue Jan  8 04:01:51 2013
@@ -1109,7 +1109,7 @@
       receiver_maps, &handler_ics);
   isolate()->counters()->keyed_load_polymorphic_stubs()->Increment();
   PROFILE(isolate(),
- CodeCreateEvent(Logger::KEYED_LOAD_MEGAMORPHIC_IC_TAG, *code, 0)); + CodeCreateEvent(Logger::KEYED_LOAD_POLYMORPHIC_IC_TAG, *code, 0));
   return code;
 }

@@ -1329,6 +1329,7 @@
   switch (state) {
     case UNINITIALIZED:
     case PREMONOMORPHIC:
+    case POLYMORPHIC:
       set_target(*code);
       break;
     case MONOMORPHIC:
@@ -1342,7 +1343,6 @@
     case DEBUG_PREPARE_STEP_IN:
       break;
     case MONOMORPHIC_PROTOTYPE_FAILURE:
-    case POLYMORPHIC:
       UNREACHABLE();
       break;
   }
@@ -1651,7 +1651,7 @@
       case MONOMORPHIC:
         result->Add(Handle<Map>(stub->FindFirstMap()));
         break;
-      case MEGAMORPHIC: {
+      case POLYMORPHIC: {
         AssertNoAllocation no_allocation;
         int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT);
         for (RelocIterator it(*stub, mask); !it.done(); it.next()) {
@@ -1662,10 +1662,11 @@
         }
         break;
       }
+      case MEGAMORPHIC:
+        break;
       case UNINITIALIZED:
       case PREMONOMORPHIC:
       case MONOMORPHIC_PROTOTYPE_FAILURE:
-      case POLYMORPHIC:
       case DEBUG_BREAK:
       case DEBUG_PREPARE_STEP_IN:
         UNREACHABLE();
@@ -1877,7 +1878,7 @@
       receiver_maps, &handler_ics, &transitioned_maps);
   isolate()->counters()->keyed_store_polymorphic_stubs()->Increment();
   PROFILE(isolate(),
- CodeCreateEvent(Logger::KEYED_STORE_MEGAMORPHIC_IC_TAG, *code, 0)); + CodeCreateEvent(Logger::KEYED_STORE_POLYMORPHIC_IC_TAG, *code, 0));
   return code;
 }

@@ -2101,6 +2102,7 @@
   switch (state) {
     case UNINITIALIZED:
     case PREMONOMORPHIC:
+    case POLYMORPHIC:
       set_target(*code);
       break;
     case MONOMORPHIC:
@@ -2116,7 +2118,6 @@
     case DEBUG_PREPARE_STEP_IN:
       break;
     case MONOMORPHIC_PROTOTYPE_FAILURE:
-    case POLYMORPHIC:
       UNREACHABLE();
       break;
   }
=======================================
--- /branches/bleeding_edge/src/log.h   Fri Dec  7 05:47:42 2012
+++ /branches/bleeding_edge/src/log.h   Tue Jan  8 04:01:51 2013
@@ -127,10 +127,10 @@
   V(EVAL_TAG,                       "Eval")                             \
   V(FUNCTION_TAG,                   "Function")                         \
   V(KEYED_LOAD_IC_TAG,              "KeyedLoadIC")                      \
-  V(KEYED_LOAD_MEGAMORPHIC_IC_TAG,  "KeyedLoadMegamorphicIC")           \
+  V(KEYED_LOAD_POLYMORPHIC_IC_TAG,  "KeyedLoadPolymorphicIC")           \
   V(KEYED_EXTERNAL_ARRAY_LOAD_IC_TAG, "KeyedExternalArrayLoadIC")       \
   V(KEYED_STORE_IC_TAG,             "KeyedStoreIC")                     \
-  V(KEYED_STORE_MEGAMORPHIC_IC_TAG, "KeyedStoreMegamorphicIC")          \
+  V(KEYED_STORE_POLYMORPHIC_IC_TAG, "KeyedStorePolymorphicIC")          \
   V(KEYED_EXTERNAL_ARRAY_STORE_IC_TAG, "KeyedExternalArrayStoreIC")     \
   V(LAZY_COMPILE_TAG,               "LazyCompile")                      \
   V(LOAD_IC_TAG,                    "LoadIC")                           \
=======================================
--- /branches/bleeding_edge/src/mips/stub-cache-mips.cc Mon Jan 7 02:18:25 2013 +++ /branches/bleeding_edge/src/mips/stub-cache-mips.cc Tue Jan 8 04:01:51 2013
@@ -3319,7 +3319,7 @@
   __ Jump(miss_ic, RelocInfo::CODE_TARGET);

   // Return the generated code.
-  return GetCode(Code::NORMAL, factory()->empty_string(), MEGAMORPHIC);
+  return GetCode(Code::NORMAL, factory()->empty_string(), POLYMORPHIC);
 }


@@ -3422,7 +3422,7 @@
   __ Jump(miss_ic, RelocInfo::CODE_TARGET);

   // Return the generated code.
-  return GetCode(Code::NORMAL, factory()->empty_string(), MEGAMORPHIC);
+  return GetCode(Code::NORMAL, factory()->empty_string(), POLYMORPHIC);
 }


=======================================
--- /branches/bleeding_edge/src/objects-visiting-inl.h Tue Dec 11 09:28:40 2012 +++ /branches/bleeding_edge/src/objects-visiting-inl.h Tue Jan 8 04:01:51 2013
@@ -211,7 +211,8 @@
   // when they might be keeping a Context alive, or when the heap is about
   // to be serialized.
   if (FLAG_cleanup_code_caches_at_gc && target->is_inline_cache_stub()
- && (target->ic_state() == MEGAMORPHIC || heap->flush_monomorphic_ics() ||
+      && (target->ic_state() == MEGAMORPHIC ||
+ target->ic_state() == POLYMORPHIC || heap->flush_monomorphic_ics() || Serializer::enabled() || target->ic_age() != heap->global_ic_age())) {
     IC::Clear(rinfo->pc());
     target = Code::GetCodeFromTargetAddress(rinfo->target_address());
=======================================
--- /branches/bleeding_edge/src/type-info.cc    Fri Nov 16 00:38:11 2012
+++ /branches/bleeding_edge/src/type-info.cc    Tue Jan  8 04:01:51 2013
@@ -111,14 +111,11 @@
 }


-bool TypeFeedbackOracle::LoadIsMegamorphicWithTypeInfo(Property* expr) {
+bool TypeFeedbackOracle::LoadIsPolymorphic(Property* expr) {
   Handle<Object> map_or_code = GetInfo(expr->PropertyFeedbackId());
   if (map_or_code->IsCode()) {
     Handle<Code> code = Handle<Code>::cast(map_or_code);
-    Builtins* builtins = isolate_->builtins();
-    return code->is_keyed_load_stub() &&
-        *code != builtins->builtin(Builtins::kKeyedLoadIC_Generic) &&
-        code->ic_state() == MEGAMORPHIC;
+    return code->is_keyed_load_stub() && code->ic_state() == POLYMORPHIC;
   }
   return false;
 }
@@ -145,19 +142,15 @@
 }


-bool TypeFeedbackOracle::StoreIsMegamorphicWithTypeInfo(TypeFeedbackId ast_id) {
+bool TypeFeedbackOracle::StoreIsPolymorphic(TypeFeedbackId ast_id) {
   Handle<Object> map_or_code = GetInfo(ast_id);
   if (map_or_code->IsCode()) {
     Handle<Code> code = Handle<Code>::cast(map_or_code);
-    Builtins* builtins = isolate_->builtins();
     bool allow_growth =
         Code::GetKeyedAccessGrowMode(code->extra_ic_state()) ==
         ALLOW_JSARRAY_GROWTH;
-    return code->is_keyed_store_stub() &&
-        !allow_growth &&
-        *code != builtins->builtin(Builtins::kKeyedStoreIC_Generic) &&
- *code != builtins->builtin(Builtins::kKeyedStoreIC_Generic_Strict) &&
-        code->ic_state() == MEGAMORPHIC;
+    return code->is_keyed_store_stub() && !allow_growth &&
+        code->ic_state() == POLYMORPHIC;
   }
   return false;
 }
@@ -667,7 +660,7 @@
       case Code::KEYED_LOAD_IC:
       case Code::KEYED_STORE_IC:
         if (target->ic_state() == MONOMORPHIC ||
-            target->ic_state() == MEGAMORPHIC) {
+            target->ic_state() == POLYMORPHIC) {
           SetInfo(ast_id, target);
         }
         break;
=======================================
--- /branches/bleeding_edge/src/type-info.h     Wed Nov 14 07:59:45 2012
+++ /branches/bleeding_edge/src/type-info.h     Tue Jan  8 04:01:51 2013
@@ -242,9 +242,9 @@

   bool LoadIsMonomorphicNormal(Property* expr);
   bool LoadIsUninitialized(Property* expr);
-  bool LoadIsMegamorphicWithTypeInfo(Property* expr);
+  bool LoadIsPolymorphic(Property* expr);
   bool StoreIsMonomorphicNormal(TypeFeedbackId ast_id);
-  bool StoreIsMegamorphicWithTypeInfo(TypeFeedbackId ast_id);
+  bool StoreIsPolymorphic(TypeFeedbackId ast_id);
   bool CallIsMonomorphic(Call* expr);
   bool CallNewIsMonomorphic(CallNew* expr);
   bool ObjectLiteralStoreIsMonomorphic(ObjectLiteral::Property* prop);
=======================================
--- /branches/bleeding_edge/src/x64/stub-cache-x64.cc Thu Jan 3 06:20:08 2013 +++ /branches/bleeding_edge/src/x64/stub-cache-x64.cc Tue Jan 8 04:01:51 2013
@@ -2772,7 +2772,7 @@
   __ jmp(ic, RelocInfo::CODE_TARGET);

   // Return the generated code.
-  return GetCode(Code::NORMAL, factory()->empty_string(), MEGAMORPHIC);
+  return GetCode(Code::NORMAL, factory()->empty_string(), POLYMORPHIC);
 }


@@ -3253,7 +3253,7 @@
   GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);

   // Return the generated code.
-  return GetCode(Code::NORMAL, factory()->empty_string(), MEGAMORPHIC);
+  return GetCode(Code::NORMAL, factory()->empty_string(), POLYMORPHIC);
 }


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

Reply via email to