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

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

Issue 7572018: Minimize malloc heap allocation on process startup. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 4 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-debug.cc ('k') | test/cctest/test-parsing.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 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 InitializeVM(); 284 InitializeVM();
285 285
286 v8::HandleScope scope; 286 v8::HandleScope scope;
287 const char* name = "Kasper the spunky"; 287 const char* name = "Kasper the spunky";
288 Handle<String> string = FACTORY->NewStringFromAscii(CStrVector(name)); 288 Handle<String> string = FACTORY->NewStringFromAscii(CStrVector(name));
289 CHECK_EQ(StrLength(name), string->length()); 289 CHECK_EQ(StrLength(name), string->length());
290 } 290 }
291 291
292 292
293 TEST(GlobalHandles) { 293 TEST(GlobalHandles) {
294 InitializeVM();
294 GlobalHandles* global_handles = Isolate::Current()->global_handles(); 295 GlobalHandles* global_handles = Isolate::Current()->global_handles();
295 InitializeVM();
296 296
297 Handle<Object> h1; 297 Handle<Object> h1;
298 Handle<Object> h2; 298 Handle<Object> h2;
299 Handle<Object> h3; 299 Handle<Object> h3;
300 Handle<Object> h4; 300 Handle<Object> h4;
301 301
302 { 302 {
303 HandleScope scope; 303 HandleScope scope;
304 304
305 Handle<Object> i = FACTORY->NewStringFromAscii(CStrVector("fisk")); 305 Handle<Object> i = FACTORY->NewStringFromAscii(CStrVector("fisk"));
(...skipping 26 matching lines...) Expand all
332 static bool WeakPointerCleared = false; 332 static bool WeakPointerCleared = false;
333 333
334 static void TestWeakGlobalHandleCallback(v8::Persistent<v8::Value> handle, 334 static void TestWeakGlobalHandleCallback(v8::Persistent<v8::Value> handle,
335 void* id) { 335 void* id) {
336 if (1234 == reinterpret_cast<intptr_t>(id)) WeakPointerCleared = true; 336 if (1234 == reinterpret_cast<intptr_t>(id)) WeakPointerCleared = true;
337 handle.Dispose(); 337 handle.Dispose();
338 } 338 }
339 339
340 340
341 TEST(WeakGlobalHandlesScavenge) { 341 TEST(WeakGlobalHandlesScavenge) {
342 InitializeVM();
342 GlobalHandles* global_handles = Isolate::Current()->global_handles(); 343 GlobalHandles* global_handles = Isolate::Current()->global_handles();
343 InitializeVM();
344 344
345 WeakPointerCleared = false; 345 WeakPointerCleared = false;
346 346
347 Handle<Object> h1; 347 Handle<Object> h1;
348 Handle<Object> h2; 348 Handle<Object> h2;
349 349
350 { 350 {
351 HandleScope scope; 351 HandleScope scope;
352 352
353 Handle<Object> i = FACTORY->NewStringFromAscii(CStrVector("fisk")); 353 Handle<Object> i = FACTORY->NewStringFromAscii(CStrVector("fisk"));
(...skipping 16 matching lines...) Expand all
370 CHECK(!WeakPointerCleared); 370 CHECK(!WeakPointerCleared);
371 CHECK(!global_handles->IsNearDeath(h2.location())); 371 CHECK(!global_handles->IsNearDeath(h2.location()));
372 CHECK(!global_handles->IsNearDeath(h1.location())); 372 CHECK(!global_handles->IsNearDeath(h1.location()));
373 373
374 global_handles->Destroy(h1.location()); 374 global_handles->Destroy(h1.location());
375 global_handles->Destroy(h2.location()); 375 global_handles->Destroy(h2.location());
376 } 376 }
377 377
378 378
379 TEST(WeakGlobalHandlesMark) { 379 TEST(WeakGlobalHandlesMark) {
380 InitializeVM();
380 GlobalHandles* global_handles = Isolate::Current()->global_handles(); 381 GlobalHandles* global_handles = Isolate::Current()->global_handles();
381 InitializeVM();
382 382
383 WeakPointerCleared = false; 383 WeakPointerCleared = false;
384 384
385 Handle<Object> h1; 385 Handle<Object> h1;
386 Handle<Object> h2; 386 Handle<Object> h2;
387 387
388 { 388 {
389 HandleScope scope; 389 HandleScope scope;
390 390
391 Handle<Object> i = FACTORY->NewStringFromAscii(CStrVector("fisk")); 391 Handle<Object> i = FACTORY->NewStringFromAscii(CStrVector("fisk"));
(...skipping 17 matching lines...) Expand all
409 409
410 CHECK((*h1)->IsString()); 410 CHECK((*h1)->IsString());
411 411
412 CHECK(WeakPointerCleared); 412 CHECK(WeakPointerCleared);
413 CHECK(!GlobalHandles::IsNearDeath(h1.location())); 413 CHECK(!GlobalHandles::IsNearDeath(h1.location()));
414 414
415 global_handles->Destroy(h1.location()); 415 global_handles->Destroy(h1.location());
416 } 416 }
417 417
418 TEST(DeleteWeakGlobalHandle) { 418 TEST(DeleteWeakGlobalHandle) {
419 InitializeVM();
419 GlobalHandles* global_handles = Isolate::Current()->global_handles(); 420 GlobalHandles* global_handles = Isolate::Current()->global_handles();
420 InitializeVM();
421 421
422 WeakPointerCleared = false; 422 WeakPointerCleared = false;
423 423
424 Handle<Object> h; 424 Handle<Object> h;
425 425
426 { 426 {
427 HandleScope scope; 427 HandleScope scope;
428 428
429 Handle<Object> i = FACTORY->NewStringFromAscii(CStrVector("fisk")); 429 Handle<Object> i = FACTORY->NewStringFromAscii(CStrVector("fisk"));
430 h = global_handles->Create(*i); 430 h = global_handles->Create(*i);
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 CHECK(helper.b_found()); 1320 CHECK(helper.b_found());
1321 } 1321 }
1322 // ...but is now unreachable. 1322 // ...but is now unreachable.
1323 { 1323 {
1324 HeapIteratorTestHelper helper(a_saved, *b); 1324 HeapIteratorTestHelper helper(a_saved, *b);
1325 helper.IterateHeap(HeapIterator::kFilterUnreachable); 1325 helper.IterateHeap(HeapIterator::kFilterUnreachable);
1326 CHECK(!helper.a_found()); 1326 CHECK(!helper.a_found());
1327 CHECK(helper.b_found()); 1327 CHECK(helper.b_found());
1328 } 1328 }
1329 } 1329 }
OLDNEW
« no previous file with comments | « test/cctest/test-debug.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698