| 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 = | 143 Page* first_page = memory_allocator->AllocatePage( |
| 144 memory_allocator->AllocatePage(&faked_space, NOT_EXECUTABLE); | 144 Page::kObjectAreaSize, &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(&faked_space, NOT_EXECUTABLE); | 157 memory_allocator->AllocatePage( |
| 158 Page::kObjectAreaSize, &faked_space, NOT_EXECUTABLE); |
| 158 CHECK(other->is_valid()); | 159 CHECK(other->is_valid()); |
| 159 total_pages++; | 160 total_pages++; |
| 160 other->InsertAfter(first_page); | 161 other->InsertAfter(first_page); |
| 161 int page_count = 0; | 162 int page_count = 0; |
| 162 for (Page* p = first_page; p != faked_space.anchor(); p = p->next_page()) { | 163 for (Page* p = first_page; p != faked_space.anchor(); p = p->next_page()) { |
| 163 CHECK(p->owner() == &faked_space); | 164 CHECK(p->owner() == &faked_space); |
| 164 page_count++; | 165 page_count++; |
| 165 } | 166 } |
| 166 CHECK(total_pages == page_count); | 167 CHECK(total_pages == page_count); |
| 167 | 168 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 { MaybeObject* maybe_obj = lo->AllocateRaw(lo_size, NOT_EXECUTABLE); | 258 { MaybeObject* maybe_obj = lo->AllocateRaw(lo_size, NOT_EXECUTABLE); |
| 258 if (!maybe_obj->ToObject(&obj)) break; | 259 if (!maybe_obj->ToObject(&obj)) break; |
| 259 } | 260 } |
| 260 CHECK(lo->Available() < available); | 261 CHECK(lo->Available() < available); |
| 261 }; | 262 }; |
| 262 | 263 |
| 263 CHECK(!lo->IsEmpty()); | 264 CHECK(!lo->IsEmpty()); |
| 264 | 265 |
| 265 CHECK(lo->AllocateRaw(lo_size, NOT_EXECUTABLE)->IsFailure()); | 266 CHECK(lo->AllocateRaw(lo_size, NOT_EXECUTABLE)->IsFailure()); |
| 266 } | 267 } |
| OLD | NEW |