| Index: src/mips/full-codegen-mips.cc
|
| diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc
|
| index 841ee4b99586bfae8736407212c72db69e2e0622..44005603dfc5baf7a115e62f3bed90bb1e96c7b8 100644
|
| --- a/src/mips/full-codegen-mips.cc
|
| +++ b/src/mips/full-codegen-mips.cc
|
| @@ -1484,13 +1484,29 @@ void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy,
|
| Variable* var = proxy->var();
|
| DCHECK(var->IsUnallocatedOrGlobalSlot() ||
|
| (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL));
|
| - __ lw(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand());
|
| - __ li(LoadDescriptor::NameRegister(), Operand(var->name()));
|
| - __ li(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());
|
| + __ li(LoadGlobalViaContextDescriptor::DepthRegister(),
|
| + Operand(Smi::FromInt(depth)));
|
| + __ li(LoadGlobalViaContextDescriptor::SlotRegister(),
|
| + Operand(Smi::FromInt(slot_index)));
|
| + __ li(LoadGlobalViaContextDescriptor::NameRegister(), Operand(var->name()));
|
| + LoadGlobalViaContextStub stub(isolate(), depth);
|
| + __ CallStub(&stub);
|
| +
|
| + } else {
|
| + __ lw(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand());
|
| + __ li(LoadDescriptor::NameRegister(), Operand(var->name()));
|
| + __ li(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);
|
| + }
|
| }
|
|
|
|
|
| @@ -2739,7 +2755,7 @@ 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::ValueRegister(), result_register());
|
| __ li(StoreDescriptor::NameRegister(), Operand(var->name()));
|
| @@ -2747,6 +2763,23 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op,
|
| 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());
|
| + __ li(StoreGlobalViaContextDescriptor::DepthRegister(),
|
| + Operand(Smi::FromInt(depth)));
|
| + __ li(StoreGlobalViaContextDescriptor::SlotRegister(),
|
| + Operand(Smi::FromInt(slot_index)));
|
| + __ li(StoreGlobalViaContextDescriptor::NameRegister(),
|
| + Operand(var->name()));
|
| + __ mov(StoreGlobalViaContextDescriptor::ValueRegister(), result_register());
|
| + 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());
|
|
|