OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 } | 66 } |
67 | 67 |
68 void BitVector::clearAll() | 68 void BitVector::clearAll() |
69 { | 69 { |
70 if (isInline()) | 70 if (isInline()) |
71 m_bitsOrPointer = makeInlineBits(0); | 71 m_bitsOrPointer = makeInlineBits(0); |
72 else | 72 else |
73 memset(outOfLineBits()->bits(), 0, byteCount(size())); | 73 memset(outOfLineBits()->bits(), 0, byteCount(size())); |
74 } | 74 } |
75 | 75 |
| 76 void BitVector::setAll() |
| 77 { |
| 78 memset(bits(), 0xFF, byteCount(size())); |
| 79 } |
| 80 |
76 BitVector::OutOfLineBits* BitVector::OutOfLineBits::create(size_t numBits) | 81 BitVector::OutOfLineBits* BitVector::OutOfLineBits::create(size_t numBits) |
77 { | 82 { |
78 // Because of the way BitVector stores the pointer, memory tools | 83 // Because of the way BitVector stores the pointer, memory tools |
79 // will erroneously report a leak here. | 84 // will erroneously report a leak here. |
80 WTF_ANNOTATE_SCOPED_MEMORY_LEAK; | 85 WTF_ANNOTATE_SCOPED_MEMORY_LEAK; |
81 numBits = (numBits + bitsInPointer() - 1) & ~(bitsInPointer() - 1); | 86 numBits = (numBits + bitsInPointer() - 1) & ~(bitsInPointer() - 1); |
82 size_t size = sizeof(OutOfLineBits) + sizeof(uintptr_t) * (numBits / bitsInP
ointer()); | 87 size_t size = sizeof(OutOfLineBits) + sizeof(uintptr_t) * (numBits / bitsInP
ointer()); |
83 void* allocation = partitionAllocGeneric(Partitions::getBufferPartition(), s
ize); | 88 void* allocation = partitionAllocGeneric(Partitions::getBufferPartition(), s
ize); |
84 OutOfLineBits* result = new (NotNull, allocation) OutOfLineBits(numBits); | 89 OutOfLineBits* result = new (NotNull, allocation) OutOfLineBits(numBits); |
85 return result; | 90 return result; |
(...skipping 29 matching lines...) Expand all Loading... |
115 { | 120 { |
116 for (size_t i = 0; i < size(); ++i) { | 121 for (size_t i = 0; i < size(); ++i) { |
117 if (get(i)) | 122 if (get(i)) |
118 out.printf("1"); | 123 out.printf("1"); |
119 else | 124 else |
120 out.printf("-"); | 125 out.printf("-"); |
121 } | 126 } |
122 } | 127 } |
123 | 128 |
124 } // namespace WTF | 129 } // namespace WTF |
OLD | NEW |