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

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

Issue 1224793002: Loads and stores to global vars are now made via property cell shortcuts installed into parent scri… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressing comments 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 | « no previous file | 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 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after
1485 __ jmp(done); 1485 __ jmp(done);
1486 } 1486 }
1487 } 1487 }
1488 1488
1489 1489
1490 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy, 1490 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy,
1491 TypeofState typeof_state) { 1491 TypeofState typeof_state) {
1492 Variable* var = proxy->var(); 1492 Variable* var = proxy->var();
1493 DCHECK(var->IsUnallocatedOrGlobalSlot() || 1493 DCHECK(var->IsUnallocatedOrGlobalSlot() ||
1494 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL)); 1494 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL));
1495 __ ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); 1495 if (var->IsGlobalSlot()) {
1496 __ mov(LoadDescriptor::NameRegister(), Operand(var->name())); 1496 DCHECK(var->index() > 0);
1497 __ mov(LoadDescriptor::SlotRegister(), 1497 DCHECK(var->IsStaticGlobalObjectProperty());
1498 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); 1498 // Each var occupies two slots in the context: for reads and writes.
1499 // Inside typeof use a regular load, not a contextual load, to avoid 1499 int slot_index = var->index();
1500 // a reference error. 1500 int depth = scope()->ContextChainLength(var->scope());
1501 CallLoadIC(typeof_state == NOT_INSIDE_TYPEOF ? CONTEXTUAL : NOT_CONTEXTUAL); 1501 __ mov(LoadGlobalViaContextDescriptor::DepthRegister(),
1502 Operand(Smi::FromInt(depth)));
1503 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(),
1504 Operand(Smi::FromInt(slot_index)));
1505 __ mov(LoadGlobalViaContextDescriptor::NameRegister(),
1506 Operand(var->name()));
1507 LoadGlobalViaContextStub stub(isolate(), depth);
1508 __ CallStub(&stub);
1509
1510 } else {
1511 __ ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand());
1512 __ mov(LoadDescriptor::NameRegister(), Operand(var->name()));
1513 __ mov(LoadDescriptor::SlotRegister(),
1514 Operand(SmiFromSlot(proxy->VariableFeedbackSlot())));
1515 // Inside typeof use a regular load, not a contextual load, to avoid
1516 // a reference error.
1517 CallLoadIC(typeof_state == NOT_INSIDE_TYPEOF ? CONTEXTUAL : NOT_CONTEXTUAL);
1518 }
1502 } 1519 }
1503 1520
1504 1521
1505 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, 1522 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy,
1506 TypeofState typeof_state) { 1523 TypeofState typeof_state) {
1507 // Record position before possible IC call. 1524 // Record position before possible IC call.
1508 SetExpressionPosition(proxy); 1525 SetExpressionPosition(proxy);
1509 PrepareForBailoutForId(proxy->BeforeId(), NO_REGISTERS); 1526 PrepareForBailoutForId(proxy->BeforeId(), NO_REGISTERS);
1510 Variable* var = proxy->var(); 1527 Variable* var = proxy->var();
1511 1528
(...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after
2745 __ mov(r3, result_register()); 2762 __ mov(r3, result_register());
2746 int offset = Context::SlotOffset(var->index()); 2763 int offset = Context::SlotOffset(var->index());
2747 __ RecordWriteContextSlot( 2764 __ RecordWriteContextSlot(
2748 r1, offset, r3, r2, kLRHasBeenSaved, kDontSaveFPRegs); 2765 r1, offset, r3, r2, kLRHasBeenSaved, kDontSaveFPRegs);
2749 } 2766 }
2750 } 2767 }
2751 2768
2752 2769
2753 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, 2770 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op,
2754 FeedbackVectorICSlot slot) { 2771 FeedbackVectorICSlot slot) {
2755 if (var->IsUnallocatedOrGlobalSlot()) { 2772 if (var->IsUnallocated()) {
2756 // Global var, const, or let. 2773 // Global var, const, or let.
2757 __ mov(StoreDescriptor::NameRegister(), Operand(var->name())); 2774 __ mov(StoreDescriptor::NameRegister(), Operand(var->name()));
2758 __ ldr(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); 2775 __ ldr(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand());
2759 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); 2776 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot);
2760 CallStoreIC(); 2777 CallStoreIC();
2761 2778
2779 } else if (var->IsGlobalSlot()) {
2780 // Global var, const, or let.
2781 DCHECK(var->index() > 0);
2782 DCHECK(var->IsStaticGlobalObjectProperty());
2783 // Each var occupies two slots in the context: for reads and writes.
2784 int slot_index = var->index() + 1;
2785 int depth = scope()->ContextChainLength(var->scope());
2786 __ mov(StoreGlobalViaContextDescriptor::DepthRegister(),
2787 Operand(Smi::FromInt(depth)));
2788 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(),
2789 Operand(Smi::FromInt(slot_index)));
2790 __ mov(StoreGlobalViaContextDescriptor::NameRegister(),
2791 Operand(var->name()));
2792 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(r0));
2793 StoreGlobalViaContextStub stub(isolate(), depth, language_mode());
2794 __ CallStub(&stub);
2795
2762 } else if (var->mode() == LET && op != Token::INIT_LET) { 2796 } else if (var->mode() == LET && op != Token::INIT_LET) {
2763 // Non-initializing assignment to let variable needs a write barrier. 2797 // Non-initializing assignment to let variable needs a write barrier.
2764 DCHECK(!var->IsLookupSlot()); 2798 DCHECK(!var->IsLookupSlot());
2765 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); 2799 DCHECK(var->IsStackAllocated() || var->IsContextSlot());
2766 Label assign; 2800 Label assign;
2767 MemOperand location = VarOperand(var, r1); 2801 MemOperand location = VarOperand(var, r1);
2768 __ ldr(r3, location); 2802 __ ldr(r3, location);
2769 __ CompareRoot(r3, Heap::kTheHoleValueRootIndex); 2803 __ CompareRoot(r3, Heap::kTheHoleValueRootIndex);
2770 __ b(ne, &assign); 2804 __ b(ne, &assign);
2771 __ mov(r3, Operand(var->name())); 2805 __ mov(r3, Operand(var->name()));
(...skipping 2819 matching lines...) Expand 10 before | Expand all | Expand 10 after
5591 DCHECK(interrupt_address == 5625 DCHECK(interrupt_address ==
5592 isolate->builtins()->OsrAfterStackCheck()->entry()); 5626 isolate->builtins()->OsrAfterStackCheck()->entry());
5593 return OSR_AFTER_STACK_CHECK; 5627 return OSR_AFTER_STACK_CHECK;
5594 } 5628 }
5595 5629
5596 5630
5597 } // namespace internal 5631 } // namespace internal
5598 } // namespace v8 5632 } // namespace v8
5599 5633
5600 #endif // V8_TARGET_ARCH_ARM 5634 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/interface-descriptors-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698