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

Side by Side Diff: src/full-codegen/x87/full-codegen-x87.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
« no previous file with comments | « src/full-codegen/x64/full-codegen-x64.cc ('k') | src/hydrogen.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_X87 7 #if V8_TARGET_ARCH_X87
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 1326
1327 1327
1328 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy, 1328 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy,
1329 TypeofMode typeof_mode) { 1329 TypeofMode typeof_mode) {
1330 Variable* var = proxy->var(); 1330 Variable* var = proxy->var();
1331 DCHECK(var->IsUnallocatedOrGlobalSlot() || 1331 DCHECK(var->IsUnallocatedOrGlobalSlot() ||
1332 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL)); 1332 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL));
1333 if (var->IsGlobalSlot()) { 1333 if (var->IsGlobalSlot()) {
1334 DCHECK(var->index() > 0); 1334 DCHECK(var->index() > 0);
1335 DCHECK(var->IsStaticGlobalObjectProperty()); 1335 DCHECK(var->IsStaticGlobalObjectProperty());
1336 // Each var occupies two slots in the context: for reads and writes.
1337 int const slot = var->index(); 1336 int const slot = var->index();
1338 int const depth = scope()->ContextChainLength(var->scope()); 1337 int const depth = scope()->ContextChainLength(var->scope());
1339 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { 1338 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) {
1340 __ Move(LoadGlobalViaContextDescriptor::SlotRegister(), Immediate(slot)); 1339 __ Move(LoadGlobalViaContextDescriptor::SlotRegister(), Immediate(slot));
1341 __ mov(LoadGlobalViaContextDescriptor::NameRegister(), var->name()); 1340 __ mov(LoadGlobalViaContextDescriptor::NameRegister(), var->name());
1342 LoadGlobalViaContextStub stub(isolate(), depth); 1341 LoadGlobalViaContextStub stub(isolate(), depth);
1343 __ CallStub(&stub); 1342 __ CallStub(&stub);
1344 } else { 1343 } else {
1345 __ Push(Smi::FromInt(slot)); 1344 __ Push(Smi::FromInt(slot));
1346 __ Push(var->name()); 1345 __ Push(var->name());
(...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after
2606 // Global var, const, or let. 2605 // Global var, const, or let.
2607 __ mov(StoreDescriptor::NameRegister(), var->name()); 2606 __ mov(StoreDescriptor::NameRegister(), var->name());
2608 __ mov(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); 2607 __ mov(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand());
2609 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); 2608 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot);
2610 CallStoreIC(); 2609 CallStoreIC();
2611 2610
2612 } else if (var->IsGlobalSlot()) { 2611 } else if (var->IsGlobalSlot()) {
2613 // Global var, const, or let. 2612 // Global var, const, or let.
2614 DCHECK(var->index() > 0); 2613 DCHECK(var->index() > 0);
2615 DCHECK(var->IsStaticGlobalObjectProperty()); 2614 DCHECK(var->IsStaticGlobalObjectProperty());
2616 // Each var occupies two slots in the context: for reads and writes. 2615 int const slot = var->index();
2617 int const slot = var->index() + 1;
2618 int const depth = scope()->ContextChainLength(var->scope()); 2616 int const depth = scope()->ContextChainLength(var->scope());
2619 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { 2617 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) {
2620 __ Move(StoreGlobalViaContextDescriptor::SlotRegister(), Immediate(slot)); 2618 __ Move(StoreGlobalViaContextDescriptor::SlotRegister(), Immediate(slot));
2621 __ mov(StoreGlobalViaContextDescriptor::NameRegister(), var->name()); 2619 __ mov(StoreGlobalViaContextDescriptor::NameRegister(), var->name());
2622 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(eax)); 2620 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(eax));
2623 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); 2621 StoreGlobalViaContextStub stub(isolate(), depth, language_mode());
2624 __ CallStub(&stub); 2622 __ CallStub(&stub);
2625 } else { 2623 } else {
2626 __ Push(Smi::FromInt(slot)); 2624 __ Push(Smi::FromInt(slot));
2627 __ Push(var->name()); 2625 __ Push(var->name());
(...skipping 2710 matching lines...) Expand 10 before | Expand all | Expand 10 after
5338 Assembler::target_address_at(call_target_address, 5336 Assembler::target_address_at(call_target_address,
5339 unoptimized_code)); 5337 unoptimized_code));
5340 return OSR_AFTER_STACK_CHECK; 5338 return OSR_AFTER_STACK_CHECK;
5341 } 5339 }
5342 5340
5343 5341
5344 } // namespace internal 5342 } // namespace internal
5345 } // namespace v8 5343 } // namespace v8
5346 5344
5347 #endif // V8_TARGET_ARCH_X87 5345 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/full-codegen/x64/full-codegen-x64.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698