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 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
684 // Setup elements object. | 684 // Setup elements object. |
685 Node* elements = InnerAllocate(array, elements_offset); | 685 Node* elements = InnerAllocate(array, elements_offset); |
686 StoreObjectFieldNoWriteBarrier(array, JSArray::kElementsOffset, elements); | 686 StoreObjectFieldNoWriteBarrier(array, JSArray::kElementsOffset, elements); |
687 Handle<Map> elements_map(is_double ? heap->fixed_double_array_map() | 687 Handle<Map> elements_map(is_double ? heap->fixed_double_array_map() |
688 : heap->fixed_array_map()); | 688 : heap->fixed_array_map()); |
689 StoreMapNoWriteBarrier(elements, HeapConstant(elements_map)); | 689 StoreMapNoWriteBarrier(elements, HeapConstant(elements_map)); |
690 StoreObjectFieldNoWriteBarrier( | 690 StoreObjectFieldNoWriteBarrier( |
691 elements, FixedArray::kLengthOffset, | 691 elements, FixedArray::kLengthOffset, |
692 mode == SMI_PARAMETERS ? capacity_node : SmiTag(capacity_node)); | 692 mode == SMI_PARAMETERS ? capacity_node : SmiTag(capacity_node)); |
693 | 693 |
694 Node* double_hole = Float64Constant(bit_cast<double>(kHoleNanInt64)); | 694 int const first_element_offset = FixedArray::kHeaderSize - kHeapObjectTag; |
695 Node* hole = HeapConstant(Handle<HeapObject>(heap->the_hole_value())); | 695 Node* hole = HeapConstant(Handle<HeapObject>(heap->the_hole_value())); |
696 Node* double_hole = | |
697 Is64() ? Int64Constant(kHoleNanInt64) : Int32Constant(kHoleNanLower32); | |
698 DCHECK_EQ(kHoleNanLower32, kHoleNanUpper32); | |
696 if (constant_capacity && capacity <= kElementLoopUnrollThreshold) { | 699 if (constant_capacity && capacity <= kElementLoopUnrollThreshold) { |
697 for (int i = 0; i < capacity; ++i) { | 700 for (int i = 0; i < capacity; ++i) { |
698 if (is_double) { | 701 if (is_double) { |
699 StoreFixedDoubleArrayElement(elements, Int32Constant(i), double_hole); | 702 Node* offset = ElementOffsetFromIndex(Int32Constant(i), kind, mode, |
703 first_element_offset); | |
704 // Don't use doubles to store the hole double, since manipulating the | |
Benedikt Meurer
2016/05/21 09:12:22
Mhm, yeah, we really need Float64 and Float32 help
danno
2016/05/21 09:22:16
Done.
| |
705 // signaling NaN used for the hole in C++, e.g. with bit_cast, will | |
706 // change its value on ia32 (the x87 stack is used to return values | |
707 // and stores to the stack silently clear the signalling bit). | |
708 if (Is64()) { | |
709 StoreNoWriteBarrier(MachineRepresentation::kWord64, elements, offset, | |
710 double_hole); | |
711 } else { | |
712 StoreNoWriteBarrier(MachineRepresentation::kWord32, elements, offset, | |
713 double_hole); | |
714 offset = ElementOffsetFromIndex(Int32Constant(i), kind, mode, | |
715 first_element_offset + kPointerSize); | |
716 StoreNoWriteBarrier(MachineRepresentation::kWord32, elements, offset, | |
717 double_hole); | |
718 } | |
700 } else { | 719 } else { |
701 StoreFixedArrayElement(elements, Int32Constant(i), hole, | 720 StoreFixedArrayElement(elements, Int32Constant(i), hole, |
702 SKIP_WRITE_BARRIER); | 721 SKIP_WRITE_BARRIER); |
703 } | 722 } |
704 } | 723 } |
705 } else { | 724 } else { |
706 // TODO(danno): Add a loop for initialization | 725 // TODO(danno): Add a loop for initialization |
707 UNIMPLEMENTED(); | 726 UNIMPLEMENTED(); |
708 } | 727 } |
709 | 728 |
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1549 } | 1568 } |
1550 return IntPtrAdd( | 1569 return IntPtrAdd( |
1551 Int32Constant(base_size), | 1570 Int32Constant(base_size), |
1552 (element_size_shift >= 0) | 1571 (element_size_shift >= 0) |
1553 ? WordShl(index_node, IntPtrConstant(element_size_shift)) | 1572 ? WordShl(index_node, IntPtrConstant(element_size_shift)) |
1554 : WordShr(index_node, IntPtrConstant(-element_size_shift))); | 1573 : WordShr(index_node, IntPtrConstant(-element_size_shift))); |
1555 } | 1574 } |
1556 | 1575 |
1557 } // namespace internal | 1576 } // namespace internal |
1558 } // namespace v8 | 1577 } // namespace v8 |
OLD | NEW |