OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 | 313 |
314 MemoryChunk* next_chunk() const { return next_chunk_; } | 314 MemoryChunk* next_chunk() const { return next_chunk_; } |
315 MemoryChunk* prev_chunk() const { return prev_chunk_; } | 315 MemoryChunk* prev_chunk() const { return prev_chunk_; } |
316 | 316 |
317 void set_next_chunk(MemoryChunk* next) { next_chunk_ = next; } | 317 void set_next_chunk(MemoryChunk* next) { next_chunk_ = next; } |
318 void set_prev_chunk(MemoryChunk* prev) { prev_chunk_ = prev; } | 318 void set_prev_chunk(MemoryChunk* prev) { prev_chunk_ = prev; } |
319 | 319 |
320 Space* owner() const { | 320 Space* owner() const { |
321 if ((reinterpret_cast<intptr_t>(owner_) & kFailureTagMask) == | 321 if ((reinterpret_cast<intptr_t>(owner_) & kFailureTagMask) == |
322 kFailureTag) { | 322 kFailureTag) { |
323 return reinterpret_cast<Space*>(owner_ - kFailureTag); | 323 return reinterpret_cast<Space*>(reinterpret_cast<intptr_t>(owner_) - |
| 324 kFailureTag); |
324 } else { | 325 } else { |
325 return NULL; | 326 return NULL; |
326 } | 327 } |
327 } | 328 } |
328 | 329 |
329 void set_owner(Space* space) { | 330 void set_owner(Space* space) { |
330 ASSERT((reinterpret_cast<intptr_t>(space) & kFailureTagMask) == 0); | 331 ASSERT((reinterpret_cast<intptr_t>(space) & kFailureTagMask) == 0); |
331 owner_ = reinterpret_cast<Address>(space) + kFailureTag; | 332 owner_ = reinterpret_cast<Address>(space) + kFailureTag; |
332 ASSERT((reinterpret_cast<intptr_t>(owner_) & kFailureTagMask) == | 333 ASSERT((reinterpret_cast<intptr_t>(owner_) & kFailureTagMask) == |
333 kFailureTag); | 334 kFailureTag); |
334 } | 335 } |
335 | 336 |
336 // Workaround for a bug in Clang-3.3 which in some situations optimizes away | |
337 // an "if (chunk->owner() != NULL)" check. | |
338 bool has_owner() { | |
339 if (owner_ == 0) return false; | |
340 if (reinterpret_cast<intptr_t>(owner_) == kFailureTag) return false; | |
341 return true; | |
342 } | |
343 | |
344 VirtualMemory* reserved_memory() { | 337 VirtualMemory* reserved_memory() { |
345 return &reservation_; | 338 return &reservation_; |
346 } | 339 } |
347 | 340 |
348 void InitializeReservedMemory() { | 341 void InitializeReservedMemory() { |
349 reservation_.Reset(); | 342 reservation_.Reset(); |
350 } | 343 } |
351 | 344 |
352 void set_reserved_memory(VirtualMemory* reservation) { | 345 void set_reserved_memory(VirtualMemory* reservation) { |
353 ASSERT_NOT_NULL(reservation); | 346 ASSERT_NOT_NULL(reservation); |
(...skipping 2473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2827 } | 2820 } |
2828 // Must be small, since an iteration is used for lookup. | 2821 // Must be small, since an iteration is used for lookup. |
2829 static const int kMaxComments = 64; | 2822 static const int kMaxComments = 64; |
2830 }; | 2823 }; |
2831 #endif | 2824 #endif |
2832 | 2825 |
2833 | 2826 |
2834 } } // namespace v8::internal | 2827 } } // namespace v8::internal |
2835 | 2828 |
2836 #endif // V8_SPACES_H_ | 2829 #endif // V8_SPACES_H_ |
OLD | NEW |