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

Side by Side Diff: src/interpreter/constant-array-builder.h

Issue 2336553002: [interpreter] Use hashmap for ConstantArrayBuilder's constant map (Closed)
Patch Set: Rebase Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « src/base/hashmap.h ('k') | src/interpreter/constant-array-builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « src/base/hashmap.h ('k') | src/interpreter/constant-array-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698