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 15194211 : BytecodeLiveness::BytecodeLiveness(int register_count, Zone* zone)
12 : : in(new (zone) BytecodeLivenessState(register_count, zone)),
13 30388415 : out(new (zone) BytecodeLivenessState(register_count, zone)) {}
14 :
15 529755 : BytecodeLivenessMap::BytecodeLivenessMap(int bytecode_size, Zone* zone)
16 529755 : : liveness_map_(base::bits::RoundUpToPowerOfTwo32(bytecode_size / 4 + 1),
17 : base::KeyEqualityMatcher<int>(),
18 1059504 : ZoneAllocationPolicy(zone)) {}
19 :
20 27303116 : uint32_t OffsetHash(int offset) { return offset; }
21 :
22 15194198 : BytecodeLiveness& BytecodeLivenessMap::InitializeLiveness(int offset,
23 : int register_count,
24 : Zone* zone) {
25 : return liveness_map_
26 60776809 : .LookupOrInsert(offset, OffsetHash(offset),
27 15194207 : [&]() { return BytecodeLiveness(register_count, zone); },
28 : ZoneAllocationPolicy(zone))
29 30388430 : ->value;
30 : }
31 :
32 2005344 : BytecodeLiveness& BytecodeLivenessMap::GetLiveness(int offset) {
33 2005344 : return liveness_map_.Lookup(offset, OffsetHash(offset))->value;
34 : }
35 :
36 10103574 : const BytecodeLiveness& BytecodeLivenessMap::GetLiveness(int offset) const {
37 10103574 : return liveness_map_.Lookup(offset, OffsetHash(offset))->value;
38 : }
39 :
40 : } // namespace compiler
41 : } // namespace internal
42 122036 : } // namespace v8
|