OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_BITMAP_H_ | 5 #ifndef VM_BITMAP_H_ |
6 #define VM_BITMAP_H_ | 6 #define VM_BITMAP_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
10 #include "vm/zone.h" | 10 #include "vm/zone.h" |
11 | 11 |
12 namespace dart { | 12 namespace dart { |
13 | 13 |
14 // Forward declarations. | 14 // Forward declarations. |
15 class RawStackmap; | 15 class RawStackmap; |
16 class Stackmap; | 16 class Stackmap; |
17 | 17 |
18 | 18 |
19 // BitmapBuilder is used to build a bitmap. The implementation is optimized | 19 // BitmapBuilder is used to build a bitmap. The implementation is optimized |
20 // for a dense set of small bit maps without a fixed upper bound (e.g: a | 20 // for a dense set of small bit maps without a fixed upper bound (e.g: a |
21 // pointer map description of a stack). | 21 // pointer map description of a stack). |
22 class BitmapBuilder : public ZoneAllocated { | 22 class BitmapBuilder : public ZoneAllocated { |
23 public: | 23 public: |
24 BitmapBuilder() | 24 BitmapBuilder() |
25 : length_(0), | 25 : length_(0), |
26 data_size_in_bytes_(kInitialSizeInBytes), | 26 data_size_in_bytes_(kInitialSizeInBytes), |
27 data_(Isolate::Current()->current_zone()->Alloc<uint8_t>( | 27 data_(Thread::Current()->zone()->Alloc<uint8_t>( |
28 kInitialSizeInBytes)) { | 28 kInitialSizeInBytes)) { |
29 memset(data_, 0, kInitialSizeInBytes); | 29 memset(data_, 0, kInitialSizeInBytes); |
30 } | 30 } |
31 | 31 |
32 intptr_t Length() const { return length_; } | 32 intptr_t Length() const { return length_; } |
33 void SetLength(intptr_t length); | 33 void SetLength(intptr_t length); |
34 | 34 |
35 // Get/Set individual bits in the bitmap, setting bits beyond the bitmap's | 35 // Get/Set individual bits in the bitmap, setting bits beyond the bitmap's |
36 // length increases the length and expands the underlying bitmap if | 36 // length increases the length and expands the underlying bitmap if |
37 // needed. | 37 // needed. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // (up to length_) is allowed and they are assumed to be false. | 71 // (up to length_) is allowed and they are assumed to be false. |
72 intptr_t data_size_in_bytes_; | 72 intptr_t data_size_in_bytes_; |
73 uint8_t* data_; | 73 uint8_t* data_; |
74 | 74 |
75 DISALLOW_COPY_AND_ASSIGN(BitmapBuilder); | 75 DISALLOW_COPY_AND_ASSIGN(BitmapBuilder); |
76 }; | 76 }; |
77 | 77 |
78 } // namespace dart | 78 } // namespace dart |
79 | 79 |
80 #endif // VM_BITMAP_H_ | 80 #endif // VM_BITMAP_H_ |
OLD | NEW |