Index: src/arm/lithium-codegen-arm.cc |
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc |
index 194b5fe0ce5e4b4007fd27dc916d7ee7ea89e56a..97881ba1a2d3c7dca6b9c4b15cc456dbecbf414a 100644 |
--- a/src/arm/lithium-codegen-arm.cc |
+++ b/src/arm/lithium-codegen-arm.cc |
@@ -2987,16 +2987,20 @@ void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) { |
DCHECK(ToRegister(instr->context()).is(cp)); |
DCHECK(ToRegister(instr->result()).is(r0)); |
- __ mov(LoadGlobalViaContextDescriptor::DepthRegister(), |
- Operand(Smi::FromInt(instr->depth()))); |
- __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), |
- Operand(Smi::FromInt(instr->slot_index()))); |
- __ mov(LoadGlobalViaContextDescriptor::NameRegister(), |
- Operand(instr->name())); |
- |
- Handle<Code> stub = |
- CodeFactory::LoadGlobalViaContext(isolate(), instr->depth()).code(); |
- CallCode(stub, RelocInfo::CODE_TARGET, instr); |
+ int const slot = instr->slot_index(); |
+ int const depth = instr->depth(); |
+ if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { |
+ __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); |
+ __ mov(LoadGlobalViaContextDescriptor::NameRegister(), |
+ Operand(instr->name())); |
+ Handle<Code> stub = |
+ CodeFactory::LoadGlobalViaContext(isolate(), depth).code(); |
+ CallCode(stub, RelocInfo::CODE_TARGET, instr); |
+ } else { |
+ __ Push(Smi::FromInt(slot)); |
+ __ Push(instr->name()); |
+ __ CallRuntime(Runtime::kLoadGlobalViaContext, 2); |
+ } |
} |
@@ -4249,17 +4253,25 @@ void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) { |
DCHECK(ToRegister(instr->value()) |
.is(StoreGlobalViaContextDescriptor::ValueRegister())); |
- __ mov(StoreGlobalViaContextDescriptor::DepthRegister(), |
- Operand(Smi::FromInt(instr->depth()))); |
- __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), |
- Operand(Smi::FromInt(instr->slot_index()))); |
- __ mov(StoreGlobalViaContextDescriptor::NameRegister(), |
- Operand(instr->name())); |
- |
- Handle<Code> stub = |
- CodeFactory::StoreGlobalViaContext(isolate(), instr->depth(), |
- instr->language_mode()).code(); |
- CallCode(stub, RelocInfo::CODE_TARGET, instr); |
+ int const slot = instr->slot_index(); |
+ int const depth = instr->depth(); |
+ if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { |
+ __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); |
+ __ mov(StoreGlobalViaContextDescriptor::NameRegister(), |
+ Operand(instr->name())); |
+ Handle<Code> stub = CodeFactory::StoreGlobalViaContext( |
+ isolate(), depth, instr->language_mode()) |
+ .code(); |
+ CallCode(stub, RelocInfo::CODE_TARGET, instr); |
+ } else { |
+ __ Push(Smi::FromInt(slot)); |
+ __ Push(instr->name()); |
+ __ push(StoreGlobalViaContextDescriptor::ValueRegister()); |
+ __ CallRuntime(is_strict(instr->language_mode()) |
+ ? Runtime::kStoreGlobalViaContext_Strict |
+ : Runtime::kStoreGlobalViaContext_Sloppy, |
+ 3); |
+ } |
} |