OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_HYDROGEN_UNIQUE_H_ | 5 #ifndef V8_HYDROGEN_UNIQUE_H_ |
6 #define V8_HYDROGEN_UNIQUE_H_ | 6 #define V8_HYDROGEN_UNIQUE_H_ |
7 | 7 |
8 #include "src/handles.h" | 8 #include "src/handles.h" |
9 #include "src/objects.h" | 9 #include "src/objects.h" |
10 #include "src/string-stream.h" | 10 #include "src/string-stream.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 const char* desc_chars = desc_string.get(); | 192 const char* desc_chars = desc_string.get(); |
193 int length = static_cast<int>(strlen(desc_chars)); | 193 int length = static_cast<int>(strlen(desc_chars)); |
194 char* desc_copy = zone->NewArray<char>(length + 1); | 194 char* desc_copy = zone->NewArray<char>(length + 1); |
195 memcpy(desc_copy, desc_chars, length + 1); | 195 memcpy(desc_copy, desc_chars, length + 1); |
196 string_ = desc_copy; | 196 string_ = desc_copy; |
197 } | 197 } |
198 }; | 198 }; |
199 | 199 |
200 | 200 |
201 template <typename T> | 201 template <typename T> |
202 class UniqueSet V8_FINAL : public ZoneObject { | 202 class UniqueSet FINAL : public ZoneObject { |
203 public: | 203 public: |
204 // Constructor. A new set will be empty. | 204 // Constructor. A new set will be empty. |
205 UniqueSet() : size_(0), capacity_(0), array_(NULL) { } | 205 UniqueSet() : size_(0), capacity_(0), array_(NULL) { } |
206 | 206 |
207 // Capacity constructor. A new set will be empty. | 207 // Capacity constructor. A new set will be empty. |
208 UniqueSet(int capacity, Zone* zone) | 208 UniqueSet(int capacity, Zone* zone) |
209 : size_(0), capacity_(capacity), | 209 : size_(0), capacity_(capacity), |
210 array_(zone->NewArray<Unique<T> >(capacity)) { | 210 array_(zone->NewArray<Unique<T> >(capacity)) { |
211 DCHECK(capacity <= kMaxCapacity); | 211 DCHECK(capacity <= kMaxCapacity); |
212 } | 212 } |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 } | 407 } |
408 capacity_ = new_capacity; | 408 capacity_ = new_capacity; |
409 array_ = new_array; | 409 array_ = new_array; |
410 } | 410 } |
411 } | 411 } |
412 }; | 412 }; |
413 | 413 |
414 } } // namespace v8::internal | 414 } } // namespace v8::internal |
415 | 415 |
416 #endif // V8_HYDROGEN_UNIQUE_H_ | 416 #endif // V8_HYDROGEN_UNIQUE_H_ |
OLD | NEW |