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

Side by Side Diff: src/spaces.h

Issue 7970009: Merged from GC branch to bleeding_edge (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Updated test expectations. More passes, but not all. Created 9 years, 3 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
« no previous file with comments | « src/mark-compact.cc ('k') | src/spaces.cc » ('j') | 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 // 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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 void SetFlags(intptr_t flags, intptr_t mask) { 445 void SetFlags(intptr_t flags, intptr_t mask) {
446 flags_ = (flags_ & ~mask) | (flags & mask); 446 flags_ = (flags_ & ~mask) | (flags & mask);
447 } 447 }
448 448
449 // Return all current flags. 449 // Return all current flags.
450 intptr_t GetFlags() { return flags_; } 450 intptr_t GetFlags() { return flags_; }
451 451
452 // Manage live byte count (count of bytes known to be live, 452 // Manage live byte count (count of bytes known to be live,
453 // because they are marked black). 453 // because they are marked black).
454 void ResetLiveBytes() { 454 void ResetLiveBytes() {
455 if (FLAG_trace_live_byte_count) {
456 PrintF("ResetLiveBytes:%p:%x->0\n",
457 static_cast<void*>(this), live_byte_count_);
458 }
455 live_byte_count_ = 0; 459 live_byte_count_ = 0;
456 } 460 }
457 void IncrementLiveBytes(int by) { 461 void IncrementLiveBytes(int by) {
462 ASSERT_LE(static_cast<unsigned>(live_byte_count_), size_);
463 if (FLAG_trace_live_byte_count) {
464 printf("UpdateLiveBytes:%p:%x%c=%x->%x\n",
465 static_cast<void*>(this), live_byte_count_,
466 ((by < 0) ? '-' : '+'), ((by < 0) ? -by : by),
467 live_byte_count_ + by);
468 }
458 live_byte_count_ += by; 469 live_byte_count_ += by;
470 ASSERT_LE(static_cast<unsigned>(live_byte_count_), size_);
459 } 471 }
460 int LiveBytes() { return live_byte_count_; } 472 int LiveBytes() {
473 ASSERT(static_cast<unsigned>(live_byte_count_) <= size_);
474 return live_byte_count_;
475 }
461 static void IncrementLiveBytes(Address address, int by) { 476 static void IncrementLiveBytes(Address address, int by) {
462 MemoryChunk::FromAddress(address)->IncrementLiveBytes(by); 477 MemoryChunk::FromAddress(address)->IncrementLiveBytes(by);
463 } 478 }
464 479
465 static const intptr_t kAlignment = 480 static const intptr_t kAlignment =
466 (static_cast<uintptr_t>(1) << kPageSizeBits); 481 (static_cast<uintptr_t>(1) << kPageSizeBits);
467 482
468 static const intptr_t kAlignmentMask = kAlignment - 1; 483 static const intptr_t kAlignmentMask = kAlignment - 1;
469 484
485 static const intptr_t kSizeOffset = kPointerSize + kPointerSize;
486
470 static const intptr_t kLiveBytesOffset = 487 static const intptr_t kLiveBytesOffset =
471 kPointerSize + kPointerSize + kPointerSize + kPointerSize + 488 kSizeOffset + kPointerSize + kPointerSize + kPointerSize +
472 kPointerSize + kPointerSize + kPointerSize + kPointerSize + 489 kPointerSize + kPointerSize + kPointerSize + kIntSize;
473 kIntSize;
474 490
475 static const size_t kSlotsBufferOffset = kLiveBytesOffset + kIntSize; 491 static const size_t kSlotsBufferOffset = kLiveBytesOffset + kIntSize;
476 492
477 static const size_t kHeaderSize = 493 static const size_t kHeaderSize =
478 kSlotsBufferOffset + kPointerSize + kPointerSize; 494 kSlotsBufferOffset + kPointerSize + kPointerSize;
479 495
480 static const int kBodyOffset = 496 static const int kBodyOffset =
481 CODE_POINTER_ALIGN(MAP_POINTER_ALIGN(kHeaderSize + Bitmap::kSize)); 497 CODE_POINTER_ALIGN(MAP_POINTER_ALIGN(kHeaderSize + Bitmap::kSize));
482 498
483 // The start offset of the object area in a page. Aligned to both maps and 499 // The start offset of the object area in a page. Aligned to both maps and
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 bool WasSweptPrecisely() { return IsFlagSet(WAS_SWEPT_PRECISELY); } 709 bool WasSweptPrecisely() { return IsFlagSet(WAS_SWEPT_PRECISELY); }
694 bool WasSweptConservatively() { return IsFlagSet(WAS_SWEPT_CONSERVATIVELY); } 710 bool WasSweptConservatively() { return IsFlagSet(WAS_SWEPT_CONSERVATIVELY); }
695 bool WasSwept() { return WasSweptPrecisely() || WasSweptConservatively(); } 711 bool WasSwept() { return WasSweptPrecisely() || WasSweptConservatively(); }
696 712
697 void MarkSweptPrecisely() { SetFlag(WAS_SWEPT_PRECISELY); } 713 void MarkSweptPrecisely() { SetFlag(WAS_SWEPT_PRECISELY); }
698 void MarkSweptConservatively() { SetFlag(WAS_SWEPT_CONSERVATIVELY); } 714 void MarkSweptConservatively() { SetFlag(WAS_SWEPT_CONSERVATIVELY); }
699 715
700 void ClearSweptPrecisely() { ClearFlag(WAS_SWEPT_PRECISELY); } 716 void ClearSweptPrecisely() { ClearFlag(WAS_SWEPT_PRECISELY); }
701 void ClearSweptConservatively() { ClearFlag(WAS_SWEPT_CONSERVATIVELY); } 717 void ClearSweptConservatively() { ClearFlag(WAS_SWEPT_CONSERVATIVELY); }
702 718
719 #ifdef DEBUG
720 void Print();
721 #endif // DEBUG
722
703 friend class MemoryAllocator; 723 friend class MemoryAllocator;
704 }; 724 };
705 725
706 726
707 STATIC_CHECK(sizeof(Page) <= MemoryChunk::kHeaderSize); 727 STATIC_CHECK(sizeof(Page) <= MemoryChunk::kHeaderSize);
708 728
709 729
710 class LargePage : public MemoryChunk { 730 class LargePage : public MemoryChunk {
711 public: 731 public:
712 HeapObject* GetObject() { 732 HeapObject* GetObject() {
(...skipping 1884 matching lines...) Expand 10 before | Expand all | Expand 10 after
2597 } 2617 }
2598 // Must be small, since an iteration is used for lookup. 2618 // Must be small, since an iteration is used for lookup.
2599 static const int kMaxComments = 64; 2619 static const int kMaxComments = 64;
2600 }; 2620 };
2601 #endif 2621 #endif
2602 2622
2603 2623
2604 } } // namespace v8::internal 2624 } } // namespace v8::internal
2605 2625
2606 #endif // V8_SPACES_H_ 2626 #endif // V8_SPACES_H_
OLDNEW
« no previous file with comments | « src/mark-compact.cc ('k') | src/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698