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

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') | vm/bitmap.cc » ('J')
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 Bitmap;
14 class RawBitmap;
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_(kInitialSize), bit_list_dynamic_(NULL) {
23 memset(bit_list_, 0, kInitialSize);
24 }
25
26 // Get/Set individual bits in the bitmap, set expands the underlying bitmap
27 // if needed.
28 bool Get(int32_t bit_offset) const;
29 void Set(int32_t bit_offset, bool value);
30
31 // Return the bit offset of the highest bit set.
32 int32_t Maximum() const;
srdjan 2012/03/14 17:31:32 intptr_t instead of int32_t for the offsets? Here
siva 2012/03/14 22:54:20 Done.
33
34 // Return the bit offset of the lowest bit set.
35 int32_t Minimum() const;
36
37 // Sets min..max (inclusive) to value.
38 void SetRange(int32_t min, int32_t max, bool value);
39
40 // Replicates the bit map setting of the passed in Bitmap object.
41 void SetBits(const Bitmap& bitmap);
42
43 // Returns a Bitmap object corrsponding to the bits built up so far.
44 RawBitmap* GetBitmap() const;
45
46 private:
47 static const int32_t kInitialSize = 16;
48 static const int32_t kIncrementSize = 16;
49
50 int32_t BitSize() const { return (size_ * kBitsPerByte); }
srdjan 2012/03/14 17:31:32 Is it more readable to say SizeInBits?
siva 2012/03/14 22:54:20 Done.
51
52 bool InRange(int32_t offset) const {
53 return (offset >= 0) && (offset < BitSize());
54 }
55
56 bool GetBit(int32_t bit_offset) const;
57 void SetBit(int32_t bit_offset, bool value);
58
59 int32_t size_;
60 uint8_t bit_list_[kInitialSize];
srdjan 2012/03/14 17:31:32 Should this then be kInitialSizeInBytes? Size it t
siva 2012/03/14 22:54:20 Done.
61 uint8_t* bit_list_dynamic_;
62
63 DISALLOW_COPY_AND_ASSIGN(BitmapBuilder);
64 };
65
66 } // namespace dart
67
68 #endif // VM_BITMAP_H_
OLDNEW
« no previous file with comments | « no previous file | vm/bitmap.cc » ('j') | vm/bitmap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698