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 5546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5557 instr = New<HLoadNamedField>(cell_constant, nullptr, access, | 5557 instr = New<HLoadNamedField>(cell_constant, nullptr, access, |
5558 field_maps, HType::HeapObject()); | 5558 field_maps, HType::HeapObject()); |
5559 } | 5559 } |
5560 instr->ClearDependsOnFlag(kInobjectFields); | 5560 instr->ClearDependsOnFlag(kInobjectFields); |
5561 instr->SetDependsOnFlag(kGlobalVars); | 5561 instr->SetDependsOnFlag(kGlobalVars); |
5562 return ast_context()->ReturnInstruction(instr, expr->id()); | 5562 return ast_context()->ReturnInstruction(instr, expr->id()); |
5563 } | 5563 } |
5564 } else if (variable->IsGlobalSlot()) { | 5564 } else if (variable->IsGlobalSlot()) { |
5565 DCHECK(variable->index() > 0); | 5565 DCHECK(variable->index() > 0); |
5566 DCHECK(variable->IsStaticGlobalObjectProperty()); | 5566 DCHECK(variable->IsStaticGlobalObjectProperty()); |
5567 // Each var occupies two slots in the context: for reads and writes. | |
5568 int slot_index = variable->index(); | 5567 int slot_index = variable->index(); |
5569 int depth = scope()->ContextChainLength(variable->scope()); | 5568 int depth = scope()->ContextChainLength(variable->scope()); |
5570 | 5569 |
5571 HLoadGlobalViaContext* instr = | 5570 HLoadGlobalViaContext* instr = |
5572 New<HLoadGlobalViaContext>(depth, slot_index); | 5571 New<HLoadGlobalViaContext>(depth, slot_index); |
5573 return ast_context()->ReturnInstruction(instr, expr->id()); | 5572 return ast_context()->ReturnInstruction(instr, expr->id()); |
5574 | 5573 |
5575 } else { | 5574 } else { |
5576 HValue* global_object = Add<HLoadNamedField>( | 5575 HValue* global_object = Add<HLoadNamedField>( |
5577 context(), nullptr, | 5576 context(), nullptr, |
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6789 } | 6788 } |
6790 HInstruction* instr = Add<HStoreNamedField>(cell_constant, access, value); | 6789 HInstruction* instr = Add<HStoreNamedField>(cell_constant, access, value); |
6791 instr->ClearChangesFlag(kInobjectFields); | 6790 instr->ClearChangesFlag(kInobjectFields); |
6792 instr->SetChangesFlag(kGlobalVars); | 6791 instr->SetChangesFlag(kGlobalVars); |
6793 if (instr->HasObservableSideEffects()) { | 6792 if (instr->HasObservableSideEffects()) { |
6794 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); | 6793 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); |
6795 } | 6794 } |
6796 } else if (var->IsGlobalSlot()) { | 6795 } else if (var->IsGlobalSlot()) { |
6797 DCHECK(var->index() > 0); | 6796 DCHECK(var->index() > 0); |
6798 DCHECK(var->IsStaticGlobalObjectProperty()); | 6797 DCHECK(var->IsStaticGlobalObjectProperty()); |
6799 // Each var occupies two slots in the context: for reads and writes. | 6798 int slot_index = var->index(); |
6800 int slot_index = var->index() + 1; | |
6801 int depth = scope()->ContextChainLength(var->scope()); | 6799 int depth = scope()->ContextChainLength(var->scope()); |
6802 | 6800 |
6803 HStoreGlobalViaContext* instr = Add<HStoreGlobalViaContext>( | 6801 HStoreGlobalViaContext* instr = Add<HStoreGlobalViaContext>( |
6804 value, depth, slot_index, function_language_mode()); | 6802 value, depth, slot_index, function_language_mode()); |
6805 USE(instr); | 6803 USE(instr); |
6806 DCHECK(instr->HasObservableSideEffects()); | 6804 DCHECK(instr->HasObservableSideEffects()); |
6807 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); | 6805 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); |
6808 | 6806 |
6809 } else { | 6807 } else { |
6810 HValue* global_object = Add<HLoadNamedField>( | 6808 HValue* global_object = Add<HLoadNamedField>( |
(...skipping 6524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13335 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13333 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13336 } | 13334 } |
13337 | 13335 |
13338 #ifdef DEBUG | 13336 #ifdef DEBUG |
13339 graph_->Verify(false); // No full verify. | 13337 graph_->Verify(false); // No full verify. |
13340 #endif | 13338 #endif |
13341 } | 13339 } |
13342 | 13340 |
13343 } // namespace internal | 13341 } // namespace internal |
13344 } // namespace v8 | 13342 } // namespace v8 |
OLD | NEW |