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

Side by Side Diff: src/arm64/full-codegen-arm64.cc

Issue 1245983003: ARM: [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 unified diff | Download patch
« no previous file with comments | « src/arm64/code-stubs-arm64.cc ('k') | src/arm64/interface-descriptors-arm64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_ARM64 7 #if V8_TARGET_ARCH_ARM64
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after
1450 1450
1451 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy, 1451 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy,
1452 TypeofMode typeof_mode) { 1452 TypeofMode typeof_mode) {
1453 Variable* var = proxy->var(); 1453 Variable* var = proxy->var();
1454 DCHECK(var->IsUnallocatedOrGlobalSlot() || 1454 DCHECK(var->IsUnallocatedOrGlobalSlot() ||
1455 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL)); 1455 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL));
1456 if (var->IsGlobalSlot()) { 1456 if (var->IsGlobalSlot()) {
1457 DCHECK(var->index() > 0); 1457 DCHECK(var->index() > 0);
1458 DCHECK(var->IsStaticGlobalObjectProperty()); 1458 DCHECK(var->IsStaticGlobalObjectProperty());
1459 // Each var occupies two slots in the context: for reads and writes. 1459 // Each var occupies two slots in the context: for reads and writes.
1460 int slot_index = var->index(); 1460 int const slot = var->index();
1461 int depth = scope()->ContextChainLength(var->scope()); 1461 int const depth = scope()->ContextChainLength(var->scope());
1462 __ Mov(LoadGlobalViaContextDescriptor::DepthRegister(), 1462 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) {
1463 Operand(Smi::FromInt(depth))); 1463 __ Mov(LoadGlobalViaContextDescriptor::SlotRegister(), slot);
1464 __ Mov(LoadGlobalViaContextDescriptor::SlotRegister(), 1464 __ Mov(LoadGlobalViaContextDescriptor::NameRegister(), var->name());
1465 Operand(Smi::FromInt(slot_index))); 1465 LoadGlobalViaContextStub stub(isolate(), depth);
1466 __ Mov(LoadGlobalViaContextDescriptor::NameRegister(), 1466 __ CallStub(&stub);
1467 Operand(var->name())); 1467 } else {
1468 LoadGlobalViaContextStub stub(isolate(), depth); 1468 __ Push(Smi::FromInt(slot));
1469 __ CallStub(&stub); 1469 __ Push(var->name());
1470 1470 __ CallRuntime(Runtime::kLoadGlobalViaContext, 2);
1471 }
1471 } else { 1472 } else {
1472 __ Ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectMemOperand()); 1473 __ Ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectMemOperand());
1473 __ Mov(LoadDescriptor::NameRegister(), Operand(var->name())); 1474 __ Mov(LoadDescriptor::NameRegister(), Operand(var->name()));
1474 __ Mov(LoadDescriptor::SlotRegister(), 1475 __ Mov(LoadDescriptor::SlotRegister(),
1475 SmiFromSlot(proxy->VariableFeedbackSlot())); 1476 SmiFromSlot(proxy->VariableFeedbackSlot()));
1476 CallLoadIC(typeof_mode); 1477 CallLoadIC(typeof_mode);
1477 } 1478 }
1478 } 1479 }
1479 1480
1480 1481
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
2453 __ Mov(StoreDescriptor::NameRegister(), Operand(var->name())); 2454 __ Mov(StoreDescriptor::NameRegister(), Operand(var->name()));
2454 __ Ldr(StoreDescriptor::ReceiverRegister(), GlobalObjectMemOperand()); 2455 __ Ldr(StoreDescriptor::ReceiverRegister(), GlobalObjectMemOperand());
2455 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); 2456 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot);
2456 CallStoreIC(); 2457 CallStoreIC();
2457 2458
2458 } else if (var->IsGlobalSlot()) { 2459 } else if (var->IsGlobalSlot()) {
2459 // Global var, const, or let. 2460 // Global var, const, or let.
2460 DCHECK(var->index() > 0); 2461 DCHECK(var->index() > 0);
2461 DCHECK(var->IsStaticGlobalObjectProperty()); 2462 DCHECK(var->IsStaticGlobalObjectProperty());
2462 // Each var occupies two slots in the context: for reads and writes. 2463 // Each var occupies two slots in the context: for reads and writes.
2463 int slot_index = var->index() + 1; 2464 int const slot = var->index() + 1;
2464 int depth = scope()->ContextChainLength(var->scope()); 2465 int const depth = scope()->ContextChainLength(var->scope());
2465 __ Mov(StoreGlobalViaContextDescriptor::DepthRegister(), 2466 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) {
2466 Operand(Smi::FromInt(depth))); 2467 __ Mov(StoreGlobalViaContextDescriptor::SlotRegister(), slot);
2467 __ Mov(StoreGlobalViaContextDescriptor::SlotRegister(), 2468 __ Mov(StoreGlobalViaContextDescriptor::NameRegister(), var->name());
2468 Operand(Smi::FromInt(slot_index))); 2469 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(x0));
2469 __ Mov(StoreGlobalViaContextDescriptor::NameRegister(), 2470 StoreGlobalViaContextStub stub(isolate(), depth, language_mode());
2470 Operand(var->name())); 2471 __ CallStub(&stub);
2471 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(x0)); 2472 } else {
2472 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); 2473 __ Push(Smi::FromInt(slot));
2473 __ CallStub(&stub); 2474 __ Push(var->name());
2474 2475 __ Push(x0);
2476 __ CallRuntime(is_strict(language_mode())
2477 ? Runtime::kStoreGlobalViaContext_Strict
2478 : Runtime::kStoreGlobalViaContext_Sloppy,
2479 3);
2480 }
2475 } else if (var->mode() == LET && op != Token::INIT_LET) { 2481 } else if (var->mode() == LET && op != Token::INIT_LET) {
2476 // Non-initializing assignment to let variable needs a write barrier. 2482 // Non-initializing assignment to let variable needs a write barrier.
2477 DCHECK(!var->IsLookupSlot()); 2483 DCHECK(!var->IsLookupSlot());
2478 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); 2484 DCHECK(var->IsStackAllocated() || var->IsContextSlot());
2479 Label assign; 2485 Label assign;
2480 MemOperand location = VarOperand(var, x1); 2486 MemOperand location = VarOperand(var, x1);
2481 __ Ldr(x10, location); 2487 __ Ldr(x10, location);
2482 __ JumpIfNotRoot(x10, Heap::kTheHoleValueRootIndex, &assign); 2488 __ JumpIfNotRoot(x10, Heap::kTheHoleValueRootIndex, &assign);
2483 __ Mov(x10, Operand(var->name())); 2489 __ Mov(x10, Operand(var->name()));
2484 __ Push(x10); 2490 __ Push(x10);
(...skipping 3078 matching lines...) Expand 10 before | Expand all | Expand 10 after
5563 } 5569 }
5564 5570
5565 return INTERRUPT; 5571 return INTERRUPT;
5566 } 5572 }
5567 5573
5568 5574
5569 } // namespace internal 5575 } // namespace internal
5570 } // namespace v8 5576 } // namespace v8
5571 5577
5572 #endif // V8_TARGET_ARCH_ARM64 5578 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm64/code-stubs-arm64.cc ('k') | src/arm64/interface-descriptors-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698