Index: src/x87/lithium-codegen-x87.cc |
diff --git a/src/x87/lithium-codegen-x87.cc b/src/x87/lithium-codegen-x87.cc |
index dc5f2eec7a1f0cdf1124219d165a019d87e63781..ee96cf698801e8c1c0deb3c6e53baad5459891ad 100644 |
--- a/src/x87/lithium-codegen-x87.cc |
+++ b/src/x87/lithium-codegen-x87.cc |
@@ -3150,15 +3150,19 @@ void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) { |
DCHECK(ToRegister(instr->context()).is(esi)); |
DCHECK(ToRegister(instr->result()).is(eax)); |
- __ mov(LoadGlobalViaContextDescriptor::DepthRegister(), |
- Immediate(Smi::FromInt(instr->depth()))); |
- __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), |
- Immediate(Smi::FromInt(instr->slot_index()))); |
- __ mov(LoadGlobalViaContextDescriptor::NameRegister(), 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(), slot); |
+ __ mov(LoadGlobalViaContextDescriptor::NameRegister(), 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); |
+ } |
} |
@@ -4546,16 +4550,24 @@ void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) { |
DCHECK(ToRegister(instr->value()) |
.is(StoreGlobalViaContextDescriptor::ValueRegister())); |
- __ mov(StoreGlobalViaContextDescriptor::DepthRegister(), |
- Immediate(Smi::FromInt(instr->depth()))); |
- __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), |
- Immediate(Smi::FromInt(instr->slot_index()))); |
- __ mov(StoreGlobalViaContextDescriptor::NameRegister(), 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(), slot); |
+ __ mov(StoreGlobalViaContextDescriptor::NameRegister(), 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); |
+ } |
} |