Reviewers: Jakob,

Message:
PTAL

Description:
Don't inline polymorphic cases if not all cases can be handled inline.

BUG=

Please review this at https://codereview.chromium.org/578233002/

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

Affected files (+16, -4 lines):
  M src/hydrogen.cc


Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 3c0705c7346f532b304357f83d90496af5edc4de..e87266bf0e44c5fba86d007381cb4ddc8a2e07eb 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -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,10 +6286,16 @@ void HOptimizedGraphBuilder::HandlePolymorphicNamedFieldAccess(
     }
   }

-  count = 0;
+  if (i < types->length()) {
+    count = -1;
+    types->Clear();
+  } else {
+    count = 0;
+  }
   HControlInstruction* smi_check = NULL;
   handled_string = false;

+
for (int i = 0; i < types->length() && count < kMaxLoadPolymorphism; ++i) {
     PropertyAccessInfo info(this, access_type, ToType(types->at(i)), name);
     if (info.type()->Is(Type::String())) {
@@ -7496,8 +7503,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 +7525,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;


--
--
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/d/optout.

Reply via email to