Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(845)

Side by Side Diff: src/hydrogen.cc

Issue 1228113008: Crankshaft part of the 'loads and stores to global vars through property cell shortcuts' feature. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments + regression test Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/arm64/lithium-codegen-arm64.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5541 matching lines...) Expand 10 before | Expand all | Expand 10 after
5552 if (field_maps == nullptr) { 5552 if (field_maps == nullptr) {
5553 instr = New<HLoadNamedField>(cell_constant, nullptr, access); 5553 instr = New<HLoadNamedField>(cell_constant, nullptr, access);
5554 } else { 5554 } else {
5555 instr = New<HLoadNamedField>(cell_constant, nullptr, access, 5555 instr = New<HLoadNamedField>(cell_constant, nullptr, access,
5556 field_maps, HType::HeapObject()); 5556 field_maps, HType::HeapObject());
5557 } 5557 }
5558 instr->ClearDependsOnFlag(kInobjectFields); 5558 instr->ClearDependsOnFlag(kInobjectFields);
5559 instr->SetDependsOnFlag(kGlobalVars); 5559 instr->SetDependsOnFlag(kGlobalVars);
5560 return ast_context()->ReturnInstruction(instr, expr->id()); 5560 return ast_context()->ReturnInstruction(instr, expr->id());
5561 } 5561 }
5562 } else if (variable->IsGlobalSlot()) {
5563 DCHECK(variable->index() > 0);
5564 DCHECK(variable->IsStaticGlobalObjectProperty());
5565 // Each var occupies two slots in the context: for reads and writes.
5566 int slot_index = variable->index();
5567 int depth = scope()->ContextChainLength(variable->scope());
5568
5569 HLoadGlobalViaContext* instr =
5570 New<HLoadGlobalViaContext>(variable->name(), depth, slot_index);
5571 return ast_context()->ReturnInstruction(instr, expr->id());
5572
5562 } else { 5573 } else {
5563 HValue* global_object = Add<HLoadNamedField>( 5574 HValue* global_object = Add<HLoadNamedField>(
5564 context(), nullptr, 5575 context(), nullptr,
5565 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); 5576 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
5566 HLoadGlobalGeneric* instr = New<HLoadGlobalGeneric>( 5577 HLoadGlobalGeneric* instr = New<HLoadGlobalGeneric>(
5567 global_object, variable->name(), ast_context()->typeof_mode()); 5578 global_object, variable->name(), ast_context()->typeof_mode());
5568 instr->SetVectorAndSlot(handle(current_feedback_vector(), isolate()), 5579 instr->SetVectorAndSlot(handle(current_feedback_vector(), isolate()),
5569 expr->VariableFeedbackSlot()); 5580 expr->VariableFeedbackSlot());
5570 return ast_context()->ReturnInstruction(instr, expr->id()); 5581 return ast_context()->ReturnInstruction(instr, expr->id());
5571 } 5582 }
(...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after
6773 break; 6784 break;
6774 } 6785 }
6775 } 6786 }
6776 } 6787 }
6777 HInstruction* instr = Add<HStoreNamedField>(cell_constant, access, value); 6788 HInstruction* instr = Add<HStoreNamedField>(cell_constant, access, value);
6778 instr->ClearChangesFlag(kInobjectFields); 6789 instr->ClearChangesFlag(kInobjectFields);
6779 instr->SetChangesFlag(kGlobalVars); 6790 instr->SetChangesFlag(kGlobalVars);
6780 if (instr->HasObservableSideEffects()) { 6791 if (instr->HasObservableSideEffects()) {
6781 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); 6792 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE);
6782 } 6793 }
6794 } else if (var->IsGlobalSlot()) {
6795 DCHECK(var->index() > 0);
6796 DCHECK(var->IsStaticGlobalObjectProperty());
6797 // Each var occupies two slots in the context: for reads and writes.
6798 int slot_index = var->index() + 1;
6799 int depth = scope()->ContextChainLength(var->scope());
6800
6801 HStoreGlobalViaContext* instr = Add<HStoreGlobalViaContext>(
6802 var->name(), value, depth, slot_index, function_language_mode());
6803 USE(instr);
6804 DCHECK(instr->HasObservableSideEffects());
6805 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE);
6806
6783 } else { 6807 } else {
6784 HValue* global_object = Add<HLoadNamedField>( 6808 HValue* global_object = Add<HLoadNamedField>(
6785 context(), nullptr, 6809 context(), nullptr,
6786 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); 6810 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
6787 HStoreNamedGeneric* instr = 6811 HStoreNamedGeneric* instr =
6788 Add<HStoreNamedGeneric>(global_object, var->name(), value, 6812 Add<HStoreNamedGeneric>(global_object, var->name(), value,
6789 function_language_mode(), PREMONOMORPHIC); 6813 function_language_mode(), PREMONOMORPHIC);
6790 USE(instr); 6814 USE(instr);
6791 DCHECK(instr->HasObservableSideEffects()); 6815 DCHECK(instr->HasObservableSideEffects());
6792 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); 6816 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE);
(...skipping 6504 matching lines...) Expand 10 before | Expand all | Expand 10 after
13297 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13321 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13298 } 13322 }
13299 13323
13300 #ifdef DEBUG 13324 #ifdef DEBUG
13301 graph_->Verify(false); // No full verify. 13325 graph_->Verify(false); // No full verify.
13302 #endif 13326 #endif
13303 } 13327 }
13304 13328
13305 } // namespace internal 13329 } // namespace internal
13306 } // namespace v8 13330 } // namespace v8
OLDNEW
« no previous file with comments | « src/arm64/lithium-codegen-arm64.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698