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

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

Powered by Google App Engine
This is Rietveld 408576698