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

Side by Side Diff: src/mips64/full-codegen-mips64.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/mips64/code-stubs-mips64.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 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 1463
1464 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy, 1464 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy,
1465 TypeofMode typeof_mode) { 1465 TypeofMode typeof_mode) {
1466 Variable* var = proxy->var(); 1466 Variable* var = proxy->var();
1467 DCHECK(var->IsUnallocatedOrGlobalSlot() || 1467 DCHECK(var->IsUnallocatedOrGlobalSlot() ||
1468 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL)); 1468 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL));
1469 if (var->IsGlobalSlot()) { 1469 if (var->IsGlobalSlot()) {
1470 DCHECK(var->index() > 0); 1470 DCHECK(var->index() > 0);
1471 DCHECK(var->IsStaticGlobalObjectProperty()); 1471 DCHECK(var->IsStaticGlobalObjectProperty());
1472 // Each var occupies two slots in the context: for reads and writes. 1472 // Each var occupies two slots in the context: for reads and writes.
1473 int slot_index = var->index(); 1473 int const slot = var->index();
1474 int depth = scope()->ContextChainLength(var->scope()); 1474 int const depth = scope()->ContextChainLength(var->scope());
1475 __ li(LoadGlobalViaContextDescriptor::DepthRegister(), 1475 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) {
1476 Operand(Smi::FromInt(depth))); 1476 __ li(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
1477 __ li(LoadGlobalViaContextDescriptor::SlotRegister(), 1477 __ li(LoadGlobalViaContextDescriptor::NameRegister(), var->name());
1478 Operand(Smi::FromInt(slot_index))); 1478 LoadGlobalViaContextStub stub(isolate(), depth);
1479 __ li(LoadGlobalViaContextDescriptor::NameRegister(), Operand(var->name())); 1479 __ CallStub(&stub);
1480 LoadGlobalViaContextStub stub(isolate(), depth); 1480 } else {
1481 __ CallStub(&stub); 1481 __ Push(Smi::FromInt(slot));
1482 __ Push(var->name());
1483 __ CallRuntime(Runtime::kLoadGlobalViaContext, 2);
1484 }
1482 1485
1483 } else { 1486 } else {
1484 __ ld(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); 1487 __ ld(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand());
1485 __ li(LoadDescriptor::NameRegister(), Operand(var->name())); 1488 __ li(LoadDescriptor::NameRegister(), Operand(var->name()));
1486 __ li(LoadDescriptor::SlotRegister(), 1489 __ li(LoadDescriptor::SlotRegister(),
1487 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); 1490 Operand(SmiFromSlot(proxy->VariableFeedbackSlot())));
1488 CallLoadIC(typeof_mode); 1491 CallLoadIC(typeof_mode);
1489 } 1492 }
1490 } 1493 }
1491 1494
(...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after
2757 __ mov(StoreDescriptor::ValueRegister(), result_register()); 2760 __ mov(StoreDescriptor::ValueRegister(), result_register());
2758 __ li(StoreDescriptor::NameRegister(), Operand(var->name())); 2761 __ li(StoreDescriptor::NameRegister(), Operand(var->name()));
2759 __ ld(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); 2762 __ ld(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand());
2760 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); 2763 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot);
2761 CallStoreIC(); 2764 CallStoreIC();
2762 2765
2763 } else if (var->IsGlobalSlot()) { 2766 } else if (var->IsGlobalSlot()) {
2764 // Global var, const, or let. 2767 // Global var, const, or let.
2765 DCHECK(var->index() > 0); 2768 DCHECK(var->index() > 0);
2766 DCHECK(var->IsStaticGlobalObjectProperty()); 2769 DCHECK(var->IsStaticGlobalObjectProperty());
2770 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(a0));
2771 __ mov(StoreGlobalViaContextDescriptor::ValueRegister(), result_register());
2767 // Each var occupies two slots in the context: for reads and writes. 2772 // Each var occupies two slots in the context: for reads and writes.
2768 int slot_index = var->index() + 1; 2773 int const slot = var->index() + 1;
2769 int depth = scope()->ContextChainLength(var->scope()); 2774 int const depth = scope()->ContextChainLength(var->scope());
2770 __ li(StoreGlobalViaContextDescriptor::DepthRegister(), 2775 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) {
2771 Operand(Smi::FromInt(depth))); 2776 __ li(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
2772 __ li(StoreGlobalViaContextDescriptor::SlotRegister(), 2777 __ li(StoreGlobalViaContextDescriptor::NameRegister(), var->name());
2773 Operand(Smi::FromInt(slot_index))); 2778 StoreGlobalViaContextStub stub(isolate(), depth, language_mode());
2774 __ li(StoreGlobalViaContextDescriptor::NameRegister(), 2779 __ CallStub(&stub);
2775 Operand(var->name())); 2780 } else {
2776 __ mov(StoreGlobalViaContextDescriptor::ValueRegister(), result_register()); 2781 __ Push(Smi::FromInt(slot));
2777 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); 2782 __ Push(var->name());
2778 __ CallStub(&stub); 2783 __ Push(a0);
2784 __ CallRuntime(is_strict(language_mode())
2785 ? Runtime::kStoreGlobalViaContext_Strict
2786 : Runtime::kStoreGlobalViaContext_Sloppy,
2787 3);
2788 }
2779 2789
2780 } else if (var->mode() == LET && op != Token::INIT_LET) { 2790 } else if (var->mode() == LET && op != Token::INIT_LET) {
2781 // Non-initializing assignment to let variable needs a write barrier. 2791 // Non-initializing assignment to let variable needs a write barrier.
2782 DCHECK(!var->IsLookupSlot()); 2792 DCHECK(!var->IsLookupSlot());
2783 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); 2793 DCHECK(var->IsStackAllocated() || var->IsContextSlot());
2784 Label assign; 2794 Label assign;
2785 MemOperand location = VarOperand(var, a1); 2795 MemOperand location = VarOperand(var, a1);
2786 __ ld(a3, location); 2796 __ ld(a3, location);
2787 __ LoadRoot(a4, Heap::kTheHoleValueRootIndex); 2797 __ LoadRoot(a4, Heap::kTheHoleValueRootIndex);
2788 __ Branch(&assign, ne, a3, Operand(a4)); 2798 __ Branch(&assign, ne, a3, Operand(a4));
(...skipping 2761 matching lines...) Expand 10 before | Expand all | Expand 10 after
5550 reinterpret_cast<uint64_t>( 5560 reinterpret_cast<uint64_t>(
5551 isolate->builtins()->OsrAfterStackCheck()->entry())); 5561 isolate->builtins()->OsrAfterStackCheck()->entry()));
5552 return OSR_AFTER_STACK_CHECK; 5562 return OSR_AFTER_STACK_CHECK;
5553 } 5563 }
5554 5564
5555 5565
5556 } // namespace internal 5566 } // namespace internal
5557 } // namespace v8 5567 } // namespace v8
5558 5568
5559 #endif // V8_TARGET_ARCH_MIPS64 5569 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips64/code-stubs-mips64.cc ('k') | src/mips64/interface-descriptors-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698