| 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 6773 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 6784                                    isolate_is_locked); | 6784                                    isolate_is_locked); | 
| 6785   int mark_sweep_count_after = heap->ms_count(); | 6785   int mark_sweep_count_after = heap->ms_count(); | 
| 6786   int mark_sweeps_performed = mark_sweep_count_after - mark_sweep_count_before; | 6786   int mark_sweeps_performed = mark_sweep_count_after - mark_sweep_count_before; | 
| 6787   // The memory pressuer handler either performed two GCs or performed one and | 6787   // The memory pressuer handler either performed two GCs or performed one and | 
| 6788   // started incremental marking. | 6788   // started incremental marking. | 
| 6789   CHECK(mark_sweeps_performed == 2 || | 6789   CHECK(mark_sweeps_performed == 2 || | 
| 6790         (mark_sweeps_performed == 1 && | 6790         (mark_sweeps_performed == 1 && | 
| 6791          !heap->incremental_marking()->IsStopped())); | 6791          !heap->incremental_marking()->IsStopped())); | 
| 6792 } | 6792 } | 
| 6793 | 6793 | 
|  | 6794 TEST(UncommitUnusedLargeObjectMemory) { | 
|  | 6795   CcTest::InitializeVM(); | 
|  | 6796   v8::HandleScope scope(CcTest::isolate()); | 
|  | 6797   Heap* heap = CcTest::heap(); | 
|  | 6798   Isolate* isolate = heap->isolate(); | 
|  | 6799 | 
|  | 6800   Handle<FixedArray> array = isolate->factory()->NewFixedArray(200000); | 
|  | 6801   MemoryChunk* chunk = MemoryChunk::FromAddress(array->address()); | 
|  | 6802   CHECK(chunk->owner()->identity() == LO_SPACE); | 
|  | 6803 | 
|  | 6804   intptr_t size_before = array->Size(); | 
|  | 6805   size_t committed_memory_before = chunk->CommittedPhysicalMemory(); | 
|  | 6806 | 
|  | 6807   array->Shrink(1); | 
|  | 6808   CHECK(array->Size() < size_before); | 
|  | 6809 | 
|  | 6810   CcTest::heap()->CollectAllGarbage(); | 
|  | 6811   CHECK(chunk->CommittedPhysicalMemory() < committed_memory_before); | 
|  | 6812   size_t shrinked_size = | 
|  | 6813       RoundUp((array->address() - chunk->address()) + array->Size(), | 
|  | 6814               base::OS::CommitPageSize()); | 
|  | 6815   CHECK_EQ(shrinked_size, chunk->CommittedPhysicalMemory()); | 
|  | 6816 } | 
| 6794 }  // namespace internal | 6817 }  // namespace internal | 
| 6795 }  // namespace v8 | 6818 }  // namespace v8 | 
| OLD | NEW | 
|---|