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

Unified Diff: src/mips64/full-codegen-mips64.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/mips64/full-codegen-mips64.cc
diff --git a/src/mips64/full-codegen-mips64.cc b/src/mips64/full-codegen-mips64.cc
index 1aacde6f565e8f41045c29cc0d8ac57d9b867adb..7894a180349e212ddcee9a0962cabdf5ecd31b95 100644
--- a/src/mips64/full-codegen-mips64.cc
+++ b/src/mips64/full-codegen-mips64.cc
@@ -1403,15 +1403,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 {
__ ld(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand());
@@ -2697,18 +2700,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.

Powered by Google App Engine
This is Rietveld 408576698