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

Side by Side Diff: test/cctest/test-object-observe.cc

Issue 1082973003: Force full GC whenever CollectAllGarbage is meant to trigger a full GC. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 | « test/cctest/test-mementos.cc ('k') | test/cctest/test-serialize.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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 i::Handle<i::JSWeakMap> objectInfoMap = 422 i::Handle<i::JSWeakMap> objectInfoMap =
423 i::Handle<i::JSWeakMap>::cast(i::Object::GetProperty( 423 i::Handle<i::JSWeakMap>::cast(i::Object::GetProperty(
424 i_isolate, observation_state, "objectInfoMap").ToHandleChecked()); 424 i_isolate, observation_state, "objectInfoMap").ToHandleChecked());
425 i::Handle<i::JSWeakMap> notifierObjectInfoMap = 425 i::Handle<i::JSWeakMap> notifierObjectInfoMap =
426 i::Handle<i::JSWeakMap>::cast(i::Object::GetProperty( 426 i::Handle<i::JSWeakMap>::cast(i::Object::GetProperty(
427 i_isolate, observation_state, "notifierObjectInfoMap") 427 i_isolate, observation_state, "notifierObjectInfoMap")
428 .ToHandleChecked()); 428 .ToHandleChecked());
429 CHECK_EQ(1, NumberOfElements(callbackInfoMap)); 429 CHECK_EQ(1, NumberOfElements(callbackInfoMap));
430 CHECK_EQ(1, NumberOfElements(objectInfoMap)); 430 CHECK_EQ(1, NumberOfElements(objectInfoMap));
431 CHECK_EQ(1, NumberOfElements(notifierObjectInfoMap)); 431 CHECK_EQ(1, NumberOfElements(notifierObjectInfoMap));
432 i_isolate->heap()->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); 432 i_isolate->heap()->CollectAllGarbage();
433 CHECK_EQ(0, NumberOfElements(callbackInfoMap)); 433 CHECK_EQ(0, NumberOfElements(callbackInfoMap));
434 CHECK_EQ(0, NumberOfElements(objectInfoMap)); 434 CHECK_EQ(0, NumberOfElements(objectInfoMap));
435 CHECK_EQ(0, NumberOfElements(notifierObjectInfoMap)); 435 CHECK_EQ(0, NumberOfElements(notifierObjectInfoMap));
436 } 436 }
437 437
438 438
439 static int TestObserveSecurity(Handle<Context> observer_context, 439 static int TestObserveSecurity(Handle<Context> observer_context,
440 Handle<Context> object_context, 440 Handle<Context> object_context,
441 Handle<Context> mutation_context) { 441 Handle<Context> mutation_context) {
442 Context::Scope observer_scope(observer_context); 442 Context::Scope observer_scope(observer_context);
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 return count; 675 return count;
676 } 676 }
677 677
678 678
679 static void CheckSurvivingGlobalObjectsCount(int expected) { 679 static void CheckSurvivingGlobalObjectsCount(int expected) {
680 // We need to collect all garbage twice to be sure that everything 680 // We need to collect all garbage twice to be sure that everything
681 // has been collected. This is because inline caches are cleared in 681 // has been collected. This is because inline caches are cleared in
682 // the first garbage collection but some of the maps have already 682 // the first garbage collection but some of the maps have already
683 // been marked at that point. Therefore some of the maps are not 683 // been marked at that point. Therefore some of the maps are not
684 // collected until the second garbage collection. 684 // collected until the second garbage collection.
685 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); 685 CcTest::heap()->CollectAllGarbage();
686 CcTest::heap()->CollectAllGarbage(i::Heap::kMakeHeapIterableMask); 686 CcTest::heap()->CollectAllGarbage(i::Heap::kMakeHeapIterableMask);
687 int count = GetGlobalObjectsCount(); 687 int count = GetGlobalObjectsCount();
688 #ifdef DEBUG 688 #ifdef DEBUG
689 if (count != expected) CcTest::heap()->TracePathToGlobal(); 689 if (count != expected) CcTest::heap()->TracePathToGlobal();
690 #endif 690 #endif
691 CHECK_EQ(expected, count); 691 CHECK_EQ(expected, count);
692 } 692 }
693 693
694 694
695 TEST(DontLeakContextOnObserve) { 695 TEST(DontLeakContextOnObserve) {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 i::Isolate* isolate = CcTest::i_isolate(); 878 i::Isolate* isolate = CcTest::i_isolate();
879 i::HandleScope scope(isolate); 879 i::HandleScope scope(isolate);
880 LocalContext env; 880 LocalContext env;
881 int use_counts[v8::Isolate::kUseCounterFeatureCount] = {}; 881 int use_counts[v8::Isolate::kUseCounterFeatureCount] = {};
882 global_use_counts = use_counts; 882 global_use_counts = use_counts;
883 CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback); 883 CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback);
884 CompileRun("var obj = {}"); 884 CompileRun("var obj = {}");
885 CompileRun("Object.getNotifier(obj)"); 885 CompileRun("Object.getNotifier(obj)");
886 CHECK_EQ(1, use_counts[v8::Isolate::kObjectObserve]); 886 CHECK_EQ(1, use_counts[v8::Isolate::kObjectObserve]);
887 } 887 }
OLDNEW
« no previous file with comments | « test/cctest/test-mementos.cc ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698