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

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

Issue 1885723002: disallow left-trim fast path when sampling heap profiler is active (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: explicitly trigger a scavenge in the test Created 4 years, 8 months 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/profiler/heap-profiler.h ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 3022 matching lines...) Expand 10 before | Expand all | Expand 10 after
3033 v8::base::SmartPointer<v8::AllocationProfile> profile( 3033 v8::base::SmartPointer<v8::AllocationProfile> profile(
3034 heap_profiler->GetAllocationProfile()); 3034 heap_profiler->GetAllocationProfile());
3035 CHECK(!profile.is_empty()); 3035 CHECK(!profile.is_empty());
3036 const char* names[] = {"(V8 API)"}; 3036 const char* names[] = {"(V8 API)"};
3037 auto node = FindAllocationProfileNode( 3037 auto node = FindAllocationProfileNode(
3038 *profile, Vector<const char*>(names, arraysize(names))); 3038 *profile, Vector<const char*>(names, arraysize(names)));
3039 CHECK(node); 3039 CHECK(node);
3040 3040
3041 heap_profiler->StopSamplingHeapProfiler(); 3041 heap_profiler->StopSamplingHeapProfiler();
3042 } 3042 }
3043
3044 TEST(SamplingHeapProfilerLeftTrimming) {
3045 v8::HandleScope scope(v8::Isolate::GetCurrent());
3046 LocalContext env;
3047 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
3048
3049 // Suppress randomness to avoid flakiness in tests.
3050 v8::internal::FLAG_sampling_heap_profiler_suppress_randomness = true;
3051
3052 heap_profiler->StartSamplingHeapProfiler(64);
3053
3054 CompileRun(
3055 "for (var j = 0; j < 500; ++j) {\n"
3056 " var a = [];\n"
3057 " for (var i = 0; i < 5; ++i)\n"
3058 " a[i] = i;\n"
3059 " for (var i = 0; i < 3; ++i)\n"
3060 " a.shift();\n"
3061 "}\n");
3062
3063 CcTest::heap()->CollectGarbage(v8::internal::NEW_SPACE);
3064 // Should not crash.
3065
3066 heap_profiler->StopSamplingHeapProfiler();
3067 }
OLDNEW
« no previous file with comments | « src/profiler/heap-profiler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698