Chromium Code Reviews| 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 intptr_t skipped_bitfield_words = ((start >> kWordSizeLog2) / kBitsPerWord); |
| 35 data_ = &allocation_[-skipped_bitfield_words]; | |
| 35 ASSERT(allocation_ == &data_[(start >> kWordSizeLog2) / kBitsPerWord]); | 36 ASSERT(allocation_ == &data_[(start >> kWordSizeLog2) / kBitsPerWord]); |
|
koda
2014/09/25 22:08:23
Please make it a "const intptr_t" and then use it
rmacnak
2014/09/25 22:15:23
Done.
| |
| 36 Clear(); | 37 Clear(); |
| 37 } | 38 } |
| 38 | 39 |
| 39 bool Contains(RawObject* raw_obj) const { | 40 bool Contains(RawObject* raw_obj) const { |
| 40 uword raw_addr = RawObject::ToAddr(raw_obj); | 41 uword raw_addr = RawObject::ToAddr(raw_obj); |
| 41 ASSERT(raw_addr >= start_); | 42 ASSERT(raw_addr >= start_); |
| 42 ASSERT(raw_addr < end_); | 43 ASSERT(raw_addr < end_); |
| 43 uword i = raw_addr >> kWordSizeLog2; | 44 uword i = raw_addr >> kWordSizeLog2; |
| 44 uword mask = (static_cast<uword>(1) << (i % kBitsPerWord)); | 45 uword mask = (static_cast<uword>(1) << (i % kBitsPerWord)); |
| 45 return (data_[i / kBitsPerWord] & mask) != 0; | 46 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. | 106 // The inclusive maximum address in this ObjectMap. |
| 106 // Used by FastClear | 107 // Used by FastClear |
| 107 uword max_; | 108 uword max_; |
| 108 | 109 |
| 109 DISALLOW_COPY_AND_ASSIGN(ObjectSet); | 110 DISALLOW_COPY_AND_ASSIGN(ObjectSet); |
| 110 }; | 111 }; |
| 111 | 112 |
| 112 } // namespace dart | 113 } // namespace dart |
| 113 | 114 |
| 114 #endif // VM_OBJECT_SET_H_ | 115 #endif // VM_OBJECT_SET_H_ |
| OLD | NEW |