8 #include "testing/gtest/include/gtest/gtest.h"
35 kNewSpaceAllocationThroughput;
39 static const size_t kSizeOfObjects = 100 *
MB;
40 static const size_t kMarkCompactSpeed = 200 *
KB;
41 static const size_t kMarkingSpeed = 200 *
KB;
42 static const size_t kScavengeSpeed = 100 *
KB;
43 static const size_t kNewSpaceCapacity = 1 *
MB;
44 static const size_t kNewSpaceAllocationThroughput = 10 *
KB;
63 size_t marking_speed_in_bytes_per_millisecond = 100;
65 1, marking_speed_in_bytes_per_millisecond);
66 EXPECT_EQ(
static_cast<size_t>(marking_speed_in_bytes_per_millisecond *
74 10, std::numeric_limits<size_t>::max());
82 std::numeric_limits<size_t>::max(), 10);
98 size_t speed = 1 *
MB;
100 EXPECT_EQ(
size / speed, time);
105 size_t size = std::numeric_limits<size_t>::max();
121 size_t speed = 1 *
MB;
123 EXPECT_EQ(
size / speed, time);
135 size_t speed = 1 *
KB;
142 size_t speed = 1 *
KB;
147 TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeLargeIdleTime) {
159 TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeSmallIdleTime1) {
164 int idle_time_ms =
static_cast<int>(heap_state.
size_of_objects / speed - 1);
170 TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeSmallIdleTime2) {
174 int idle_time_ms =
static_cast<int>(heap_state.
size_of_objects / speed - 1);
180 TEST_F(GCIdleTimeHandlerTest, IncrementalMarking1) {
183 int idle_time_ms = 10;
186 EXPECT_GT(speed *
static_cast<size_t>(idle_time_ms),
192 TEST_F(GCIdleTimeHandlerTest, IncrementalMarking2) {
196 int idle_time_ms = 10;
199 EXPECT_GT(speed *
static_cast<size_t>(idle_time_ms),
205 TEST_F(GCIdleTimeHandlerTest, NotEnoughTime) {
210 int idle_time_ms =
static_cast<int>(heap_state.
size_of_objects / speed - 1);
216 TEST_F(GCIdleTimeHandlerTest, StopEventually1) {
221 int idle_time_ms =
static_cast<int>(heap_state.
size_of_objects / speed + 1);
225 handler()->NotifyIdleMarkCompact();
232 TEST_F(GCIdleTimeHandlerTest, StopEventually2) {
234 int idle_time_ms = 10;
240 handler()->NotifyIdleMarkCompact();
248 TEST_F(GCIdleTimeHandlerTest, ContinueAfterStop1) {
253 int idle_time_ms =
static_cast<int>(heap_state.
size_of_objects / speed + 1);
257 handler()->NotifyIdleMarkCompact();
263 handler()->NotifyScavenge();
265 action = handler()->Compute(idle_time_ms, heap_state);
270 TEST_F(GCIdleTimeHandlerTest, ContinueAfterStop2) {
272 int idle_time_ms = 10;
279 handler()->NotifyIdleMarkCompact();
286 handler()->NotifyScavenge();
289 action = handler()->Compute(idle_time_ms, heap_state);
294 TEST_F(GCIdleTimeHandlerTest, Scavenge) {
296 int idle_time_ms = 10;
298 kNewSpaceAllocationThroughput * idle_time_ms;
304 TEST_F(GCIdleTimeHandlerTest, ScavengeAndDone) {
306 int idle_time_ms = 10;
310 kNewSpaceAllocationThroughput * idle_time_ms;
314 action = handler()->Compute(idle_time_ms, heap_state);
319 TEST_F(GCIdleTimeHandlerTest, ZeroIdleTimeNothingToDo) {
321 int idle_time_ms = 0;
327 TEST_F(GCIdleTimeHandlerTest, ZeroIdleTimeDoNothingButStartIdleRound) {
329 int idle_time_ms = 10;
336 handler()->NotifyIdleMarkCompact();
341 handler()->NotifyScavenge();
343 action = handler()->Compute(0, heap_state);
GCIdleTimeActionType type
static size_t EstimateScavengeTime(size_t new_space_size, size_t scavenger_speed_in_bytes_per_ms)
static const double kConservativeTimeRatio
static const size_t kInitialConservativeMarkingSpeed
static const size_t kInitialConservativeMarkCompactSpeed
static const size_t kMaxFrameRenderingIdleTime
static const size_t kMaxMarkCompactTimeInMs
static const size_t kInitialConservativeScavengeSpeed
static size_t EstimateMarkCompactTime(size_t size_of_objects, size_t mark_compact_speed_in_bytes_per_ms)
static const size_t kMaximumMarkingStepSize
static bool ScavangeMayHappenSoon(size_t available_new_space_memory, size_t new_space_allocation_throughput_in_bytes_per_ms)
static size_t EstimateMarkingStepSize(size_t idle_time_in_ms, size_t marking_speed_in_bytes_per_ms)
static const int kIdleScavengeThreshold
static const int kMaxMarkCompactsInIdleRound
GCIdleTimeHandler::HeapState DefaultHeapState()
GCIdleTimeHandler * handler()
virtual ~GCIdleTimeHandlerTest()
GCIdleTimeHandler handler_
enable harmony numeric enable harmony object literal extensions Optimize object size
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if available(X64 only)") DEFINE_BOOL(enable_vfp3
TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeLargeIdleTime)
Debugger support for the V8 JavaScript engine.
size_t incremental_marking_speed_in_bytes_per_ms
size_t available_new_space_memory
bool sweeping_in_progress
bool incremental_marking_stopped
bool can_start_incremental_marking
size_t new_space_capacity
size_t scavenge_speed_in_bytes_per_ms
size_t mark_compact_speed_in_bytes_per_ms
size_t new_space_allocation_throughput_in_bytes_per_ms