OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/hydrogen.h" | 5 #include "src/hydrogen.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 6950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6961 | 6961 |
6962 HInstruction* HOptimizedGraphBuilder::BuildNamedGeneric( | 6962 HInstruction* HOptimizedGraphBuilder::BuildNamedGeneric( |
6963 PropertyAccessType access_type, Expression* expr, HValue* object, | 6963 PropertyAccessType access_type, Expression* expr, HValue* object, |
6964 Handle<String> name, HValue* value, bool is_uninitialized) { | 6964 Handle<String> name, HValue* value, bool is_uninitialized) { |
6965 if (is_uninitialized) { | 6965 if (is_uninitialized) { |
6966 Add<HDeoptimize>( | 6966 Add<HDeoptimize>( |
6967 Deoptimizer::kInsufficientTypeFeedbackForGenericNamedAccess, | 6967 Deoptimizer::kInsufficientTypeFeedbackForGenericNamedAccess, |
6968 Deoptimizer::SOFT); | 6968 Deoptimizer::SOFT); |
6969 } | 6969 } |
6970 if (access_type == LOAD) { | 6970 if (access_type == LOAD) { |
6971 HLoadNamedGeneric* result = | |
6972 New<HLoadNamedGeneric>(object, name, PREMONOMORPHIC); | |
6973 if (FLAG_vector_ics) { | 6971 if (FLAG_vector_ics) { |
6974 Handle<TypeFeedbackVector> vector = | 6972 Handle<TypeFeedbackVector> vector = |
6975 handle(current_feedback_vector(), isolate()); | 6973 handle(current_feedback_vector(), isolate()); |
6976 FeedbackVectorICSlot slot = expr->AsProperty()->PropertyFeedbackSlot(); | 6974 FeedbackVectorICSlot slot = expr->AsProperty()->PropertyFeedbackSlot(); |
| 6975 |
| 6976 if (!expr->AsProperty()->key()->IsPropertyName()) { |
| 6977 // It's possible that a keyed load of a constant string was converted |
| 6978 // to a named load. Here, at the last minute, we need to make sure to |
| 6979 // use a generic Keyed Load if we are using the type vector, because |
| 6980 // it has to share information with full code. |
| 6981 HConstant* key = Add<HConstant>(name); |
| 6982 HLoadKeyedGeneric* result = |
| 6983 New<HLoadKeyedGeneric>(object, key, PREMONOMORPHIC); |
| 6984 result->SetVectorAndSlot(vector, slot); |
| 6985 return result; |
| 6986 } |
| 6987 |
| 6988 HLoadNamedGeneric* result = |
| 6989 New<HLoadNamedGeneric>(object, name, PREMONOMORPHIC); |
6977 result->SetVectorAndSlot(vector, slot); | 6990 result->SetVectorAndSlot(vector, slot); |
| 6991 return result; |
6978 } | 6992 } |
6979 return result; | 6993 return New<HLoadNamedGeneric>(object, name, PREMONOMORPHIC); |
6980 } else { | 6994 } else { |
6981 return New<HStoreNamedGeneric>(object, name, value, | 6995 return New<HStoreNamedGeneric>(object, name, value, |
6982 function_language_mode(), PREMONOMORPHIC); | 6996 function_language_mode(), PREMONOMORPHIC); |
6983 } | 6997 } |
6984 } | 6998 } |
6985 | 6999 |
6986 | 7000 |
6987 | 7001 |
6988 HInstruction* HOptimizedGraphBuilder::BuildKeyedGeneric( | 7002 HInstruction* HOptimizedGraphBuilder::BuildKeyedGeneric( |
6989 PropertyAccessType access_type, | 7003 PropertyAccessType access_type, |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7272 Deoptimizer::kUnknownMapInPolymorphicElementAccess); | 7286 Deoptimizer::kUnknownMapInPolymorphicElementAccess); |
7273 set_current_block(join); | 7287 set_current_block(join); |
7274 return access_type == STORE ? val : Pop(); | 7288 return access_type == STORE ? val : Pop(); |
7275 } | 7289 } |
7276 | 7290 |
7277 | 7291 |
7278 HValue* HOptimizedGraphBuilder::HandleKeyedElementAccess( | 7292 HValue* HOptimizedGraphBuilder::HandleKeyedElementAccess( |
7279 HValue* obj, HValue* key, HValue* val, Expression* expr, BailoutId ast_id, | 7293 HValue* obj, HValue* key, HValue* val, Expression* expr, BailoutId ast_id, |
7280 BailoutId return_id, PropertyAccessType access_type, | 7294 BailoutId return_id, PropertyAccessType access_type, |
7281 bool* has_side_effects) { | 7295 bool* has_side_effects) { |
7282 // TODO(mvstanton): This optimization causes trouble for vector-based | 7296 if (key->ActualValue()->IsConstant()) { |
7283 // KeyedLoadICs, turn it off for now. | |
7284 if (!FLAG_vector_ics && key->ActualValue()->IsConstant()) { | |
7285 Handle<Object> constant = | 7297 Handle<Object> constant = |
7286 HConstant::cast(key->ActualValue())->handle(isolate()); | 7298 HConstant::cast(key->ActualValue())->handle(isolate()); |
7287 uint32_t array_index; | 7299 uint32_t array_index; |
7288 if (constant->IsString() && | 7300 if (constant->IsString() && |
7289 !Handle<String>::cast(constant)->AsArrayIndex(&array_index)) { | 7301 !Handle<String>::cast(constant)->AsArrayIndex(&array_index)) { |
7290 if (!constant->IsUniqueName()) { | 7302 if (!constant->IsUniqueName()) { |
7291 constant = isolate()->factory()->InternalizeString( | 7303 constant = isolate()->factory()->InternalizeString( |
7292 Handle<String>::cast(constant)); | 7304 Handle<String>::cast(constant)); |
7293 } | 7305 } |
7294 HInstruction* instr = | 7306 HInstruction* instr = |
(...skipping 5740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13035 if (ShouldProduceTraceOutput()) { | 13047 if (ShouldProduceTraceOutput()) { |
13036 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13048 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13037 } | 13049 } |
13038 | 13050 |
13039 #ifdef DEBUG | 13051 #ifdef DEBUG |
13040 graph_->Verify(false); // No full verify. | 13052 graph_->Verify(false); // No full verify. |
13041 #endif | 13053 #endif |
13042 } | 13054 } |
13043 | 13055 |
13044 } } // namespace v8::internal | 13056 } } // namespace v8::internal |
OLD | NEW |