Don't inline polymorphic cases if not all cases can be handled inline.
authorverwaest@chromium.org <verwaest@chromium.org>
Thu, 18 Sep 2014 10:57:18 +0000 (10:57 +0000)
committerverwaest@chromium.org <verwaest@chromium.org>
Thu, 18 Sep 2014 10:57:18 +0000 (10:57 +0000)
BUG=
R=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/578233002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24029 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/hydrogen.cc

index 675b611..37ecb1b 100644 (file)
@@ -6270,7 +6270,8 @@ void HOptimizedGraphBuilder::HandlePolymorphicNamedFieldAccess(
 
   bool handle_smi = false;
   STATIC_ASSERT(kMaxLoadPolymorphism == kMaxStorePolymorphism);
-  for (int i = 0; i < types->length() && count < kMaxLoadPolymorphism; ++i) {
+  int i;
+  for (i = 0; i < types->length() && count < kMaxLoadPolymorphism; ++i) {
     PropertyAccessInfo info(this, access_type, ToType(types->at(i)), name);
     if (info.type()->Is(Type::String())) {
       if (handled_string) continue;
@@ -6285,7 +6286,12 @@ void HOptimizedGraphBuilder::HandlePolymorphicNamedFieldAccess(
     }
   }
 
-  count = 0;
+  if (i < types->length()) {
+    count = -1;
+    types->Clear();
+  } else {
+    count = 0;
+  }
   HControlInstruction* smi_check = NULL;
   handled_string = false;
 
@@ -7496,8 +7502,8 @@ void HOptimizedGraphBuilder::HandlePolymorphicCallNamed(
   bool handled_string = false;
   int ordered_functions = 0;
 
-  for (int i = 0;
-       i < types->length() && ordered_functions < kMaxCallPolymorphism;
+  int i;
+  for (i = 0; i < types->length() && ordered_functions < kMaxCallPolymorphism;
        ++i) {
     PropertyAccessInfo info(this, LOAD, ToType(types->at(i)), name);
     if (info.CanAccessMonomorphic() && info.IsConstant() &&
@@ -7518,6 +7524,11 @@ void HOptimizedGraphBuilder::HandlePolymorphicCallNamed(
 
   std::sort(order, order + ordered_functions);
 
+  if (i < types->length()) {
+    types->Clear();
+    ordered_functions = -1;
+  }
+
   HBasicBlock* number_block = NULL;
   HBasicBlock* join = NULL;
   handled_string = false;