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 5551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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. | 5567 // Each var occupies two slots in the context: for reads and writes. |
5568 int slot_index = variable->index(); | 5568 int slot_index = variable->index(); |
5569 int depth = scope()->ContextChainLength(variable->scope()); | 5569 int depth = scope()->ContextChainLength(variable->scope()); |
5570 | 5570 |
5571 HLoadGlobalViaContext* instr = | 5571 HLoadGlobalViaContext* instr = |
5572 New<HLoadGlobalViaContext>(variable->name(), depth, slot_index); | 5572 New<HLoadGlobalViaContext>(depth, slot_index); |
5573 return ast_context()->ReturnInstruction(instr, expr->id()); | 5573 return ast_context()->ReturnInstruction(instr, expr->id()); |
5574 | 5574 |
5575 } else { | 5575 } else { |
5576 HValue* global_object = Add<HLoadNamedField>( | 5576 HValue* global_object = Add<HLoadNamedField>( |
5577 context(), nullptr, | 5577 context(), nullptr, |
5578 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); | 5578 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); |
5579 HLoadGlobalGeneric* instr = New<HLoadGlobalGeneric>( | 5579 HLoadGlobalGeneric* instr = New<HLoadGlobalGeneric>( |
5580 global_object, variable->name(), ast_context()->typeof_mode()); | 5580 global_object, variable->name(), ast_context()->typeof_mode()); |
5581 instr->SetVectorAndSlot(handle(current_feedback_vector(), isolate()), | 5581 instr->SetVectorAndSlot(handle(current_feedback_vector(), isolate()), |
5582 expr->VariableFeedbackSlot()); | 5582 expr->VariableFeedbackSlot()); |
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6794 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); | 6794 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); |
6795 } | 6795 } |
6796 } else if (var->IsGlobalSlot()) { | 6796 } else if (var->IsGlobalSlot()) { |
6797 DCHECK(var->index() > 0); | 6797 DCHECK(var->index() > 0); |
6798 DCHECK(var->IsStaticGlobalObjectProperty()); | 6798 DCHECK(var->IsStaticGlobalObjectProperty()); |
6799 // Each var occupies two slots in the context: for reads and writes. | 6799 // Each var occupies two slots in the context: for reads and writes. |
6800 int slot_index = var->index() + 1; | 6800 int slot_index = var->index() + 1; |
6801 int depth = scope()->ContextChainLength(var->scope()); | 6801 int depth = scope()->ContextChainLength(var->scope()); |
6802 | 6802 |
6803 HStoreGlobalViaContext* instr = Add<HStoreGlobalViaContext>( | 6803 HStoreGlobalViaContext* instr = Add<HStoreGlobalViaContext>( |
6804 var->name(), value, depth, slot_index, function_language_mode()); | 6804 value, depth, slot_index, function_language_mode()); |
6805 USE(instr); | 6805 USE(instr); |
6806 DCHECK(instr->HasObservableSideEffects()); | 6806 DCHECK(instr->HasObservableSideEffects()); |
6807 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); | 6807 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); |
6808 | 6808 |
6809 } else { | 6809 } else { |
6810 HValue* global_object = Add<HLoadNamedField>( | 6810 HValue* global_object = Add<HLoadNamedField>( |
6811 context(), nullptr, | 6811 context(), nullptr, |
6812 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); | 6812 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); |
6813 HStoreNamedGeneric* instr = | 6813 HStoreNamedGeneric* instr = |
6814 Add<HStoreNamedGeneric>(global_object, var->name(), value, | 6814 Add<HStoreNamedGeneric>(global_object, var->name(), value, |
(...skipping 6520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13335 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13335 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13336 } | 13336 } |
13337 | 13337 |
13338 #ifdef DEBUG | 13338 #ifdef DEBUG |
13339 graph_->Verify(false); // No full verify. | 13339 graph_->Verify(false); // No full verify. |
13340 #endif | 13340 #endif |
13341 } | 13341 } |
13342 | 13342 |
13343 } // namespace internal | 13343 } // namespace internal |
13344 } // namespace v8 | 13344 } // namespace v8 |
OLD | NEW |