OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 7 #if V8_TARGET_ARCH_PPC |
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 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1370 | 1370 |
1371 | 1371 |
1372 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy, | 1372 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy, |
1373 TypeofMode typeof_mode) { | 1373 TypeofMode typeof_mode) { |
1374 Variable* var = proxy->var(); | 1374 Variable* var = proxy->var(); |
1375 DCHECK(var->IsUnallocatedOrGlobalSlot() || | 1375 DCHECK(var->IsUnallocatedOrGlobalSlot() || |
1376 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL)); | 1376 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL)); |
1377 if (var->IsGlobalSlot()) { | 1377 if (var->IsGlobalSlot()) { |
1378 DCHECK(var->index() > 0); | 1378 DCHECK(var->index() > 0); |
1379 DCHECK(var->IsStaticGlobalObjectProperty()); | 1379 DCHECK(var->IsStaticGlobalObjectProperty()); |
1380 // Each var occupies two slots in the context: for reads and writes. | |
1381 const int slot = var->index(); | 1380 const int slot = var->index(); |
1382 const int depth = scope()->ContextChainLength(var->scope()); | 1381 const int depth = scope()->ContextChainLength(var->scope()); |
1383 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { | 1382 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { |
1384 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); | 1383 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); |
1385 __ mov(LoadGlobalViaContextDescriptor::NameRegister(), | 1384 __ mov(LoadGlobalViaContextDescriptor::NameRegister(), |
1386 Operand(var->name())); | 1385 Operand(var->name())); |
1387 LoadGlobalViaContextStub stub(isolate(), depth); | 1386 LoadGlobalViaContextStub stub(isolate(), depth); |
1388 __ CallStub(&stub); | 1387 __ CallStub(&stub); |
1389 } else { | 1388 } else { |
1390 __ Push(Smi::FromInt(slot)); | 1389 __ Push(Smi::FromInt(slot)); |
(...skipping 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2708 // Global var, const, or let. | 2707 // Global var, const, or let. |
2709 __ mov(StoreDescriptor::NameRegister(), Operand(var->name())); | 2708 __ mov(StoreDescriptor::NameRegister(), Operand(var->name())); |
2710 __ LoadP(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 2709 __ LoadP(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
2711 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); | 2710 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); |
2712 CallStoreIC(); | 2711 CallStoreIC(); |
2713 | 2712 |
2714 } else if (var->IsGlobalSlot()) { | 2713 } else if (var->IsGlobalSlot()) { |
2715 // Global var, const, or let. | 2714 // Global var, const, or let. |
2716 DCHECK(var->index() > 0); | 2715 DCHECK(var->index() > 0); |
2717 DCHECK(var->IsStaticGlobalObjectProperty()); | 2716 DCHECK(var->IsStaticGlobalObjectProperty()); |
2718 // Each var occupies two slots in the context: for reads and writes. | 2717 const int slot = var->index(); |
2719 const int slot = var->index() + 1; | |
2720 const int depth = scope()->ContextChainLength(var->scope()); | 2718 const int depth = scope()->ContextChainLength(var->scope()); |
2721 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { | 2719 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { |
2722 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); | 2720 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); |
2723 __ mov(StoreGlobalViaContextDescriptor::NameRegister(), | 2721 __ mov(StoreGlobalViaContextDescriptor::NameRegister(), |
2724 Operand(var->name())); | 2722 Operand(var->name())); |
2725 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(r3)); | 2723 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(r3)); |
2726 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); | 2724 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); |
2727 __ CallStub(&stub); | 2725 __ CallStub(&stub); |
2728 } else { | 2726 } else { |
2729 __ Push(Smi::FromInt(slot)); | 2727 __ Push(Smi::FromInt(slot)); |
(...skipping 2695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5425 return ON_STACK_REPLACEMENT; | 5423 return ON_STACK_REPLACEMENT; |
5426 } | 5424 } |
5427 | 5425 |
5428 DCHECK(interrupt_address == | 5426 DCHECK(interrupt_address == |
5429 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5427 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5430 return OSR_AFTER_STACK_CHECK; | 5428 return OSR_AFTER_STACK_CHECK; |
5431 } | 5429 } |
5432 } // namespace internal | 5430 } // namespace internal |
5433 } // namespace v8 | 5431 } // namespace v8 |
5434 #endif // V8_TARGET_ARCH_PPC | 5432 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |