OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
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 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 135 |
136 static Unique<T> CreateImmovable(Handle<T> handle) { | 136 static Unique<T> CreateImmovable(Handle<T> handle) { |
137 return Unique<T>(reinterpret_cast<Address>(*handle), handle); | 137 return Unique<T>(reinterpret_cast<Address>(*handle), handle); |
138 } | 138 } |
139 | 139 |
140 friend class UniqueSet<T>; // Uses internal details for speed. | 140 friend class UniqueSet<T>; // Uses internal details for speed. |
141 template <class U> | 141 template <class U> |
142 friend class Unique; // For comparing raw_address values. | 142 friend class Unique; // For comparing raw_address values. |
143 | 143 |
144 private: | 144 private: |
| 145 Unique<T>() : raw_address_(NULL) { } |
| 146 |
145 Address raw_address_; | 147 Address raw_address_; |
146 Handle<T> handle_; | 148 Handle<T> handle_; |
| 149 |
| 150 friend class SideEffectsTracker; |
147 }; | 151 }; |
148 | 152 |
149 | 153 |
150 template <typename T> | 154 template <typename T> |
151 class UniqueSet V8_FINAL : public ZoneObject { | 155 class UniqueSet V8_FINAL : public ZoneObject { |
152 public: | 156 public: |
153 // Constructor. A new set will be empty. | 157 // Constructor. A new set will be empty. |
154 UniqueSet() : size_(0), capacity_(0), array_(NULL) { } | 158 UniqueSet() : size_(0), capacity_(0), array_(NULL) { } |
155 | 159 |
156 // Add a new element to this unique set. Mutates this set. O(|this|). | 160 // Add a new element to this unique set. Mutates this set. O(|this|). |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 capacity_ = new_capacity; | 327 capacity_ = new_capacity; |
324 array_ = new_array; | 328 array_ = new_array; |
325 } | 329 } |
326 } | 330 } |
327 }; | 331 }; |
328 | 332 |
329 | 333 |
330 } } // namespace v8::internal | 334 } } // namespace v8::internal |
331 | 335 |
332 #endif // V8_HYDROGEN_UNIQUE_H_ | 336 #endif // V8_HYDROGEN_UNIQUE_H_ |
OLD | NEW |