Line data Source code
1 : // Copyright 2016 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/bytecode-liveness-map.h"
6 :
7 : namespace v8 {
8 : namespace internal {
9 : namespace compiler {
10 :
11 15859918 : BytecodeLiveness::BytecodeLiveness(int register_count, Zone* zone)
12 : : in(new (zone) BytecodeLivenessState(register_count, zone)),
13 31719819 : out(new (zone) BytecodeLivenessState(register_count, zone)) {}
14 :
15 522844 : BytecodeLivenessMap::BytecodeLivenessMap(int bytecode_size, Zone* zone)
16 522844 : : liveness_map_(base::bits::RoundUpToPowerOfTwo32(bytecode_size / 4 + 1),
17 : base::KeyEqualityMatcher<int>(),
18 1045685 : ZoneAllocationPolicy(zone)) {}
19 :
20 28474246 : uint32_t OffsetHash(int offset) { return offset; }
21 :
22 15859915 : BytecodeLiveness& BytecodeLivenessMap::InitializeLiveness(int offset,
23 : int register_count,
24 : Zone* zone) {
25 : return liveness_map_
26 : .LookupOrInsert(offset, OffsetHash(offset),
27 15859917 : [&]() { return BytecodeLiveness(register_count, zone); },
28 63439654 : ZoneAllocationPolicy(zone))
29 31719818 : ->value;
30 : }
31 :
32 2008001 : BytecodeLiveness& BytecodeLivenessMap::GetLiveness(int offset) {
33 4016002 : return liveness_map_.Lookup(offset, OffsetHash(offset))->value;
34 : }
35 :
36 10606330 : const BytecodeLiveness& BytecodeLivenessMap::GetLiveness(int offset) const {
37 21212660 : return liveness_map_.Lookup(offset, OffsetHash(offset))->value;
38 : }
39 :
40 : } // namespace compiler
41 : } // namespace internal
42 178779 : } // namespace v8
|