Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: test/cctest/test-spaces.cc

Issue 2274001: Revert r4715. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-heap.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 static void VerifyRegionMarking(Address page_start) { 35 static void VerifyRSet(Address page_start) {
36 #ifdef DEBUG
37 Page::set_rset_state(Page::IN_USE);
38 #endif
39
36 Page* p = Page::FromAddress(page_start); 40 Page* p = Page::FromAddress(page_start);
37 41
38 p->SetRegionMarks(Page::kAllRegionsCleanMarks); 42 p->ClearRSet();
39 43
40 for (Address addr = p->ObjectAreaStart(); 44 for (Address addr = p->ObjectAreaStart();
41 addr < p->ObjectAreaEnd(); 45 addr < p->ObjectAreaEnd();
42 addr += kPointerSize) { 46 addr += kPointerSize) {
43 CHECK(!Page::FromAddress(addr)->IsRegionDirty(addr)); 47 CHECK(!Page::IsRSetSet(addr, 0));
44 } 48 }
45 49
46 for (Address addr = p->ObjectAreaStart(); 50 for (Address addr = p->ObjectAreaStart();
47 addr < p->ObjectAreaEnd(); 51 addr < p->ObjectAreaEnd();
48 addr += kPointerSize) { 52 addr += kPointerSize) {
49 Page::FromAddress(addr)->MarkRegionDirty(addr); 53 Page::SetRSet(addr, 0);
50 } 54 }
51 55
52 for (Address addr = p->ObjectAreaStart(); 56 for (Address addr = p->ObjectAreaStart();
53 addr < p->ObjectAreaEnd(); 57 addr < p->ObjectAreaEnd();
54 addr += kPointerSize) { 58 addr += kPointerSize) {
55 CHECK(Page::FromAddress(addr)->IsRegionDirty(addr)); 59 CHECK(Page::IsRSetSet(addr, 0));
56 } 60 }
57 } 61 }
58 62
59 63
60 TEST(Page) { 64 TEST(Page) {
65 #ifdef DEBUG
66 Page::set_rset_state(Page::NOT_IN_USE);
67 #endif
68
61 byte* mem = NewArray<byte>(2*Page::kPageSize); 69 byte* mem = NewArray<byte>(2*Page::kPageSize);
62 CHECK(mem != NULL); 70 CHECK(mem != NULL);
63 71
64 Address start = reinterpret_cast<Address>(mem); 72 Address start = reinterpret_cast<Address>(mem);
65 Address page_start = RoundUp(start, Page::kPageSize); 73 Address page_start = RoundUp(start, Page::kPageSize);
66 74
67 Page* p = Page::FromAddress(page_start); 75 Page* p = Page::FromAddress(page_start);
68 CHECK(p->address() == page_start); 76 CHECK(p->address() == page_start);
69 CHECK(p->is_valid()); 77 CHECK(p->is_valid());
70 78
71 p->opaque_header = 0; 79 p->opaque_header = 0;
72 p->SetIsLargeObjectPage(false); 80 p->SetIsLargeObjectPage(false);
73 CHECK(!p->next_page()->is_valid()); 81 CHECK(!p->next_page()->is_valid());
74 82
75 CHECK(p->ObjectAreaStart() == page_start + Page::kObjectStartOffset); 83 CHECK(p->ObjectAreaStart() == page_start + Page::kObjectStartOffset);
76 CHECK(p->ObjectAreaEnd() == page_start + Page::kPageSize); 84 CHECK(p->ObjectAreaEnd() == page_start + Page::kPageSize);
77 85
78 CHECK(p->Offset(page_start + Page::kObjectStartOffset) == 86 CHECK(p->Offset(page_start + Page::kObjectStartOffset) ==
79 Page::kObjectStartOffset); 87 Page::kObjectStartOffset);
80 CHECK(p->Offset(page_start + Page::kPageSize) == Page::kPageSize); 88 CHECK(p->Offset(page_start + Page::kPageSize) == Page::kPageSize);
81 89
82 CHECK(p->OffsetToAddress(Page::kObjectStartOffset) == p->ObjectAreaStart()); 90 CHECK(p->OffsetToAddress(Page::kObjectStartOffset) == p->ObjectAreaStart());
83 CHECK(p->OffsetToAddress(Page::kPageSize) == p->ObjectAreaEnd()); 91 CHECK(p->OffsetToAddress(Page::kPageSize) == p->ObjectAreaEnd());
84 92
85 // test region marking 93 // test remember set
86 VerifyRegionMarking(page_start); 94 VerifyRSet(page_start);
87 95
88 DeleteArray(mem); 96 DeleteArray(mem);
89 } 97 }
90 98
91 99
92 TEST(MemoryAllocator) { 100 TEST(MemoryAllocator) {
93 CHECK(Heap::ConfigureHeapDefault()); 101 CHECK(Heap::ConfigureHeapDefault());
94 CHECK(MemoryAllocator::Setup(Heap::MaxReserved())); 102 CHECK(MemoryAllocator::Setup(Heap::MaxReserved()));
95 103
96 OldSpace faked_space(Heap::MaxReserved(), OLD_POINTER_SPACE, NOT_EXECUTABLE); 104 OldSpace faked_space(Heap::MaxReserved(), OLD_POINTER_SPACE, NOT_EXECUTABLE);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 CHECK(!lo->IsEmpty()); 239 CHECK(!lo->IsEmpty());
232 240
233 obj = lo->AllocateRaw(lo_size); 241 obj = lo->AllocateRaw(lo_size);
234 CHECK(obj->IsFailure()); 242 CHECK(obj->IsFailure());
235 243
236 lo->TearDown(); 244 lo->TearDown();
237 delete lo; 245 delete lo;
238 246
239 MemoryAllocator::TearDown(); 247 MemoryAllocator::TearDown();
240 } 248 }
OLDNEW
« no previous file with comments | « test/cctest/test-heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698