| 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 6848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6859 instr->SetChangesFlag(kGlobalVars); | 6859 instr->SetChangesFlag(kGlobalVars); |
| 6860 if (instr->HasObservableSideEffects()) { | 6860 if (instr->HasObservableSideEffects()) { |
| 6861 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); | 6861 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); |
| 6862 } | 6862 } |
| 6863 } else { | 6863 } else { |
| 6864 HValue* global_object = Add<HLoadNamedField>( | 6864 HValue* global_object = Add<HLoadNamedField>( |
| 6865 BuildGetNativeContext(), nullptr, | 6865 BuildGetNativeContext(), nullptr, |
| 6866 HObjectAccess::ForContextSlot(Context::EXTENSION_INDEX)); | 6866 HObjectAccess::ForContextSlot(Context::EXTENSION_INDEX)); |
| 6867 Handle<TypeFeedbackVector> vector = | 6867 Handle<TypeFeedbackVector> vector = |
| 6868 handle(current_feedback_vector(), isolate()); | 6868 handle(current_feedback_vector(), isolate()); |
| 6869 HStoreNamedGeneric* instr = | 6869 HValue* name = Add<HConstant>(var->name()); |
| 6870 Add<HStoreNamedGeneric>(global_object, var->name(), value, | 6870 HValue* vector_value = Add<HConstant>(vector); |
| 6871 function_language_mode(), vector, slot); | 6871 HValue* slot_value = Add<HConstant>(vector->GetIndex(slot)); |
| 6872 Callable callable = CodeFactory::StoreICInOptimizedCode( |
| 6873 isolate(), function_language_mode()); |
| 6874 HValue* stub = Add<HConstant>(callable.code()); |
| 6875 HValue* values[] = {context(), global_object, name, |
| 6876 value, slot_value, vector_value}; |
| 6877 HCallWithDescriptor* instr = Add<HCallWithDescriptor>( |
| 6878 stub, 0, callable.descriptor(), ArrayVector(values)); |
| 6872 USE(instr); | 6879 USE(instr); |
| 6873 DCHECK(instr->HasObservableSideEffects()); | 6880 DCHECK(instr->HasObservableSideEffects()); |
| 6874 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); | 6881 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); |
| 6875 } | 6882 } |
| 6876 } | 6883 } |
| 6877 | 6884 |
| 6878 | 6885 |
| 6879 void HOptimizedGraphBuilder::HandleCompoundAssignment(Assignment* expr) { | 6886 void HOptimizedGraphBuilder::HandleCompoundAssignment(Assignment* expr) { |
| 6880 Expression* target = expr->target(); | 6887 Expression* target = expr->target(); |
| 6881 VariableProxy* proxy = target->AsVariableProxy(); | 6888 VariableProxy* proxy = target->AsVariableProxy(); |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7196 // It's possible that a keyed store of a constant string was converted | 7203 // It's possible that a keyed store of a constant string was converted |
| 7197 // to a named store. Here, at the last minute, we need to make sure to | 7204 // to a named store. Here, at the last minute, we need to make sure to |
| 7198 // use a generic Keyed Store if we are using the type vector, because | 7205 // use a generic Keyed Store if we are using the type vector, because |
| 7199 // it has to share information with full code. | 7206 // it has to share information with full code. |
| 7200 HConstant* key = Add<HConstant>(name); | 7207 HConstant* key = Add<HConstant>(name); |
| 7201 HStoreKeyedGeneric* result = New<HStoreKeyedGeneric>( | 7208 HStoreKeyedGeneric* result = New<HStoreKeyedGeneric>( |
| 7202 object, key, value, function_language_mode(), vector, slot); | 7209 object, key, value, function_language_mode(), vector, slot); |
| 7203 return result; | 7210 return result; |
| 7204 } | 7211 } |
| 7205 | 7212 |
| 7206 HStoreNamedGeneric* result = New<HStoreNamedGeneric>( | 7213 HValue* name_value = Add<HConstant>(name); |
| 7207 object, name, value, function_language_mode(), vector, slot); | 7214 HValue* vector_value = Add<HConstant>(vector); |
| 7215 HValue* slot_value = Add<HConstant>(vector->GetIndex(slot)); |
| 7216 Callable callable = CodeFactory::StoreICInOptimizedCode( |
| 7217 isolate(), function_language_mode()); |
| 7218 HValue* stub = Add<HConstant>(callable.code()); |
| 7219 HValue* values[] = {context(), object, name_value, |
| 7220 value, slot_value, vector_value}; |
| 7221 HCallWithDescriptor* result = New<HCallWithDescriptor>( |
| 7222 stub, 0, callable.descriptor(), ArrayVector(values)); |
| 7208 return result; | 7223 return result; |
| 7209 } | 7224 } |
| 7210 } | 7225 } |
| 7211 | 7226 |
| 7212 | 7227 |
| 7213 HInstruction* HOptimizedGraphBuilder::BuildKeyedGeneric( | 7228 HInstruction* HOptimizedGraphBuilder::BuildKeyedGeneric( |
| 7214 PropertyAccessType access_type, Expression* expr, FeedbackVectorSlot slot, | 7229 PropertyAccessType access_type, Expression* expr, FeedbackVectorSlot slot, |
| 7215 HValue* object, HValue* key, HValue* value) { | 7230 HValue* object, HValue* key, HValue* value) { |
| 7216 Handle<TypeFeedbackVector> vector = | 7231 Handle<TypeFeedbackVector> vector = |
| 7217 handle(current_feedback_vector(), isolate()); | 7232 handle(current_feedback_vector(), isolate()); |
| (...skipping 6125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13343 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13358 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13344 } | 13359 } |
| 13345 | 13360 |
| 13346 #ifdef DEBUG | 13361 #ifdef DEBUG |
| 13347 graph_->Verify(false); // No full verify. | 13362 graph_->Verify(false); // No full verify. |
| 13348 #endif | 13363 #endif |
| 13349 } | 13364 } |
| 13350 | 13365 |
| 13351 } // namespace internal | 13366 } // namespace internal |
| 13352 } // namespace v8 | 13367 } // namespace v8 |
| OLD | NEW |