OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/code-stub-assembler.h" | 5 #include "src/code-stub-assembler.h" |
6 #include "src/code-factory.h" | 6 #include "src/code-factory.h" |
7 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 | 10 |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 first_element_offset + kPointerSize); | 719 first_element_offset + kPointerSize); |
720 StoreNoWriteBarrier(MachineRepresentation::kWord32, elements, offset, | 720 StoreNoWriteBarrier(MachineRepresentation::kWord32, elements, offset, |
721 double_hole); | 721 double_hole); |
722 } | 722 } |
723 } else { | 723 } else { |
724 StoreFixedArrayElement(elements, Int32Constant(i), hole, | 724 StoreFixedArrayElement(elements, Int32Constant(i), hole, |
725 SKIP_WRITE_BARRIER); | 725 SKIP_WRITE_BARRIER); |
726 } | 726 } |
727 } | 727 } |
728 } else { | 728 } else { |
729 // TODO(danno): Add a loop for initialization | 729 Variable current(this, MachineRepresentation::kTagged); |
730 UNIMPLEMENTED(); | 730 Label test(this); |
| 731 Label decrement(this, ¤t); |
| 732 Label done(this); |
| 733 Node* limit = IntPtrAdd(elements, IntPtrConstant(first_element_offset)); |
| 734 current.Bind( |
| 735 IntPtrAdd(limit, ElementOffsetFromIndex(capacity_node, kind, mode, 0))); |
| 736 |
| 737 Branch(WordEqual(current.value(), limit), &done, &decrement); |
| 738 |
| 739 Bind(&decrement); |
| 740 current.Bind(IntPtrSub( |
| 741 current.value(), |
| 742 Int32Constant(IsFastDoubleElementsKind(kind) ? kDoubleSize |
| 743 : kPointerSize))); |
| 744 if (is_double) { |
| 745 // Don't use doubles to store the hole double, since manipulating the |
| 746 // signaling NaN used for the hole in C++, e.g. with bit_cast, will |
| 747 // change its value on ia32 (the x87 stack is used to return values |
| 748 // and stores to the stack silently clear the signalling bit). |
| 749 // |
| 750 // TODO(danno): When we have a Float32/Float64 wrapper class that |
| 751 // preserves double bits during manipulation, remove this code/change |
| 752 // this to an indexed Float64 store. |
| 753 if (Is64()) { |
| 754 StoreNoWriteBarrier(MachineRepresentation::kWord64, current.value(), |
| 755 double_hole); |
| 756 } else { |
| 757 StoreNoWriteBarrier(MachineRepresentation::kWord32, current.value(), |
| 758 double_hole); |
| 759 StoreNoWriteBarrier( |
| 760 MachineRepresentation::kWord32, |
| 761 IntPtrAdd(current.value(), Int32Constant(kPointerSize)), |
| 762 double_hole); |
| 763 } |
| 764 } else { |
| 765 StoreNoWriteBarrier(MachineRepresentation::kTagged, current.value(), |
| 766 hole); |
| 767 } |
| 768 Node* compare = WordNotEqual(current.value(), limit); |
| 769 Branch(compare, &decrement, &done); |
| 770 |
| 771 Bind(&done); |
731 } | 772 } |
732 | 773 |
733 return array; | 774 return array; |
734 } | 775 } |
735 | 776 |
736 void CodeStubAssembler::InitializeAllocationMemento( | 777 void CodeStubAssembler::InitializeAllocationMemento( |
737 compiler::Node* base_allocation, int base_allocation_size, | 778 compiler::Node* base_allocation, int base_allocation_size, |
738 compiler::Node* allocation_site) { | 779 compiler::Node* allocation_site) { |
739 StoreObjectFieldNoWriteBarrier( | 780 StoreObjectFieldNoWriteBarrier( |
740 base_allocation, AllocationMemento::kMapOffset + base_allocation_size, | 781 base_allocation, AllocationMemento::kMapOffset + base_allocation_size, |
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1575 } | 1616 } |
1576 return IntPtrAdd( | 1617 return IntPtrAdd( |
1577 IntPtrConstant(base_size), | 1618 IntPtrConstant(base_size), |
1578 (element_size_shift >= 0) | 1619 (element_size_shift >= 0) |
1579 ? WordShl(index_node, IntPtrConstant(element_size_shift)) | 1620 ? WordShl(index_node, IntPtrConstant(element_size_shift)) |
1580 : WordShr(index_node, IntPtrConstant(-element_size_shift))); | 1621 : WordShr(index_node, IntPtrConstant(-element_size_shift))); |
1581 } | 1622 } |
1582 | 1623 |
1583 } // namespace internal | 1624 } // namespace internal |
1584 } // namespace v8 | 1625 } // namespace v8 |
OLD | NEW |