 Chromium Code Reviews
 Chromium Code Reviews Issue 2167763003:
  [Interpreter] Avoid allocating pairs array in VisitDeclarations.  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@int_merge_binary
    
  
    Issue 2167763003:
  [Interpreter] Avoid allocating pairs array in VisitDeclarations.  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@int_merge_binary| Index: src/interpreter/constant-array-builder.h | 
| diff --git a/src/interpreter/constant-array-builder.h b/src/interpreter/constant-array-builder.h | 
| index 1a68646251f1f4360f72668bb91ff9fb48593de6..5aa442e4d716002794666c78569da27e74f50ded 100644 | 
| --- a/src/interpreter/constant-array-builder.h | 
| +++ b/src/interpreter/constant-array-builder.h | 
| @@ -48,10 +48,18 @@ class ConstantArrayBuilder final BASE_EMBEDDED { | 
| // present. Returns the array index associated with the object. | 
| size_t Insert(Handle<Object> object); | 
| + // Reserves a entry which cannot later be discarded, and returns the array | 
| + // index associated with the reservation. | 
| + size_t ReserveEntry(); | 
| + | 
| + // Commits an undiscardable reserved entry and updates the entry with the | 
| + // given object. | 
| + void InsertReservedEntry(size_t index, Handle<Object> object); | 
| + | 
| // Creates a reserved entry in the constant pool and returns | 
| // the size of the operand that'll be required to hold the entry | 
| // when committed. | 
| - OperandSize CreateReservedEntry(); | 
| + OperandSize CreateDiscardableReservedEntry(); | 
| 
oth
2016/07/22 10:22:10
The names here used to align to give a hint that i
 
rmcilroy
2016/07/25 10:55:29
SGTM (/s/BindAllocatedEntry/InsertAllocatedEntry).
 | 
| // Commit reserved entry and returns the constant pool index for the | 
| // object. | 
| @@ -64,6 +72,7 @@ class ConstantArrayBuilder final BASE_EMBEDDED { | 
| typedef uint32_t index_t; | 
| index_t AllocateEntry(Handle<Object> object); | 
| + index_t AllocateIndex(Handle<Object> object); | 
| struct ConstantArraySlice final : public ZoneObject { | 
| ConstantArraySlice(Zone* zone, size_t start_index, size_t capacity, | 
| @@ -72,6 +81,7 @@ class ConstantArrayBuilder final BASE_EMBEDDED { | 
| void Unreserve(); | 
| size_t Allocate(Handle<Object> object); | 
| Handle<Object> At(size_t index) const; | 
| + void Update(size_t index, Handle<Object> object); | 
| inline size_t available() const { return capacity() - reserved() - size(); } | 
| inline size_t reserved() const { return reserved_; } | 
| @@ -91,7 +101,7 @@ class ConstantArrayBuilder final BASE_EMBEDDED { | 
| DISALLOW_COPY_AND_ASSIGN(ConstantArraySlice); | 
| }; | 
| - const ConstantArraySlice* IndexToSlice(size_t index) const; | 
| + ConstantArraySlice* IndexToSlice(size_t index) const; | 
| ConstantArraySlice* OperandSizeToSlice(OperandSize operand_size) const; | 
| IdentityMap<index_t>* constants_map() { return &constants_map_; } |