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/crankshaft/hydrogen.h" | 5 #include "src/crankshaft/hydrogen.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
(...skipping 7079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7090 | 7090 |
7091 | 7091 |
7092 HInstruction* HOptimizedGraphBuilder::BuildNamedGeneric( | 7092 HInstruction* HOptimizedGraphBuilder::BuildNamedGeneric( |
7093 PropertyAccessType access_type, Expression* expr, FeedbackVectorSlot slot, | 7093 PropertyAccessType access_type, Expression* expr, FeedbackVectorSlot slot, |
7094 HValue* object, Handle<Name> name, HValue* value, bool is_uninitialized) { | 7094 HValue* object, Handle<Name> name, HValue* value, bool is_uninitialized) { |
7095 if (is_uninitialized) { | 7095 if (is_uninitialized) { |
7096 Add<HDeoptimize>( | 7096 Add<HDeoptimize>( |
7097 DeoptimizeReason::kInsufficientTypeFeedbackForGenericNamedAccess, | 7097 DeoptimizeReason::kInsufficientTypeFeedbackForGenericNamedAccess, |
7098 Deoptimizer::SOFT); | 7098 Deoptimizer::SOFT); |
7099 } | 7099 } |
| 7100 Handle<TypeFeedbackVector> vector(current_feedback_vector(), isolate()); |
| 7101 |
| 7102 HValue* key = Add<HConstant>(name); |
| 7103 HValue* vector_value = Add<HConstant>(vector); |
| 7104 HValue* slot_value = Add<HConstant>(vector->GetIndex(slot)); |
| 7105 |
7100 if (access_type == LOAD) { | 7106 if (access_type == LOAD) { |
7101 Handle<TypeFeedbackVector> vector = | 7107 HValue* values[] = {context(), object, key, slot_value, vector_value}; |
7102 handle(current_feedback_vector(), isolate()); | |
7103 | |
7104 if (!expr->AsProperty()->key()->IsPropertyName()) { | 7108 if (!expr->AsProperty()->key()->IsPropertyName()) { |
7105 // It's possible that a keyed load of a constant string was converted | 7109 // It's possible that a keyed load of a constant string was converted |
7106 // to a named load. Here, at the last minute, we need to make sure to | 7110 // to a named load. Here, at the last minute, we need to make sure to |
7107 // use a generic Keyed Load if we are using the type vector, because | 7111 // use a generic Keyed Load if we are using the type vector, because |
7108 // it has to share information with full code. | 7112 // it has to share information with full code. |
7109 HConstant* key = Add<HConstant>(name); | |
7110 HLoadKeyedGeneric* result = | 7113 HLoadKeyedGeneric* result = |
7111 New<HLoadKeyedGeneric>(object, key, vector, slot); | 7114 New<HLoadKeyedGeneric>(object, key, vector, slot); |
7112 return result; | 7115 return result; |
7113 } | 7116 } |
7114 | 7117 |
7115 HLoadNamedGeneric* result = | 7118 Callable callable = CodeFactory::LoadICInOptimizedCode(isolate()); |
7116 New<HLoadNamedGeneric>(object, name, vector, slot); | 7119 HValue* stub = Add<HConstant>(callable.code()); |
| 7120 HCallWithDescriptor* result = New<HCallWithDescriptor>( |
| 7121 stub, 0, callable.descriptor(), ArrayVector(values)); |
7117 return result; | 7122 return result; |
| 7123 |
7118 } else { | 7124 } else { |
7119 Handle<TypeFeedbackVector> vector = | |
7120 handle(current_feedback_vector(), isolate()); | |
7121 | |
7122 HValue* key = Add<HConstant>(name); | |
7123 HValue* vector_value = Add<HConstant>(vector); | |
7124 HValue* slot_value = Add<HConstant>(vector->GetIndex(slot)); | |
7125 HValue* values[] = {context(), object, key, | 7125 HValue* values[] = {context(), object, key, |
7126 value, slot_value, vector_value}; | 7126 value, slot_value, vector_value}; |
7127 | 7127 |
7128 if (current_feedback_vector()->GetKind(slot) == | 7128 if (vector->GetKind(slot) == FeedbackVectorSlotKind::KEYED_STORE_IC) { |
7129 FeedbackVectorSlotKind::KEYED_STORE_IC) { | |
7130 // It's possible that a keyed store of a constant string was converted | 7129 // It's possible that a keyed store of a constant string was converted |
7131 // to a named store. Here, at the last minute, we need to make sure to | 7130 // to a named store. Here, at the last minute, we need to make sure to |
7132 // use a generic Keyed Store if we are using the type vector, because | 7131 // use a generic Keyed Store if we are using the type vector, because |
7133 // it has to share information with full code. | 7132 // it has to share information with full code. |
7134 Callable callable = CodeFactory::KeyedStoreICInOptimizedCode( | 7133 Callable callable = CodeFactory::KeyedStoreICInOptimizedCode( |
7135 isolate(), function_language_mode()); | 7134 isolate(), function_language_mode()); |
7136 HValue* stub = Add<HConstant>(callable.code()); | 7135 HValue* stub = Add<HConstant>(callable.code()); |
7137 HCallWithDescriptor* result = New<HCallWithDescriptor>( | 7136 HCallWithDescriptor* result = New<HCallWithDescriptor>( |
7138 stub, 0, callable.descriptor(), ArrayVector(values)); | 7137 stub, 0, callable.descriptor(), ArrayVector(values)); |
7139 return result; | 7138 return result; |
(...skipping 6145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13285 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13284 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13286 } | 13285 } |
13287 | 13286 |
13288 #ifdef DEBUG | 13287 #ifdef DEBUG |
13289 graph_->Verify(false); // No full verify. | 13288 graph_->Verify(false); // No full verify. |
13290 #endif | 13289 #endif |
13291 } | 13290 } |
13292 | 13291 |
13293 } // namespace internal | 13292 } // namespace internal |
13294 } // namespace v8 | 13293 } // namespace v8 |
OLD | NEW |