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 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 } | 765 } |
766 | 766 |
767 Node* CodeStubAssembler::AllocateJSArray(ElementsKind kind, Node* array_map, | 767 Node* CodeStubAssembler::AllocateJSArray(ElementsKind kind, Node* array_map, |
768 Node* capacity_node, Node* length_node, | 768 Node* capacity_node, Node* length_node, |
769 compiler::Node* allocation_site, | 769 compiler::Node* allocation_site, |
770 ParameterMode mode) { | 770 ParameterMode mode) { |
771 bool is_double = IsFastDoubleElementsKind(kind); | 771 bool is_double = IsFastDoubleElementsKind(kind); |
772 int base_size = JSArray::kSize + FixedArray::kHeaderSize; | 772 int base_size = JSArray::kSize + FixedArray::kHeaderSize; |
773 int elements_offset = JSArray::kSize; | 773 int elements_offset = JSArray::kSize; |
774 | 774 |
| 775 Comment("begin allocation of JSArray"); |
| 776 |
775 if (allocation_site != nullptr) { | 777 if (allocation_site != nullptr) { |
776 base_size += AllocationMemento::kSize; | 778 base_size += AllocationMemento::kSize; |
777 elements_offset += AllocationMemento::kSize; | 779 elements_offset += AllocationMemento::kSize; |
778 } | 780 } |
779 | 781 |
780 int32_t capacity; | 782 int32_t capacity; |
781 bool constant_capacity = ToInt32Constant(capacity_node, capacity); | 783 bool constant_capacity = ToInt32Constant(capacity_node, capacity); |
782 Node* total_size = | 784 Node* total_size = |
783 ElementOffsetFromIndex(capacity_node, kind, mode, base_size); | 785 ElementOffsetFromIndex(capacity_node, kind, mode, base_size); |
784 | 786 |
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1978 } | 1980 } |
1979 return IntPtrAdd( | 1981 return IntPtrAdd( |
1980 IntPtrConstant(base_size), | 1982 IntPtrConstant(base_size), |
1981 (element_size_shift >= 0) | 1983 (element_size_shift >= 0) |
1982 ? WordShl(index_node, IntPtrConstant(element_size_shift)) | 1984 ? WordShl(index_node, IntPtrConstant(element_size_shift)) |
1983 : WordShr(index_node, IntPtrConstant(-element_size_shift))); | 1985 : WordShr(index_node, IntPtrConstant(-element_size_shift))); |
1984 } | 1986 } |
1985 | 1987 |
1986 } // namespace internal | 1988 } // namespace internal |
1987 } // namespace v8 | 1989 } // namespace v8 |
OLD | NEW |