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

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

Issue 4764002: Fix executable memory setting and fix test. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 1 month 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 | « src/spaces.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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 CHECK_EQ(NULL, address); 68 CHECK_EQ(NULL, address);
69 DeleteArray(mem); 69 DeleteArray(mem);
70 } 70 }
71 71
72 72
73 TEST(Promotion) { 73 TEST(Promotion) {
74 // Ensure that we get a compacting collection so that objects are promoted 74 // Ensure that we get a compacting collection so that objects are promoted
75 // from new space. 75 // from new space.
76 FLAG_gc_global = true; 76 FLAG_gc_global = true;
77 FLAG_always_compact = true; 77 FLAG_always_compact = true;
78 Heap::ConfigureHeap(2*256*KB, 4*MB, 0); 78 Heap::ConfigureHeap(2*256*KB, 4*MB, 4*MB);
79 79
80 InitializeVM(); 80 InitializeVM();
81 81
82 v8::HandleScope sc; 82 v8::HandleScope sc;
83 83
84 // Allocate a fixed array in the new space. 84 // Allocate a fixed array in the new space.
85 int array_size = 85 int array_size =
86 (Heap::MaxObjectSizeInPagedSpace() - FixedArray::kHeaderSize) / 86 (Heap::MaxObjectSizeInPagedSpace() - FixedArray::kHeaderSize) /
87 (kPointerSize * 4); 87 (kPointerSize * 4);
88 Object* obj = Heap::AllocateFixedArray(array_size)->ToObjectChecked(); 88 Object* obj = Heap::AllocateFixedArray(array_size)->ToObjectChecked();
89 89
90 Handle<FixedArray> array(FixedArray::cast(obj)); 90 Handle<FixedArray> array(FixedArray::cast(obj));
91 91
92 // Array should be in the new space. 92 // Array should be in the new space.
93 CHECK(Heap::InSpace(*array, NEW_SPACE)); 93 CHECK(Heap::InSpace(*array, NEW_SPACE));
94 94
95 // Call the m-c collector, so array becomes an old object. 95 // Call the m-c collector, so array becomes an old object.
96 Heap::CollectGarbage(OLD_POINTER_SPACE); 96 Heap::CollectGarbage(OLD_POINTER_SPACE);
97 97
98 // Array now sits in the old space 98 // Array now sits in the old space
99 CHECK(Heap::InSpace(*array, OLD_POINTER_SPACE)); 99 CHECK(Heap::InSpace(*array, OLD_POINTER_SPACE));
100 } 100 }
101 101
102 102
103 TEST(NoPromotion) { 103 TEST(NoPromotion) {
104 Heap::ConfigureHeap(2*256*KB, 4*MB, 0); 104 Heap::ConfigureHeap(2*256*KB, 4*MB, 4*MB);
105 105
106 // Test the situation that some objects in new space are promoted to 106 // Test the situation that some objects in new space are promoted to
107 // the old space 107 // the old space
108 InitializeVM(); 108 InitializeVM();
109 109
110 v8::HandleScope sc; 110 v8::HandleScope sc;
111 111
112 // Do a mark compact GC to shrink the heap. 112 // Do a mark compact GC to shrink the heap.
113 Heap::CollectGarbage(OLD_POINTER_SPACE); 113 Heap::CollectGarbage(OLD_POINTER_SPACE);
114 114
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 Object** g2_objects[] = { g2s1.location(), g2s2.location() }; 350 Object** g2_objects[] = { g2s1.location(), g2s2.location() };
351 GlobalHandles::AddGroup(g1_objects, 2); 351 GlobalHandles::AddGroup(g1_objects, 2);
352 GlobalHandles::AddGroup(g2_objects, 2); 352 GlobalHandles::AddGroup(g2_objects, 2);
353 } 353 }
354 354
355 Heap::CollectGarbage(OLD_POINTER_SPACE); 355 Heap::CollectGarbage(OLD_POINTER_SPACE);
356 356
357 // All objects should be gone. 5 global handles in total. 357 // All objects should be gone. 5 global handles in total.
358 CHECK_EQ(5, NumberOfWeakCalls); 358 CHECK_EQ(5, NumberOfWeakCalls);
359 } 359 }
OLDNEW
« no previous file with comments | « src/spaces.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698