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 #include "src/code-stub-assembler.h" | 4 #include "src/code-stub-assembler.h" |
5 #include "src/code-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/frames-inl.h" | 6 #include "src/frames-inl.h" |
7 #include "src/frames.h" | 7 #include "src/frames.h" |
8 #include "src/ic/handler-configuration.h" | 8 #include "src/ic/handler-configuration.h" |
9 #include "src/ic/stub-cache.h" | 9 #include "src/ic/stub-cache.h" |
10 | 10 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 for (int i = 1; i <= 16; i *= 2) { | 134 for (int i = 1; i <= 16; i *= 2) { |
135 value = WordOr(value, WordShr(value, IntPtrConstant(i))); | 135 value = WordOr(value, WordShr(value, IntPtrConstant(i))); |
136 } | 136 } |
137 return IntPtrAdd(value, IntPtrConstant(1)); | 137 return IntPtrAdd(value, IntPtrConstant(1)); |
138 } | 138 } |
139 | 139 |
140 Node* CodeStubAssembler::WordIsPowerOfTwo(Node* value) { | 140 Node* CodeStubAssembler::WordIsPowerOfTwo(Node* value) { |
141 // value && !(value & (value - 1)) | 141 // value && !(value & (value - 1)) |
142 return WordEqual( | 142 return WordEqual( |
143 Select(WordEqual(value, IntPtrConstant(0)), IntPtrConstant(1), | 143 Select(WordEqual(value, IntPtrConstant(0)), IntPtrConstant(1), |
144 WordAnd(value, IntPtrSub(value, IntPtrConstant(1)))), | 144 WordAnd(value, IntPtrSub(value, IntPtrConstant(1))), |
| 145 MachineType::PointerRepresentation()), |
145 IntPtrConstant(0)); | 146 IntPtrConstant(0)); |
146 } | 147 } |
147 | 148 |
148 Node* CodeStubAssembler::Float64Round(Node* x) { | 149 Node* CodeStubAssembler::Float64Round(Node* x) { |
149 Node* one = Float64Constant(1.0); | 150 Node* one = Float64Constant(1.0); |
150 Node* one_half = Float64Constant(0.5); | 151 Node* one_half = Float64Constant(0.5); |
151 | 152 |
152 Variable var_x(this, MachineRepresentation::kFloat64); | 153 Variable var_x(this, MachineRepresentation::kFloat64); |
153 Label return_x(this); | 154 Label return_x(this); |
154 | 155 |
(...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1702 SmiTag(capacity), SKIP_WRITE_BARRIER); | 1703 SmiTag(capacity), SKIP_WRITE_BARRIER); |
1703 // Initialize Dictionary fields. | 1704 // Initialize Dictionary fields. |
1704 Node* filler = LoadRoot(Heap::kUndefinedValueRootIndex); | 1705 Node* filler = LoadRoot(Heap::kUndefinedValueRootIndex); |
1705 StoreFixedArrayElement(result, NameDictionary::kMaxNumberKeyIndex, filler, | 1706 StoreFixedArrayElement(result, NameDictionary::kMaxNumberKeyIndex, filler, |
1706 SKIP_WRITE_BARRIER); | 1707 SKIP_WRITE_BARRIER); |
1707 StoreFixedArrayElement(result, NameDictionary::kNextEnumerationIndexIndex, | 1708 StoreFixedArrayElement(result, NameDictionary::kNextEnumerationIndexIndex, |
1708 SmiConstant(PropertyDetails::kInitialIndex), | 1709 SmiConstant(PropertyDetails::kInitialIndex), |
1709 SKIP_WRITE_BARRIER); | 1710 SKIP_WRITE_BARRIER); |
1710 | 1711 |
1711 // Initialize NameDictionary elements. | 1712 // Initialize NameDictionary elements. |
| 1713 result = BitcastTaggedToWord(result); |
1712 Node* start_address = IntPtrAdd( | 1714 Node* start_address = IntPtrAdd( |
1713 result, IntPtrConstant(NameDictionary::OffsetOfElementAt( | 1715 result, IntPtrConstant(NameDictionary::OffsetOfElementAt( |
1714 NameDictionary::kElementsStartIndex) - | 1716 NameDictionary::kElementsStartIndex) - |
1715 kHeapObjectTag)); | 1717 kHeapObjectTag)); |
1716 Node* end_address = IntPtrAdd( | 1718 Node* end_address = IntPtrAdd( |
1717 result, | 1719 result, |
1718 IntPtrSubFoldConstants(store_size, IntPtrConstant(kHeapObjectTag))); | 1720 IntPtrSubFoldConstants(store_size, IntPtrConstant(kHeapObjectTag))); |
1719 StoreFieldsNoWriteBarrier(start_address, end_address, filler); | 1721 StoreFieldsNoWriteBarrier(start_address, end_address, filler); |
1720 return result; | 1722 return result; |
1721 } | 1723 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1766 IntPtrSub(IntPtrAdd(object, size), IntPtrConstant(kHeapObjectTag)); | 1768 IntPtrSub(IntPtrAdd(object, size), IntPtrConstant(kHeapObjectTag)); |
1767 StoreFieldsNoWriteBarrier(start_address, end_address, filler); | 1769 StoreFieldsNoWriteBarrier(start_address, end_address, filler); |
1768 } | 1770 } |
1769 | 1771 |
1770 void CodeStubAssembler::StoreFieldsNoWriteBarrier(Node* start_address, | 1772 void CodeStubAssembler::StoreFieldsNoWriteBarrier(Node* start_address, |
1771 Node* end_address, | 1773 Node* end_address, |
1772 Node* value) { | 1774 Node* value) { |
1773 Comment("StoreFieldsNoWriteBarrier"); | 1775 Comment("StoreFieldsNoWriteBarrier"); |
1774 CSA_ASSERT(WordIsWordAligned(start_address)); | 1776 CSA_ASSERT(WordIsWordAligned(start_address)); |
1775 CSA_ASSERT(WordIsWordAligned(end_address)); | 1777 CSA_ASSERT(WordIsWordAligned(end_address)); |
1776 BuildFastLoop(MachineType::PointerRepresentation(), start_address, | 1778 BuildFastLoop( |
1777 end_address, | 1779 MachineType::PointerRepresentation(), start_address, end_address, |
1778 [value](CodeStubAssembler* a, Node* current) { | 1780 [value](CodeStubAssembler* a, Node* current) { |
1779 a->StoreNoWriteBarrier(MachineType::PointerRepresentation(), | 1781 a->StoreNoWriteBarrier(MachineRepresentation::kTagged, current, value); |
1780 current, value); | 1782 }, |
1781 }, | 1783 kPointerSize, IndexAdvanceMode::kPost); |
1782 kPointerSize, IndexAdvanceMode::kPost); | |
1783 } | 1784 } |
1784 | 1785 |
1785 Node* CodeStubAssembler::AllocateUninitializedJSArrayWithoutElements( | 1786 Node* CodeStubAssembler::AllocateUninitializedJSArrayWithoutElements( |
1786 ElementsKind kind, Node* array_map, Node* length, Node* allocation_site) { | 1787 ElementsKind kind, Node* array_map, Node* length, Node* allocation_site) { |
1787 Comment("begin allocation of JSArray without elements"); | 1788 Comment("begin allocation of JSArray without elements"); |
1788 int base_size = JSArray::kSize; | 1789 int base_size = JSArray::kSize; |
1789 if (allocation_site != nullptr) { | 1790 if (allocation_site != nullptr) { |
1790 base_size += AllocationMemento::kSize; | 1791 base_size += AllocationMemento::kSize; |
1791 } | 1792 } |
1792 | 1793 |
(...skipping 2213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4006 template Node* CodeStubAssembler::EntryToIndex<NameDictionary>(Node*, int); | 4007 template Node* CodeStubAssembler::EntryToIndex<NameDictionary>(Node*, int); |
4007 template Node* CodeStubAssembler::EntryToIndex<GlobalDictionary>(Node*, int); | 4008 template Node* CodeStubAssembler::EntryToIndex<GlobalDictionary>(Node*, int); |
4008 | 4009 |
4009 Node* CodeStubAssembler::HashTableComputeCapacity(Node* at_least_space_for) { | 4010 Node* CodeStubAssembler::HashTableComputeCapacity(Node* at_least_space_for) { |
4010 Node* capacity = IntPtrRoundUpToPowerOfTwo32( | 4011 Node* capacity = IntPtrRoundUpToPowerOfTwo32( |
4011 WordShl(at_least_space_for, IntPtrConstant(1))); | 4012 WordShl(at_least_space_for, IntPtrConstant(1))); |
4012 return IntPtrMax(capacity, IntPtrConstant(HashTableBase::kMinCapacity)); | 4013 return IntPtrMax(capacity, IntPtrConstant(HashTableBase::kMinCapacity)); |
4013 } | 4014 } |
4014 | 4015 |
4015 Node* CodeStubAssembler::IntPtrMax(Node* left, Node* right) { | 4016 Node* CodeStubAssembler::IntPtrMax(Node* left, Node* right) { |
4016 return Select(IntPtrGreaterThanOrEqual(left, right), left, right); | 4017 return Select(IntPtrGreaterThanOrEqual(left, right), left, right, |
| 4018 MachineType::PointerRepresentation()); |
4017 } | 4019 } |
4018 | 4020 |
4019 template <typename Dictionary> | 4021 template <typename Dictionary> |
4020 void CodeStubAssembler::NameDictionaryLookup(Node* dictionary, | 4022 void CodeStubAssembler::NameDictionaryLookup(Node* dictionary, |
4021 Node* unique_name, Label* if_found, | 4023 Node* unique_name, Label* if_found, |
4022 Variable* var_name_index, | 4024 Variable* var_name_index, |
4023 Label* if_not_found, | 4025 Label* if_not_found, |
4024 int inlined_probes) { | 4026 int inlined_probes) { |
4025 CSA_ASSERT(IsDictionary(dictionary)); | 4027 CSA_ASSERT(IsDictionary(dictionary)); |
4026 DCHECK_EQ(MachineType::PointerRepresentation(), var_name_index->rep()); | 4028 DCHECK_EQ(MachineType::PointerRepresentation(), var_name_index->rep()); |
(...skipping 4724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8751 Node* buffer_bit_field = LoadObjectField( | 8753 Node* buffer_bit_field = LoadObjectField( |
8752 buffer, JSArrayBuffer::kBitFieldOffset, MachineType::Uint32()); | 8754 buffer, JSArrayBuffer::kBitFieldOffset, MachineType::Uint32()); |
8753 Node* was_neutered_mask = Int32Constant(JSArrayBuffer::WasNeutered::kMask); | 8755 Node* was_neutered_mask = Int32Constant(JSArrayBuffer::WasNeutered::kMask); |
8754 | 8756 |
8755 return Word32NotEqual(Word32And(buffer_bit_field, was_neutered_mask), | 8757 return Word32NotEqual(Word32And(buffer_bit_field, was_neutered_mask), |
8756 Int32Constant(0)); | 8758 Int32Constant(0)); |
8757 } | 8759 } |
8758 | 8760 |
8759 } // namespace internal | 8761 } // namespace internal |
8760 } // namespace v8 | 8762 } // namespace v8 |
OLD | NEW |