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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 // 1MB aligned. Start of the body is aligned so it can accommodate | 300 // 1MB aligned. Start of the body is aligned so it can accommodate |
301 // any heap object. | 301 // any heap object. |
302 class MemoryChunk { | 302 class MemoryChunk { |
303 public: | 303 public: |
304 // Only works if the pointer is in the first kPageSize of the MemoryChunk. | 304 // Only works if the pointer is in the first kPageSize of the MemoryChunk. |
305 static MemoryChunk* FromAddress(Address a) { | 305 static MemoryChunk* FromAddress(Address a) { |
306 return reinterpret_cast<MemoryChunk*>(OffsetFrom(a) & ~kAlignmentMask); | 306 return reinterpret_cast<MemoryChunk*>(OffsetFrom(a) & ~kAlignmentMask); |
307 } | 307 } |
308 | 308 |
309 // Only works for addresses in pointer spaces, not data or code spaces. | 309 // Only works for addresses in pointer spaces, not data or code spaces. |
310 static inline MemoryChunk* FromAnyPointerAddress(Address addr); | 310 static inline MemoryChunk* FromAnyPointerAddress(Heap* heap, Address addr); |
311 | 311 |
312 Address address() { return reinterpret_cast<Address>(this); } | 312 Address address() { return reinterpret_cast<Address>(this); } |
313 | 313 |
314 bool is_valid() { return address() != NULL; } | 314 bool is_valid() { return address() != NULL; } |
315 | 315 |
316 MemoryChunk* next_chunk() const { return next_chunk_; } | 316 MemoryChunk* next_chunk() const { return next_chunk_; } |
317 MemoryChunk* prev_chunk() const { return prev_chunk_; } | 317 MemoryChunk* prev_chunk() const { return prev_chunk_; } |
318 | 318 |
319 void set_next_chunk(MemoryChunk* next) { next_chunk_ = next; } | 319 void set_next_chunk(MemoryChunk* next) { next_chunk_ = next; } |
320 void set_prev_chunk(MemoryChunk* prev) { prev_chunk_ = prev; } | 320 void set_prev_chunk(MemoryChunk* prev) { prev_chunk_ = prev; } |
(...skipping 2575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2896 } | 2896 } |
2897 // Must be small, since an iteration is used for lookup. | 2897 // Must be small, since an iteration is used for lookup. |
2898 static const int kMaxComments = 64; | 2898 static const int kMaxComments = 64; |
2899 }; | 2899 }; |
2900 #endif | 2900 #endif |
2901 | 2901 |
2902 | 2902 |
2903 } } // namespace v8::internal | 2903 } } // namespace v8::internal |
2904 | 2904 |
2905 #endif // V8_SPACES_H_ | 2905 #endif // V8_SPACES_H_ |
OLD | NEW |