Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(425)

Unified Diff: src/interpreter/constant-array-builder.h

Issue 1731893003: [interpreter] Preparation for 32-bit operands. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Move ReadUnalignedUInt32. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/interpreter/constant-array-builder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
};
« no previous file with comments | « no previous file | src/interpreter/constant-array-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698