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 7180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7191 return result; | 7191 return result; |
7192 } | 7192 } |
7193 | 7193 |
7194 HLoadNamedGeneric* result = | 7194 HLoadNamedGeneric* result = |
7195 New<HLoadNamedGeneric>(object, name, vector, slot); | 7195 New<HLoadNamedGeneric>(object, name, vector, slot); |
7196 return result; | 7196 return result; |
7197 } else { | 7197 } else { |
7198 Handle<TypeFeedbackVector> vector = | 7198 Handle<TypeFeedbackVector> vector = |
7199 handle(current_feedback_vector(), isolate()); | 7199 handle(current_feedback_vector(), isolate()); |
7200 | 7200 |
| 7201 HValue* key = Add<HConstant>(name); |
| 7202 HValue* vector_value = Add<HConstant>(vector); |
| 7203 HValue* slot_value = Add<HConstant>(vector->GetIndex(slot)); |
| 7204 HValue* values[] = {context(), object, key, |
| 7205 value, slot_value, vector_value}; |
| 7206 |
7201 if (current_feedback_vector()->GetKind(slot) == | 7207 if (current_feedback_vector()->GetKind(slot) == |
7202 FeedbackVectorSlotKind::KEYED_STORE_IC) { | 7208 FeedbackVectorSlotKind::KEYED_STORE_IC) { |
7203 // It's possible that a keyed store of a constant string was converted | 7209 // It's possible that a keyed store of a constant string was converted |
7204 // to a named store. Here, at the last minute, we need to make sure to | 7210 // to a named store. Here, at the last minute, we need to make sure to |
7205 // use a generic Keyed Store if we are using the type vector, because | 7211 // use a generic Keyed Store if we are using the type vector, because |
7206 // it has to share information with full code. | 7212 // it has to share information with full code. |
7207 HConstant* key = Add<HConstant>(name); | 7213 Callable callable = CodeFactory::KeyedStoreICInOptimizedCode( |
7208 HStoreKeyedGeneric* result = New<HStoreKeyedGeneric>( | 7214 isolate(), function_language_mode()); |
7209 object, key, value, function_language_mode(), vector, slot); | 7215 HValue* stub = Add<HConstant>(callable.code()); |
| 7216 HCallWithDescriptor* result = New<HCallWithDescriptor>( |
| 7217 stub, 0, callable.descriptor(), ArrayVector(values)); |
7210 return result; | 7218 return result; |
7211 } | 7219 } |
7212 | |
7213 HValue* name_value = Add<HConstant>(name); | |
7214 HValue* vector_value = Add<HConstant>(vector); | |
7215 HValue* slot_value = Add<HConstant>(vector->GetIndex(slot)); | |
7216 Callable callable = CodeFactory::StoreICInOptimizedCode( | 7220 Callable callable = CodeFactory::StoreICInOptimizedCode( |
7217 isolate(), function_language_mode()); | 7221 isolate(), function_language_mode()); |
7218 HValue* stub = Add<HConstant>(callable.code()); | 7222 HValue* stub = Add<HConstant>(callable.code()); |
7219 HValue* values[] = {context(), object, name_value, | |
7220 value, slot_value, vector_value}; | |
7221 HCallWithDescriptor* result = New<HCallWithDescriptor>( | 7223 HCallWithDescriptor* result = New<HCallWithDescriptor>( |
7222 stub, 0, callable.descriptor(), ArrayVector(values)); | 7224 stub, 0, callable.descriptor(), ArrayVector(values)); |
7223 return result; | 7225 return result; |
7224 } | 7226 } |
7225 } | 7227 } |
7226 | 7228 |
7227 | 7229 |
7228 HInstruction* HOptimizedGraphBuilder::BuildKeyedGeneric( | 7230 HInstruction* HOptimizedGraphBuilder::BuildKeyedGeneric( |
7229 PropertyAccessType access_type, Expression* expr, FeedbackVectorSlot slot, | 7231 PropertyAccessType access_type, Expression* expr, FeedbackVectorSlot slot, |
7230 HValue* object, HValue* key, HValue* value) { | 7232 HValue* object, HValue* key, HValue* value) { |
7231 Handle<TypeFeedbackVector> vector = | 7233 Handle<TypeFeedbackVector> vector = |
7232 handle(current_feedback_vector(), isolate()); | 7234 handle(current_feedback_vector(), isolate()); |
7233 if (access_type == LOAD) { | 7235 if (access_type == LOAD) { |
7234 HLoadKeyedGeneric* result = | 7236 HLoadKeyedGeneric* result = |
7235 New<HLoadKeyedGeneric>(object, key, vector, slot); | 7237 New<HLoadKeyedGeneric>(object, key, vector, slot); |
7236 return result; | 7238 return result; |
7237 } else { | 7239 } else { |
7238 HStoreKeyedGeneric* result = New<HStoreKeyedGeneric>( | 7240 HValue* vector_value = Add<HConstant>(vector); |
7239 object, key, value, function_language_mode(), vector, slot); | 7241 HValue* slot_value = Add<HConstant>(vector->GetIndex(slot)); |
| 7242 HValue* values[] = {context(), object, key, |
| 7243 value, slot_value, vector_value}; |
| 7244 |
| 7245 Callable callable = CodeFactory::KeyedStoreICInOptimizedCode( |
| 7246 isolate(), function_language_mode()); |
| 7247 HValue* stub = Add<HConstant>(callable.code()); |
| 7248 HCallWithDescriptor* result = New<HCallWithDescriptor>( |
| 7249 stub, 0, callable.descriptor(), ArrayVector(values)); |
7240 return result; | 7250 return result; |
7241 } | 7251 } |
7242 } | 7252 } |
7243 | 7253 |
7244 | 7254 |
7245 LoadKeyedHoleMode HOptimizedGraphBuilder::BuildKeyedHoleMode(Handle<Map> map) { | 7255 LoadKeyedHoleMode HOptimizedGraphBuilder::BuildKeyedHoleMode(Handle<Map> map) { |
7246 // Loads from a "stock" fast holey double arrays can elide the hole check. | 7256 // Loads from a "stock" fast holey double arrays can elide the hole check. |
7247 // Loads from a "stock" fast holey array can convert the hole to undefined | 7257 // Loads from a "stock" fast holey array can convert the hole to undefined |
7248 // with impunity. | 7258 // with impunity. |
7249 LoadKeyedHoleMode load_mode = NEVER_RETURN_HOLE; | 7259 LoadKeyedHoleMode load_mode = NEVER_RETURN_HOLE; |
(...skipping 6108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13358 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13368 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13359 } | 13369 } |
13360 | 13370 |
13361 #ifdef DEBUG | 13371 #ifdef DEBUG |
13362 graph_->Verify(false); // No full verify. | 13372 graph_->Verify(false); // No full verify. |
13363 #endif | 13373 #endif |
13364 } | 13374 } |
13365 | 13375 |
13366 } // namespace internal | 13376 } // namespace internal |
13367 } // namespace v8 | 13377 } // namespace v8 |
OLD | NEW |