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

Side by Side Diff: src/mips/full-codegen-mips.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 | « src/interface-descriptors.cc ('k') | src/mips/interface-descriptors-mips.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_MIPS 7 #if V8_TARGET_ARCH_MIPS
8 8
9 // Note on Mips implementation: 9 // Note on Mips implementation:
10 // 10 //
(...skipping 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 __ Branch(done); 1477 __ Branch(done);
1478 } 1478 }
1479 } 1479 }
1480 1480
1481 1481
1482 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy, 1482 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy,
1483 TypeofState typeof_state) { 1483 TypeofState typeof_state) {
1484 Variable* var = proxy->var(); 1484 Variable* var = proxy->var();
1485 DCHECK(var->IsUnallocatedOrGlobalSlot() || 1485 DCHECK(var->IsUnallocatedOrGlobalSlot() ||
1486 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL)); 1486 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL));
1487 __ lw(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); 1487 if (var->IsGlobalSlot()) {
1488 __ li(LoadDescriptor::NameRegister(), Operand(var->name())); 1488 DCHECK(var->index() > 0);
1489 __ li(LoadDescriptor::SlotRegister(), 1489 DCHECK(var->IsStaticGlobalObjectProperty());
1490 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); 1490 // Each var occupies two slots in the context: for reads and writes.
1491 // Inside typeof use a regular load, not a contextual load, to avoid 1491 int slot_index = var->index();
1492 // a reference error. 1492 int depth = scope()->ContextChainLength(var->scope());
1493 CallLoadIC(typeof_state == NOT_INSIDE_TYPEOF ? CONTEXTUAL : NOT_CONTEXTUAL); 1493 __ li(LoadGlobalViaContextDescriptor::DepthRegister(),
1494 Operand(Smi::FromInt(depth)));
1495 __ li(LoadGlobalViaContextDescriptor::SlotRegister(),
1496 Operand(Smi::FromInt(slot_index)));
1497 __ li(LoadGlobalViaContextDescriptor::NameRegister(), Operand(var->name()));
1498 LoadGlobalViaContextStub stub(isolate(), depth);
1499 __ CallStub(&stub);
1500
1501 } else {
1502 __ lw(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand());
1503 __ li(LoadDescriptor::NameRegister(), Operand(var->name()));
1504 __ li(LoadDescriptor::SlotRegister(),
1505 Operand(SmiFromSlot(proxy->VariableFeedbackSlot())));
1506 // Inside typeof use a regular load, not a contextual load, to avoid
1507 // a reference error.
1508 CallLoadIC(typeof_state == NOT_INSIDE_TYPEOF ? CONTEXTUAL : NOT_CONTEXTUAL);
1509 }
1494 } 1510 }
1495 1511
1496 1512
1497 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, 1513 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy,
1498 TypeofState typeof_state) { 1514 TypeofState typeof_state) {
1499 // Record position before possible IC call. 1515 // Record position before possible IC call.
1500 SetExpressionPosition(proxy); 1516 SetExpressionPosition(proxy);
1501 PrepareForBailoutForId(proxy->BeforeId(), NO_REGISTERS); 1517 PrepareForBailoutForId(proxy->BeforeId(), NO_REGISTERS);
1502 Variable* var = proxy->var(); 1518 Variable* var = proxy->var();
1503 1519
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after
2732 __ Move(a3, result_register()); 2748 __ Move(a3, result_register());
2733 int offset = Context::SlotOffset(var->index()); 2749 int offset = Context::SlotOffset(var->index());
2734 __ RecordWriteContextSlot( 2750 __ RecordWriteContextSlot(
2735 a1, offset, a3, a2, kRAHasBeenSaved, kDontSaveFPRegs); 2751 a1, offset, a3, a2, kRAHasBeenSaved, kDontSaveFPRegs);
2736 } 2752 }
2737 } 2753 }
2738 2754
2739 2755
2740 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, 2756 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op,
2741 FeedbackVectorICSlot slot) { 2757 FeedbackVectorICSlot slot) {
2742 if (var->IsUnallocatedOrGlobalSlot()) { 2758 if (var->IsUnallocated()) {
2743 // Global var, const, or let. 2759 // Global var, const, or let.
2744 __ mov(StoreDescriptor::ValueRegister(), result_register()); 2760 __ mov(StoreDescriptor::ValueRegister(), result_register());
2745 __ li(StoreDescriptor::NameRegister(), Operand(var->name())); 2761 __ li(StoreDescriptor::NameRegister(), Operand(var->name()));
2746 __ lw(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); 2762 __ lw(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand());
2747 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); 2763 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot);
2748 CallStoreIC(); 2764 CallStoreIC();
2749 2765
2766 } else if (var->IsGlobalSlot()) {
2767 // Global var, const, or let.
2768 DCHECK(var->index() > 0);
2769 DCHECK(var->IsStaticGlobalObjectProperty());
2770 // Each var occupies two slots in the context: for reads and writes.
2771 int slot_index = var->index() + 1;
2772 int depth = scope()->ContextChainLength(var->scope());
2773 __ li(StoreGlobalViaContextDescriptor::DepthRegister(),
2774 Operand(Smi::FromInt(depth)));
2775 __ li(StoreGlobalViaContextDescriptor::SlotRegister(),
2776 Operand(Smi::FromInt(slot_index)));
2777 __ li(StoreGlobalViaContextDescriptor::NameRegister(),
2778 Operand(var->name()));
2779 __ mov(StoreGlobalViaContextDescriptor::ValueRegister(), result_register());
2780 StoreGlobalViaContextStub stub(isolate(), depth, language_mode());
2781 __ CallStub(&stub);
2782
2750 } else if (var->mode() == LET && op != Token::INIT_LET) { 2783 } else if (var->mode() == LET && op != Token::INIT_LET) {
2751 // Non-initializing assignment to let variable needs a write barrier. 2784 // Non-initializing assignment to let variable needs a write barrier.
2752 DCHECK(!var->IsLookupSlot()); 2785 DCHECK(!var->IsLookupSlot());
2753 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); 2786 DCHECK(var->IsStackAllocated() || var->IsContextSlot());
2754 Label assign; 2787 Label assign;
2755 MemOperand location = VarOperand(var, a1); 2788 MemOperand location = VarOperand(var, a1);
2756 __ lw(a3, location); 2789 __ lw(a3, location);
2757 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex); 2790 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex);
2758 __ Branch(&assign, ne, a3, Operand(t0)); 2791 __ Branch(&assign, ne, a3, Operand(t0));
2759 __ li(a3, Operand(var->name())); 2792 __ li(a3, Operand(var->name()));
(...skipping 2790 matching lines...) Expand 10 before | Expand all | Expand 10 after
5550 reinterpret_cast<uint32_t>( 5583 reinterpret_cast<uint32_t>(
5551 isolate->builtins()->OsrAfterStackCheck()->entry())); 5584 isolate->builtins()->OsrAfterStackCheck()->entry()));
5552 return OSR_AFTER_STACK_CHECK; 5585 return OSR_AFTER_STACK_CHECK;
5553 } 5586 }
5554 5587
5555 5588
5556 } // namespace internal 5589 } // namespace internal
5557 } // namespace v8 5590 } // namespace v8
5558 5591
5559 #endif // V8_TARGET_ARCH_MIPS 5592 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/interface-descriptors.cc ('k') | src/mips/interface-descriptors-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698