| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 133 |
| 134 MemoryAllocator* memory_allocator = new MemoryAllocator(isolate); | 134 MemoryAllocator* memory_allocator = new MemoryAllocator(isolate); |
| 135 CHECK(memory_allocator->SetUp(heap->MaxReserved(), | 135 CHECK(memory_allocator->SetUp(heap->MaxReserved(), |
| 136 heap->MaxExecutableSize())); | 136 heap->MaxExecutableSize())); |
| 137 | 137 |
| 138 int total_pages = 0; | 138 int total_pages = 0; |
| 139 OldSpace faked_space(heap, | 139 OldSpace faked_space(heap, |
| 140 heap->MaxReserved(), | 140 heap->MaxReserved(), |
| 141 OLD_POINTER_SPACE, | 141 OLD_POINTER_SPACE, |
| 142 NOT_EXECUTABLE); | 142 NOT_EXECUTABLE); |
| 143 Page* first_page = memory_allocator->AllocatePage( | 143 Page* first_page = |
| 144 Page::kObjectAreaSize, &faked_space, NOT_EXECUTABLE); | 144 memory_allocator->AllocatePage(&faked_space, NOT_EXECUTABLE); |
| 145 | 145 |
| 146 first_page->InsertAfter(faked_space.anchor()->prev_page()); | 146 first_page->InsertAfter(faked_space.anchor()->prev_page()); |
| 147 CHECK(first_page->is_valid()); | 147 CHECK(first_page->is_valid()); |
| 148 CHECK(first_page->next_page() == faked_space.anchor()); | 148 CHECK(first_page->next_page() == faked_space.anchor()); |
| 149 total_pages++; | 149 total_pages++; |
| 150 | 150 |
| 151 for (Page* p = first_page; p != faked_space.anchor(); p = p->next_page()) { | 151 for (Page* p = first_page; p != faked_space.anchor(); p = p->next_page()) { |
| 152 CHECK(p->owner() == &faked_space); | 152 CHECK(p->owner() == &faked_space); |
| 153 } | 153 } |
| 154 | 154 |
| 155 // Again, we should get n or n - 1 pages. | 155 // Again, we should get n or n - 1 pages. |
| 156 Page* other = | 156 Page* other = |
| 157 memory_allocator->AllocatePage( | 157 memory_allocator->AllocatePage(&faked_space, NOT_EXECUTABLE); |
| 158 Page::kObjectAreaSize, &faked_space, NOT_EXECUTABLE); | |
| 159 CHECK(other->is_valid()); | 158 CHECK(other->is_valid()); |
| 160 total_pages++; | 159 total_pages++; |
| 161 other->InsertAfter(first_page); | 160 other->InsertAfter(first_page); |
| 162 int page_count = 0; | 161 int page_count = 0; |
| 163 for (Page* p = first_page; p != faked_space.anchor(); p = p->next_page()) { | 162 for (Page* p = first_page; p != faked_space.anchor(); p = p->next_page()) { |
| 164 CHECK(p->owner() == &faked_space); | 163 CHECK(p->owner() == &faked_space); |
| 165 page_count++; | 164 page_count++; |
| 166 } | 165 } |
| 167 CHECK(total_pages == page_count); | 166 CHECK(total_pages == page_count); |
| 168 | 167 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 { MaybeObject* maybe_obj = lo->AllocateRaw(lo_size, NOT_EXECUTABLE); | 257 { MaybeObject* maybe_obj = lo->AllocateRaw(lo_size, NOT_EXECUTABLE); |
| 259 if (!maybe_obj->ToObject(&obj)) break; | 258 if (!maybe_obj->ToObject(&obj)) break; |
| 260 } | 259 } |
| 261 CHECK(lo->Available() < available); | 260 CHECK(lo->Available() < available); |
| 262 }; | 261 }; |
| 263 | 262 |
| 264 CHECK(!lo->IsEmpty()); | 263 CHECK(!lo->IsEmpty()); |
| 265 | 264 |
| 266 CHECK(lo->AllocateRaw(lo_size, NOT_EXECUTABLE)->IsFailure()); | 265 CHECK(lo->AllocateRaw(lo_size, NOT_EXECUTABLE)->IsFailure()); |
| 267 } | 266 } |
| OLD | NEW |