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 <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/allocation-site-scopes.h" | 9 #include "src/allocation-site-scopes.h" |
10 #include "src/ast-numbering.h" | 10 #include "src/ast-numbering.h" |
(...skipping 5698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5709 if (field_maps == nullptr) { | 5709 if (field_maps == nullptr) { |
5710 instr = New<HLoadNamedField>(cell_constant, nullptr, access); | 5710 instr = New<HLoadNamedField>(cell_constant, nullptr, access); |
5711 } else { | 5711 } else { |
5712 instr = New<HLoadNamedField>(cell_constant, nullptr, access, | 5712 instr = New<HLoadNamedField>(cell_constant, nullptr, access, |
5713 field_maps, HType::HeapObject()); | 5713 field_maps, HType::HeapObject()); |
5714 } | 5714 } |
5715 instr->ClearDependsOnFlag(kInobjectFields); | 5715 instr->ClearDependsOnFlag(kInobjectFields); |
5716 instr->SetDependsOnFlag(kGlobalVars); | 5716 instr->SetDependsOnFlag(kGlobalVars); |
5717 return ast_context()->ReturnInstruction(instr, expr->id()); | 5717 return ast_context()->ReturnInstruction(instr, expr->id()); |
5718 } | 5718 } |
5719 } else if (variable->IsGlobalSlot()) { | |
5720 DCHECK(variable->index() > 0); | |
5721 DCHECK(variable->IsStaticGlobalObjectProperty()); | |
5722 int slot_index = variable->index(); | |
5723 int depth = scope()->ContextChainLength(variable->scope()); | |
5724 | |
5725 HLoadGlobalViaContext* instr = | |
5726 New<HLoadGlobalViaContext>(depth, slot_index); | |
5727 return ast_context()->ReturnInstruction(instr, expr->id()); | |
5728 | |
5729 } else { | 5719 } else { |
5730 HValue* global_object = Add<HLoadNamedField>( | 5720 HValue* global_object = Add<HLoadNamedField>( |
5731 context(), nullptr, | 5721 context(), nullptr, |
5732 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); | 5722 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); |
5733 HLoadGlobalGeneric* instr = New<HLoadGlobalGeneric>( | 5723 HLoadGlobalGeneric* instr = New<HLoadGlobalGeneric>( |
5734 global_object, variable->name(), ast_context()->typeof_mode()); | 5724 global_object, variable->name(), ast_context()->typeof_mode()); |
5735 instr->SetVectorAndSlot(handle(current_feedback_vector(), isolate()), | 5725 instr->SetVectorAndSlot(handle(current_feedback_vector(), isolate()), |
5736 expr->VariableFeedbackSlot()); | 5726 expr->VariableFeedbackSlot()); |
5737 return ast_context()->ReturnInstruction(instr, expr->id()); | 5727 return ast_context()->ReturnInstruction(instr, expr->id()); |
5738 } | 5728 } |
(...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6934 break; | 6924 break; |
6935 } | 6925 } |
6936 } | 6926 } |
6937 } | 6927 } |
6938 HInstruction* instr = Add<HStoreNamedField>(cell_constant, access, value); | 6928 HInstruction* instr = Add<HStoreNamedField>(cell_constant, access, value); |
6939 instr->ClearChangesFlag(kInobjectFields); | 6929 instr->ClearChangesFlag(kInobjectFields); |
6940 instr->SetChangesFlag(kGlobalVars); | 6930 instr->SetChangesFlag(kGlobalVars); |
6941 if (instr->HasObservableSideEffects()) { | 6931 if (instr->HasObservableSideEffects()) { |
6942 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); | 6932 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); |
6943 } | 6933 } |
6944 } else if (var->IsGlobalSlot()) { | |
6945 DCHECK(var->index() > 0); | |
6946 DCHECK(var->IsStaticGlobalObjectProperty()); | |
6947 int slot_index = var->index(); | |
6948 int depth = scope()->ContextChainLength(var->scope()); | |
6949 | |
6950 HStoreGlobalViaContext* instr = Add<HStoreGlobalViaContext>( | |
6951 value, depth, slot_index, function_language_mode()); | |
6952 USE(instr); | |
6953 DCHECK(instr->HasObservableSideEffects()); | |
6954 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); | |
6955 | |
6956 } else { | 6934 } else { |
6957 HValue* global_object = Add<HLoadNamedField>( | 6935 HValue* global_object = Add<HLoadNamedField>( |
6958 context(), nullptr, | 6936 context(), nullptr, |
6959 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); | 6937 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); |
6960 HStoreNamedGeneric* instr = | 6938 HStoreNamedGeneric* instr = |
6961 Add<HStoreNamedGeneric>(global_object, var->name(), value, | 6939 Add<HStoreNamedGeneric>(global_object, var->name(), value, |
6962 function_language_mode(), PREMONOMORPHIC); | 6940 function_language_mode(), PREMONOMORPHIC); |
6963 if (FLAG_vector_stores) { | 6941 if (FLAG_vector_stores) { |
6964 Handle<TypeFeedbackVector> vector = | 6942 Handle<TypeFeedbackVector> vector = |
6965 handle(current_feedback_vector(), isolate()); | 6943 handle(current_feedback_vector(), isolate()); |
(...skipping 6734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13700 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13678 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13701 } | 13679 } |
13702 | 13680 |
13703 #ifdef DEBUG | 13681 #ifdef DEBUG |
13704 graph_->Verify(false); // No full verify. | 13682 graph_->Verify(false); // No full verify. |
13705 #endif | 13683 #endif |
13706 } | 13684 } |
13707 | 13685 |
13708 } // namespace internal | 13686 } // namespace internal |
13709 } // namespace v8 | 13687 } // namespace v8 |
OLD | NEW |