| OLD | NEW |
| (Empty) |
| 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 Liveness::Liveness(int size, Zone* zone) | |
| 12 : in(new (zone) BitVector(size, zone)), | |
| 13 out(new (zone) BitVector(size, zone)) {} | |
| 14 | |
| 15 BytecodeLivenessMap::BytecodeLivenessMap(int bytecode_size, Zone* zone) | |
| 16 : liveness_map_(base::bits::RoundUpToPowerOfTwo32(bytecode_size / 4 + 1), | |
| 17 base::KeyEqualityMatcher<int>(), | |
| 18 ZoneAllocationPolicy(zone)) {} | |
| 19 | |
| 20 uint32_t OffsetHash(int offset) { return offset; } | |
| 21 | |
| 22 Liveness& BytecodeLivenessMap::InitializeLiveness(int offset, int size, | |
| 23 Zone* zone) { | |
| 24 return liveness_map_ | |
| 25 .LookupOrInsert(offset, OffsetHash(offset), | |
| 26 [&]() { return Liveness(size, zone); }, | |
| 27 ZoneAllocationPolicy(zone)) | |
| 28 ->value; | |
| 29 } | |
| 30 | |
| 31 Liveness& BytecodeLivenessMap::GetLiveness(int offset) { | |
| 32 return liveness_map_.Lookup(offset, OffsetHash(offset))->value; | |
| 33 } | |
| 34 | |
| 35 const Liveness& BytecodeLivenessMap::GetLiveness(int offset) const { | |
| 36 return liveness_map_.Lookup(offset, OffsetHash(offset))->value; | |
| 37 } | |
| 38 | |
| 39 } // namespace compiler | |
| 40 } // namespace internal | |
| 41 } // namespace v8 | |
| OLD | NEW |