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 #include "vm/bitmap.h" | 5 #include "vm/bitmap.h" |
6 | 6 |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "vm/object.h" | 8 #include "vm/object.h" |
9 | 9 |
10 namespace dart { | 10 namespace dart { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // Bits not covered by the backing store are implicitly false. | 47 // Bits not covered by the backing store are implicitly false. |
48 if (!value) return; | 48 if (!value) return; |
49 // Grow the backing store if necessary. | 49 // Grow the backing store if necessary. |
50 intptr_t byte_offset = bit_offset >> kBitsPerByteLog2; | 50 intptr_t byte_offset = bit_offset >> kBitsPerByteLog2; |
51 if (byte_offset >= data_size_in_bytes_) { | 51 if (byte_offset >= data_size_in_bytes_) { |
52 uint8_t* old_data = data_; | 52 uint8_t* old_data = data_; |
53 intptr_t old_size = data_size_in_bytes_; | 53 intptr_t old_size = data_size_in_bytes_; |
54 data_size_in_bytes_ = | 54 data_size_in_bytes_ = |
55 Utils::RoundUp(byte_offset + 1, kIncrementSizeInBytes); | 55 Utils::RoundUp(byte_offset + 1, kIncrementSizeInBytes); |
56 ASSERT(data_size_in_bytes_ > 0); | 56 ASSERT(data_size_in_bytes_ > 0); |
57 data_ = Isolate::Current()->current_zone()->Alloc<uint8_t>( | 57 data_ = Thread::Current()->zone()->Alloc<uint8_t>( |
58 data_size_in_bytes_); | 58 data_size_in_bytes_); |
59 ASSERT(data_ != NULL); | 59 ASSERT(data_ != NULL); |
60 memmove(data_, old_data, old_size); | 60 memmove(data_, old_data, old_size); |
61 memset(&data_[old_size], 0, (data_size_in_bytes_ - old_size)); | 61 memset(&data_[old_size], 0, (data_size_in_bytes_ - old_size)); |
62 } | 62 } |
63 } | 63 } |
64 SetBit(bit_offset, value); | 64 SetBit(bit_offset, value); |
65 } | 65 } |
66 | 66 |
67 | 67 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 uint8_t mask = 1U << bit_remainder; | 107 uint8_t mask = 1U << bit_remainder; |
108 ASSERT(data_ != NULL); | 108 ASSERT(data_ != NULL); |
109 if (value) { | 109 if (value) { |
110 data_[byte_offset] |= mask; | 110 data_[byte_offset] |= mask; |
111 } else { | 111 } else { |
112 data_[byte_offset] &= ~mask; | 112 data_[byte_offset] &= ~mask; |
113 } | 113 } |
114 } | 114 } |
115 | 115 |
116 } // namespace dart | 116 } // namespace dart |
OLD | NEW |