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

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

Issue 1238143002: [stubs] Optimize LoadGlobalViaContextStub and StoreGlobalViaContextStub. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix ARM typo. 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
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 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after
1400 1400
1401 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy, 1401 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy,
1402 TypeofMode typeof_mode) { 1402 TypeofMode typeof_mode) {
1403 Variable* var = proxy->var(); 1403 Variable* var = proxy->var();
1404 DCHECK(var->IsUnallocatedOrGlobalSlot() || 1404 DCHECK(var->IsUnallocatedOrGlobalSlot() ||
1405 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL)); 1405 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL));
1406 if (var->IsGlobalSlot()) { 1406 if (var->IsGlobalSlot()) {
1407 DCHECK(var->index() > 0); 1407 DCHECK(var->index() > 0);
1408 DCHECK(var->IsStaticGlobalObjectProperty()); 1408 DCHECK(var->IsStaticGlobalObjectProperty());
1409 // Each var occupies two slots in the context: for reads and writes. 1409 // Each var occupies two slots in the context: for reads and writes.
1410 int slot_index = var->index(); 1410 int const slot = var->index();
1411 int depth = scope()->ContextChainLength(var->scope()); 1411 int const depth = scope()->ContextChainLength(var->scope());
1412 __ li(LoadGlobalViaContextDescriptor::DepthRegister(), 1412 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) {
1413 Operand(Smi::FromInt(depth))); 1413 __ li(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
1414 __ li(LoadGlobalViaContextDescriptor::SlotRegister(), 1414 __ li(LoadGlobalViaContextDescriptor::NameRegister(), var->name());
1415 Operand(Smi::FromInt(slot_index))); 1415 LoadGlobalViaContextStub stub(isolate(), depth);
1416 __ li(LoadGlobalViaContextDescriptor::NameRegister(), Operand(var->name())); 1416 __ CallStub(&stub);
1417 LoadGlobalViaContextStub stub(isolate(), depth); 1417 } else {
1418 __ CallStub(&stub); 1418 __ Push(Smi::FromInt(slot));
1419 __ Push(var->name());
1420 __ CallRuntime(Runtime::kLoadGlobalViaContext, 2);
1421 }
1419 1422
1420 } else { 1423 } else {
1421 __ lw(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); 1424 __ lw(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand());
1422 __ li(LoadDescriptor::NameRegister(), Operand(var->name())); 1425 __ li(LoadDescriptor::NameRegister(), Operand(var->name()));
1423 __ li(LoadDescriptor::SlotRegister(), 1426 __ li(LoadDescriptor::SlotRegister(),
1424 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); 1427 Operand(SmiFromSlot(proxy->VariableFeedbackSlot())));
1425 CallLoadIC(typeof_mode); 1428 CallLoadIC(typeof_mode);
1426 } 1429 }
1427 } 1430 }
1428 1431
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after
2693 __ mov(StoreDescriptor::ValueRegister(), result_register()); 2696 __ mov(StoreDescriptor::ValueRegister(), result_register());
2694 __ li(StoreDescriptor::NameRegister(), Operand(var->name())); 2697 __ li(StoreDescriptor::NameRegister(), Operand(var->name()));
2695 __ lw(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); 2698 __ lw(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand());
2696 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); 2699 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot);
2697 CallStoreIC(); 2700 CallStoreIC();
2698 2701
2699 } else if (var->IsGlobalSlot()) { 2702 } else if (var->IsGlobalSlot()) {
2700 // Global var, const, or let. 2703 // Global var, const, or let.
2701 DCHECK(var->index() > 0); 2704 DCHECK(var->index() > 0);
2702 DCHECK(var->IsStaticGlobalObjectProperty()); 2705 DCHECK(var->IsStaticGlobalObjectProperty());
2706 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(a0));
2707 __ mov(StoreGlobalViaContextDescriptor::ValueRegister(), result_register());
2703 // Each var occupies two slots in the context: for reads and writes. 2708 // Each var occupies two slots in the context: for reads and writes.
2704 int slot_index = var->index() + 1; 2709 int const slot = var->index() + 1;
2705 int depth = scope()->ContextChainLength(var->scope()); 2710 int const depth = scope()->ContextChainLength(var->scope());
2706 __ li(StoreGlobalViaContextDescriptor::DepthRegister(), 2711 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) {
2707 Operand(Smi::FromInt(depth))); 2712 __ li(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
2708 __ li(StoreGlobalViaContextDescriptor::SlotRegister(), 2713 __ li(StoreGlobalViaContextDescriptor::NameRegister(), var->name());
2709 Operand(Smi::FromInt(slot_index))); 2714 StoreGlobalViaContextStub stub(isolate(), depth, language_mode());
2710 __ li(StoreGlobalViaContextDescriptor::NameRegister(), 2715 __ CallStub(&stub);
2711 Operand(var->name())); 2716 } else {
2712 __ mov(StoreGlobalViaContextDescriptor::ValueRegister(), result_register()); 2717 __ Push(Smi::FromInt(slot));
2713 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); 2718 __ Push(var->name());
2714 __ CallStub(&stub); 2719 __ Push(a0);
2720 __ CallRuntime(is_strict(language_mode())
2721 ? Runtime::kStoreGlobalViaContext_Strict
2722 : Runtime::kStoreGlobalViaContext_Sloppy,
2723 3);
2724 }
2715 2725
2716 } else if (var->mode() == LET && op != Token::INIT_LET) { 2726 } else if (var->mode() == LET && op != Token::INIT_LET) {
2717 // Non-initializing assignment to let variable needs a write barrier. 2727 // Non-initializing assignment to let variable needs a write barrier.
2718 DCHECK(!var->IsLookupSlot()); 2728 DCHECK(!var->IsLookupSlot());
2719 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); 2729 DCHECK(var->IsStackAllocated() || var->IsContextSlot());
2720 Label assign; 2730 Label assign;
2721 MemOperand location = VarOperand(var, a1); 2731 MemOperand location = VarOperand(var, a1);
2722 __ lw(a3, location); 2732 __ lw(a3, location);
2723 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex); 2733 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex);
2724 __ Branch(&assign, ne, a3, Operand(t0)); 2734 __ Branch(&assign, ne, a3, Operand(t0));
(...skipping 2701 matching lines...) Expand 10 before | Expand all | Expand 10 after
5426 reinterpret_cast<uint32_t>( 5436 reinterpret_cast<uint32_t>(
5427 isolate->builtins()->OsrAfterStackCheck()->entry())); 5437 isolate->builtins()->OsrAfterStackCheck()->entry()));
5428 return OSR_AFTER_STACK_CHECK; 5438 return OSR_AFTER_STACK_CHECK;
5429 } 5439 }
5430 5440
5431 5441
5432 } // namespace internal 5442 } // namespace internal
5433 } // namespace v8 5443 } // namespace v8
5434 5444
5435 #endif // V8_TARGET_ARCH_MIPS 5445 #endif // V8_TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698