OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
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 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1390 | 1390 |
1391 | 1391 |
1392 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy, | 1392 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy, |
1393 TypeofMode typeof_mode) { | 1393 TypeofMode typeof_mode) { |
1394 Variable* var = proxy->var(); | 1394 Variable* var = proxy->var(); |
1395 DCHECK(var->IsUnallocatedOrGlobalSlot() || | 1395 DCHECK(var->IsUnallocatedOrGlobalSlot() || |
1396 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL)); | 1396 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL)); |
1397 if (var->IsGlobalSlot()) { | 1397 if (var->IsGlobalSlot()) { |
1398 DCHECK(var->index() > 0); | 1398 DCHECK(var->index() > 0); |
1399 DCHECK(var->IsStaticGlobalObjectProperty()); | 1399 DCHECK(var->IsStaticGlobalObjectProperty()); |
1400 // Each var occupies two slots in the context: for reads and writes. | |
1401 int const slot = var->index(); | 1400 int const slot = var->index(); |
1402 int const depth = scope()->ContextChainLength(var->scope()); | 1401 int const depth = scope()->ContextChainLength(var->scope()); |
1403 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { | 1402 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { |
1404 __ Mov(LoadGlobalViaContextDescriptor::SlotRegister(), slot); | 1403 __ Mov(LoadGlobalViaContextDescriptor::SlotRegister(), slot); |
1405 LoadGlobalViaContextStub stub(isolate(), depth); | 1404 LoadGlobalViaContextStub stub(isolate(), depth); |
1406 __ CallStub(&stub); | 1405 __ CallStub(&stub); |
1407 } else { | 1406 } else { |
1408 __ Push(Smi::FromInt(slot)); | 1407 __ Push(Smi::FromInt(slot)); |
1409 __ CallRuntime(Runtime::kLoadGlobalViaContext, 1); | 1408 __ CallRuntime(Runtime::kLoadGlobalViaContext, 1); |
1410 } | 1409 } |
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2392 // Global var, const, or let. | 2391 // Global var, const, or let. |
2393 __ Mov(StoreDescriptor::NameRegister(), Operand(var->name())); | 2392 __ Mov(StoreDescriptor::NameRegister(), Operand(var->name())); |
2394 __ Ldr(StoreDescriptor::ReceiverRegister(), GlobalObjectMemOperand()); | 2393 __ Ldr(StoreDescriptor::ReceiverRegister(), GlobalObjectMemOperand()); |
2395 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); | 2394 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); |
2396 CallStoreIC(); | 2395 CallStoreIC(); |
2397 | 2396 |
2398 } else if (var->IsGlobalSlot()) { | 2397 } else if (var->IsGlobalSlot()) { |
2399 // Global var, const, or let. | 2398 // Global var, const, or let. |
2400 DCHECK(var->index() > 0); | 2399 DCHECK(var->index() > 0); |
2401 DCHECK(var->IsStaticGlobalObjectProperty()); | 2400 DCHECK(var->IsStaticGlobalObjectProperty()); |
2402 // Each var occupies two slots in the context: for reads and writes. | 2401 int const slot = var->index(); |
2403 int const slot = var->index() + 1; | |
2404 int const depth = scope()->ContextChainLength(var->scope()); | 2402 int const depth = scope()->ContextChainLength(var->scope()); |
2405 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { | 2403 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { |
2406 __ Mov(StoreGlobalViaContextDescriptor::SlotRegister(), slot); | 2404 __ Mov(StoreGlobalViaContextDescriptor::SlotRegister(), slot); |
2407 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(x0)); | 2405 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(x0)); |
2408 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); | 2406 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); |
2409 __ CallStub(&stub); | 2407 __ CallStub(&stub); |
2410 } else { | 2408 } else { |
2411 __ Push(Smi::FromInt(slot)); | 2409 __ Push(Smi::FromInt(slot)); |
2412 __ Push(x0); | 2410 __ Push(x0); |
2413 __ CallRuntime(is_strict(language_mode()) | 2411 __ CallRuntime(is_strict(language_mode()) |
(...skipping 3041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5455 } | 5453 } |
5456 | 5454 |
5457 return INTERRUPT; | 5455 return INTERRUPT; |
5458 } | 5456 } |
5459 | 5457 |
5460 | 5458 |
5461 } // namespace internal | 5459 } // namespace internal |
5462 } // namespace v8 | 5460 } // namespace v8 |
5463 | 5461 |
5464 #endif // V8_TARGET_ARCH_ARM64 | 5462 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |