| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 7 #if V8_TARGET_ARCH_PPC |
| 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 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1455 __ b(done); | 1455 __ b(done); |
| 1456 } | 1456 } |
| 1457 } | 1457 } |
| 1458 | 1458 |
| 1459 | 1459 |
| 1460 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy, | 1460 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy, |
| 1461 TypeofState typeof_state) { | 1461 TypeofState typeof_state) { |
| 1462 Variable* var = proxy->var(); | 1462 Variable* var = proxy->var(); |
| 1463 DCHECK(var->IsUnallocatedOrGlobalSlot() || | 1463 DCHECK(var->IsUnallocatedOrGlobalSlot() || |
| 1464 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL)); | 1464 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL)); |
| 1465 __ LoadP(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 1465 if (var->IsGlobalSlot()) { |
| 1466 __ mov(LoadDescriptor::NameRegister(), Operand(var->name())); | 1466 DCHECK(var->index() > 0); |
| 1467 __ mov(LoadDescriptor::SlotRegister(), | 1467 DCHECK(var->IsStaticGlobalObjectProperty()); |
| 1468 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); | 1468 // Each var occupies two slots in the context: for reads and writes. |
| 1469 // Inside typeof use a regular load, not a contextual load, to avoid | 1469 int slot_index = var->index(); |
| 1470 // a reference error. | 1470 int depth = scope()->ContextChainLength(var->scope()); |
| 1471 CallLoadIC(typeof_state == NOT_INSIDE_TYPEOF ? CONTEXTUAL : NOT_CONTEXTUAL); | 1471 __ mov(LoadGlobalViaContextDescriptor::DepthRegister(), |
| 1472 Operand(Smi::FromInt(depth))); |
| 1473 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), |
| 1474 Operand(Smi::FromInt(slot_index))); |
| 1475 __ mov(LoadGlobalViaContextDescriptor::NameRegister(), |
| 1476 Operand(var->name())); |
| 1477 LoadGlobalViaContextStub stub(isolate(), depth); |
| 1478 __ CallStub(&stub); |
| 1479 |
| 1480 } else { |
| 1481 __ LoadP(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
| 1482 __ mov(LoadDescriptor::NameRegister(), Operand(var->name())); |
| 1483 __ mov(LoadDescriptor::SlotRegister(), |
| 1484 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); |
| 1485 // Inside typeof use a regular load, not a contextual load, to avoid |
| 1486 // a reference error. |
| 1487 CallLoadIC(typeof_state == NOT_INSIDE_TYPEOF ? CONTEXTUAL : NOT_CONTEXTUAL); |
| 1488 } |
| 1472 } | 1489 } |
| 1473 | 1490 |
| 1474 | 1491 |
| 1475 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, | 1492 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, |
| 1476 TypeofState typeof_state) { | 1493 TypeofState typeof_state) { |
| 1477 // Record position before possible IC call. | 1494 // Record position before possible IC call. |
| 1478 SetExpressionPosition(proxy); | 1495 SetExpressionPosition(proxy); |
| 1479 PrepareForBailoutForId(proxy->BeforeId(), NO_REGISTERS); | 1496 PrepareForBailoutForId(proxy->BeforeId(), NO_REGISTERS); |
| 1480 Variable* var = proxy->var(); | 1497 Variable* var = proxy->var(); |
| 1481 | 1498 |
| (...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2752 __ mr(r6, result_register()); | 2769 __ mr(r6, result_register()); |
| 2753 int offset = Context::SlotOffset(var->index()); | 2770 int offset = Context::SlotOffset(var->index()); |
| 2754 __ RecordWriteContextSlot(r4, offset, r6, r5, kLRHasBeenSaved, | 2771 __ RecordWriteContextSlot(r4, offset, r6, r5, kLRHasBeenSaved, |
| 2755 kDontSaveFPRegs); | 2772 kDontSaveFPRegs); |
| 2756 } | 2773 } |
| 2757 } | 2774 } |
| 2758 | 2775 |
| 2759 | 2776 |
| 2760 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, | 2777 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, |
| 2761 FeedbackVectorICSlot slot) { | 2778 FeedbackVectorICSlot slot) { |
| 2762 if (var->IsUnallocatedOrGlobalSlot()) { | 2779 if (var->IsUnallocated()) { |
| 2763 // Global var, const, or let. | 2780 // Global var, const, or let. |
| 2764 __ mov(StoreDescriptor::NameRegister(), Operand(var->name())); | 2781 __ mov(StoreDescriptor::NameRegister(), Operand(var->name())); |
| 2765 __ LoadP(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 2782 __ LoadP(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
| 2766 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); | 2783 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); |
| 2767 CallStoreIC(); | 2784 CallStoreIC(); |
| 2768 | 2785 |
| 2786 } else if (var->IsGlobalSlot()) { |
| 2787 // Global var, const, or let. |
| 2788 DCHECK(var->index() > 0); |
| 2789 DCHECK(var->IsStaticGlobalObjectProperty()); |
| 2790 // Each var occupies two slots in the context: for reads and writes. |
| 2791 int slot_index = var->index() + 1; |
| 2792 int depth = scope()->ContextChainLength(var->scope()); |
| 2793 __ mov(StoreGlobalViaContextDescriptor::DepthRegister(), |
| 2794 Operand(Smi::FromInt(depth))); |
| 2795 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), |
| 2796 Operand(Smi::FromInt(slot_index))); |
| 2797 __ mov(StoreGlobalViaContextDescriptor::NameRegister(), |
| 2798 Operand(var->name())); |
| 2799 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(r3)); |
| 2800 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); |
| 2801 __ CallStub(&stub); |
| 2802 |
| 2769 } else if (var->mode() == LET && op != Token::INIT_LET) { | 2803 } else if (var->mode() == LET && op != Token::INIT_LET) { |
| 2770 // Non-initializing assignment to let variable needs a write barrier. | 2804 // Non-initializing assignment to let variable needs a write barrier. |
| 2771 DCHECK(!var->IsLookupSlot()); | 2805 DCHECK(!var->IsLookupSlot()); |
| 2772 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2806 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
| 2773 Label assign; | 2807 Label assign; |
| 2774 MemOperand location = VarOperand(var, r4); | 2808 MemOperand location = VarOperand(var, r4); |
| 2775 __ LoadP(r6, location); | 2809 __ LoadP(r6, location); |
| 2776 __ CompareRoot(r6, Heap::kTheHoleValueRootIndex); | 2810 __ CompareRoot(r6, Heap::kTheHoleValueRootIndex); |
| 2777 __ bne(&assign); | 2811 __ bne(&assign); |
| 2778 __ mov(r6, Operand(var->name())); | 2812 __ mov(r6, Operand(var->name())); |
| (...skipping 2768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5547 return ON_STACK_REPLACEMENT; | 5581 return ON_STACK_REPLACEMENT; |
| 5548 } | 5582 } |
| 5549 | 5583 |
| 5550 DCHECK(interrupt_address == | 5584 DCHECK(interrupt_address == |
| 5551 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5585 isolate->builtins()->OsrAfterStackCheck()->entry()); |
| 5552 return OSR_AFTER_STACK_CHECK; | 5586 return OSR_AFTER_STACK_CHECK; |
| 5553 } | 5587 } |
| 5554 } // namespace internal | 5588 } // namespace internal |
| 5555 } // namespace v8 | 5589 } // namespace v8 |
| 5556 #endif // V8_TARGET_ARCH_PPC | 5590 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |