OLD | NEW |
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 4918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4929 "};" | 4929 "};" |
4930 "function foo%d(x) { with (x) { return 1 + x; } };" | 4930 "function foo%d(x) { with (x) { return 1 + x; } };" |
4931 "bar%d();" | 4931 "bar%d();" |
4932 "bar%d();" | 4932 "bar%d();" |
4933 "bar%d();" | 4933 "bar%d();" |
4934 "%%OptimizeFunctionOnNextCall(bar%d);" | 4934 "%%OptimizeFunctionOnNextCall(bar%d);" |
4935 "bar%d();", | 4935 "bar%d();", |
4936 i, i, i, i, i, i, i, i); | 4936 i, i, i, i, i, i, i, i); |
4937 CompileRun(source.start()); | 4937 CompileRun(source.start()); |
4938 } | 4938 } |
4939 heap->CollectAllGarbage(); | 4939 // We have to abort incremental marking here to abandon black pages. |
| 4940 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); |
4940 } | 4941 } |
4941 int elements = 0; | 4942 int elements = 0; |
4942 if (heap->weak_object_to_code_table()->IsHashTable()) { | 4943 if (heap->weak_object_to_code_table()->IsHashTable()) { |
4943 WeakHashTable* t = WeakHashTable::cast(heap->weak_object_to_code_table()); | 4944 WeakHashTable* t = WeakHashTable::cast(heap->weak_object_to_code_table()); |
4944 elements = t->NumberOfElements(); | 4945 elements = t->NumberOfElements(); |
4945 } | 4946 } |
4946 CHECK_EQ(0, elements); | 4947 CHECK_EQ(0, elements); |
4947 } | 4948 } |
4948 | 4949 |
4949 | 4950 |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5449 CHECK(weak_cell->value()->IsFixedArray()); | 5450 CHECK(weak_cell->value()->IsFixedArray()); |
5450 IncrementalMarking* marking = heap->incremental_marking(); | 5451 IncrementalMarking* marking = heap->incremental_marking(); |
5451 if (marking->IsStopped()) { | 5452 if (marking->IsStopped()) { |
5452 heap->StartIncrementalMarking(); | 5453 heap->StartIncrementalMarking(); |
5453 } | 5454 } |
5454 marking->Step(128, IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 5455 marking->Step(128, IncrementalMarking::NO_GC_VIA_STACK_GUARD); |
5455 heap->CollectGarbage(NEW_SPACE); | 5456 heap->CollectGarbage(NEW_SPACE); |
5456 CHECK(weak_cell->value()->IsFixedArray()); | 5457 CHECK(weak_cell->value()->IsFixedArray()); |
5457 weak_cells[i] = inner_scope.CloseAndEscape(weak_cell); | 5458 weak_cells[i] = inner_scope.CloseAndEscape(weak_cell); |
5458 } | 5459 } |
| 5460 // Call collect all twice to make sure that we also cleared |
| 5461 // weak cells that were allocated on black pages. |
| 5462 heap->CollectAllGarbage(); |
5459 heap->CollectAllGarbage(); | 5463 heap->CollectAllGarbage(); |
5460 CHECK_EQ(*survivor, weak_cells[0]->value()); | 5464 CHECK_EQ(*survivor, weak_cells[0]->value()); |
5461 for (int i = 1; i < N; i++) { | 5465 for (int i = 1; i < N; i++) { |
5462 CHECK(weak_cells[i]->cleared()); | 5466 CHECK(weak_cells[i]->cleared()); |
5463 } | 5467 } |
5464 } | 5468 } |
5465 | 5469 |
5466 | 5470 |
5467 #ifdef DEBUG | 5471 #ifdef DEBUG |
5468 TEST(AddInstructionChangesNewSpacePromotion) { | 5472 TEST(AddInstructionChangesNewSpacePromotion) { |
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6487 isolate->IncrementJsCallsFromApiCounter(); | 6491 isolate->IncrementJsCallsFromApiCounter(); |
6488 isolate->IncrementJsCallsFromApiCounter(); | 6492 isolate->IncrementJsCallsFromApiCounter(); |
6489 isolate->IncrementJsCallsFromApiCounter(); | 6493 isolate->IncrementJsCallsFromApiCounter(); |
6490 calls_per_ms = memory_reducer->SampleAndGetJsCallsPerMs(4); | 6494 calls_per_ms = memory_reducer->SampleAndGetJsCallsPerMs(4); |
6491 CheckDoubleEquals(2, calls_per_ms); | 6495 CheckDoubleEquals(2, calls_per_ms); |
6492 } | 6496 } |
6493 | 6497 |
6494 | 6498 |
6495 } // namespace internal | 6499 } // namespace internal |
6496 } // namespace v8 | 6500 } // namespace v8 |
OLD | NEW |