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

Side by Side Diff: src/mips64/full-codegen-mips64.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_MIPS64 7 #if V8_TARGET_ARCH_MIPS64
8 8
9 // Note on Mips implementation: 9 // Note on Mips implementation:
10 // 10 //
(...skipping 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after
1396 1396
1397 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy, 1397 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy,
1398 TypeofMode typeof_mode) { 1398 TypeofMode typeof_mode) {
1399 Variable* var = proxy->var(); 1399 Variable* var = proxy->var();
1400 DCHECK(var->IsUnallocatedOrGlobalSlot() || 1400 DCHECK(var->IsUnallocatedOrGlobalSlot() ||
1401 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL)); 1401 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL));
1402 if (var->IsGlobalSlot()) { 1402 if (var->IsGlobalSlot()) {
1403 DCHECK(var->index() > 0); 1403 DCHECK(var->index() > 0);
1404 DCHECK(var->IsStaticGlobalObjectProperty()); 1404 DCHECK(var->IsStaticGlobalObjectProperty());
1405 // Each var occupies two slots in the context: for reads and writes. 1405 // Each var occupies two slots in the context: for reads and writes.
1406 int slot_index = var->index(); 1406 int const slot = var->index();
1407 int depth = scope()->ContextChainLength(var->scope()); 1407 int const depth = scope()->ContextChainLength(var->scope());
1408 __ li(LoadGlobalViaContextDescriptor::DepthRegister(), 1408 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) {
1409 Operand(Smi::FromInt(depth))); 1409 __ li(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
1410 __ li(LoadGlobalViaContextDescriptor::SlotRegister(), 1410 __ li(LoadGlobalViaContextDescriptor::NameRegister(), var->name());
1411 Operand(Smi::FromInt(slot_index))); 1411 LoadGlobalViaContextStub stub(isolate(), depth);
1412 __ li(LoadGlobalViaContextDescriptor::NameRegister(), Operand(var->name())); 1412 __ CallStub(&stub);
1413 LoadGlobalViaContextStub stub(isolate(), depth); 1413 } else {
1414 __ CallStub(&stub); 1414 __ Push(Smi::FromInt(slot));
1415 __ Push(var->name());
1416 __ CallRuntime(Runtime::kLoadGlobalViaContext, 2);
1417 }
1415 1418
1416 } else { 1419 } else {
1417 __ ld(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); 1420 __ ld(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand());
1418 __ li(LoadDescriptor::NameRegister(), Operand(var->name())); 1421 __ li(LoadDescriptor::NameRegister(), Operand(var->name()));
1419 __ li(LoadDescriptor::SlotRegister(), 1422 __ li(LoadDescriptor::SlotRegister(),
1420 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); 1423 Operand(SmiFromSlot(proxy->VariableFeedbackSlot())));
1421 CallLoadIC(typeof_mode); 1424 CallLoadIC(typeof_mode);
1422 } 1425 }
1423 } 1426 }
1424 1427
(...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after
2690 __ mov(StoreDescriptor::ValueRegister(), result_register()); 2693 __ mov(StoreDescriptor::ValueRegister(), result_register());
2691 __ li(StoreDescriptor::NameRegister(), Operand(var->name())); 2694 __ li(StoreDescriptor::NameRegister(), Operand(var->name()));
2692 __ ld(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); 2695 __ ld(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand());
2693 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); 2696 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot);
2694 CallStoreIC(); 2697 CallStoreIC();
2695 2698
2696 } else if (var->IsGlobalSlot()) { 2699 } else if (var->IsGlobalSlot()) {
2697 // Global var, const, or let. 2700 // Global var, const, or let.
2698 DCHECK(var->index() > 0); 2701 DCHECK(var->index() > 0);
2699 DCHECK(var->IsStaticGlobalObjectProperty()); 2702 DCHECK(var->IsStaticGlobalObjectProperty());
2703 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(a0));
2704 __ mov(StoreGlobalViaContextDescriptor::ValueRegister(), result_register());
2700 // Each var occupies two slots in the context: for reads and writes. 2705 // Each var occupies two slots in the context: for reads and writes.
2701 int slot_index = var->index() + 1; 2706 int const slot = var->index() + 1;
2702 int depth = scope()->ContextChainLength(var->scope()); 2707 int const depth = scope()->ContextChainLength(var->scope());
2703 __ li(StoreGlobalViaContextDescriptor::DepthRegister(), 2708 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) {
2704 Operand(Smi::FromInt(depth))); 2709 __ li(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
2705 __ li(StoreGlobalViaContextDescriptor::SlotRegister(), 2710 __ li(StoreGlobalViaContextDescriptor::NameRegister(), var->name());
2706 Operand(Smi::FromInt(slot_index))); 2711 StoreGlobalViaContextStub stub(isolate(), depth, language_mode());
2707 __ li(StoreGlobalViaContextDescriptor::NameRegister(), 2712 __ CallStub(&stub);
2708 Operand(var->name())); 2713 } else {
2709 __ mov(StoreGlobalViaContextDescriptor::ValueRegister(), result_register()); 2714 __ Push(Smi::FromInt(slot));
2710 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); 2715 __ Push(var->name());
2711 __ CallStub(&stub); 2716 __ Push(a0);
2717 __ CallRuntime(is_strict(language_mode())
2718 ? Runtime::kStoreGlobalViaContext_Strict
2719 : Runtime::kStoreGlobalViaContext_Sloppy,
2720 3);
2721 }
2712 2722
2713 } else if (var->mode() == LET && op != Token::INIT_LET) { 2723 } else if (var->mode() == LET && op != Token::INIT_LET) {
2714 // Non-initializing assignment to let variable needs a write barrier. 2724 // Non-initializing assignment to let variable needs a write barrier.
2715 DCHECK(!var->IsLookupSlot()); 2725 DCHECK(!var->IsLookupSlot());
2716 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); 2726 DCHECK(var->IsStackAllocated() || var->IsContextSlot());
2717 Label assign; 2727 Label assign;
2718 MemOperand location = VarOperand(var, a1); 2728 MemOperand location = VarOperand(var, a1);
2719 __ ld(a3, location); 2729 __ ld(a3, location);
2720 __ LoadRoot(a4, Heap::kTheHoleValueRootIndex); 2730 __ LoadRoot(a4, Heap::kTheHoleValueRootIndex);
2721 __ Branch(&assign, ne, a3, Operand(a4)); 2731 __ Branch(&assign, ne, a3, Operand(a4));
(...skipping 2709 matching lines...) Expand 10 before | Expand all | Expand 10 after
5431 reinterpret_cast<uint64_t>( 5441 reinterpret_cast<uint64_t>(
5432 isolate->builtins()->OsrAfterStackCheck()->entry())); 5442 isolate->builtins()->OsrAfterStackCheck()->entry()));
5433 return OSR_AFTER_STACK_CHECK; 5443 return OSR_AFTER_STACK_CHECK;
5434 } 5444 }
5435 5445
5436 5446
5437 } // namespace internal 5447 } // namespace internal
5438 } // namespace v8 5448 } // namespace v8
5439 5449
5440 #endif // V8_TARGET_ARCH_MIPS64 5450 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698