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

Side by Side Diff: src/spaces.h

Issue 414045: After performing scavenge, hint OS that data in from spaces are no more neede... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 1 month 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/platform-win32.cc ('k') | src/spaces-inl.h » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 // and false otherwise. 433 // and false otherwise.
434 static bool CommitBlock(Address start, size_t size, Executability executable); 434 static bool CommitBlock(Address start, size_t size, Executability executable);
435 435
436 436
437 // Uncommit a contiguous block of memory [start..(start+size)[. 437 // Uncommit a contiguous block of memory [start..(start+size)[.
438 // start is not NULL, the size is greater than zero, and the 438 // start is not NULL, the size is greater than zero, and the
439 // block is contained in the initial chunk. Returns true if it succeeded 439 // block is contained in the initial chunk. Returns true if it succeeded
440 // and false otherwise. 440 // and false otherwise.
441 static bool UncommitBlock(Address start, size_t size); 441 static bool UncommitBlock(Address start, size_t size);
442 442
443 // Give OS a hint that data of this contiguous block of memory are no longer
444 // needed and could be discarded. This does NOT uncommit the block though.
445 static inline bool ResetBlock(Address start, size_t size,
446 Executability executable);
447
443 // Attempts to allocate the requested (non-zero) number of pages from the 448 // Attempts to allocate the requested (non-zero) number of pages from the
444 // OS. Fewer pages might be allocated than requested. If it fails to 449 // OS. Fewer pages might be allocated than requested. If it fails to
445 // allocate memory for the OS or cannot allocate a single page, this 450 // allocate memory for the OS or cannot allocate a single page, this
446 // function returns an invalid page pointer (NULL). The caller must check 451 // function returns an invalid page pointer (NULL). The caller must check
447 // whether the returned page is valid (by calling Page::is_valid()). It is 452 // whether the returned page is valid (by calling Page::is_valid()). It is
448 // guaranteed that allocated pages have contiguous addresses. The actual 453 // guaranteed that allocated pages have contiguous addresses. The actual
449 // number of allocated pages is returned in the output parameter 454 // number of allocated pages is returned in the output parameter
450 // allocated_pages. If the PagedSpace owner is executable and there is 455 // allocated_pages. If the PagedSpace owner is executable and there is
451 // a code range, the pages are allocated from the code range. 456 // a code range, the pages are allocated from the code range.
452 static Page* AllocatePages(int requested_pages, int* allocated_pages, 457 static Page* AllocatePages(int requested_pages, int* allocated_pages,
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 // If we don't have this here then SemiSpace will be abstract. However 1128 // If we don't have this here then SemiSpace will be abstract. However
1124 // it should never be called. 1129 // it should never be called.
1125 virtual int Size() { 1130 virtual int Size() {
1126 UNREACHABLE(); 1131 UNREACHABLE();
1127 return 0; 1132 return 0;
1128 } 1133 }
1129 1134
1130 bool is_committed() { return committed_; } 1135 bool is_committed() { return committed_; }
1131 bool Commit(); 1136 bool Commit();
1132 bool Uncommit(); 1137 bool Uncommit();
1138 inline bool Reset();
1133 1139
1134 #ifdef DEBUG 1140 #ifdef DEBUG
1135 virtual void Print(); 1141 virtual void Print();
1136 virtual void Verify(); 1142 virtual void Verify();
1137 #endif 1143 #endif
1138 1144
1139 // Returns the current capacity of the semi space. 1145 // Returns the current capacity of the semi space.
1140 int Capacity() { return capacity_; } 1146 int Capacity() { return capacity_; }
1141 1147
1142 // Returns the maximum capacity of the semi space. 1148 // Returns the maximum capacity of the semi space.
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1382 bool CommitFromSpaceIfNeeded() { 1388 bool CommitFromSpaceIfNeeded() {
1383 if (from_space_.is_committed()) return true; 1389 if (from_space_.is_committed()) return true;
1384 return from_space_.Commit(); 1390 return from_space_.Commit();
1385 } 1391 }
1386 1392
1387 bool UncommitFromSpace() { 1393 bool UncommitFromSpace() {
1388 if (!from_space_.is_committed()) return true; 1394 if (!from_space_.is_committed()) return true;
1389 return from_space_.Uncommit(); 1395 return from_space_.Uncommit();
1390 } 1396 }
1391 1397
1398 bool ResetFromSpace() {
1399 return from_space_.Reset();
1400 }
1401
1392 private: 1402 private:
1393 // The semispaces. 1403 // The semispaces.
1394 SemiSpace to_space_; 1404 SemiSpace to_space_;
1395 SemiSpace from_space_; 1405 SemiSpace from_space_;
1396 1406
1397 // Start address and bit mask for containment testing. 1407 // Start address and bit mask for containment testing.
1398 Address start_; 1408 Address start_;
1399 uintptr_t address_mask_; 1409 uintptr_t address_mask_;
1400 uintptr_t object_mask_; 1410 uintptr_t object_mask_;
1401 uintptr_t object_expected_; 1411 uintptr_t object_expected_;
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
1949 1959
1950 private: 1960 private:
1951 LargeObjectChunk* current_; 1961 LargeObjectChunk* current_;
1952 HeapObjectCallback size_func_; 1962 HeapObjectCallback size_func_;
1953 }; 1963 };
1954 1964
1955 1965
1956 } } // namespace v8::internal 1966 } } // namespace v8::internal
1957 1967
1958 #endif // V8_SPACES_H_ 1968 #endif // V8_SPACES_H_
OLDNEW
« no previous file with comments | « src/platform-win32.cc ('k') | src/spaces-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698