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

Side by Side Diff: src/spaces.h

Issue 10974003: Make the speed of incrmental marking depend also on the rate (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 2 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
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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 CellPrinter printer; 277 CellPrinter printer;
278 for (int i = 0; i < CellsCount(); i++) { 278 for (int i = 0; i < CellsCount(); i++) {
279 printer.Print(i, cells()[i]); 279 printer.Print(i, cells()[i]);
280 } 280 }
281 printer.Flush(); 281 printer.Flush();
282 PrintF("\n"); 282 PrintF("\n");
283 } 283 }
284 284
285 bool IsClean() { 285 bool IsClean() {
286 for (int i = 0; i < CellsCount(); i++) { 286 for (int i = 0; i < CellsCount(); i++) {
287 if (cells()[i] != 0) return false; 287 if (cells()[i] != 0) {
288 return false;
289 }
288 } 290 }
289 return true; 291 return true;
290 } 292 }
291 }; 293 };
292 294
293 295
294 class SkipList; 296 class SkipList;
295 class SlotsBuffer; 297 class SlotsBuffer;
296 298
297 // MemoryChunk represents a memory region owned by a specific space. 299 // MemoryChunk represents a memory region owned by a specific space.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 return addr >= area_start() && addr < area_end(); 368 return addr >= area_start() && addr < area_end();
367 } 369 }
368 370
369 // Checks whether addr can be a limit of addresses in this page. 371 // Checks whether addr can be a limit of addresses in this page.
370 // It's a limit if it's in the page, or if it's just after the 372 // It's a limit if it's in the page, or if it's just after the
371 // last byte of the page. 373 // last byte of the page.
372 bool ContainsLimit(Address addr) { 374 bool ContainsLimit(Address addr) {
373 return addr >= area_start() && addr <= area_end(); 375 return addr >= area_start() && addr <= area_end();
374 } 376 }
375 377
378 // Every n write barrier invocations we go to runtime even though
379 // we could have handled it in generated code. This lets us check
380 // whether we have hit the limit and should do some more marking.
381 static const int kWriteBarrierCounterGranularity = 500;
382
376 enum MemoryChunkFlags { 383 enum MemoryChunkFlags {
377 IS_EXECUTABLE, 384 IS_EXECUTABLE,
378 ABOUT_TO_BE_FREED, 385 ABOUT_TO_BE_FREED,
379 POINTERS_TO_HERE_ARE_INTERESTING, 386 POINTERS_TO_HERE_ARE_INTERESTING,
380 POINTERS_FROM_HERE_ARE_INTERESTING, 387 POINTERS_FROM_HERE_ARE_INTERESTING,
381 SCAN_ON_SCAVENGE, 388 SCAN_ON_SCAVENGE,
382 IN_FROM_SPACE, // Mutually exclusive with IN_TO_SPACE. 389 IN_FROM_SPACE, // Mutually exclusive with IN_TO_SPACE.
383 IN_TO_SPACE, // All pages in new space has one of these two set. 390 IN_TO_SPACE, // All pages in new space has one of these two set.
384 NEW_SPACE_BELOW_AGE_MARK, 391 NEW_SPACE_BELOW_AGE_MARK,
385 CONTAINS_ONLY_DATA, 392 CONTAINS_ONLY_DATA,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 live_byte_count_ + by); 468 live_byte_count_ + by);
462 } 469 }
463 live_byte_count_ += by; 470 live_byte_count_ += by;
464 ASSERT_LE(static_cast<unsigned>(live_byte_count_), size_); 471 ASSERT_LE(static_cast<unsigned>(live_byte_count_), size_);
465 } 472 }
466 int LiveBytes() { 473 int LiveBytes() {
467 ASSERT(static_cast<unsigned>(live_byte_count_) <= size_); 474 ASSERT(static_cast<unsigned>(live_byte_count_) <= size_);
468 return live_byte_count_; 475 return live_byte_count_;
469 } 476 }
470 477
478 int write_barrier_counter() {
479 return static_cast<int>(write_barrier_counter_);
480 }
481
482 void set_write_barrier_counter(int counter) {
483 write_barrier_counter_ = counter;
484 }
485
486
471 static void IncrementLiveBytesFromGC(Address address, int by) { 487 static void IncrementLiveBytesFromGC(Address address, int by) {
472 MemoryChunk::FromAddress(address)->IncrementLiveBytes(by); 488 MemoryChunk::FromAddress(address)->IncrementLiveBytes(by);
473 } 489 }
474 490
475 static void IncrementLiveBytesFromMutator(Address address, int by); 491 static void IncrementLiveBytesFromMutator(Address address, int by);
476 492
477 static const intptr_t kAlignment = 493 static const intptr_t kAlignment =
478 (static_cast<uintptr_t>(1) << kPageSizeBits); 494 (static_cast<uintptr_t>(1) << kPageSizeBits);
479 495
480 static const intptr_t kAlignmentMask = kAlignment - 1; 496 static const intptr_t kAlignmentMask = kAlignment - 1;
481 497
482 static const intptr_t kSizeOffset = kPointerSize + kPointerSize; 498 static const intptr_t kSizeOffset = kPointerSize + kPointerSize;
483 499
484 static const intptr_t kLiveBytesOffset = 500 static const intptr_t kLiveBytesOffset =
485 kSizeOffset + kPointerSize + kPointerSize + kPointerSize + 501 kSizeOffset + kPointerSize + kPointerSize + kPointerSize +
486 kPointerSize + kPointerSize + 502 kPointerSize + kPointerSize +
487 kPointerSize + kPointerSize + kPointerSize + kIntSize; 503 kPointerSize + kPointerSize + kPointerSize + kIntSize;
488 504
489 static const size_t kSlotsBufferOffset = kLiveBytesOffset + kIntSize; 505 static const size_t kSlotsBufferOffset = kLiveBytesOffset + kIntSize;
490 506
491 static const size_t kHeaderSize = 507 static const size_t kWriteBarrierCounterOffset =
492 kSlotsBufferOffset + kPointerSize + kPointerSize; 508 kSlotsBufferOffset + kPointerSize + kPointerSize;
493 509
510 static const size_t kHeaderSize = kWriteBarrierCounterOffset + kPointerSize;
511
494 static const int kBodyOffset = 512 static const int kBodyOffset =
495 CODE_POINTER_ALIGN(MAP_POINTER_ALIGN(kHeaderSize + Bitmap::kSize)); 513 CODE_POINTER_ALIGN(MAP_POINTER_ALIGN(kHeaderSize + Bitmap::kSize));
496 514
497 // The start offset of the object area in a page. Aligned to both maps and 515 // The start offset of the object area in a page. Aligned to both maps and
498 // code alignment to be suitable for both. Also aligned to 32 words because 516 // code alignment to be suitable for both. Also aligned to 32 words because
499 // the marking bitmap is arranged in 32 bit chunks. 517 // the marking bitmap is arranged in 32 bit chunks.
500 static const int kObjectStartAlignment = 32 * kPointerSize; 518 static const int kObjectStartAlignment = 32 * kPointerSize;
501 static const int kObjectStartOffset = kBodyOffset - 1 + 519 static const int kObjectStartOffset = kBodyOffset - 1 +
502 (kObjectStartAlignment - (kBodyOffset - 1) % kObjectStartAlignment); 520 (kObjectStartAlignment - (kBodyOffset - 1) % kObjectStartAlignment);
503 521
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 // in a fixed array. 636 // in a fixed array.
619 Address owner_; 637 Address owner_;
620 Heap* heap_; 638 Heap* heap_;
621 // Used by the store buffer to keep track of which pages to mark scan-on- 639 // Used by the store buffer to keep track of which pages to mark scan-on-
622 // scavenge. 640 // scavenge.
623 int store_buffer_counter_; 641 int store_buffer_counter_;
624 // Count of bytes marked black on page. 642 // Count of bytes marked black on page.
625 int live_byte_count_; 643 int live_byte_count_;
626 SlotsBuffer* slots_buffer_; 644 SlotsBuffer* slots_buffer_;
627 SkipList* skip_list_; 645 SkipList* skip_list_;
646 intptr_t write_barrier_counter_;
628 647
629 static MemoryChunk* Initialize(Heap* heap, 648 static MemoryChunk* Initialize(Heap* heap,
630 Address base, 649 Address base,
631 size_t size, 650 size_t size,
632 Address area_start, 651 Address area_start,
633 Address area_end, 652 Address area_end,
634 Executability executable, 653 Executability executable,
635 Space* owner); 654 Space* owner);
636 655
637 friend class MemoryAllocator; 656 friend class MemoryAllocator;
(...skipping 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after
2649 } 2668 }
2650 // Must be small, since an iteration is used for lookup. 2669 // Must be small, since an iteration is used for lookup.
2651 static const int kMaxComments = 64; 2670 static const int kMaxComments = 64;
2652 }; 2671 };
2653 #endif 2672 #endif
2654 2673
2655 2674
2656 } } // namespace v8::internal 2675 } } // namespace v8::internal
2657 2676
2658 #endif // V8_SPACES_H_ 2677 #endif // V8_SPACES_H_
OLDNEW
« src/incremental-marking.cc ('K') | « src/incremental-marking-inl.h ('k') | src/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698