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

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

Issue 2264033002: [heap] Tracer: Handle incremental marking scopes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add wrapper tracing epilogue scope Created 4 years, 3 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/heap/mark-compact.cc ('k') | test/unittests/heap/gc-tracer-unittest.cc » ('j') | 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 6188 matching lines...) Expand 10 before | Expand all | Expand 10 after
6199 size_t start = heap->OldGenerationAllocationCounter(); 6199 size_t start = heap->OldGenerationAllocationCounter();
6200 for (int i = 0; i < 20; i++) { 6200 for (int i = 0; i < 20; i++) {
6201 AllocateInSpace(isolate, kSize, OLD_SPACE); 6201 AllocateInSpace(isolate, kSize, OLD_SPACE);
6202 size_t counter = heap->OldGenerationAllocationCounter(); 6202 size_t counter = heap->OldGenerationAllocationCounter();
6203 CHECK_LE(kSize, counter - start); 6203 CHECK_LE(kSize, counter - start);
6204 start = counter; 6204 start = counter;
6205 } 6205 }
6206 } 6206 }
6207 6207
6208 6208
6209 TEST(NewSpaceAllocationThroughput) {
6210 CcTest::InitializeVM();
6211 v8::HandleScope scope(CcTest::isolate());
6212 Isolate* isolate = CcTest::i_isolate();
6213 Heap* heap = isolate->heap();
6214 GCTracer* tracer = heap->tracer();
6215 tracer->ResetForTesting();
6216 int time1 = 100;
6217 size_t counter1 = 1000;
6218 tracer->SampleAllocation(time1, counter1, 0);
6219 int time2 = 200;
6220 size_t counter2 = 2000;
6221 tracer->SampleAllocation(time2, counter2, 0);
6222 size_t throughput =
6223 tracer->NewSpaceAllocationThroughputInBytesPerMillisecond();
6224 CHECK_EQ((counter2 - counter1) / (time2 - time1), throughput);
6225 int time3 = 1000;
6226 size_t counter3 = 30000;
6227 tracer->SampleAllocation(time3, counter3, 0);
6228 throughput = tracer->NewSpaceAllocationThroughputInBytesPerMillisecond();
6229 CHECK_EQ((counter3 - counter1) / (time3 - time1), throughput);
6230 }
6231
6232
6233 TEST(NewSpaceAllocationThroughput2) {
6234 CcTest::InitializeVM();
6235 v8::HandleScope scope(CcTest::isolate());
6236 Isolate* isolate = CcTest::i_isolate();
6237 Heap* heap = isolate->heap();
6238 GCTracer* tracer = heap->tracer();
6239 tracer->ResetForTesting();
6240 int time1 = 100;
6241 size_t counter1 = 1000;
6242 tracer->SampleAllocation(time1, counter1, 0);
6243 int time2 = 200;
6244 size_t counter2 = 2000;
6245 tracer->SampleAllocation(time2, counter2, 0);
6246 size_t throughput =
6247 tracer->NewSpaceAllocationThroughputInBytesPerMillisecond(100);
6248 CHECK_EQ((counter2 - counter1) / (time2 - time1), throughput);
6249 int time3 = 1000;
6250 size_t counter3 = 30000;
6251 tracer->SampleAllocation(time3, counter3, 0);
6252 throughput = tracer->NewSpaceAllocationThroughputInBytesPerMillisecond(100);
6253 CHECK_EQ((counter3 - counter1) / (time3 - time1), throughput);
6254 }
6255
6256
6257 static void CheckLeak(const v8::FunctionCallbackInfo<v8::Value>& args) { 6209 static void CheckLeak(const v8::FunctionCallbackInfo<v8::Value>& args) {
6258 Isolate* isolate = CcTest::i_isolate(); 6210 Isolate* isolate = CcTest::i_isolate();
6259 Object* message = 6211 Object* message =
6260 *reinterpret_cast<Object**>(isolate->pending_message_obj_address()); 6212 *reinterpret_cast<Object**>(isolate->pending_message_obj_address());
6261 CHECK(message->IsTheHole(isolate)); 6213 CHECK(message->IsTheHole(isolate));
6262 } 6214 }
6263 6215
6264 6216
6265 TEST(MessageObjectLeak) { 6217 TEST(MessageObjectLeak) {
6266 CcTest::InitializeVM(); 6218 CcTest::InitializeVM();
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
6359 "var g1 = f();" 6311 "var g1 = f();"
6360 "var g2 = f();" 6312 "var g2 = f();"
6361 "check(g1, g2);" 6313 "check(g1, g2);"
6362 "g1();" 6314 "g1();"
6363 "g2();" 6315 "g2();"
6364 "remove(g1);" 6316 "remove(g1);"
6365 "g2();" 6317 "g2();"
6366 "check(g1, g2);"); 6318 "check(g1, g2);");
6367 } 6319 }
6368 6320
6369 TEST(OldGenerationAllocationThroughput) {
6370 CcTest::InitializeVM();
6371 v8::HandleScope scope(CcTest::isolate());
6372 Isolate* isolate = CcTest::i_isolate();
6373 Heap* heap = isolate->heap();
6374 GCTracer* tracer = heap->tracer();
6375 tracer->ResetForTesting();
6376 int time1 = 100;
6377 size_t counter1 = 1000;
6378 tracer->SampleAllocation(time1, 0, counter1);
6379 int time2 = 200;
6380 size_t counter2 = 2000;
6381 tracer->SampleAllocation(time2, 0, counter2);
6382 size_t throughput = static_cast<size_t>(
6383 tracer->OldGenerationAllocationThroughputInBytesPerMillisecond(100));
6384 CHECK_EQ((counter2 - counter1) / (time2 - time1), throughput);
6385 int time3 = 1000;
6386 size_t counter3 = 30000;
6387 tracer->SampleAllocation(time3, 0, counter3);
6388 throughput = static_cast<size_t>(
6389 tracer->OldGenerationAllocationThroughputInBytesPerMillisecond(100));
6390 CHECK_EQ((counter3 - counter1) / (time3 - time1), throughput);
6391 }
6392
6393
6394 TEST(AllocationThroughput) {
6395 CcTest::InitializeVM();
6396 v8::HandleScope scope(CcTest::isolate());
6397 Isolate* isolate = CcTest::i_isolate();
6398 Heap* heap = isolate->heap();
6399 GCTracer* tracer = heap->tracer();
6400 tracer->ResetForTesting();
6401 int time1 = 100;
6402 size_t counter1 = 1000;
6403 tracer->SampleAllocation(time1, counter1, counter1);
6404 int time2 = 200;
6405 size_t counter2 = 2000;
6406 tracer->SampleAllocation(time2, counter2, counter2);
6407 size_t throughput = static_cast<size_t>(
6408 tracer->AllocationThroughputInBytesPerMillisecond(100));
6409 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput);
6410 int time3 = 1000;
6411 size_t counter3 = 30000;
6412 tracer->SampleAllocation(time3, counter3, counter3);
6413 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100);
6414 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput);
6415 }
6416
6417
6418 TEST(ContextMeasure) { 6321 TEST(ContextMeasure) {
6419 CcTest::InitializeVM(); 6322 CcTest::InitializeVM();
6420 v8::HandleScope scope(CcTest::isolate()); 6323 v8::HandleScope scope(CcTest::isolate());
6421 Isolate* isolate = CcTest::i_isolate(); 6324 Isolate* isolate = CcTest::i_isolate();
6422 LocalContext context; 6325 LocalContext context;
6423 6326
6424 int size_upper_limit = 0; 6327 int size_upper_limit = 0;
6425 int count_upper_limit = 0; 6328 int count_upper_limit = 0;
6426 HeapIterator it(CcTest::heap()); 6329 HeapIterator it(CcTest::heap());
6427 for (HeapObject* obj = it.next(); obj != NULL; obj = it.next()) { 6330 for (HeapObject* obj = it.next(); obj != NULL; obj = it.next()) {
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
7176 chunk, chunk->area_end() - kPointerSize, chunk->area_end()); 7079 chunk, chunk->area_end() - kPointerSize, chunk->area_end());
7177 slots[chunk->area_end() - kPointerSize] = false; 7080 slots[chunk->area_end() - kPointerSize] = false;
7178 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { 7081 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) {
7179 CHECK(slots[addr]); 7082 CHECK(slots[addr]);
7180 return KEEP_SLOT; 7083 return KEEP_SLOT;
7181 }); 7084 });
7182 } 7085 }
7183 7086
7184 } // namespace internal 7087 } // namespace internal
7185 } // namespace v8 7088 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/mark-compact.cc ('k') | test/unittests/heap/gc-tracer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698