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 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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. | 1380 // Each var occupies two slots in the context: for reads and writes. |
1381 int slot_index = var->index(); | 1381 const int slot = var->index(); |
1382 int depth = scope()->ContextChainLength(var->scope()); | 1382 const int depth = scope()->ContextChainLength(var->scope()); |
1383 __ mov(LoadGlobalViaContextDescriptor::DepthRegister(), | 1383 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { |
1384 Operand(Smi::FromInt(depth))); | 1384 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); |
1385 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), | 1385 __ mov(LoadGlobalViaContextDescriptor::NameRegister(), |
1386 Operand(Smi::FromInt(slot_index))); | 1386 Operand(var->name())); |
1387 __ mov(LoadGlobalViaContextDescriptor::NameRegister(), | 1387 LoadGlobalViaContextStub stub(isolate(), depth); |
1388 Operand(var->name())); | 1388 __ CallStub(&stub); |
1389 LoadGlobalViaContextStub stub(isolate(), depth); | 1389 } else { |
1390 __ CallStub(&stub); | 1390 __ Push(Smi::FromInt(slot)); |
1391 | 1391 __ Push(var->name()); |
| 1392 __ CallRuntime(Runtime::kLoadGlobalViaContext, 2); |
| 1393 } |
1392 } else { | 1394 } else { |
1393 __ LoadP(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 1395 __ LoadP(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
1394 __ mov(LoadDescriptor::NameRegister(), Operand(var->name())); | 1396 __ mov(LoadDescriptor::NameRegister(), Operand(var->name())); |
1395 __ mov(LoadDescriptor::SlotRegister(), | 1397 __ mov(LoadDescriptor::SlotRegister(), |
1396 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); | 1398 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); |
1397 CallLoadIC(typeof_mode); | 1399 CallLoadIC(typeof_mode); |
1398 } | 1400 } |
1399 } | 1401 } |
1400 | 1402 |
1401 | 1403 |
(...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2707 __ mov(StoreDescriptor::NameRegister(), Operand(var->name())); | 2709 __ mov(StoreDescriptor::NameRegister(), Operand(var->name())); |
2708 __ LoadP(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 2710 __ LoadP(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
2709 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); | 2711 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); |
2710 CallStoreIC(); | 2712 CallStoreIC(); |
2711 | 2713 |
2712 } else if (var->IsGlobalSlot()) { | 2714 } else if (var->IsGlobalSlot()) { |
2713 // Global var, const, or let. | 2715 // Global var, const, or let. |
2714 DCHECK(var->index() > 0); | 2716 DCHECK(var->index() > 0); |
2715 DCHECK(var->IsStaticGlobalObjectProperty()); | 2717 DCHECK(var->IsStaticGlobalObjectProperty()); |
2716 // Each var occupies two slots in the context: for reads and writes. | 2718 // Each var occupies two slots in the context: for reads and writes. |
2717 int slot_index = var->index() + 1; | 2719 const int slot = var->index() + 1; |
2718 int depth = scope()->ContextChainLength(var->scope()); | 2720 const int depth = scope()->ContextChainLength(var->scope()); |
2719 __ mov(StoreGlobalViaContextDescriptor::DepthRegister(), | 2721 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { |
2720 Operand(Smi::FromInt(depth))); | 2722 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); |
2721 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), | 2723 __ mov(StoreGlobalViaContextDescriptor::NameRegister(), |
2722 Operand(Smi::FromInt(slot_index))); | 2724 Operand(var->name())); |
2723 __ mov(StoreGlobalViaContextDescriptor::NameRegister(), | 2725 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(r3)); |
2724 Operand(var->name())); | 2726 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); |
2725 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(r3)); | 2727 __ CallStub(&stub); |
2726 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); | 2728 } else { |
2727 __ CallStub(&stub); | 2729 __ Push(Smi::FromInt(slot)); |
2728 | 2730 __ Push(var->name()); |
| 2731 __ push(r3); |
| 2732 __ CallRuntime(is_strict(language_mode()) |
| 2733 ? Runtime::kStoreGlobalViaContext_Strict |
| 2734 : Runtime::kStoreGlobalViaContext_Sloppy, |
| 2735 3); |
| 2736 } |
2729 } else if (var->mode() == LET && op != Token::INIT_LET) { | 2737 } else if (var->mode() == LET && op != Token::INIT_LET) { |
2730 // Non-initializing assignment to let variable needs a write barrier. | 2738 // Non-initializing assignment to let variable needs a write barrier. |
2731 DCHECK(!var->IsLookupSlot()); | 2739 DCHECK(!var->IsLookupSlot()); |
2732 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2740 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
2733 Label assign; | 2741 Label assign; |
2734 MemOperand location = VarOperand(var, r4); | 2742 MemOperand location = VarOperand(var, r4); |
2735 __ LoadP(r6, location); | 2743 __ LoadP(r6, location); |
2736 __ CompareRoot(r6, Heap::kTheHoleValueRootIndex); | 2744 __ CompareRoot(r6, Heap::kTheHoleValueRootIndex); |
2737 __ bne(&assign); | 2745 __ bne(&assign); |
2738 __ mov(r6, Operand(var->name())); | 2746 __ mov(r6, Operand(var->name())); |
(...skipping 2678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5417 return ON_STACK_REPLACEMENT; | 5425 return ON_STACK_REPLACEMENT; |
5418 } | 5426 } |
5419 | 5427 |
5420 DCHECK(interrupt_address == | 5428 DCHECK(interrupt_address == |
5421 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5429 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5422 return OSR_AFTER_STACK_CHECK; | 5430 return OSR_AFTER_STACK_CHECK; |
5423 } | 5431 } |
5424 } // namespace internal | 5432 } // namespace internal |
5425 } // namespace v8 | 5433 } // namespace v8 |
5426 #endif // V8_TARGET_ARCH_PPC | 5434 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |