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

Unified Diff: src/ppc/full-codegen-ppc.cc

Issue 1224793002: Loads and stores to global vars are now made via property cell shortcuts installed into parent scri… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressing comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/mips64/interface-descriptors-mips64.cc ('k') | src/ppc/interface-descriptors-ppc.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ppc/full-codegen-ppc.cc
diff --git a/src/ppc/full-codegen-ppc.cc b/src/ppc/full-codegen-ppc.cc
index ec94a242b4a1473d8661918c071eda09c877dbcc..2a6023f5ed4ebf3764bc8a438a9c195da1f2e98a 100644
--- a/src/ppc/full-codegen-ppc.cc
+++ b/src/ppc/full-codegen-ppc.cc
@@ -1462,13 +1462,30 @@ void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy,
Variable* var = proxy->var();
DCHECK(var->IsUnallocatedOrGlobalSlot() ||
(var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL));
- __ LoadP(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand());
- __ mov(LoadDescriptor::NameRegister(), Operand(var->name()));
- __ mov(LoadDescriptor::SlotRegister(),
- Operand(SmiFromSlot(proxy->VariableFeedbackSlot())));
- // Inside typeof use a regular load, not a contextual load, to avoid
- // a reference error.
- CallLoadIC(typeof_state == NOT_INSIDE_TYPEOF ? CONTEXTUAL : NOT_CONTEXTUAL);
+ if (var->IsGlobalSlot()) {
+ DCHECK(var->index() > 0);
+ DCHECK(var->IsStaticGlobalObjectProperty());
+ // Each var occupies two slots in the context: for reads and writes.
+ int slot_index = var->index();
+ int depth = scope()->ContextChainLength(var->scope());
+ __ mov(LoadGlobalViaContextDescriptor::DepthRegister(),
+ Operand(Smi::FromInt(depth)));
+ __ mov(LoadGlobalViaContextDescriptor::SlotRegister(),
+ Operand(Smi::FromInt(slot_index)));
+ __ mov(LoadGlobalViaContextDescriptor::NameRegister(),
+ Operand(var->name()));
+ LoadGlobalViaContextStub stub(isolate(), depth);
+ __ CallStub(&stub);
+
+ } else {
+ __ LoadP(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand());
+ __ mov(LoadDescriptor::NameRegister(), Operand(var->name()));
+ __ mov(LoadDescriptor::SlotRegister(),
+ Operand(SmiFromSlot(proxy->VariableFeedbackSlot())));
+ // Inside typeof use a regular load, not a contextual load, to avoid
+ // a reference error.
+ CallLoadIC(typeof_state == NOT_INSIDE_TYPEOF ? CONTEXTUAL : NOT_CONTEXTUAL);
+ }
}
@@ -2759,13 +2776,30 @@ void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot(
void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op,
FeedbackVectorICSlot slot) {
- if (var->IsUnallocatedOrGlobalSlot()) {
+ if (var->IsUnallocated()) {
// Global var, const, or let.
__ mov(StoreDescriptor::NameRegister(), Operand(var->name()));
__ LoadP(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand());
if (FLAG_vector_stores) EmitLoadStoreICSlot(slot);
CallStoreIC();
+ } else if (var->IsGlobalSlot()) {
+ // Global var, const, or let.
+ DCHECK(var->index() > 0);
+ DCHECK(var->IsStaticGlobalObjectProperty());
+ // Each var occupies two slots in the context: for reads and writes.
+ int slot_index = var->index() + 1;
+ int depth = scope()->ContextChainLength(var->scope());
+ __ mov(StoreGlobalViaContextDescriptor::DepthRegister(),
+ Operand(Smi::FromInt(depth)));
+ __ mov(StoreGlobalViaContextDescriptor::SlotRegister(),
+ Operand(Smi::FromInt(slot_index)));
+ __ mov(StoreGlobalViaContextDescriptor::NameRegister(),
+ Operand(var->name()));
+ DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(r3));
+ StoreGlobalViaContextStub stub(isolate(), depth, language_mode());
+ __ CallStub(&stub);
+
} else if (var->mode() == LET && op != Token::INIT_LET) {
// Non-initializing assignment to let variable needs a write barrier.
DCHECK(!var->IsLookupSlot());
« no previous file with comments | « src/mips64/interface-descriptors-mips64.cc ('k') | src/ppc/interface-descriptors-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698