Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Side by Side Diff: vm/bitmap.h

Issue 9701010: First step towards implementing stack map descriptions for the optimizing compiler. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | vm/bitmap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 #ifndef VM_BITMAP_H_
6 #define VM_BITMAP_H_
7
8 #include "vm/allocation.h"
9
10 namespace dart {
11
12 // Forward declarations.
13 class RawStackmap;
14 class Stackmap;
15
16
17 // BitmapBuilder is used to build a bitmap. The implementation is optimized for
18 // a dense set of small bit maps without an upper bound (e.g: a pointer map
19 // description of a stack).
20 class BitmapBuilder : public ZoneAllocated {
21 public:
22 BitmapBuilder() : size_in_bytes_(kInitialSizeInBytes),
23 bit_list_(bit_list_data_) {
24 memset(bit_list_data_, 0, kInitialSizeInBytes);
25 }
26
27 intptr_t SizeInBits() const { return (size_in_bytes_ * kBitsPerByte); }
28 intptr_t SizeInBytes() const { return size_in_bytes_; }
29
30 // Get/Set individual bits in the bitmap, set expands the underlying bitmap
31 // if needed.
32 bool Get(intptr_t bit_offset) const;
33 void Set(intptr_t bit_offset, bool value);
34
35 // Return the bit offset of the highest bit set.
36 intptr_t Maximum() const;
37
38 // Return the bit offset of the lowest bit set.
39 intptr_t Minimum() const;
40
41 // Sets min..max (inclusive) to value.
42 void SetRange(intptr_t min, intptr_t max, bool value);
43
44 // Replicates the bit map setting of the passed in Stackmap object.
45 void SetBits(const Stackmap& bitmap);
46
47 private:
48 static const intptr_t kInitialSizeInBytes = 16;
49 static const intptr_t kIncrementSizeInBytes = 16;
50
51 bool InRange(intptr_t offset) const {
52 return (offset >= 0) && (offset < SizeInBits());
53 }
54
55 bool GetBit(intptr_t bit_offset) const;
56 void SetBit(intptr_t bit_offset, bool value);
57
58 intptr_t size_in_bytes_;
59 uint8_t bit_list_data_[kInitialSizeInBytes];
60 uint8_t* bit_list_;
61
62 DISALLOW_COPY_AND_ASSIGN(BitmapBuilder);
63 };
64
65 } // namespace dart
66
67 #endif // VM_BITMAP_H_
OLDNEW
« no previous file with comments | « no previous file | vm/bitmap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698