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

Side by Side Diff: src/arm/full-codegen-arm.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/arm/code-stubs-arm.cc ('k') | src/arm/interface-descriptors-arm.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_ARM 7 #if V8_TARGET_ARCH_ARM
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 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 1467
1468 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy, 1468 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy,
1469 TypeofMode typeof_mode) { 1469 TypeofMode typeof_mode) {
1470 Variable* var = proxy->var(); 1470 Variable* var = proxy->var();
1471 DCHECK(var->IsUnallocatedOrGlobalSlot() || 1471 DCHECK(var->IsUnallocatedOrGlobalSlot() ||
1472 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL)); 1472 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL));
1473 if (var->IsGlobalSlot()) { 1473 if (var->IsGlobalSlot()) {
1474 DCHECK(var->index() > 0); 1474 DCHECK(var->index() > 0);
1475 DCHECK(var->IsStaticGlobalObjectProperty()); 1475 DCHECK(var->IsStaticGlobalObjectProperty());
1476 // Each var occupies two slots in the context: for reads and writes. 1476 // Each var occupies two slots in the context: for reads and writes.
1477 int slot_index = var->index(); 1477 const int slot_index = var->index();
1478 int depth = scope()->ContextChainLength(var->scope()); 1478 const int depth = scope()->ContextChainLength(var->scope());
1479 __ mov(LoadGlobalViaContextDescriptor::DepthRegister(), 1479 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) {
1480 Operand(Smi::FromInt(depth))); 1480 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(),
1481 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), 1481 Operand(slot_index));
1482 Operand(Smi::FromInt(slot_index))); 1482 __ mov(LoadGlobalViaContextDescriptor::NameRegister(),
1483 __ mov(LoadGlobalViaContextDescriptor::NameRegister(), 1483 Operand(var->name()));
1484 Operand(var->name())); 1484 LoadGlobalViaContextStub stub(isolate(), depth);
1485 LoadGlobalViaContextStub stub(isolate(), depth); 1485 __ CallStub(&stub);
1486 __ CallStub(&stub); 1486 } else {
1487 1487 __ Push(Smi::FromInt(slot_index));
1488 __ Push(var->name());
1489 __ CallRuntime(Runtime::kLoadGlobalViaContext, 2);
1490 }
1488 } else { 1491 } else {
1489 __ ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); 1492 __ ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand());
1490 __ mov(LoadDescriptor::NameRegister(), Operand(var->name())); 1493 __ mov(LoadDescriptor::NameRegister(), Operand(var->name()));
1491 __ mov(LoadDescriptor::SlotRegister(), 1494 __ mov(LoadDescriptor::SlotRegister(),
1492 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); 1495 Operand(SmiFromSlot(proxy->VariableFeedbackSlot())));
1493 CallLoadIC(typeof_mode); 1496 CallLoadIC(typeof_mode);
1494 } 1497 }
1495 } 1498 }
1496 1499
1497 1500
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after
2767 __ mov(StoreDescriptor::NameRegister(), Operand(var->name())); 2770 __ mov(StoreDescriptor::NameRegister(), Operand(var->name()));
2768 __ ldr(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); 2771 __ ldr(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand());
2769 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); 2772 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot);
2770 CallStoreIC(); 2773 CallStoreIC();
2771 2774
2772 } else if (var->IsGlobalSlot()) { 2775 } else if (var->IsGlobalSlot()) {
2773 // Global var, const, or let. 2776 // Global var, const, or let.
2774 DCHECK(var->index() > 0); 2777 DCHECK(var->index() > 0);
2775 DCHECK(var->IsStaticGlobalObjectProperty()); 2778 DCHECK(var->IsStaticGlobalObjectProperty());
2776 // Each var occupies two slots in the context: for reads and writes. 2779 // Each var occupies two slots in the context: for reads and writes.
2777 int slot_index = var->index() + 1; 2780 const int slot_index = var->index() + 1;
2778 int depth = scope()->ContextChainLength(var->scope()); 2781 const int depth = scope()->ContextChainLength(var->scope());
2779 __ mov(StoreGlobalViaContextDescriptor::DepthRegister(), 2782 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) {
2780 Operand(Smi::FromInt(depth))); 2783 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(),
2781 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), 2784 Operand(slot_index));
2782 Operand(Smi::FromInt(slot_index))); 2785 __ mov(StoreGlobalViaContextDescriptor::NameRegister(),
2783 __ mov(StoreGlobalViaContextDescriptor::NameRegister(), 2786 Operand(var->name()));
2784 Operand(var->name())); 2787 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(r0));
2785 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(r0)); 2788 StoreGlobalViaContextStub stub(isolate(), depth, language_mode());
2786 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); 2789 __ CallStub(&stub);
2787 __ CallStub(&stub); 2790 } else {
2788 2791 __ Push(Smi::FromInt(slot_index));
2792 __ Push(var->name());
2793 __ push(r0);
2794 __ CallRuntime(is_strict(language_mode())
2795 ? Runtime::kStoreGlobalViaContext_Strict
2796 : Runtime::kStoreGlobalViaContext_Sloppy,
2797 3);
2798 }
2789 } else if (var->mode() == LET && op != Token::INIT_LET) { 2799 } else if (var->mode() == LET && op != Token::INIT_LET) {
2790 // Non-initializing assignment to let variable needs a write barrier. 2800 // Non-initializing assignment to let variable needs a write barrier.
2791 DCHECK(!var->IsLookupSlot()); 2801 DCHECK(!var->IsLookupSlot());
2792 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); 2802 DCHECK(var->IsStackAllocated() || var->IsContextSlot());
2793 Label assign; 2803 Label assign;
2794 MemOperand location = VarOperand(var, r1); 2804 MemOperand location = VarOperand(var, r1);
2795 __ ldr(r3, location); 2805 __ ldr(r3, location);
2796 __ CompareRoot(r3, Heap::kTheHoleValueRootIndex); 2806 __ CompareRoot(r3, Heap::kTheHoleValueRootIndex);
2797 __ b(ne, &assign); 2807 __ b(ne, &assign);
2798 __ mov(r3, Operand(var->name())); 2808 __ mov(r3, Operand(var->name()));
(...skipping 2781 matching lines...) Expand 10 before | Expand all | Expand 10 after
5580 DCHECK(interrupt_address == 5590 DCHECK(interrupt_address ==
5581 isolate->builtins()->OsrAfterStackCheck()->entry()); 5591 isolate->builtins()->OsrAfterStackCheck()->entry());
5582 return OSR_AFTER_STACK_CHECK; 5592 return OSR_AFTER_STACK_CHECK;
5583 } 5593 }
5584 5594
5585 5595
5586 } // namespace internal 5596 } // namespace internal
5587 } // namespace v8 5597 } // namespace v8
5588 5598
5589 #endif // V8_TARGET_ARCH_ARM 5599 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/arm/interface-descriptors-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698