Chromium Code Reviews| Index: src/interpreter/constant-array-builder.h |
| diff --git a/src/interpreter/constant-array-builder.h b/src/interpreter/constant-array-builder.h |
| index 2018f256931c8e6cc18e95c5738f0d4bbc77eae7..63dc24151cf77f62814344eb7fdfee136b217e0d 100644 |
| --- a/src/interpreter/constant-array-builder.h |
| +++ b/src/interpreter/constant-array-builder.h |
| @@ -6,6 +6,7 @@ |
| #define V8_INTERPRETER_CONSTANT_ARRAY_BUILDER_H_ |
| #include "src/identity-map.h" |
| +#include "src/inline-hash-map.h" |
| #include "src/interpreter/bytecodes.h" |
| #include "src/zone-containers.h" |
| @@ -16,6 +17,14 @@ class Isolate; |
| namespace interpreter { |
| +// Hashing function specifically for addresses |
| +struct AddressHash { |
| + size_t operator()(Address address) const { |
| + // Divide by 8, then knuth multiplicative hash |
|
rmcilroy
2016/09/12 14:17:31
Should we divide 8 or by kPointerSize?
|
| + return (bit_cast<size_t>(address) >> 3) * 2654435761; |
| + } |
| +}; |
| + |
| // A helper class for constructing constant arrays for the |
| // interpreter. Each instance of this class is intended to be used to |
| // generate exactly one FixedArray of constants via the ToFixedArray |
| @@ -108,7 +117,7 @@ class ConstantArrayBuilder final BASE_EMBEDDED { |
| Handle<Object> the_hole_value() const { return the_hole_value_; } |
| ConstantArraySlice* idx_slice_[3]; |
| - ZoneMap<Address, index_t> constants_map_; |
| + ZoneInlineHashMap<Address, index_t, AddressHash> constants_map_; |
| ZoneMap<Smi*, index_t> smi_map_; |
| ZoneVector<std::pair<Smi*, index_t>> smi_pairs_; |
| Handle<Object> the_hole_value_; |