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 #if V8_TARGET_ARCH_ARM | 5 #if V8_TARGET_ARCH_ARM |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/debug/debug.h" | 10 #include "src/debug/debug.h" |
(...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1384 __ jmp(done); | 1384 __ jmp(done); |
1385 } | 1385 } |
1386 } | 1386 } |
1387 | 1387 |
1388 | 1388 |
1389 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy, | 1389 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy, |
1390 TypeofMode typeof_mode) { | 1390 TypeofMode typeof_mode) { |
1391 Variable* var = proxy->var(); | 1391 Variable* var = proxy->var(); |
1392 DCHECK(var->IsUnallocatedOrGlobalSlot() || | 1392 DCHECK(var->IsUnallocatedOrGlobalSlot() || |
1393 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL)); | 1393 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL)); |
1394 if (var->IsGlobalSlot()) { | 1394 __ ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
1395 DCHECK(var->index() > 0); | 1395 __ mov(LoadDescriptor::NameRegister(), Operand(var->name())); |
1396 DCHECK(var->IsStaticGlobalObjectProperty()); | 1396 __ mov(LoadDescriptor::SlotRegister(), |
1397 const int slot = var->index(); | 1397 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); |
1398 const int depth = scope()->ContextChainLength(var->scope()); | 1398 CallLoadIC(typeof_mode); |
1399 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { | |
1400 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); | |
1401 LoadGlobalViaContextStub stub(isolate(), depth); | |
1402 __ CallStub(&stub); | |
1403 } else { | |
1404 __ Push(Smi::FromInt(slot)); | |
1405 __ CallRuntime(Runtime::kLoadGlobalViaContext, 1); | |
1406 } | |
1407 } else { | |
1408 __ ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); | |
1409 __ mov(LoadDescriptor::NameRegister(), Operand(var->name())); | |
1410 __ mov(LoadDescriptor::SlotRegister(), | |
1411 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); | |
1412 CallLoadIC(typeof_mode); | |
1413 } | |
1414 } | 1399 } |
1415 | 1400 |
1416 | 1401 |
1417 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, | 1402 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, |
1418 TypeofMode typeof_mode) { | 1403 TypeofMode typeof_mode) { |
1419 // Record position before possible IC call. | 1404 // Record position before possible IC call. |
1420 SetExpressionPosition(proxy); | 1405 SetExpressionPosition(proxy); |
1421 PrepareForBailoutForId(proxy->BeforeId(), NO_REGISTERS); | 1406 PrepareForBailoutForId(proxy->BeforeId(), NO_REGISTERS); |
1422 Variable* var = proxy->var(); | 1407 Variable* var = proxy->var(); |
1423 | 1408 |
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2606 | 2591 |
2607 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, | 2592 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, |
2608 FeedbackVectorSlot slot) { | 2593 FeedbackVectorSlot slot) { |
2609 if (var->IsUnallocated()) { | 2594 if (var->IsUnallocated()) { |
2610 // Global var, const, or let. | 2595 // Global var, const, or let. |
2611 __ mov(StoreDescriptor::NameRegister(), Operand(var->name())); | 2596 __ mov(StoreDescriptor::NameRegister(), Operand(var->name())); |
2612 __ ldr(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 2597 __ ldr(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
2613 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); | 2598 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); |
2614 CallStoreIC(); | 2599 CallStoreIC(); |
2615 | 2600 |
2616 } else if (var->IsGlobalSlot()) { | |
2617 // Global var, const, or let. | |
2618 DCHECK(var->index() > 0); | |
2619 DCHECK(var->IsStaticGlobalObjectProperty()); | |
2620 const int slot = var->index(); | |
2621 const int depth = scope()->ContextChainLength(var->scope()); | |
2622 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { | |
2623 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); | |
2624 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(r0)); | |
2625 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); | |
2626 __ CallStub(&stub); | |
2627 } else { | |
2628 __ Push(Smi::FromInt(slot)); | |
2629 __ push(r0); | |
2630 __ CallRuntime(is_strict(language_mode()) | |
2631 ? Runtime::kStoreGlobalViaContext_Strict | |
2632 : Runtime::kStoreGlobalViaContext_Sloppy, | |
2633 2); | |
2634 } | |
2635 } else if (var->mode() == LET && op != Token::INIT_LET) { | 2601 } else if (var->mode() == LET && op != Token::INIT_LET) { |
2636 // Non-initializing assignment to let variable needs a write barrier. | 2602 // Non-initializing assignment to let variable needs a write barrier. |
2637 DCHECK(!var->IsLookupSlot()); | 2603 DCHECK(!var->IsLookupSlot()); |
2638 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2604 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
2639 Label assign; | 2605 Label assign; |
2640 MemOperand location = VarOperand(var, r1); | 2606 MemOperand location = VarOperand(var, r1); |
2641 __ ldr(r3, location); | 2607 __ ldr(r3, location); |
2642 __ CompareRoot(r3, Heap::kTheHoleValueRootIndex); | 2608 __ CompareRoot(r3, Heap::kTheHoleValueRootIndex); |
2643 __ b(ne, &assign); | 2609 __ b(ne, &assign); |
2644 __ mov(r3, Operand(var->name())); | 2610 __ mov(r3, Operand(var->name())); |
(...skipping 2580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5225 DCHECK(interrupt_address == | 5191 DCHECK(interrupt_address == |
5226 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5192 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5227 return OSR_AFTER_STACK_CHECK; | 5193 return OSR_AFTER_STACK_CHECK; |
5228 } | 5194 } |
5229 | 5195 |
5230 | 5196 |
5231 } // namespace internal | 5197 } // namespace internal |
5232 } // namespace v8 | 5198 } // namespace v8 |
5233 | 5199 |
5234 #endif // V8_TARGET_ARCH_ARM | 5200 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |