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

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

Issue 1258213002: [stubs] Use a single slot for context globals. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1399 1399
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.
1410 int const slot = var->index(); 1409 int const slot = var->index();
1411 int const depth = scope()->ContextChainLength(var->scope()); 1410 int const depth = scope()->ContextChainLength(var->scope());
1412 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { 1411 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) {
1413 __ li(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); 1412 __ li(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
1414 LoadGlobalViaContextStub stub(isolate(), depth); 1413 LoadGlobalViaContextStub stub(isolate(), depth);
1415 __ CallStub(&stub); 1414 __ CallStub(&stub);
1416 } else { 1415 } else {
1417 __ Push(Smi::FromInt(slot)); 1416 __ Push(Smi::FromInt(slot));
1418 __ CallRuntime(Runtime::kLoadGlobalViaContext, 1); 1417 __ CallRuntime(Runtime::kLoadGlobalViaContext, 1);
1419 } 1418 }
(...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after
2696 __ lw(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); 2695 __ lw(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand());
2697 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); 2696 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot);
2698 CallStoreIC(); 2697 CallStoreIC();
2699 2698
2700 } else if (var->IsGlobalSlot()) { 2699 } else if (var->IsGlobalSlot()) {
2701 // Global var, const, or let. 2700 // Global var, const, or let.
2702 DCHECK(var->index() > 0); 2701 DCHECK(var->index() > 0);
2703 DCHECK(var->IsStaticGlobalObjectProperty()); 2702 DCHECK(var->IsStaticGlobalObjectProperty());
2704 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(a0)); 2703 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(a0));
2705 __ mov(StoreGlobalViaContextDescriptor::ValueRegister(), result_register()); 2704 __ mov(StoreGlobalViaContextDescriptor::ValueRegister(), result_register());
2706 // Each var occupies two slots in the context: for reads and writes. 2705 int const slot = var->index();
2707 int const slot = var->index() + 1;
2708 int const depth = scope()->ContextChainLength(var->scope()); 2706 int const depth = scope()->ContextChainLength(var->scope());
2709 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { 2707 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) {
2710 __ li(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); 2708 __ li(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
2711 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); 2709 StoreGlobalViaContextStub stub(isolate(), depth, language_mode());
2712 __ CallStub(&stub); 2710 __ CallStub(&stub);
2713 } else { 2711 } else {
2714 __ Push(Smi::FromInt(slot)); 2712 __ Push(Smi::FromInt(slot));
2715 __ Push(a0); 2713 __ Push(a0);
2716 __ CallRuntime(is_strict(language_mode()) 2714 __ CallRuntime(is_strict(language_mode())
2717 ? Runtime::kStoreGlobalViaContext_Strict 2715 ? Runtime::kStoreGlobalViaContext_Strict
(...skipping 2714 matching lines...) Expand 10 before | Expand all | Expand 10 after
5432 reinterpret_cast<uint32_t>( 5430 reinterpret_cast<uint32_t>(
5433 isolate->builtins()->OsrAfterStackCheck()->entry())); 5431 isolate->builtins()->OsrAfterStackCheck()->entry()));
5434 return OSR_AFTER_STACK_CHECK; 5432 return OSR_AFTER_STACK_CHECK;
5435 } 5433 }
5436 5434
5437 5435
5438 } // namespace internal 5436 } // namespace internal
5439 } // namespace v8 5437 } // namespace v8
5440 5438
5441 #endif // V8_TARGET_ARCH_MIPS 5439 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/full-codegen/ia32/full-codegen-ia32.cc ('k') | src/full-codegen/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698