Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: src/spaces.h

Issue 349623002: Make object accessors more const-correct. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« src/objects.h ('K') | « src/objects-inl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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_SPACES_H_ 5 #ifndef V8_SPACES_H_
6 #define V8_SPACES_H_ 6 #define V8_SPACES_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/base/atomicops.h" 9 #include "src/base/atomicops.h"
10 #include "src/hashmap.h" 10 #include "src/hashmap.h"
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 // MemoryChunk represents a memory region owned by a specific space. 276 // MemoryChunk represents a memory region owned by a specific space.
277 // It is divided into the header and the body. Chunk start is always 277 // It is divided into the header and the body. Chunk start is always
278 // 1MB aligned. Start of the body is aligned so it can accommodate 278 // 1MB aligned. Start of the body is aligned so it can accommodate
279 // any heap object. 279 // any heap object.
280 class MemoryChunk { 280 class MemoryChunk {
281 public: 281 public:
282 // Only works if the pointer is in the first kPageSize of the MemoryChunk. 282 // Only works if the pointer is in the first kPageSize of the MemoryChunk.
283 static MemoryChunk* FromAddress(Address a) { 283 static MemoryChunk* FromAddress(Address a) {
284 return reinterpret_cast<MemoryChunk*>(OffsetFrom(a) & ~kAlignmentMask); 284 return reinterpret_cast<MemoryChunk*>(OffsetFrom(a) & ~kAlignmentMask);
285 } 285 }
286 static const MemoryChunk* FromAddress(const byte* a) {
287 return reinterpret_cast<const MemoryChunk*>(
288 OffsetFrom(a) & ~kAlignmentMask);
289 }
286 290
287 // Only works for addresses in pointer spaces, not data or code spaces. 291 // Only works for addresses in pointer spaces, not data or code spaces.
288 static inline MemoryChunk* FromAnyPointerAddress(Heap* heap, Address addr); 292 static inline MemoryChunk* FromAnyPointerAddress(Heap* heap, Address addr);
289 293
290 Address address() { return reinterpret_cast<Address>(this); } 294 Address address() { return reinterpret_cast<Address>(this); }
291 295
292 bool is_valid() { return address() != NULL; } 296 bool is_valid() { return address() != NULL; }
293 297
294 MemoryChunk* next_chunk() const { 298 MemoryChunk* next_chunk() const {
295 return reinterpret_cast<MemoryChunk*>(base::Acquire_Load(&next_chunk_)); 299 return reinterpret_cast<MemoryChunk*>(base::Acquire_Load(&next_chunk_));
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 return static_cast<uint32_t>(offset) >> kPointerSizeLog2; 624 return static_cast<uint32_t>(offset) >> kPointerSizeLog2;
621 } 625 }
622 626
623 inline Address MarkbitIndexToAddress(uint32_t index) { 627 inline Address MarkbitIndexToAddress(uint32_t index) {
624 return this->address() + (index << kPointerSizeLog2); 628 return this->address() + (index << kPointerSizeLog2);
625 } 629 }
626 630
627 void InsertAfter(MemoryChunk* other); 631 void InsertAfter(MemoryChunk* other);
628 void Unlink(); 632 void Unlink();
629 633
630 inline Heap* heap() { return heap_; } 634 inline Heap* heap() const { return heap_; }
631 635
632 static const int kFlagsOffset = kPointerSize; 636 static const int kFlagsOffset = kPointerSize;
633 637
634 bool IsEvacuationCandidate() { return IsFlagSet(EVACUATION_CANDIDATE); } 638 bool IsEvacuationCandidate() { return IsFlagSet(EVACUATION_CANDIDATE); }
635 639
636 bool ShouldSkipEvacuationSlotRecording() { 640 bool ShouldSkipEvacuationSlotRecording() {
637 return (flags_ & kSkipEvacuationSlotsRecordingMask) != 0; 641 return (flags_ & kSkipEvacuationSlotsRecordingMask) != 0;
638 } 642 }
639 643
640 inline SkipList* skip_list() { 644 inline SkipList* skip_list() {
(...skipping 2359 matching lines...) Expand 10 before | Expand all | Expand 10 after
3000 } 3004 }
3001 // Must be small, since an iteration is used for lookup. 3005 // Must be small, since an iteration is used for lookup.
3002 static const int kMaxComments = 64; 3006 static const int kMaxComments = 64;
3003 }; 3007 };
3004 #endif 3008 #endif
3005 3009
3006 3010
3007 } } // namespace v8::internal 3011 } } // namespace v8::internal
3008 3012
3009 #endif // V8_SPACES_H_ 3013 #endif // V8_SPACES_H_
OLDNEW
« src/objects.h ('K') | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698