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

Side by Side Diff: src/heap.h

Issue 10552002: Unify promotion and allocation limit computation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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
« no previous file with comments | « no previous file | src/heap.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 } 1352 }
1353 1353
1354 inline intptr_t OldGenerationSpaceAvailable() { 1354 inline intptr_t OldGenerationSpaceAvailable() {
1355 return old_gen_allocation_limit_ - PromotedTotalSize(); 1355 return old_gen_allocation_limit_ - PromotedTotalSize();
1356 } 1356 }
1357 1357
1358 inline intptr_t OldGenerationCapacityAvailable() { 1358 inline intptr_t OldGenerationCapacityAvailable() {
1359 return max_old_generation_size_ - PromotedTotalSize(); 1359 return max_old_generation_size_ - PromotedTotalSize();
1360 } 1360 }
1361 1361
1362 static const intptr_t kMinimumPromotionLimit = 5 * Page::kPageSize; 1362 static const intptr_t kMinPromotionLimit = 5 * Page::kPageSize;
1363 static const intptr_t kMinimumAllocationLimit = 1363 static const intptr_t kMinAllocationLimit =
1364 8 * (Page::kPageSize > MB ? Page::kPageSize : MB); 1364 8 * (Page::kPageSize > MB ? Page::kPageSize : MB);
1365 1365
1366 intptr_t OldGenPromotionLimit(intptr_t old_gen_size) { 1366 intptr_t OldGenLimit(intptr_t old_gen_size, intptr_t min_limit) {
1367 const int divisor = FLAG_stress_compaction ? 10 : 3; 1367 const int divisor = FLAG_stress_compaction ? 8 : 2;
1368 intptr_t limit = 1368 intptr_t limit = Max(old_gen_size + old_gen_size / divisor, min_limit);
1369 Max(old_gen_size + old_gen_size / divisor, kMinimumPromotionLimit);
1370 limit += new_space_.Capacity(); 1369 limit += new_space_.Capacity();
1371 limit *= old_gen_limit_factor_; 1370 limit *= old_gen_limit_factor_;
1372 intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2; 1371 intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2;
1373 return Min(limit, halfway_to_the_max);
1374 }
1375
1376 intptr_t OldGenAllocationLimit(intptr_t old_gen_size) {
1377 const int divisor = FLAG_stress_compaction ? 8 : 2;
1378 intptr_t limit =
1379 Max(old_gen_size + old_gen_size / divisor, kMinimumAllocationLimit);
1380 limit += new_space_.Capacity();
1381 limit *= old_gen_limit_factor_;
1382 intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2;
1383 return Min(limit, halfway_to_the_max); 1372 return Min(limit, halfway_to_the_max);
1384 } 1373 }
1385 1374
1386 // Implements the corresponding V8 API function. 1375 // Implements the corresponding V8 API function.
1387 bool IdleNotification(int hint); 1376 bool IdleNotification(int hint);
1388 1377
1389 // Declare all the root indices. 1378 // Declare all the root indices.
1390 enum RootListIndex { 1379 enum RootListIndex {
1391 #define ROOT_INDEX_DECLARATION(type, name, camel_name) k##camel_name##RootIndex, 1380 #define ROOT_INDEX_DECLARATION(type, name, camel_name) k##camel_name##RootIndex,
1392 STRONG_ROOT_LIST(ROOT_INDEX_DECLARATION) 1381 STRONG_ROOT_LIST(ROOT_INDEX_DECLARATION)
(...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after
2701 AssertNoAllocation no_alloc; // i.e. no gc allowed. 2690 AssertNoAllocation no_alloc; // i.e. no gc allowed.
2702 2691
2703 private: 2692 private:
2704 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 2693 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
2705 }; 2694 };
2706 #endif // DEBUG || LIVE_OBJECT_LIST 2695 #endif // DEBUG || LIVE_OBJECT_LIST
2707 2696
2708 } } // namespace v8::internal 2697 } } // namespace v8::internal
2709 2698
2710 #endif // V8_HEAP_H_ 2699 #endif // V8_HEAP_H_
OLDNEW
« no previous file with comments | « no previous file | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698