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

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

Issue 9187004: Fix Mac build boken in r10383. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 11 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 | « no previous file | 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 2
3 #include <stdlib.h> 3 #include <stdlib.h>
4 4
5 #include "v8.h" 5 #include "v8.h"
6 6
7 #include "execution.h" 7 #include "execution.h"
8 #include "factory.h" 8 #include "factory.h"
9 #include "macro-assembler.h" 9 #include "macro-assembler.h"
10 #include "global-handles.h" 10 #include "global-handles.h"
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 TEST(TestSizeOfObjects) { 1190 TEST(TestSizeOfObjects) {
1191 v8::V8::Initialize(); 1191 v8::V8::Initialize();
1192 1192
1193 // Get initial heap size after several full GCs, which will stabilize 1193 // Get initial heap size after several full GCs, which will stabilize
1194 // the heap size and return with sweeping finished completely. 1194 // the heap size and return with sweeping finished completely.
1195 HEAP->CollectAllGarbage(Heap::kNoGCFlags); 1195 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
1196 HEAP->CollectAllGarbage(Heap::kNoGCFlags); 1196 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
1197 HEAP->CollectAllGarbage(Heap::kNoGCFlags); 1197 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
1198 HEAP->CollectAllGarbage(Heap::kNoGCFlags); 1198 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
1199 CHECK(HEAP->old_pointer_space()->IsSweepingComplete()); 1199 CHECK(HEAP->old_pointer_space()->IsSweepingComplete());
1200 intptr_t initial_size = HEAP->SizeOfObjects(); 1200 int initial_size = static_cast<int>(HEAP->SizeOfObjects());
1201 1201
1202 { 1202 {
1203 // Allocate objects on several different old-space pages so that 1203 // Allocate objects on several different old-space pages so that
1204 // lazy sweeping kicks in for subsequent GC runs. 1204 // lazy sweeping kicks in for subsequent GC runs.
1205 AlwaysAllocateScope always_allocate; 1205 AlwaysAllocateScope always_allocate;
1206 intptr_t filler_size = FixedArray::SizeFor(8192); 1206 int filler_size = static_cast<int>(FixedArray::SizeFor(8192));
1207 for (int i = 1; i <= 100; i++) { 1207 for (int i = 1; i <= 100; i++) {
1208 HEAP->AllocateFixedArray(8192, TENURED)->ToObjectChecked(); 1208 HEAP->AllocateFixedArray(8192, TENURED)->ToObjectChecked();
1209 CHECK_EQ(initial_size + i * filler_size, HEAP->SizeOfObjects()); 1209 CHECK_EQ(initial_size + i * filler_size,
1210 static_cast<int>(HEAP->SizeOfObjects()));
1210 } 1211 }
1211 } 1212 }
1212 1213
1213 // The heap size should go back to initial size after a full GC, even 1214 // The heap size should go back to initial size after a full GC, even
1214 // though sweeping didn't finish yet. 1215 // though sweeping didn't finish yet.
1215 HEAP->CollectAllGarbage(Heap::kNoGCFlags); 1216 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
1216 CHECK(!HEAP->old_pointer_space()->IsSweepingComplete()); 1217 CHECK(!HEAP->old_pointer_space()->IsSweepingComplete());
1217 CHECK_EQ(initial_size, HEAP->SizeOfObjects()); 1218 CHECK_EQ(initial_size, static_cast<int>(HEAP->SizeOfObjects()));
1218 1219
1219 // Advancing the sweeper step-wise should not change the heap size. 1220 // Advancing the sweeper step-wise should not change the heap size.
1220 while (!HEAP->old_pointer_space()->IsSweepingComplete()) { 1221 while (!HEAP->old_pointer_space()->IsSweepingComplete()) {
1221 HEAP->old_pointer_space()->AdvanceSweeper(KB); 1222 HEAP->old_pointer_space()->AdvanceSweeper(KB);
1222 CHECK_EQ(initial_size, HEAP->SizeOfObjects()); 1223 CHECK_EQ(initial_size, static_cast<int>(HEAP->SizeOfObjects()));
1223 } 1224 }
1224 } 1225 }
1225 1226
1226 1227
1227 TEST(TestSizeOfObjectsVsHeapIteratorPrecision) { 1228 TEST(TestSizeOfObjectsVsHeapIteratorPrecision) {
1228 InitializeVM(); 1229 InitializeVM();
1229 HEAP->EnsureHeapIsIterable(); 1230 HEAP->EnsureHeapIsIterable();
1230 intptr_t size_of_objects_1 = HEAP->SizeOfObjects(); 1231 intptr_t size_of_objects_1 = HEAP->SizeOfObjects();
1231 HeapIterator iterator; 1232 HeapIterator iterator;
1232 intptr_t size_of_objects_2 = 0; 1233 intptr_t size_of_objects_2 = 0;
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
1564 v8::HandleScope scope; 1565 v8::HandleScope scope;
1565 v8::Handle<v8::Object> global = v8::Context::GetCurrent()->Global(); 1566 v8::Handle<v8::Object> global = v8::Context::GetCurrent()->Global();
1566 v8::Handle<v8::Function> g = 1567 v8::Handle<v8::Function> g =
1567 v8::Handle<v8::Function>::Cast(global->Get(v8_str("g"))); 1568 v8::Handle<v8::Function>::Cast(global->Get(v8_str("g")));
1568 g->Call(global, 0, NULL); 1569 g->Call(global, 0, NULL);
1569 } 1570 }
1570 1571
1571 HEAP->incremental_marking()->set_should_hurry(true); 1572 HEAP->incremental_marking()->set_should_hurry(true);
1572 HEAP->CollectGarbage(OLD_POINTER_SPACE); 1573 HEAP->CollectGarbage(OLD_POINTER_SPACE);
1573 } 1574 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698