 Chromium Code Reviews
 Chromium Code Reviews Issue 1701963003:
  Filter invalid slots after array trimming.  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master
    
  
    Issue 1701963003:
  Filter invalid slots after array trimming.  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master| 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 6474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6485 CheckDoubleEquals(0, calls_per_ms); | 6485 CheckDoubleEquals(0, calls_per_ms); | 
| 6486 | 6486 | 
| 6487 isolate->IncrementJsCallsFromApiCounter(); | 6487 isolate->IncrementJsCallsFromApiCounter(); | 
| 6488 isolate->IncrementJsCallsFromApiCounter(); | 6488 isolate->IncrementJsCallsFromApiCounter(); | 
| 6489 isolate->IncrementJsCallsFromApiCounter(); | 6489 isolate->IncrementJsCallsFromApiCounter(); | 
| 6490 isolate->IncrementJsCallsFromApiCounter(); | 6490 isolate->IncrementJsCallsFromApiCounter(); | 
| 6491 calls_per_ms = memory_reducer->SampleAndGetJsCallsPerMs(4); | 6491 calls_per_ms = memory_reducer->SampleAndGetJsCallsPerMs(4); | 
| 6492 CheckDoubleEquals(2, calls_per_ms); | 6492 CheckDoubleEquals(2, calls_per_ms); | 
| 6493 } | 6493 } | 
| 6494 | 6494 | 
| 6495 HEAP_TEST(Regress587004) { | |
| 6496 FLAG_concurrent_sweeping = false; | |
| 6497 #ifdef VERIFY_HEAP | |
| 6498 FLAG_verify_heap = false; | |
| 
ulan
2016/02/16 19:42:25
Verify heap forces sweeping to finish during MarkC
 | |
| 6499 #endif | |
| 6500 CcTest::InitializeVM(); | |
| 6501 v8::HandleScope scope(CcTest::isolate()); | |
| 6502 Heap* heap = CcTest::heap(); | |
| 6503 Isolate* isolate = CcTest::i_isolate(); | |
| 6504 Factory* factory = isolate->factory(); | |
| 6505 const int N = (Page::kMaxRegularHeapObjectSize - FixedArray::kHeaderSize) / | |
| 6506 kPointerSize; | |
| 6507 Handle<FixedArray> array = factory->NewFixedArray(N, TENURED); | |
| 6508 CHECK(heap->old_space()->Contains(*array)); | |
| 6509 Handle<Object> number = factory->NewHeapNumber(1.0); | |
| 6510 CHECK(heap->InNewSpace(*number)); | |
| 6511 for (int i = 0; i < N; i++) { | |
| 6512 array->set(i, *number); | |
| 6513 } | |
| 6514 heap->CollectGarbage(OLD_SPACE); | |
| 6515 SimulateFullSpace(heap->old_space()); | |
| 6516 heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(*array, N - 1); | |
| 6517 heap->mark_compact_collector()->EnsureSweepingCompleted(); | |
| 6518 ByteArray* byte_array; | |
| 6519 const int M = 256; | |
| 6520 // Don't allow old space expansion. The test works without this flag too, | |
| 6521 // but becomes very slow. | |
| 6522 heap->set_force_oom(true); | |
| 6523 while (heap->AllocateByteArray(M, TENURED).To(&byte_array)) { | |
| 6524 for (int j = 0; j < M; j++) { | |
| 6525 byte_array->set(j, 0x31); | |
| 6526 } | |
| 6527 } | |
| 6528 // Re-enable old space expansion to avoid OOM crash. | |
| 6529 heap->set_force_oom(false); | |
| 6530 heap->CollectGarbage(NEW_SPACE); | |
| 6531 } | |
| 6495 | 6532 | 
| 6496 } // namespace internal | 6533 } // namespace internal | 
| 6497 } // namespace v8 | 6534 } // namespace v8 | 
| OLD | NEW |