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

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

Issue 2482163002: [heap] Remove js call rate heuristic from memory reducer. (Closed)
Patch Set: fix test Created 4 years, 1 month 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/isolate.cc ('k') | no next file » | 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 6390 matching lines...) Expand 10 before | Expand all | Expand 10 after
6401 // The CollectGarbage call above starts sweeper threads. 6401 // The CollectGarbage call above starts sweeper threads.
6402 // The crash will happen if the following two functions 6402 // The crash will happen if the following two functions
6403 // are called before sweeping finishes. 6403 // are called before sweeping finishes.
6404 heap->StartIncrementalMarking(i::Heap::kNoGCFlags, 6404 heap->StartIncrementalMarking(i::Heap::kNoGCFlags,
6405 i::GarbageCollectionReason::kTesting); 6405 i::GarbageCollectionReason::kTesting);
6406 heap->FinalizeIncrementalMarkingIfComplete( 6406 heap->FinalizeIncrementalMarkingIfComplete(
6407 i::GarbageCollectionReason::kTesting); 6407 i::GarbageCollectionReason::kTesting);
6408 } 6408 }
6409 6409
6410 6410
6411 HEAP_TEST(TestMemoryReducerSampleJsCalls) {
6412 CcTest::InitializeVM();
6413 v8::HandleScope scope(CcTest::isolate());
6414 Heap* heap = CcTest::heap();
6415 Isolate* isolate = CcTest::i_isolate();
6416 MemoryReducer* memory_reducer = heap->memory_reducer_;
6417 memory_reducer->SampleAndGetJsCallsPerMs(0);
6418 isolate->IncrementJsCallsFromApiCounter();
6419 isolate->IncrementJsCallsFromApiCounter();
6420 isolate->IncrementJsCallsFromApiCounter();
6421 double calls_per_ms = memory_reducer->SampleAndGetJsCallsPerMs(1);
6422 CheckDoubleEquals(3, calls_per_ms);
6423
6424 calls_per_ms = memory_reducer->SampleAndGetJsCallsPerMs(2);
6425 CheckDoubleEquals(0, calls_per_ms);
6426
6427 isolate->IncrementJsCallsFromApiCounter();
6428 isolate->IncrementJsCallsFromApiCounter();
6429 isolate->IncrementJsCallsFromApiCounter();
6430 isolate->IncrementJsCallsFromApiCounter();
6431 calls_per_ms = memory_reducer->SampleAndGetJsCallsPerMs(4);
6432 CheckDoubleEquals(2, calls_per_ms);
6433 }
6434
6435 HEAP_TEST(Regress587004) { 6411 HEAP_TEST(Regress587004) {
6436 FLAG_concurrent_sweeping = false; 6412 FLAG_concurrent_sweeping = false;
6437 #ifdef VERIFY_HEAP 6413 #ifdef VERIFY_HEAP
6438 FLAG_verify_heap = false; 6414 FLAG_verify_heap = false;
6439 #endif 6415 #endif
6440 CcTest::InitializeVM(); 6416 CcTest::InitializeVM();
6441 v8::HandleScope scope(CcTest::isolate()); 6417 v8::HandleScope scope(CcTest::isolate());
6442 Heap* heap = CcTest::heap(); 6418 Heap* heap = CcTest::heap();
6443 Isolate* isolate = CcTest::i_isolate(); 6419 Isolate* isolate = CcTest::i_isolate();
6444 Factory* factory = isolate->factory(); 6420 Factory* factory = isolate->factory();
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
7024 SlotSet::FREE_EMPTY_BUCKETS); 7000 SlotSet::FREE_EMPTY_BUCKETS);
7025 slots[chunk->area_end() - kPointerSize] = false; 7001 slots[chunk->area_end() - kPointerSize] = false;
7026 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { 7002 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) {
7027 CHECK(slots[addr]); 7003 CHECK(slots[addr]);
7028 return KEEP_SLOT; 7004 return KEEP_SLOT;
7029 }); 7005 });
7030 } 7006 }
7031 7007
7032 } // namespace internal 7008 } // namespace internal
7033 } // namespace v8 7009 } // namespace v8
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698