Index: src/interpreter/constant-array-builder.h |
diff --git a/src/interpreter/constant-array-builder.h b/src/interpreter/constant-array-builder.h |
index d7e41e377102ced2e9d38341a5d6467770c31cda..6c9ca82495cc5c608c14f8740285b3aa914b37c4 100644 |
--- a/src/interpreter/constant-array-builder.h |
+++ b/src/interpreter/constant-array-builder.h |
@@ -23,13 +23,14 @@ namespace interpreter { |
class ConstantArrayBuilder final BASE_EMBEDDED { |
public: |
// Capacity of the 8-bit operand slice. |
- static const size_t kLowCapacity = 1u << kBitsPerByte; |
- |
- // Capacity of the combined 8-bit and 16-bit operand slices. |
- static const size_t kMaxCapacity = 1u << (2 * kBitsPerByte); |
+ static const size_t k8BitCapacity = 1u << kBitsPerByte; |
// Capacity of the 16-bit operand slice. |
- static const size_t kHighCapacity = kMaxCapacity - kLowCapacity; |
+ static const size_t k16BitCapacity = (1u << 2 * kBitsPerByte) - k8BitCapacity; |
+ |
+ // Capacity of the 32-bit operand slice. |
+ static const size_t k32BitCapacity = |
+ kMaxUInt32 - k16BitCapacity - k8BitCapacity + 1; |
ConstantArrayBuilder(Isolate* isolate, Zone* zone); |
@@ -60,12 +61,13 @@ class ConstantArrayBuilder final BASE_EMBEDDED { |
void DiscardReservedEntry(OperandSize operand_size); |
private: |
- typedef uint16_t index_t; |
+ typedef uint32_t index_t; |
index_t AllocateEntry(Handle<Object> object); |
- struct ConstantArraySlice final { |
- ConstantArraySlice(Zone* zone, size_t start_index, size_t capacity); |
+ struct ConstantArraySlice final : public ZoneObject { |
+ ConstantArraySlice(Zone* zone, size_t start_index, size_t capacity, |
+ OperandSize operand_size); |
void Reserve(); |
void Unreserve(); |
size_t Allocate(Handle<Object> object); |
@@ -76,21 +78,26 @@ class ConstantArrayBuilder final BASE_EMBEDDED { |
inline size_t capacity() const { return capacity_; } |
inline size_t size() const { return constants_.size(); } |
inline size_t start_index() const { return start_index_; } |
+ inline size_t max_index() const { return start_index_ + capacity() - 1; } |
+ inline OperandSize operand_size() const { return operand_size_; } |
private: |
const size_t start_index_; |
const size_t capacity_; |
size_t reserved_; |
+ OperandSize operand_size_; |
ZoneVector<Handle<Object>> constants_; |
DISALLOW_COPY_AND_ASSIGN(ConstantArraySlice); |
}; |
+ const ConstantArraySlice* IndexToSlice(size_t index) const; |
+ ConstantArraySlice* OperandSizeToSlice(OperandSize operand_size) const; |
+ |
IdentityMap<index_t>* constants_map() { return &constants_map_; } |
Isolate* isolate_; |
- ConstantArraySlice idx8_slice_; |
- ConstantArraySlice idx16_slice_; |
+ ConstantArraySlice* idx_slice_[2]; |
IdentityMap<index_t> constants_map_; |
}; |