| 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_OBJECT_SET_H_ | 5 #ifndef VM_OBJECT_SET_H_ |
| 6 #define VM_OBJECT_SET_H_ | 6 #define VM_OBJECT_SET_H_ |
| 7 | 7 |
| 8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
| 9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
| 10 #include "vm/raw_object.h" | 10 #include "vm/raw_object.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 ~ObjectSet() { | 24 ~ObjectSet() { |
| 25 delete[] allocation_; | 25 delete[] allocation_; |
| 26 } | 26 } |
| 27 | 27 |
| 28 void Init(uword start, uword end) { | 28 void Init(uword start, uword end) { |
| 29 start_ = start; | 29 start_ = start; |
| 30 end_ = end; | 30 end_ = end; |
| 31 ASSERT(start_ <= end_); | 31 ASSERT(start_ <= end_); |
| 32 size_ = SizeFor((end_ - start_) >> kWordSizeLog2); | 32 size_ = SizeFor((end_ - start_) >> kWordSizeLog2); |
| 33 allocation_ = new uword[size_]; | 33 allocation_ = new uword[size_]; |
| 34 data_ = &allocation_[-((start >> kWordSizeLog2) / kBitsPerWord)]; | 34 const intptr_t skipped_bitfield_words = |
| 35 ASSERT(allocation_ == &data_[(start >> kWordSizeLog2) / kBitsPerWord]); | 35 (start >> kWordSizeLog2) / kBitsPerWord; |
| 36 data_ = &allocation_[-skipped_bitfield_words]; |
| 37 ASSERT(allocation_ == &data_[skipped_bitfield_words]); |
| 36 Clear(); | 38 Clear(); |
| 37 } | 39 } |
| 38 | 40 |
| 39 bool Contains(RawObject* raw_obj) const { | 41 bool Contains(RawObject* raw_obj) const { |
| 40 uword raw_addr = RawObject::ToAddr(raw_obj); | 42 uword raw_addr = RawObject::ToAddr(raw_obj); |
| 41 ASSERT(raw_addr >= start_); | 43 ASSERT(raw_addr >= start_); |
| 42 ASSERT(raw_addr < end_); | 44 ASSERT(raw_addr < end_); |
| 43 uword i = raw_addr >> kWordSizeLog2; | 45 uword i = raw_addr >> kWordSizeLog2; |
| 44 uword mask = (static_cast<uword>(1) << (i % kBitsPerWord)); | 46 uword mask = (static_cast<uword>(1) << (i % kBitsPerWord)); |
| 45 return (data_[i / kBitsPerWord] & mask) != 0; | 47 return (data_[i / kBitsPerWord] & mask) != 0; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // The inclusive maximum address in this ObjectMap. | 107 // The inclusive maximum address in this ObjectMap. |
| 106 // Used by FastClear | 108 // Used by FastClear |
| 107 uword max_; | 109 uword max_; |
| 108 | 110 |
| 109 DISALLOW_COPY_AND_ASSIGN(ObjectSet); | 111 DISALLOW_COPY_AND_ASSIGN(ObjectSet); |
| 110 }; | 112 }; |
| 111 | 113 |
| 112 } // namespace dart | 114 } // namespace dart |
| 113 | 115 |
| 114 #endif // VM_OBJECT_SET_H_ | 116 #endif // VM_OBJECT_SET_H_ |
| OLD | NEW |