OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
Jakob Kummerow
2012/02/22 11:36:06
nit: 2012
| |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 } | 78 } |
79 | 79 |
80 BitVector* target_; | 80 BitVector* target_; |
81 int current_index_; | 81 int current_index_; |
82 uint32_t current_value_; | 82 uint32_t current_value_; |
83 int current_; | 83 int current_; |
84 | 84 |
85 friend class BitVector; | 85 friend class BitVector; |
86 }; | 86 }; |
87 | 87 |
88 explicit BitVector(int length) | 88 BitVector(int length, Zone* zone) |
89 : length_(length), | 89 : length_(length), |
90 data_length_(SizeFor(length)), | 90 data_length_(SizeFor(length)), |
91 data_(ZONE->NewArray<uint32_t>(data_length_)) { | 91 data_(zone->NewArray<uint32_t>(data_length_)) { |
92 ASSERT(length > 0); | 92 ASSERT(length > 0); |
93 Clear(); | 93 Clear(); |
94 } | 94 } |
95 | 95 |
96 BitVector(const BitVector& other) | 96 BitVector(const BitVector& other, Zone* zone) |
97 : length_(other.length()), | 97 : length_(other.length()), |
98 data_length_(SizeFor(length_)), | 98 data_length_(SizeFor(length_)), |
99 data_(ZONE->NewArray<uint32_t>(data_length_)) { | 99 data_(zone->NewArray<uint32_t>(data_length_)) { |
100 CopyFrom(other); | 100 CopyFrom(other); |
101 } | 101 } |
102 | 102 |
103 static int SizeFor(int length) { | 103 static int SizeFor(int length) { |
104 return 1 + ((length - 1) / 32); | 104 return 1 + ((length - 1) / 32); |
105 } | 105 } |
106 | 106 |
107 BitVector& operator=(const BitVector& rhs) { | 107 BitVector& operator=(const BitVector& rhs) { |
108 if (this != &rhs) CopyFrom(rhs); | 108 if (this != &rhs) CopyFrom(rhs); |
109 return *this; | 109 return *this; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
196 private: | 196 private: |
197 int length_; | 197 int length_; |
198 int data_length_; | 198 int data_length_; |
199 uint32_t* data_; | 199 uint32_t* data_; |
200 }; | 200 }; |
201 | 201 |
202 } } // namespace v8::internal | 202 } } // namespace v8::internal |
203 | 203 |
204 | 204 |
205 #endif // V8_DATAFLOW_H_ | 205 #endif // V8_DATAFLOW_H_ |
OLD | NEW |