| 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 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1070 case PROPERTY_CELL_SPACE: | 1070 case PROPERTY_CELL_SPACE: |
| 1071 size = 8 * kPointerSize * KB; | 1071 size = 8 * kPointerSize * KB; |
| 1072 break; | 1072 break; |
| 1073 case CODE_SPACE: | 1073 case CODE_SPACE: |
| 1074 if (heap()->isolate()->code_range()->exists()) { | 1074 if (heap()->isolate()->code_range()->exists()) { |
| 1075 // When code range exists, code pages are allocated in a special way | 1075 // When code range exists, code pages are allocated in a special way |
| 1076 // (from the reserved code range). That part of the code is not yet | 1076 // (from the reserved code range). That part of the code is not yet |
| 1077 // upgraded to handle small pages. | 1077 // upgraded to handle small pages. |
| 1078 size = AreaSize(); | 1078 size = AreaSize(); |
| 1079 } else { | 1079 } else { |
| 1080 size = 384 * KB; | 1080 size = 416 * KB; |
| 1081 } | 1081 } |
| 1082 break; | 1082 break; |
| 1083 default: | 1083 default: |
| 1084 UNREACHABLE(); | 1084 UNREACHABLE(); |
| 1085 } | 1085 } |
| 1086 return Min(size, AreaSize()); | 1086 return Min(size, AreaSize()); |
| 1087 } | 1087 } |
| 1088 | 1088 |
| 1089 | 1089 |
| 1090 int PagedSpace::CountTotalPages() { | 1090 int PagedSpace::CountTotalPages() { |
| (...skipping 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2678 // Free list allocation failed and there is no next page. Fail if we have | 2678 // Free list allocation failed and there is no next page. Fail if we have |
| 2679 // hit the old generation size limit that should cause a garbage | 2679 // hit the old generation size limit that should cause a garbage |
| 2680 // collection. | 2680 // collection. |
| 2681 if (!heap()->always_allocate() && | 2681 if (!heap()->always_allocate() && |
| 2682 heap()->OldGenerationAllocationLimitReached()) { | 2682 heap()->OldGenerationAllocationLimitReached()) { |
| 2683 return NULL; | 2683 return NULL; |
| 2684 } | 2684 } |
| 2685 | 2685 |
| 2686 // Try to expand the space and allocate in the new next page. | 2686 // Try to expand the space and allocate in the new next page. |
| 2687 if (Expand()) { | 2687 if (Expand()) { |
| 2688 ASSERT(CountTotalPages() > 1 || size_in_bytes <= free_list_.available()); |
| 2688 return free_list_.Allocate(size_in_bytes); | 2689 return free_list_.Allocate(size_in_bytes); |
| 2689 } | 2690 } |
| 2690 | 2691 |
| 2691 // Last ditch, sweep all the remaining pages to try to find space. This may | 2692 // Last ditch, sweep all the remaining pages to try to find space. This may |
| 2692 // cause a pause. | 2693 // cause a pause. |
| 2693 if (!IsLazySweepingComplete()) { | 2694 if (!IsLazySweepingComplete()) { |
| 2694 EnsureSweeperProgress(kMaxInt); | 2695 EnsureSweeperProgress(kMaxInt); |
| 2695 | 2696 |
| 2696 // Retry the free list allocation. | 2697 // Retry the free list allocation. |
| 2697 HeapObject* object = free_list_.Allocate(size_in_bytes); | 2698 HeapObject* object = free_list_.Allocate(size_in_bytes); |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3221 object->ShortPrint(); | 3222 object->ShortPrint(); |
| 3222 PrintF("\n"); | 3223 PrintF("\n"); |
| 3223 } | 3224 } |
| 3224 printf(" --------------------------------------\n"); | 3225 printf(" --------------------------------------\n"); |
| 3225 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3226 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
| 3226 } | 3227 } |
| 3227 | 3228 |
| 3228 #endif // DEBUG | 3229 #endif // DEBUG |
| 3229 | 3230 |
| 3230 } } // namespace v8::internal | 3231 } } // namespace v8::internal |
| OLD | NEW |