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

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

Issue 1238253002: MIPS: [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/mips/code-stubs-mips.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 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 int const slot = var->index();
1478 int depth = scope()->ContextChainLength(var->scope()); 1478 int const depth = scope()->ContextChainLength(var->scope());
1479 __ li(LoadGlobalViaContextDescriptor::DepthRegister(), 1479 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) {
1480 Operand(Smi::FromInt(depth))); 1480 __ li(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
1481 __ li(LoadGlobalViaContextDescriptor::SlotRegister(), 1481 __ li(LoadGlobalViaContextDescriptor::NameRegister(), var->name());
1482 Operand(Smi::FromInt(slot_index))); 1482 LoadGlobalViaContextStub stub(isolate(), depth);
1483 __ li(LoadGlobalViaContextDescriptor::NameRegister(), Operand(var->name())); 1483 __ CallStub(&stub);
1484 LoadGlobalViaContextStub stub(isolate(), depth); 1484 } else {
1485 __ CallStub(&stub); 1485 __ Push(Smi::FromInt(slot));
1486 __ Push(var->name());
1487 __ CallRuntime(Runtime::kLoadGlobalViaContext, 2);
1488 }
1486 1489
1487 } else { 1490 } else {
1488 __ lw(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); 1491 __ lw(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand());
1489 __ li(LoadDescriptor::NameRegister(), Operand(var->name())); 1492 __ li(LoadDescriptor::NameRegister(), Operand(var->name()));
1490 __ li(LoadDescriptor::SlotRegister(), 1493 __ li(LoadDescriptor::SlotRegister(),
1491 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); 1494 Operand(SmiFromSlot(proxy->VariableFeedbackSlot())));
1492 CallLoadIC(typeof_mode); 1495 CallLoadIC(typeof_mode);
1493 } 1496 }
1494 } 1497 }
1495 1498
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after
2760 __ mov(StoreDescriptor::ValueRegister(), result_register()); 2763 __ mov(StoreDescriptor::ValueRegister(), result_register());
2761 __ li(StoreDescriptor::NameRegister(), Operand(var->name())); 2764 __ li(StoreDescriptor::NameRegister(), Operand(var->name()));
2762 __ lw(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); 2765 __ lw(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand());
2763 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); 2766 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot);
2764 CallStoreIC(); 2767 CallStoreIC();
2765 2768
2766 } else if (var->IsGlobalSlot()) { 2769 } else if (var->IsGlobalSlot()) {
2767 // Global var, const, or let. 2770 // Global var, const, or let.
2768 DCHECK(var->index() > 0); 2771 DCHECK(var->index() > 0);
2769 DCHECK(var->IsStaticGlobalObjectProperty()); 2772 DCHECK(var->IsStaticGlobalObjectProperty());
2773 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(a0));
2774 __ mov(StoreGlobalViaContextDescriptor::ValueRegister(), result_register());
2770 // Each var occupies two slots in the context: for reads and writes. 2775 // Each var occupies two slots in the context: for reads and writes.
2771 int slot_index = var->index() + 1; 2776 int const slot = var->index() + 1;
2772 int depth = scope()->ContextChainLength(var->scope()); 2777 int const depth = scope()->ContextChainLength(var->scope());
2773 __ li(StoreGlobalViaContextDescriptor::DepthRegister(), 2778 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) {
2774 Operand(Smi::FromInt(depth))); 2779 __ li(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
2775 __ li(StoreGlobalViaContextDescriptor::SlotRegister(), 2780 __ li(StoreGlobalViaContextDescriptor::NameRegister(), var->name());
2776 Operand(Smi::FromInt(slot_index))); 2781 StoreGlobalViaContextStub stub(isolate(), depth, language_mode());
2777 __ li(StoreGlobalViaContextDescriptor::NameRegister(), 2782 __ CallStub(&stub);
2778 Operand(var->name())); 2783 } else {
2779 __ mov(StoreGlobalViaContextDescriptor::ValueRegister(), result_register()); 2784 __ Push(Smi::FromInt(slot));
2780 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); 2785 __ Push(var->name());
2781 __ CallStub(&stub); 2786 __ Push(a0);
2787 __ CallRuntime(is_strict(language_mode())
2788 ? Runtime::kStoreGlobalViaContext_Strict
2789 : Runtime::kStoreGlobalViaContext_Sloppy,
2790 3);
2791 }
2782 2792
2783 } else if (var->mode() == LET && op != Token::INIT_LET) { 2793 } else if (var->mode() == LET && op != Token::INIT_LET) {
2784 // Non-initializing assignment to let variable needs a write barrier. 2794 // Non-initializing assignment to let variable needs a write barrier.
2785 DCHECK(!var->IsLookupSlot()); 2795 DCHECK(!var->IsLookupSlot());
2786 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); 2796 DCHECK(var->IsStackAllocated() || var->IsContextSlot());
2787 Label assign; 2797 Label assign;
2788 MemOperand location = VarOperand(var, a1); 2798 MemOperand location = VarOperand(var, a1);
2789 __ lw(a3, location); 2799 __ lw(a3, location);
2790 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex); 2800 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex);
2791 __ Branch(&assign, ne, a3, Operand(t0)); 2801 __ Branch(&assign, ne, a3, Operand(t0));
(...skipping 2753 matching lines...) Expand 10 before | Expand all | Expand 10 after
5545 reinterpret_cast<uint32_t>( 5555 reinterpret_cast<uint32_t>(
5546 isolate->builtins()->OsrAfterStackCheck()->entry())); 5556 isolate->builtins()->OsrAfterStackCheck()->entry()));
5547 return OSR_AFTER_STACK_CHECK; 5557 return OSR_AFTER_STACK_CHECK;
5548 } 5558 }
5549 5559
5550 5560
5551 } // namespace internal 5561 } // namespace internal
5552 } // namespace v8 5562 } // namespace v8
5553 5563
5554 #endif // V8_TARGET_ARCH_MIPS 5564 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/mips/interface-descriptors-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698