OLD | NEW |
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_ARM | 7 #if V8_TARGET_ARCH_ARM |
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 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1408 | 1408 |
1409 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy, | 1409 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy, |
1410 TypeofMode typeof_mode) { | 1410 TypeofMode typeof_mode) { |
1411 Variable* var = proxy->var(); | 1411 Variable* var = proxy->var(); |
1412 DCHECK(var->IsUnallocatedOrGlobalSlot() || | 1412 DCHECK(var->IsUnallocatedOrGlobalSlot() || |
1413 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL)); | 1413 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL)); |
1414 if (var->IsGlobalSlot()) { | 1414 if (var->IsGlobalSlot()) { |
1415 DCHECK(var->index() > 0); | 1415 DCHECK(var->index() > 0); |
1416 DCHECK(var->IsStaticGlobalObjectProperty()); | 1416 DCHECK(var->IsStaticGlobalObjectProperty()); |
1417 // Each var occupies two slots in the context: for reads and writes. | 1417 // Each var occupies two slots in the context: for reads and writes. |
1418 int slot_index = var->index(); | 1418 const int slot = var->index(); |
1419 int depth = scope()->ContextChainLength(var->scope()); | 1419 const int depth = scope()->ContextChainLength(var->scope()); |
1420 __ mov(LoadGlobalViaContextDescriptor::DepthRegister(), | 1420 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { |
1421 Operand(Smi::FromInt(depth))); | 1421 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); |
1422 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), | 1422 __ mov(LoadGlobalViaContextDescriptor::NameRegister(), |
1423 Operand(Smi::FromInt(slot_index))); | 1423 Operand(var->name())); |
1424 __ mov(LoadGlobalViaContextDescriptor::NameRegister(), | 1424 LoadGlobalViaContextStub stub(isolate(), depth); |
1425 Operand(var->name())); | 1425 __ CallStub(&stub); |
1426 LoadGlobalViaContextStub stub(isolate(), depth); | 1426 } else { |
1427 __ CallStub(&stub); | 1427 __ Push(Smi::FromInt(slot)); |
1428 | 1428 __ Push(var->name()); |
| 1429 __ CallRuntime(Runtime::kLoadGlobalViaContext, 2); |
| 1430 } |
1429 } else { | 1431 } else { |
1430 __ ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 1432 __ ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
1431 __ mov(LoadDescriptor::NameRegister(), Operand(var->name())); | 1433 __ mov(LoadDescriptor::NameRegister(), Operand(var->name())); |
1432 __ mov(LoadDescriptor::SlotRegister(), | 1434 __ mov(LoadDescriptor::SlotRegister(), |
1433 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); | 1435 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); |
1434 CallLoadIC(typeof_mode); | 1436 CallLoadIC(typeof_mode); |
1435 } | 1437 } |
1436 } | 1438 } |
1437 | 1439 |
1438 | 1440 |
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2708 __ mov(StoreDescriptor::NameRegister(), Operand(var->name())); | 2710 __ mov(StoreDescriptor::NameRegister(), Operand(var->name())); |
2709 __ ldr(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 2711 __ ldr(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
2710 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); | 2712 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); |
2711 CallStoreIC(); | 2713 CallStoreIC(); |
2712 | 2714 |
2713 } else if (var->IsGlobalSlot()) { | 2715 } else if (var->IsGlobalSlot()) { |
2714 // Global var, const, or let. | 2716 // Global var, const, or let. |
2715 DCHECK(var->index() > 0); | 2717 DCHECK(var->index() > 0); |
2716 DCHECK(var->IsStaticGlobalObjectProperty()); | 2718 DCHECK(var->IsStaticGlobalObjectProperty()); |
2717 // Each var occupies two slots in the context: for reads and writes. | 2719 // Each var occupies two slots in the context: for reads and writes. |
2718 int slot_index = var->index() + 1; | 2720 const int slot = var->index() + 1; |
2719 int depth = scope()->ContextChainLength(var->scope()); | 2721 const int depth = scope()->ContextChainLength(var->scope()); |
2720 __ mov(StoreGlobalViaContextDescriptor::DepthRegister(), | 2722 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { |
2721 Operand(Smi::FromInt(depth))); | 2723 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); |
2722 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), | 2724 __ mov(StoreGlobalViaContextDescriptor::NameRegister(), |
2723 Operand(Smi::FromInt(slot_index))); | 2725 Operand(var->name())); |
2724 __ mov(StoreGlobalViaContextDescriptor::NameRegister(), | 2726 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(r0)); |
2725 Operand(var->name())); | 2727 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); |
2726 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(r0)); | 2728 __ CallStub(&stub); |
2727 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); | 2729 } else { |
2728 __ CallStub(&stub); | 2730 __ Push(Smi::FromInt(slot)); |
2729 | 2731 __ Push(var->name()); |
| 2732 __ push(r0); |
| 2733 __ CallRuntime(is_strict(language_mode()) |
| 2734 ? Runtime::kStoreGlobalViaContext_Strict |
| 2735 : Runtime::kStoreGlobalViaContext_Sloppy, |
| 2736 3); |
| 2737 } |
2730 } else if (var->mode() == LET && op != Token::INIT_LET) { | 2738 } else if (var->mode() == LET && op != Token::INIT_LET) { |
2731 // Non-initializing assignment to let variable needs a write barrier. | 2739 // Non-initializing assignment to let variable needs a write barrier. |
2732 DCHECK(!var->IsLookupSlot()); | 2740 DCHECK(!var->IsLookupSlot()); |
2733 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2741 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
2734 Label assign; | 2742 Label assign; |
2735 MemOperand location = VarOperand(var, r1); | 2743 MemOperand location = VarOperand(var, r1); |
2736 __ ldr(r3, location); | 2744 __ ldr(r3, location); |
2737 __ CompareRoot(r3, Heap::kTheHoleValueRootIndex); | 2745 __ CompareRoot(r3, Heap::kTheHoleValueRootIndex); |
2738 __ b(ne, &assign); | 2746 __ b(ne, &assign); |
2739 __ mov(r3, Operand(var->name())); | 2747 __ mov(r3, Operand(var->name())); |
(...skipping 2729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5469 DCHECK(interrupt_address == | 5477 DCHECK(interrupt_address == |
5470 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5478 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5471 return OSR_AFTER_STACK_CHECK; | 5479 return OSR_AFTER_STACK_CHECK; |
5472 } | 5480 } |
5473 | 5481 |
5474 | 5482 |
5475 } // namespace internal | 5483 } // namespace internal |
5476 } // namespace v8 | 5484 } // namespace v8 |
5477 | 5485 |
5478 #endif // V8_TARGET_ARCH_ARM | 5486 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |