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

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

Issue 1420423009: [heap] Black allocation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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 | « src/transitions.cc ('k') | test/cctest/test-api.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 4919 matching lines...) Expand 10 before | Expand all | Expand 10 after
4930 "};" 4930 "};"
4931 "function foo%d(x) { with (x) { return 1 + x; } };" 4931 "function foo%d(x) { with (x) { return 1 + x; } };"
4932 "bar%d();" 4932 "bar%d();"
4933 "bar%d();" 4933 "bar%d();"
4934 "bar%d();" 4934 "bar%d();"
4935 "%%OptimizeFunctionOnNextCall(bar%d);" 4935 "%%OptimizeFunctionOnNextCall(bar%d);"
4936 "bar%d();", 4936 "bar%d();",
4937 i, i, i, i, i, i, i, i); 4937 i, i, i, i, i, i, i, i);
4938 CompileRun(source.start()); 4938 CompileRun(source.start());
4939 } 4939 }
4940 heap->CollectAllGarbage(); 4940 // We have to abort incremental marking here to abandon black pages.
4941 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
4941 } 4942 }
4942 int elements = 0; 4943 int elements = 0;
4943 if (heap->weak_object_to_code_table()->IsHashTable()) { 4944 if (heap->weak_object_to_code_table()->IsHashTable()) {
4944 WeakHashTable* t = WeakHashTable::cast(heap->weak_object_to_code_table()); 4945 WeakHashTable* t = WeakHashTable::cast(heap->weak_object_to_code_table());
4945 elements = t->NumberOfElements(); 4946 elements = t->NumberOfElements();
4946 } 4947 }
4947 CHECK_EQ(0, elements); 4948 CHECK_EQ(0, elements);
4948 } 4949 }
4949 4950
4950 4951
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
5450 CHECK(weak_cell->value()->IsFixedArray()); 5451 CHECK(weak_cell->value()->IsFixedArray());
5451 IncrementalMarking* marking = heap->incremental_marking(); 5452 IncrementalMarking* marking = heap->incremental_marking();
5452 if (marking->IsStopped()) { 5453 if (marking->IsStopped()) {
5453 heap->StartIncrementalMarking(); 5454 heap->StartIncrementalMarking();
5454 } 5455 }
5455 marking->Step(128, IncrementalMarking::NO_GC_VIA_STACK_GUARD); 5456 marking->Step(128, IncrementalMarking::NO_GC_VIA_STACK_GUARD);
5456 heap->CollectGarbage(NEW_SPACE); 5457 heap->CollectGarbage(NEW_SPACE);
5457 CHECK(weak_cell->value()->IsFixedArray()); 5458 CHECK(weak_cell->value()->IsFixedArray());
5458 weak_cells[i] = inner_scope.CloseAndEscape(weak_cell); 5459 weak_cells[i] = inner_scope.CloseAndEscape(weak_cell);
5459 } 5460 }
5461 // Call collect all twice to make sure that we also cleared
5462 // weak cells that were allocated on black pages.
5463 heap->CollectAllGarbage();
5460 heap->CollectAllGarbage(); 5464 heap->CollectAllGarbage();
5461 CHECK_EQ(*survivor, weak_cells[0]->value()); 5465 CHECK_EQ(*survivor, weak_cells[0]->value());
5462 for (int i = 1; i < N; i++) { 5466 for (int i = 1; i < N; i++) {
5463 CHECK(weak_cells[i]->cleared()); 5467 CHECK(weak_cells[i]->cleared());
5464 } 5468 }
5465 } 5469 }
5466 5470
5467 5471
5468 #ifdef DEBUG 5472 #ifdef DEBUG
5469 TEST(AddInstructionChangesNewSpacePromotion) { 5473 TEST(AddInstructionChangesNewSpacePromotion) {
(...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after
6602 heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(arrays[j], N - 1); 6606 heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(arrays[j], N - 1);
6603 } 6607 }
6604 } 6608 }
6605 // Force allocation from the free list. 6609 // Force allocation from the free list.
6606 heap->set_force_oom(true); 6610 heap->set_force_oom(true);
6607 heap->CollectGarbage(OLD_SPACE); 6611 heap->CollectGarbage(OLD_SPACE);
6608 } 6612 }
6609 6613
6610 } // namespace internal 6614 } // namespace internal
6611 } // namespace v8 6615 } // namespace v8
OLDNEW
« no previous file with comments | « src/transitions.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698