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

Unified Diff: src/mips64/full-codegen-mips64.cc

Issue 1235063007: MIPS: [stubs] Optimize LoadGlobalViaContextStub and StoreGlobalViaContextStub. Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
« no previous file with comments | « src/mips64/code-stubs-mips64.cc ('k') | src/mips64/interface-descriptors-mips64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips64/full-codegen-mips64.cc
diff --git a/src/mips64/full-codegen-mips64.cc b/src/mips64/full-codegen-mips64.cc
index 95fc92669bfdcfaab40a52fb01512307319b45fc..1ad6cd77ffa36776eba894b59baf03abb76f913e 100644
--- a/src/mips64/full-codegen-mips64.cc
+++ b/src/mips64/full-codegen-mips64.cc
@@ -1470,15 +1470,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());
@@ -2765,17 +2768,23 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op,
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()));
- __ mov(StoreGlobalViaContextDescriptor::ValueRegister(), result_register());
- StoreGlobalViaContextStub stub(isolate(), depth, language_mode());
- __ CallStub(&stub);
+ 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());
+ DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(a0));
+ 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.
« no previous file with comments | « src/mips64/code-stubs-mips64.cc ('k') | src/mips64/interface-descriptors-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698