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

Side by Side Diff: src/spaces.h

Issue 7834018: Support compaction for code space pages. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: port changes from ia32 to arm & x64 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
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 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after
1450 1450
1451 bool AdvanceSweeper(intptr_t bytes_to_sweep); 1451 bool AdvanceSweeper(intptr_t bytes_to_sweep);
1452 1452
1453 bool IsSweepingComplete() { 1453 bool IsSweepingComplete() {
1454 return !first_unswept_page_->is_valid(); 1454 return !first_unswept_page_->is_valid();
1455 } 1455 }
1456 1456
1457 Page* FirstPage() { return anchor_.next_page(); } 1457 Page* FirstPage() { return anchor_.next_page(); }
1458 Page* LastPage() { return anchor_.prev_page(); } 1458 Page* LastPage() { return anchor_.prev_page(); }
1459 1459
1460 bool IsFragmented(Page* p) { 1460 bool IsFragmented(Page* p) {
Erik Corry 2011/09/06 14:10:31 Perhaps this should always return true if the --al
Vyacheslav Egorov (Chromium) 2011/09/06 15:01:42 Done.
1461 intptr_t sizes[4]; 1461 intptr_t sizes[4];
1462 free_list_.CountFreeListItems(p, sizes); 1462 free_list_.CountFreeListItems(p, sizes);
1463 1463
1464 intptr_t ratio = 1464 intptr_t ratio;
1465 (sizes[0] * 5 + sizes[1]) * 100 / Page::kObjectAreaSize; 1465 intptr_t ratio_threshold;
1466 if (identity() == CODE_SPACE) {
1467 ratio = (sizes[1] * 10 + sizes[2] * 2) * 100 / Page::kObjectAreaSize;
1468 ratio_threshold = 10;
1469 } else {
1470 ratio = (sizes[0] * 5 + sizes[1]) * 100 / Page::kObjectAreaSize;
1471 ratio_threshold = 15;
1472 }
1466 1473
1467 if (FLAG_trace_fragmentation) { 1474 if (FLAG_trace_fragmentation) {
1468 PrintF("%p: %d (%.2f%%) %d (%.2f%%) %d (%.2f%%) %d (%.2f%%) %s\n", 1475 PrintF("%p [%d]: %d (%.2f%%) %d (%.2f%%) %d (%.2f%%) %d (%.2f%%) %s\n",
1469 reinterpret_cast<void*>(p), 1476 reinterpret_cast<void*>(p),
1477 identity(),
1470 static_cast<int>(sizes[0]), 1478 static_cast<int>(sizes[0]),
1471 static_cast<double>(sizes[0] * 100) / Page::kObjectAreaSize, 1479 static_cast<double>(sizes[0] * 100) / Page::kObjectAreaSize,
1472 static_cast<int>(sizes[1]), 1480 static_cast<int>(sizes[1]),
1473 static_cast<double>(sizes[1] * 100) / Page::kObjectAreaSize, 1481 static_cast<double>(sizes[1] * 100) / Page::kObjectAreaSize,
1474 static_cast<int>(sizes[2]), 1482 static_cast<int>(sizes[2]),
1475 static_cast<double>(sizes[2] * 100) / Page::kObjectAreaSize, 1483 static_cast<double>(sizes[2] * 100) / Page::kObjectAreaSize,
1476 static_cast<int>(sizes[3]), 1484 static_cast<int>(sizes[3]),
1477 static_cast<double>(sizes[3] * 100) / Page::kObjectAreaSize, 1485 static_cast<double>(sizes[3] * 100) / Page::kObjectAreaSize,
1478 (ratio > 15) ? "[fragmented]" : ""); 1486 (ratio > ratio_threshold) ? "[fragmented]" : "");
1479 } 1487 }
1480 1488
1481 return ratio > 15; 1489 return ratio > ratio_threshold;
1482 } 1490 }
1483 1491
1484 void EvictEvacuationCandidatesFromFreeLists(); 1492 void EvictEvacuationCandidatesFromFreeLists();
1485 1493
1486 protected: 1494 protected:
1487 // Maximum capacity of this space. 1495 // Maximum capacity of this space.
1488 intptr_t max_capacity_; 1496 intptr_t max_capacity_;
1489 1497
1490 // Accounting information for this space. 1498 // Accounting information for this space.
1491 AllocationStats accounting_stats_; 1499 AllocationStats accounting_stats_;
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after
2506 } 2514 }
2507 // Must be small, since an iteration is used for lookup. 2515 // Must be small, since an iteration is used for lookup.
2508 static const int kMaxComments = 64; 2516 static const int kMaxComments = 64;
2509 }; 2517 };
2510 #endif 2518 #endif
2511 2519
2512 2520
2513 } } // namespace v8::internal 2521 } } // namespace v8::internal
2514 2522
2515 #endif // V8_SPACES_H_ 2523 #endif // V8_SPACES_H_
OLDNEW
« src/mark-compact.cc ('K') | « src/objects-inl.h ('k') | src/x64/assembler-x64-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698