Index: vm/object.h |
=================================================================== |
--- vm/object.h (revision 5450) |
+++ vm/object.h (working copy) |
@@ -152,6 +152,7 @@ |
kCodeClass, |
kInstructionsClass, |
kPcDescriptorsClass, |
+ kBitmapClass, |
kLocalVarDescriptorsClass, |
kExceptionHandlersClass, |
kContextClass, |
@@ -288,6 +289,7 @@ |
static RawClass* code_class() { return code_class_; } |
static RawClass* instructions_class() { return instructions_class_; } |
static RawClass* pc_descriptors_class() { return pc_descriptors_class_; } |
+ static RawClass* bitmap_class() { return bitmap_class_; } |
static RawClass* var_descriptors_class() { return var_descriptors_class_; } |
static RawClass* exception_handlers_class() { |
return exception_handlers_class_; |
@@ -395,6 +397,7 @@ |
static RawClass* code_class_; // Class of the Code vm object. |
static RawClass* instructions_class_; // Class of the Instructions vm object. |
static RawClass* pc_descriptors_class_; // Class of PcDescriptors vm object. |
+ static RawClass* bitmap_class_; // Class of BitMap vm object. |
static RawClass* var_descriptors_class_; // Class of LocalVarDescriptors. |
static RawClass* exception_handlers_class_; // Class of ExceptionHandlers. |
static RawClass* context_class_; // Class of the Context vm object. |
@@ -1984,6 +1987,46 @@ |
}; |
+class Bitmap : public Object { |
+ public: |
+ static const int32_t kNoMaximum = -1; |
+ static const int32_t kNoMinimum = -1; |
+ |
+ bool Get(int32_t bit_offset) const { |
+ return InRange(bit_offset) && GetBit(bit_offset); |
+ } |
+ |
+ // Return the bit offset of the highest bit set. |
+ int32_t Maximum() const; |
srdjan
2012/03/14 17:31:32
intptr_t, here and elsewhere
siva
2012/03/14 22:54:20
Done.
|
+ |
+ // Return the bit offset of the lowest bit set. |
+ int32_t Minimum() const; |
+ |
+ static intptr_t InstanceSize() { |
+ ASSERT(sizeof(RawBitmap) == OFFSET_OF(RawBitmap, data_)); |
+ return 0; |
+ } |
+ static intptr_t InstanceSize(intptr_t size) { |
+ return RoundedAllocationSize(sizeof(RawBitmap) + (size * kWordSize)); |
+ } |
+ static RawBitmap* New(intptr_t size); |
+ |
+ private: |
+ inline int32_t Size() const; |
srdjan
2012/03/14 17:31:32
SizeInBits?
siva
2012/03/14 22:54:20
Done.
|
+ |
+ bool InRange(int32_t offset) const { return offset < Size(); } |
+ |
+ bool GetBit(int32_t bit_offset) const; |
+ void SetBit(int32_t bit_offset, bool value) const; |
+ |
+ void set_size(int32_t value) const; |
srdjan
2012/03/14 17:31:32
SetSizeInBits?
siva
2012/03/14 22:54:20
This size is not in bits it is just the size of th
|
+ |
+ HEAP_OBJECT_IMPLEMENTATION(Bitmap, Object); |
+ friend class Class; |
+ friend class BitmapBuilder; |
+}; |
+ |
+ |
class ExceptionHandlers : public Object { |
public: |
intptr_t Length() const; |
@@ -3834,6 +3877,11 @@ |
StorePointer(InstanceAddr(index), value.raw()); |
} |
+ |
+int32_t Bitmap::Size() const { |
+ return (Smi::Value(raw_ptr()->size_) * kBitsPerByte); |
+} |
+ |
} // namespace dart |
#endif // VM_OBJECT_H_ |