From e82fe7b0a45c85df4d604db4ec6cb7f11bfe54db Mon Sep 17 00:00:00 2001 From: "verwaest@chromium.org" Date: Thu, 18 Sep 2014 10:57:18 +0000 Subject: [PATCH] Don't inline polymorphic cases if not all cases can be handled inline. 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 | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/hydrogen.cc b/src/hydrogen.cc index 675b611..37ecb1b 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,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; -- 2.7.4