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

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

Issue 1258513003: X87: [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 | « src/x87/code-stubs-x87.cc ('k') | src/x87/interface-descriptors-x87.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x87/full-codegen-x87.cc
diff --git a/src/x87/full-codegen-x87.cc b/src/x87/full-codegen-x87.cc
index dca00d241bb9ce95486a2f6105cb96841b3e2ecd..4640323f7f8641f60e7e73492a86059a39d63dc5 100644
--- a/src/x87/full-codegen-x87.cc
+++ b/src/x87/full-codegen-x87.cc
@@ -1334,15 +1334,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());
- __ mov(LoadGlobalViaContextDescriptor::DepthRegister(),
- Immediate(Smi::FromInt(depth)));
- __ mov(LoadGlobalViaContextDescriptor::SlotRegister(),
- Immediate(Smi::FromInt(slot_index)));
- __ mov(LoadGlobalViaContextDescriptor::NameRegister(), var->name());
- LoadGlobalViaContextStub stub(isolate(), depth);
- __ CallStub(&stub);
+ int const slot = var->index();
+ int const depth = scope()->ContextChainLength(var->scope());
+ if (depth <= LoadGlobalViaContextStub::kMaximumDepth) {
+ __ Move(LoadGlobalViaContextDescriptor::SlotRegister(), Immediate(slot));
+ __ mov(LoadGlobalViaContextDescriptor::NameRegister(), var->name());
+ LoadGlobalViaContextStub stub(isolate(), depth);
+ __ CallStub(&stub);
+ } else {
+ __ Push(Smi::FromInt(slot));
+ __ Push(var->name());
+ __ CallRuntime(Runtime::kLoadGlobalViaContext, 2);
+ }
} else {
__ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand());
@@ -2611,16 +2614,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());
- __ mov(StoreGlobalViaContextDescriptor::DepthRegister(),
- Immediate(Smi::FromInt(depth)));
- __ mov(StoreGlobalViaContextDescriptor::SlotRegister(),
- Immediate(Smi::FromInt(slot_index)));
- __ mov(StoreGlobalViaContextDescriptor::NameRegister(), var->name());
- DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(eax));
- 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) {
+ __ Move(StoreGlobalViaContextDescriptor::SlotRegister(), Immediate(slot));
+ __ mov(StoreGlobalViaContextDescriptor::NameRegister(), var->name());
+ DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(eax));
+ StoreGlobalViaContextStub stub(isolate(), depth, language_mode());
+ __ CallStub(&stub);
+ } else {
+ __ Push(Smi::FromInt(slot));
+ __ Push(var->name());
+ __ Push(eax);
+ __ 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/x87/code-stubs-x87.cc ('k') | src/x87/interface-descriptors-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698