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

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

Issue 1261473002: PPC: [stubs] Optimize LoadGlobalViaContextStub and StoreGlobalViaContextStub. (Closed) 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 | « no previous file | src/ppc/code-stubs-ppc.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/full-codegen/ppc/full-codegen-ppc.cc
diff --git a/src/full-codegen/ppc/full-codegen-ppc.cc b/src/full-codegen/ppc/full-codegen-ppc.cc
index a7950b4c7028e92dd63a50be835ccbba9b82f5ec..0654a9a64abd4d92ea47bee487ab154613be656d 100644
--- a/src/full-codegen/ppc/full-codegen-ppc.cc
+++ b/src/full-codegen/ppc/full-codegen-ppc.cc
@@ -1378,17 +1378,19 @@ 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());
- __ mov(LoadGlobalViaContextDescriptor::DepthRegister(),
- Operand(Smi::FromInt(depth)));
- __ mov(LoadGlobalViaContextDescriptor::SlotRegister(),
- Operand(Smi::FromInt(slot_index)));
- __ mov(LoadGlobalViaContextDescriptor::NameRegister(),
- Operand(var->name()));
- LoadGlobalViaContextStub stub(isolate(), depth);
- __ CallStub(&stub);
-
+ const int slot = var->index();
+ const int depth = scope()->ContextChainLength(var->scope());
+ if (depth <= LoadGlobalViaContextStub::kMaximumDepth) {
+ __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
+ __ mov(LoadGlobalViaContextDescriptor::NameRegister(),
+ Operand(var->name()));
+ LoadGlobalViaContextStub stub(isolate(), depth);
+ __ CallStub(&stub);
+ } else {
+ __ Push(Smi::FromInt(slot));
+ __ Push(var->name());
+ __ CallRuntime(Runtime::kLoadGlobalViaContext, 2);
+ }
} else {
__ LoadP(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand());
__ mov(LoadDescriptor::NameRegister(), Operand(var->name()));
@@ -2714,18 +2716,24 @@ 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());
- __ mov(StoreGlobalViaContextDescriptor::DepthRegister(),
- Operand(Smi::FromInt(depth)));
- __ mov(StoreGlobalViaContextDescriptor::SlotRegister(),
- Operand(Smi::FromInt(slot_index)));
- __ mov(StoreGlobalViaContextDescriptor::NameRegister(),
- Operand(var->name()));
- DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(r3));
- StoreGlobalViaContextStub stub(isolate(), depth, language_mode());
- __ CallStub(&stub);
-
+ const int slot = var->index() + 1;
+ const int depth = scope()->ContextChainLength(var->scope());
+ if (depth <= StoreGlobalViaContextStub::kMaximumDepth) {
+ __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
+ __ mov(StoreGlobalViaContextDescriptor::NameRegister(),
+ Operand(var->name()));
+ DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(r3));
+ StoreGlobalViaContextStub stub(isolate(), depth, language_mode());
+ __ CallStub(&stub);
+ } else {
+ __ Push(Smi::FromInt(slot));
+ __ Push(var->name());
+ __ push(r3);
+ __ 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.
DCHECK(!var->IsLookupSlot());
« no previous file with comments | « no previous file | src/ppc/code-stubs-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698