OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef V8_INTERPRETER_CONSTANT_ARRAY_BUILDER_H_ | 5 #ifndef V8_INTERPRETER_CONSTANT_ARRAY_BUILDER_H_ |
6 #define V8_INTERPRETER_CONSTANT_ARRAY_BUILDER_H_ | 6 #define V8_INTERPRETER_CONSTANT_ARRAY_BUILDER_H_ |
7 | 7 |
8 #include "src/globals.h" | 8 #include "src/globals.h" |
9 #include "src/identity-map.h" | 9 #include "src/identity-map.h" |
10 #include "src/interpreter/bytecodes.h" | 10 #include "src/interpreter/bytecodes.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 index_t AllocateReservedEntry(Smi* value); | 75 index_t AllocateReservedEntry(Smi* value); |
76 | 76 |
77 struct ConstantArraySlice final : public ZoneObject { | 77 struct ConstantArraySlice final : public ZoneObject { |
78 ConstantArraySlice(Zone* zone, size_t start_index, size_t capacity, | 78 ConstantArraySlice(Zone* zone, size_t start_index, size_t capacity, |
79 OperandSize operand_size); | 79 OperandSize operand_size); |
80 void Reserve(); | 80 void Reserve(); |
81 void Unreserve(); | 81 void Unreserve(); |
82 size_t Allocate(Handle<Object> object); | 82 size_t Allocate(Handle<Object> object); |
83 Handle<Object> At(size_t index) const; | 83 Handle<Object> At(size_t index) const; |
84 void InsertAt(size_t index, Handle<Object> object); | 84 void InsertAt(size_t index, Handle<Object> object); |
85 bool AllElementsAreUnique() const; | 85 |
| 86 #if DEBUG |
| 87 void CheckAllElementsAreUnique() const; |
| 88 #endif |
86 | 89 |
87 inline size_t available() const { return capacity() - reserved() - size(); } | 90 inline size_t available() const { return capacity() - reserved() - size(); } |
88 inline size_t reserved() const { return reserved_; } | 91 inline size_t reserved() const { return reserved_; } |
89 inline size_t capacity() const { return capacity_; } | 92 inline size_t capacity() const { return capacity_; } |
90 inline size_t size() const { return constants_.size(); } | 93 inline size_t size() const { return constants_.size(); } |
91 inline size_t start_index() const { return start_index_; } | 94 inline size_t start_index() const { return start_index_; } |
92 inline size_t max_index() const { return start_index_ + capacity() - 1; } | 95 inline size_t max_index() const { return start_index_ + capacity() - 1; } |
93 inline OperandSize operand_size() const { return operand_size_; } | 96 inline OperandSize operand_size() const { return operand_size_; } |
94 | 97 |
95 private: | 98 private: |
(...skipping 19 matching lines...) Expand all Loading... |
115 ZoneVector<std::pair<Smi*, index_t>> smi_pairs_; | 118 ZoneVector<std::pair<Smi*, index_t>> smi_pairs_; |
116 Zone* zone_; | 119 Zone* zone_; |
117 Handle<Object> the_hole_value_; | 120 Handle<Object> the_hole_value_; |
118 }; | 121 }; |
119 | 122 |
120 } // namespace interpreter | 123 } // namespace interpreter |
121 } // namespace internal | 124 } // namespace internal |
122 } // namespace v8 | 125 } // namespace v8 |
123 | 126 |
124 #endif // V8_INTERPRETER_CONSTANT_ARRAY_BUILDER_H_ | 127 #endif // V8_INTERPRETER_CONSTANT_ARRAY_BUILDER_H_ |
OLD | NEW |