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 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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. | 1400 // Each var occupies two slots in the context: for reads and writes. |
1401 int const slot = var->index(); | 1401 int const slot = var->index(); |
1402 int const depth = scope()->ContextChainLength(var->scope()); | 1402 int const depth = scope()->ContextChainLength(var->scope()); |
1403 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { | 1403 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { |
1404 __ Mov(LoadGlobalViaContextDescriptor::SlotRegister(), slot); | 1404 __ Mov(LoadGlobalViaContextDescriptor::SlotRegister(), slot); |
1405 __ Mov(LoadGlobalViaContextDescriptor::NameRegister(), var->name()); | |
1406 LoadGlobalViaContextStub stub(isolate(), depth); | 1405 LoadGlobalViaContextStub stub(isolate(), depth); |
1407 __ CallStub(&stub); | 1406 __ CallStub(&stub); |
1408 } else { | 1407 } else { |
1409 __ Push(Smi::FromInt(slot)); | 1408 __ Push(Smi::FromInt(slot)); |
1410 __ Push(var->name()); | 1409 __ CallRuntime(Runtime::kLoadGlobalViaContext, 1); |
1411 __ CallRuntime(Runtime::kLoadGlobalViaContext, 2); | |
1412 } | 1410 } |
1413 } else { | 1411 } else { |
1414 __ Ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectMemOperand()); | 1412 __ Ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectMemOperand()); |
1415 __ Mov(LoadDescriptor::NameRegister(), Operand(var->name())); | 1413 __ Mov(LoadDescriptor::NameRegister(), Operand(var->name())); |
1416 __ Mov(LoadDescriptor::SlotRegister(), | 1414 __ Mov(LoadDescriptor::SlotRegister(), |
1417 SmiFromSlot(proxy->VariableFeedbackSlot())); | 1415 SmiFromSlot(proxy->VariableFeedbackSlot())); |
1418 CallLoadIC(typeof_mode); | 1416 CallLoadIC(typeof_mode); |
1419 } | 1417 } |
1420 } | 1418 } |
1421 | 1419 |
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2399 | 2397 |
2400 } else if (var->IsGlobalSlot()) { | 2398 } else if (var->IsGlobalSlot()) { |
2401 // Global var, const, or let. | 2399 // Global var, const, or let. |
2402 DCHECK(var->index() > 0); | 2400 DCHECK(var->index() > 0); |
2403 DCHECK(var->IsStaticGlobalObjectProperty()); | 2401 DCHECK(var->IsStaticGlobalObjectProperty()); |
2404 // Each var occupies two slots in the context: for reads and writes. | 2402 // Each var occupies two slots in the context: for reads and writes. |
2405 int const slot = var->index() + 1; | 2403 int const slot = var->index() + 1; |
2406 int const depth = scope()->ContextChainLength(var->scope()); | 2404 int const depth = scope()->ContextChainLength(var->scope()); |
2407 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { | 2405 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { |
2408 __ Mov(StoreGlobalViaContextDescriptor::SlotRegister(), slot); | 2406 __ Mov(StoreGlobalViaContextDescriptor::SlotRegister(), slot); |
2409 __ Mov(StoreGlobalViaContextDescriptor::NameRegister(), var->name()); | |
2410 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(x0)); | 2407 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(x0)); |
2411 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); | 2408 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); |
2412 __ CallStub(&stub); | 2409 __ CallStub(&stub); |
2413 } else { | 2410 } else { |
2414 __ Push(Smi::FromInt(slot)); | 2411 __ Push(Smi::FromInt(slot)); |
2415 __ Push(var->name()); | |
2416 __ Push(x0); | 2412 __ Push(x0); |
2417 __ CallRuntime(is_strict(language_mode()) | 2413 __ CallRuntime(is_strict(language_mode()) |
2418 ? Runtime::kStoreGlobalViaContext_Strict | 2414 ? Runtime::kStoreGlobalViaContext_Strict |
2419 : Runtime::kStoreGlobalViaContext_Sloppy, | 2415 : Runtime::kStoreGlobalViaContext_Sloppy, |
2420 3); | 2416 2); |
2421 } | 2417 } |
2422 } else if (var->mode() == LET && op != Token::INIT_LET) { | 2418 } else if (var->mode() == LET && op != Token::INIT_LET) { |
2423 // Non-initializing assignment to let variable needs a write barrier. | 2419 // Non-initializing assignment to let variable needs a write barrier. |
2424 DCHECK(!var->IsLookupSlot()); | 2420 DCHECK(!var->IsLookupSlot()); |
2425 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2421 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
2426 Label assign; | 2422 Label assign; |
2427 MemOperand location = VarOperand(var, x1); | 2423 MemOperand location = VarOperand(var, x1); |
2428 __ Ldr(x10, location); | 2424 __ Ldr(x10, location); |
2429 __ JumpIfNotRoot(x10, Heap::kTheHoleValueRootIndex, &assign); | 2425 __ JumpIfNotRoot(x10, Heap::kTheHoleValueRootIndex, &assign); |
2430 __ Mov(x10, Operand(var->name())); | 2426 __ Mov(x10, Operand(var->name())); |
(...skipping 3028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5459 } | 5455 } |
5460 | 5456 |
5461 return INTERRUPT; | 5457 return INTERRUPT; |
5462 } | 5458 } |
5463 | 5459 |
5464 | 5460 |
5465 } // namespace internal | 5461 } // namespace internal |
5466 } // namespace v8 | 5462 } // namespace v8 |
5467 | 5463 |
5468 #endif // V8_TARGET_ARCH_ARM64 | 5464 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |