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