OLD | NEW |
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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 // greater than zero. | 431 // greater than zero. |
432 static Page* CommitPages(Address start, size_t size, PagedSpace* owner, | 432 static Page* CommitPages(Address start, size_t size, PagedSpace* owner, |
433 int* num_pages); | 433 int* num_pages); |
434 | 434 |
435 // Commit a contiguous block of memory from the initial chunk. Assumes that | 435 // Commit a contiguous block of memory from the initial chunk. Assumes that |
436 // the address is not NULL, the size is greater than zero, and that the | 436 // the address is not NULL, the size is greater than zero, and that the |
437 // block is contained in the initial chunk. Returns true if it succeeded | 437 // block is contained in the initial chunk. Returns true if it succeeded |
438 // and false otherwise. | 438 // and false otherwise. |
439 static bool CommitBlock(Address start, size_t size, Executability executable); | 439 static bool CommitBlock(Address start, size_t size, Executability executable); |
440 | 440 |
441 | |
442 // Uncommit a contiguous block of memory [start..(start+size)[. | 441 // Uncommit a contiguous block of memory [start..(start+size)[. |
443 // start is not NULL, the size is greater than zero, and the | 442 // start is not NULL, the size is greater than zero, and the |
444 // block is contained in the initial chunk. Returns true if it succeeded | 443 // block is contained in the initial chunk. Returns true if it succeeded |
445 // and false otherwise. | 444 // and false otherwise. |
446 static bool UncommitBlock(Address start, size_t size); | 445 static bool UncommitBlock(Address start, size_t size); |
447 | 446 |
| 447 // Zaps a contiguous block of memory [start..(start+size)[ thus |
| 448 // filling it up with a recognizable non-NULL bit pattern. |
| 449 static void ZapBlock(Address start, size_t size); |
| 450 |
448 // Attempts to allocate the requested (non-zero) number of pages from the | 451 // Attempts to allocate the requested (non-zero) number of pages from the |
449 // OS. Fewer pages might be allocated than requested. If it fails to | 452 // OS. Fewer pages might be allocated than requested. If it fails to |
450 // allocate memory for the OS or cannot allocate a single page, this | 453 // allocate memory for the OS or cannot allocate a single page, this |
451 // function returns an invalid page pointer (NULL). The caller must check | 454 // function returns an invalid page pointer (NULL). The caller must check |
452 // whether the returned page is valid (by calling Page::is_valid()). It is | 455 // whether the returned page is valid (by calling Page::is_valid()). It is |
453 // guaranteed that allocated pages have contiguous addresses. The actual | 456 // guaranteed that allocated pages have contiguous addresses. The actual |
454 // number of allocated pages is returned in the output parameter | 457 // number of allocated pages is returned in the output parameter |
455 // allocated_pages. If the PagedSpace owner is executable and there is | 458 // allocated_pages. If the PagedSpace owner is executable and there is |
456 // a code range, the pages are allocated from the code range. | 459 // a code range, the pages are allocated from the code range. |
457 static Page* AllocatePages(int requested_pages, int* allocated_pages, | 460 static Page* AllocatePages(int requested_pages, int* allocated_pages, |
(...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2067 | 2070 |
2068 private: | 2071 private: |
2069 LargeObjectChunk* current_; | 2072 LargeObjectChunk* current_; |
2070 HeapObjectCallback size_func_; | 2073 HeapObjectCallback size_func_; |
2071 }; | 2074 }; |
2072 | 2075 |
2073 | 2076 |
2074 } } // namespace v8::internal | 2077 } } // namespace v8::internal |
2075 | 2078 |
2076 #endif // V8_SPACES_H_ | 2079 #endif // V8_SPACES_H_ |
OLD | NEW |