| 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/identity-map.h" | 8 #include "src/identity-map.h" |
| 9 #include "src/interpreter/bytecodes.h" | 9 #include "src/interpreter/bytecodes.h" |
| 10 #include "src/zone/zone-containers.h" | 10 #include "src/zone/zone-containers.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // Commit reserved entry and returns the constant pool index for the | 63 // Commit reserved entry and returns the constant pool index for the |
| 64 // SMI value. | 64 // SMI value. |
| 65 size_t CommitReservedEntry(OperandSize operand_size, Smi* value); | 65 size_t CommitReservedEntry(OperandSize operand_size, Smi* value); |
| 66 | 66 |
| 67 // Discards constant pool reservation. | 67 // Discards constant pool reservation. |
| 68 void DiscardReservedEntry(OperandSize operand_size); | 68 void DiscardReservedEntry(OperandSize operand_size); |
| 69 | 69 |
| 70 private: | 70 private: |
| 71 typedef uint32_t index_t; | 71 typedef uint32_t index_t; |
| 72 | 72 |
| 73 index_t AllocateEntry(Handle<Object> object); | |
| 74 index_t AllocateIndex(Handle<Object> object); | 73 index_t AllocateIndex(Handle<Object> object); |
| 75 index_t AllocateReservedEntry(Smi* value); | 74 index_t AllocateReservedEntry(Smi* value); |
| 76 | 75 |
| 77 struct ConstantArraySlice final : public ZoneObject { | 76 struct ConstantArraySlice final : public ZoneObject { |
| 78 ConstantArraySlice(Zone* zone, size_t start_index, size_t capacity, | 77 ConstantArraySlice(Zone* zone, size_t start_index, size_t capacity, |
| 79 OperandSize operand_size); | 78 OperandSize operand_size); |
| 80 void Reserve(); | 79 void Reserve(); |
| 81 void Unreserve(); | 80 void Unreserve(); |
| 82 size_t Allocate(Handle<Object> object); | 81 size_t Allocate(Handle<Object> object); |
| 83 Handle<Object> At(size_t index) const; | 82 Handle<Object> At(size_t index) const; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 101 | 100 |
| 102 DISALLOW_COPY_AND_ASSIGN(ConstantArraySlice); | 101 DISALLOW_COPY_AND_ASSIGN(ConstantArraySlice); |
| 103 }; | 102 }; |
| 104 | 103 |
| 105 ConstantArraySlice* IndexToSlice(size_t index) const; | 104 ConstantArraySlice* IndexToSlice(size_t index) const; |
| 106 ConstantArraySlice* OperandSizeToSlice(OperandSize operand_size) const; | 105 ConstantArraySlice* OperandSizeToSlice(OperandSize operand_size) const; |
| 107 | 106 |
| 108 Handle<Object> the_hole_value() const { return the_hole_value_; } | 107 Handle<Object> the_hole_value() const { return the_hole_value_; } |
| 109 | 108 |
| 110 ConstantArraySlice* idx_slice_[3]; | 109 ConstantArraySlice* idx_slice_[3]; |
| 111 ZoneMap<Address, index_t> constants_map_; | 110 base::TemplateHashMapImpl<Address, index_t, std::equal_to<Address>, |
| 111 ZoneAllocationPolicy> |
| 112 constants_map_; |
| 112 ZoneMap<Smi*, index_t> smi_map_; | 113 ZoneMap<Smi*, index_t> smi_map_; |
| 113 ZoneVector<std::pair<Smi*, index_t>> smi_pairs_; | 114 ZoneVector<std::pair<Smi*, index_t>> smi_pairs_; |
| 115 Zone* zone_; |
| 114 Handle<Object> the_hole_value_; | 116 Handle<Object> the_hole_value_; |
| 115 }; | 117 }; |
| 116 | 118 |
| 117 } // namespace interpreter | 119 } // namespace interpreter |
| 118 } // namespace internal | 120 } // namespace internal |
| 119 } // namespace v8 | 121 } // namespace v8 |
| 120 | 122 |
| 121 #endif // V8_INTERPRETER_CONSTANT_ARRAY_BUILDER_H_ | 123 #endif // V8_INTERPRETER_CONSTANT_ARRAY_BUILDER_H_ |
| OLD | NEW |