| 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 14 matching lines...) Expand all Loading... |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include <stdlib.h> | 28 #include <stdlib.h> |
| 29 | 29 |
| 30 #include "v8.h" | 30 #include "v8.h" |
| 31 #include "cctest.h" | 31 #include "cctest.h" |
| 32 | 32 |
| 33 using namespace v8::internal; | 33 using namespace v8::internal; |
| 34 | 34 |
| 35 #if 0 |
| 35 static void VerifyRegionMarking(Address page_start) { | 36 static void VerifyRegionMarking(Address page_start) { |
| 36 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER | 37 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER |
| 37 Page* p = Page::FromAddress(page_start); | 38 Page* p = Page::FromAddress(page_start); |
| 38 | 39 |
| 39 p->SetRegionMarks(Page::kAllRegionsCleanMarks); | 40 p->SetRegionMarks(Page::kAllRegionsCleanMarks); |
| 40 | 41 |
| 41 for (Address addr = p->ObjectAreaStart(); | 42 for (Address addr = p->ObjectAreaStart(); |
| 42 addr < p->ObjectAreaEnd(); | 43 addr < p->ObjectAreaEnd(); |
| 43 addr += kPointerSize) { | 44 addr += kPointerSize) { |
| 44 CHECK(!Page::FromAddress(addr)->IsRegionDirty(addr)); | 45 CHECK(!Page::FromAddress(addr)->IsRegionDirty(addr)); |
| 45 } | 46 } |
| 46 | 47 |
| 47 for (Address addr = p->ObjectAreaStart(); | 48 for (Address addr = p->ObjectAreaStart(); |
| 48 addr < p->ObjectAreaEnd(); | 49 addr < p->ObjectAreaEnd(); |
| 49 addr += kPointerSize) { | 50 addr += kPointerSize) { |
| 50 Page::FromAddress(addr)->MarkRegionDirty(addr); | 51 Page::FromAddress(addr)->MarkRegionDirty(addr); |
| 51 } | 52 } |
| 52 | 53 |
| 53 for (Address addr = p->ObjectAreaStart(); | 54 for (Address addr = p->ObjectAreaStart(); |
| 54 addr < p->ObjectAreaEnd(); | 55 addr < p->ObjectAreaEnd(); |
| 55 addr += kPointerSize) { | 56 addr += kPointerSize) { |
| 56 CHECK(Page::FromAddress(addr)->IsRegionDirty(addr)); | 57 CHECK(Page::FromAddress(addr)->IsRegionDirty(addr)); |
| 57 } | 58 } |
| 58 #endif | 59 #endif |
| 59 } | 60 } |
| 61 #endif |
| 60 | 62 |
| 61 | 63 |
| 64 #if 0 |
| 62 TEST(Page) { | 65 TEST(Page) { |
| 63 byte* mem = NewArray<byte>(2*Page::kPageSize); | 66 byte* mem = NewArray<byte>(2*Page::kPageSize); |
| 64 CHECK(mem != NULL); | 67 CHECK(mem != NULL); |
| 65 | 68 |
| 66 Address start = reinterpret_cast<Address>(mem); | 69 Address start = reinterpret_cast<Address>(mem); |
| 67 Address page_start = RoundUp(start, Page::kPageSize); | 70 Address page_start = RoundUp(start, Page::kPageSize); |
| 68 | 71 |
| 69 Page* p = Page::FromAddress(page_start); | 72 Page* p = Page::FromAddress(page_start); |
| 70 CHECK(p->address() == page_start); | 73 CHECK(p->address() == page_start); |
| 71 CHECK(p->is_valid()); | 74 CHECK(p->is_valid()); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 | 233 |
| 231 CHECK(!lo->IsEmpty()); | 234 CHECK(!lo->IsEmpty()); |
| 232 | 235 |
| 233 CHECK(lo->AllocateRaw(lo_size)->IsFailure()); | 236 CHECK(lo->AllocateRaw(lo_size)->IsFailure()); |
| 234 | 237 |
| 235 lo->TearDown(); | 238 lo->TearDown(); |
| 236 delete lo; | 239 delete lo; |
| 237 | 240 |
| 238 MemoryAllocator::TearDown(); | 241 MemoryAllocator::TearDown(); |
| 239 } | 242 } |
| 243 #endif |
| OLD | NEW |