Index: src/ia32/lithium-codegen-ia32.cc |
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
index 4bed05280847f04382459659658edd0af8970004..db2602c179c2d40eedeb1f864f38026ac21fb517 100644 |
--- a/src/ia32/lithium-codegen-ia32.cc |
+++ b/src/ia32/lithium-codegen-ia32.cc |
@@ -2870,15 +2870,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); |
+ } |
} |
@@ -4143,16 +4147,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); |
+ } |
} |