Chromium Code Reviews| 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; |
| + |
|
Jakob Kummerow
2014/09/18 09:48:45
nit: unnecessary empty line
|
| 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; |