Line data Source code
1 : // Copyright 2018 the V8 project authors. All rights reserved.
2 : // Use of this source code is governed by a BSD-style license that can be
3 : // found in the LICENSE file.
4 :
5 : #include "src/compiler/refs-map.h"
6 :
7 : namespace v8 {
8 : namespace internal {
9 : namespace compiler {
10 :
11 : using UnderlyingMap =
12 : base::TemplateHashMapImpl<Address, ObjectData*, AddressMatcher,
13 : ZoneAllocationPolicy>;
14 :
15 500872 : RefsMap::RefsMap(uint32_t capacity, AddressMatcher match, Zone* zone)
16 1001745 : : UnderlyingMap(capacity, match, ZoneAllocationPolicy(zone)) {}
17 :
18 464201 : RefsMap::RefsMap(const RefsMap* other, Zone* zone)
19 464201 : : UnderlyingMap(other, ZoneAllocationPolicy(zone)) {}
20 :
21 51604940 : RefsMap::Entry* RefsMap::Lookup(const Address& key) const {
22 103209880 : return UnderlyingMap::Lookup(key, Hash(key));
23 : }
24 :
25 221620388 : RefsMap::Entry* RefsMap::LookupOrInsert(const Address& key, Zone* zone) {
26 664861763 : return UnderlyingMap::LookupOrInsert(key, RefsMap::Hash(key),
27 : []() { return nullptr; },
28 443241375 : ZoneAllocationPolicy(zone));
29 : }
30 :
31 273225328 : uint32_t RefsMap::Hash(Address addr) { return static_cast<uint32_t>(addr); }
32 :
33 : } // namespace compiler
34 : } // namespace internal
35 : } // namespace v8
|