OLD | NEW |
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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 | 355 |
356 Address MemoryAllocator::AllocateAlignedMemory(size_t size, | 356 Address MemoryAllocator::AllocateAlignedMemory(size_t size, |
357 size_t alignment, | 357 size_t alignment, |
358 Executability executable, | 358 Executability executable, |
359 VirtualMemory* controller) { | 359 VirtualMemory* controller) { |
360 VirtualMemory reservation; | 360 VirtualMemory reservation; |
361 Address base = ReserveAlignedMemory(size, alignment, &reservation); | 361 Address base = ReserveAlignedMemory(size, alignment, &reservation); |
362 if (base == NULL) return NULL; | 362 if (base == NULL) return NULL; |
363 | 363 |
364 if (executable == EXECUTABLE) { | 364 if (executable == EXECUTABLE) { |
365 CommitCodePage(&reservation, base, size); | 365 if (!CommitCodePage(&reservation, base, size)) { |
| 366 base = NULL; |
| 367 } |
366 } else { | 368 } else { |
367 if (!reservation.Commit(base, | 369 if (!reservation.Commit(base, size, false)) { |
368 size, | 370 base = NULL; |
369 executable == EXECUTABLE)) { | |
370 return NULL; | |
371 } | 371 } |
372 } | 372 } |
373 | 373 |
| 374 if (base == NULL) { |
| 375 // Failed to commit the body. Release the mapping and any partially |
| 376 // commited regions inside it. |
| 377 reservation.Release(); |
| 378 return NULL; |
| 379 } |
| 380 |
374 controller->TakeControl(&reservation); | 381 controller->TakeControl(&reservation); |
375 return base; | 382 return base; |
376 } | 383 } |
377 | 384 |
378 | 385 |
379 void Page::InitializeAsAnchor(PagedSpace* owner) { | 386 void Page::InitializeAsAnchor(PagedSpace* owner) { |
380 set_owner(owner); | 387 set_owner(owner); |
381 set_prev_page(this); | 388 set_prev_page(this); |
382 set_next_page(this); | 389 set_next_page(this); |
383 } | 390 } |
(...skipping 2468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2852 object->ShortPrint(); | 2859 object->ShortPrint(); |
2853 PrintF("\n"); | 2860 PrintF("\n"); |
2854 } | 2861 } |
2855 printf(" --------------------------------------\n"); | 2862 printf(" --------------------------------------\n"); |
2856 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 2863 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
2857 } | 2864 } |
2858 | 2865 |
2859 #endif // DEBUG | 2866 #endif // DEBUG |
2860 | 2867 |
2861 } } // namespace v8::internal | 2868 } } // namespace v8::internal |
OLD | NEW |