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 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1407 | 1407 |
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. | |
1418 const int slot = var->index(); | 1417 const int slot = var->index(); |
1419 const int depth = scope()->ContextChainLength(var->scope()); | 1418 const int depth = scope()->ContextChainLength(var->scope()); |
1420 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { | 1419 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { |
1421 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); | 1420 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); |
1422 LoadGlobalViaContextStub stub(isolate(), depth); | 1421 LoadGlobalViaContextStub stub(isolate(), depth); |
1423 __ CallStub(&stub); | 1422 __ CallStub(&stub); |
1424 } else { | 1423 } else { |
1425 __ Push(Smi::FromInt(slot)); | 1424 __ Push(Smi::FromInt(slot)); |
1426 __ CallRuntime(Runtime::kLoadGlobalViaContext, 1); | 1425 __ CallRuntime(Runtime::kLoadGlobalViaContext, 1); |
1427 } | 1426 } |
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2706 // Global var, const, or let. | 2705 // Global var, const, or let. |
2707 __ mov(StoreDescriptor::NameRegister(), Operand(var->name())); | 2706 __ mov(StoreDescriptor::NameRegister(), Operand(var->name())); |
2708 __ ldr(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 2707 __ ldr(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
2709 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); | 2708 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); |
2710 CallStoreIC(); | 2709 CallStoreIC(); |
2711 | 2710 |
2712 } else if (var->IsGlobalSlot()) { | 2711 } else if (var->IsGlobalSlot()) { |
2713 // Global var, const, or let. | 2712 // Global var, const, or let. |
2714 DCHECK(var->index() > 0); | 2713 DCHECK(var->index() > 0); |
2715 DCHECK(var->IsStaticGlobalObjectProperty()); | 2714 DCHECK(var->IsStaticGlobalObjectProperty()); |
2716 // Each var occupies two slots in the context: for reads and writes. | 2715 const int slot = var->index(); |
2717 const int slot = var->index() + 1; | |
2718 const int depth = scope()->ContextChainLength(var->scope()); | 2716 const int depth = scope()->ContextChainLength(var->scope()); |
2719 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { | 2717 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { |
2720 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); | 2718 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); |
2721 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(r0)); | 2719 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(r0)); |
2722 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); | 2720 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); |
2723 __ CallStub(&stub); | 2721 __ CallStub(&stub); |
2724 } else { | 2722 } else { |
2725 __ Push(Smi::FromInt(slot)); | 2723 __ Push(Smi::FromInt(slot)); |
2726 __ push(r0); | 2724 __ push(r0); |
2727 __ CallRuntime(is_strict(language_mode()) | 2725 __ CallRuntime(is_strict(language_mode()) |
(...skipping 2743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5471 DCHECK(interrupt_address == | 5469 DCHECK(interrupt_address == |
5472 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5470 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5473 return OSR_AFTER_STACK_CHECK; | 5471 return OSR_AFTER_STACK_CHECK; |
5474 } | 5472 } |
5475 | 5473 |
5476 | 5474 |
5477 } // namespace internal | 5475 } // namespace internal |
5478 } // namespace v8 | 5476 } // namespace v8 |
5479 | 5477 |
5480 #endif // V8_TARGET_ARCH_ARM | 5478 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |