Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(565)

Unified Diff: src/mips/lithium-codegen-mips.cc

Issue 1238143002: [stubs] Optimize LoadGlobalViaContextStub and StoreGlobalViaContextStub. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix ARM typo. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/mips/lithium-codegen-mips.cc
diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc
index 2703bdbe1999c9dc6df06eff856571e805f02615..c5db715d6d0b7e08459405a41c38cdf4e2731a80 100644
--- a/src/mips/lithium-codegen-mips.cc
+++ b/src/mips/lithium-codegen-mips.cc
@@ -2899,15 +2899,20 @@ void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) {
DCHECK(ToRegister(instr->context()).is(cp));
DCHECK(ToRegister(instr->result()).is(v0));
- __ li(LoadGlobalViaContextDescriptor::DepthRegister(),
- Operand(Smi::FromInt(instr->depth())));
- __ li(LoadGlobalViaContextDescriptor::SlotRegister(),
- Operand(Smi::FromInt(instr->slot_index())));
- __ li(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) {
+ __ li(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
+ __ li(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);
+ }
}
@@ -4209,17 +4214,25 @@ void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) {
DCHECK(ToRegister(instr->value())
.is(StoreGlobalViaContextDescriptor::ValueRegister()));
- __ li(StoreGlobalViaContextDescriptor::DepthRegister(),
- Operand(Smi::FromInt(instr->depth())));
- __ li(StoreGlobalViaContextDescriptor::SlotRegister(),
- Operand(Smi::FromInt(instr->slot_index())));
- __ li(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) {
+ __ li(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
+ __ li(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(language_mode())
+ ? Runtime::kStoreGlobalViaContext_Strict
+ : Runtime::kStoreGlobalViaContext_Sloppy,
+ 3);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698