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

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

Issue 882633002: Reland "Only use FreeSpace objects in the free list" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix windows build Created 5 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
« no previous file with comments | « test/cctest/test-serialize.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 // Debug code can be very large, so skip CODE_SPACE if we are generating it. 452 // Debug code can be very large, so skip CODE_SPACE if we are generating it.
453 if (i == CODE_SPACE && i::FLAG_debug_code) continue; 453 if (i == CODE_SPACE && i::FLAG_debug_code) continue;
454 CHECK_EQ(1, isolate->heap()->paged_space(i)->CountTotalPages()); 454 CHECK_EQ(1, isolate->heap()->paged_space(i)->CountTotalPages());
455 } 455 }
456 456
457 // No large objects required to perform the above steps. 457 // No large objects required to perform the above steps.
458 CHECK(isolate->heap()->lo_space()->IsEmpty()); 458 CHECK(isolate->heap()->lo_space()->IsEmpty());
459 } 459 }
460 460
461 461
462 static inline void FillCurrentPage(v8::internal::NewSpace* space) {
463 int new_linear_size = static_cast<int>(*space->allocation_limit_address() -
464 *space->allocation_top_address());
465 if (new_linear_size == 0) return;
466 v8::internal::AllocationResult allocation =
467 space->AllocateRaw(new_linear_size);
468 v8::internal::FreeListNode* node =
469 v8::internal::FreeListNode::cast(allocation.ToObjectChecked());
470 node->set_size(space->heap(), new_linear_size);
471 }
472
473
474 UNINITIALIZED_TEST(NewSpaceGrowsToTargetCapacity) { 462 UNINITIALIZED_TEST(NewSpaceGrowsToTargetCapacity) {
475 FLAG_target_semi_space_size = 2; 463 FLAG_target_semi_space_size = 2;
476 if (FLAG_optimize_for_size) return; 464 if (FLAG_optimize_for_size) return;
477 465
478 v8::Isolate* isolate = v8::Isolate::New(); 466 v8::Isolate* isolate = v8::Isolate::New();
479 { 467 {
480 v8::Isolate::Scope isolate_scope(isolate); 468 v8::Isolate::Scope isolate_scope(isolate);
481 v8::HandleScope handle_scope(isolate); 469 v8::HandleScope handle_scope(isolate);
482 v8::Context::New(isolate)->Enter(); 470 v8::Context::New(isolate)->Enter();
483 471
(...skipping 11 matching lines...) Expand all
495 483
496 // Try to allocate out of the new space. A new page should be added and 484 // Try to allocate out of the new space. A new page should be added and
497 // the 485 // the
498 // allocation should succeed. 486 // allocation should succeed.
499 v8::internal::AllocationResult allocation = new_space->AllocateRaw(80); 487 v8::internal::AllocationResult allocation = new_space->AllocateRaw(80);
500 CHECK(!allocation.IsRetry()); 488 CHECK(!allocation.IsRetry());
501 CHECK(new_space->CommittedMemory() == 2 * Page::kPageSize); 489 CHECK(new_space->CommittedMemory() == 2 * Page::kPageSize);
502 490
503 // Turn the allocation into a proper object so isolate teardown won't 491 // Turn the allocation into a proper object so isolate teardown won't
504 // crash. 492 // crash.
505 v8::internal::FreeListNode* node = 493 HeapObject* free_space = NULL;
506 v8::internal::FreeListNode::cast(allocation.ToObjectChecked()); 494 CHECK(allocation.To(&free_space));
507 node->set_size(new_space->heap(), 80); 495 new_space->heap()->CreateFillerObjectAt(free_space->address(), 80);
508 } 496 }
509 } 497 }
510 isolate->Dispose(); 498 isolate->Dispose();
511 } 499 }
OLDNEW
« no previous file with comments | « test/cctest/test-serialize.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698