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