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

Side by Side Diff: test/cctest/test-mark-compact.cc

Issue 5987005: Refactor MemoryAllocator to allow big normal pages (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: remove rogue printf Created 10 years 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') | test/cctest/test-spaces.cc » ('j') | 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // Test the situation that some objects in new space are promoted to 110 // Test the situation that some objects in new space are promoted to
111 // the old space 111 // the old space
112 InitializeVM(); 112 InitializeVM();
113 113
114 v8::HandleScope sc; 114 v8::HandleScope sc;
115 115
116 // Do a mark compact GC to shrink the heap. 116 // Do a mark compact GC to shrink the heap.
117 Heap::CollectGarbage(OLD_POINTER_SPACE); 117 Heap::CollectGarbage(OLD_POINTER_SPACE);
118 118
119 // Allocate a big Fixed array in the new space. 119 // Allocate a big Fixed array in the new space.
120 int size = (Heap::MaxObjectSizeInPagedSpace() - FixedArray::kHeaderSize) / 120 int max_size =
121 kPointerSize; 121 Min(Heap::MaxObjectSizeInPagedSpace(), Heap::MaxObjectSizeInNewSpace());
122 Object* obj = Heap::AllocateFixedArray(size)->ToObjectChecked(); 122
123 int length = (max_size - FixedArray::kHeaderSize) / (2*kPointerSize);
124 Object* obj = Heap::AllocateFixedArray(length)->ToObjectChecked();
123 125
124 Handle<FixedArray> array(FixedArray::cast(obj)); 126 Handle<FixedArray> array(FixedArray::cast(obj));
125 127
126 // Array still stays in the new space. 128 // Array still stays in the new space.
127 CHECK(Heap::InSpace(*array, NEW_SPACE)); 129 CHECK(Heap::InSpace(*array, NEW_SPACE));
128 130
129 // Allocate objects in the old space until out of memory. 131 // Allocate objects in the old space until out of memory.
130 FixedArray* host = *array; 132 FixedArray* host = *array;
131 while (true) { 133 while (true) {
132 Object* obj; 134 Object* obj;
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 Object** g2_objects[] = { g2s1.location(), g2s2.location() }; 358 Object** g2_objects[] = { g2s1.location(), g2s2.location() };
357 GlobalHandles::AddGroup(g1_objects, 2); 359 GlobalHandles::AddGroup(g1_objects, 2);
358 GlobalHandles::AddGroup(g2_objects, 2); 360 GlobalHandles::AddGroup(g2_objects, 2);
359 } 361 }
360 362
361 Heap::CollectGarbage(OLD_POINTER_SPACE); 363 Heap::CollectGarbage(OLD_POINTER_SPACE);
362 364
363 // All objects should be gone. 5 global handles in total. 365 // All objects should be gone. 5 global handles in total.
364 CHECK_EQ(5, NumberOfWeakCalls); 366 CHECK_EQ(5, NumberOfWeakCalls);
365 } 367 }
OLDNEW
« no previous file with comments | « test/cctest/test-heap.cc ('k') | test/cctest/test-spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698