Index: src/mips/full-codegen-mips.cc |
diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc |
index d0904a6d84e215576f65c35b2b872c024aa0f6d8..b501413be8d5348bae7e87468541bca657d52114 100644 |
--- a/src/mips/full-codegen-mips.cc |
+++ b/src/mips/full-codegen-mips.cc |
@@ -1407,15 +1407,18 @@ void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy, |
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); |
+ int const slot = var->index(); |
+ int const depth = scope()->ContextChainLength(var->scope()); |
+ if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { |
+ __ li(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); |
+ __ li(LoadGlobalViaContextDescriptor::NameRegister(), var->name()); |
+ LoadGlobalViaContextStub stub(isolate(), depth); |
+ __ CallStub(&stub); |
+ } else { |
+ __ Push(Smi::FromInt(slot)); |
+ __ Push(var->name()); |
+ __ CallRuntime(Runtime::kLoadGlobalViaContext, 2); |
+ } |
} else { |
__ lw(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
@@ -2700,18 +2703,25 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, |
// 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())); |
+ DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(a0)); |
__ mov(StoreGlobalViaContextDescriptor::ValueRegister(), result_register()); |
- StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); |
- __ CallStub(&stub); |
+ // Each var occupies two slots in the context: for reads and writes. |
+ int const slot = var->index() + 1; |
+ int const depth = scope()->ContextChainLength(var->scope()); |
+ if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { |
+ __ li(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); |
+ __ li(StoreGlobalViaContextDescriptor::NameRegister(), var->name()); |
+ StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); |
+ __ CallStub(&stub); |
+ } else { |
+ __ Push(Smi::FromInt(slot)); |
+ __ Push(var->name()); |
+ __ Push(a0); |
+ __ CallRuntime(is_strict(language_mode()) |
+ ? Runtime::kStoreGlobalViaContext_Strict |
+ : Runtime::kStoreGlobalViaContext_Sloppy, |
+ 3); |
+ } |
} else if (var->mode() == LET && op != Token::INIT_LET) { |
// Non-initializing assignment to let variable needs a write barrier. |