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

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

Issue 2060213002: Revert of Replace all remaining Oddball checks with new function (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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/heap/test-alloc.cc ('k') | test/cctest/test-api.h » ('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 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after
1396 1396
1397 // This compile will compile the function again. 1397 // This compile will compile the function again.
1398 { v8::HandleScope scope(CcTest::isolate()); 1398 { v8::HandleScope scope(CcTest::isolate());
1399 CompileRun("foo();"); 1399 CompileRun("foo();");
1400 } 1400 }
1401 1401
1402 // Simulate several GCs that use incremental marking but make sure 1402 // Simulate several GCs that use incremental marking but make sure
1403 // the loop breaks once the function is enqueued as a candidate. 1403 // the loop breaks once the function is enqueued as a candidate.
1404 for (int i = 0; i < kAgingThreshold; i++) { 1404 for (int i = 0; i < kAgingThreshold; i++) {
1405 heap::SimulateIncrementalMarking(CcTest::heap()); 1405 heap::SimulateIncrementalMarking(CcTest::heap());
1406 if (!function->next_function_link()->IsUndefined(CcTest::i_isolate())) 1406 if (!function->next_function_link()->IsUndefined()) break;
1407 break;
1408 CcTest::heap()->CollectAllGarbage(); 1407 CcTest::heap()->CollectAllGarbage();
1409 } 1408 }
1410 1409
1411 // Force optimization while incremental marking is active and while 1410 // Force optimization while incremental marking is active and while
1412 // the function is enqueued as a candidate. 1411 // the function is enqueued as a candidate.
1413 { v8::HandleScope scope(CcTest::isolate()); 1412 { v8::HandleScope scope(CcTest::isolate());
1414 CompileRun("%OptimizeFunctionOnNextCall(foo); foo();"); 1413 CompileRun("%OptimizeFunctionOnNextCall(foo); foo();");
1415 } 1414 }
1416 1415
1417 // Simulate one final GC to make sure the candidate queue is sane. 1416 // Simulate one final GC to make sure the candidate queue is sane.
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1676 "%s();", 1675 "%s();",
1677 name, name, name, name, name); 1676 name, name, name, name, name);
1678 CompileRun(source.start()); 1677 CompileRun(source.start());
1679 } 1678 }
1680 1679
1681 1680
1682 // Count the number of native contexts in the weak list of native contexts. 1681 // Count the number of native contexts in the weak list of native contexts.
1683 int CountNativeContexts() { 1682 int CountNativeContexts() {
1684 int count = 0; 1683 int count = 0;
1685 Object* object = CcTest::heap()->native_contexts_list(); 1684 Object* object = CcTest::heap()->native_contexts_list();
1686 while (!object->IsUndefined(CcTest::i_isolate())) { 1685 while (!object->IsUndefined()) {
1687 count++; 1686 count++;
1688 object = Context::cast(object)->next_context_link(); 1687 object = Context::cast(object)->next_context_link();
1689 } 1688 }
1690 return count; 1689 return count;
1691 } 1690 }
1692 1691
1693 1692
1694 // Count the number of user functions in the weak list of optimized 1693 // Count the number of user functions in the weak list of optimized
1695 // functions attached to a native context. 1694 // functions attached to a native context.
1696 static int CountOptimizedUserFunctions(v8::Local<v8::Context> context) { 1695 static int CountOptimizedUserFunctions(v8::Local<v8::Context> context) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1812 CHECK_EQ(0, CountNativeContexts()); 1811 CHECK_EQ(0, CountNativeContexts());
1813 } 1812 }
1814 1813
1815 1814
1816 // Count the number of native contexts in the weak list of native contexts 1815 // Count the number of native contexts in the weak list of native contexts
1817 // causing a GC after the specified number of elements. 1816 // causing a GC after the specified number of elements.
1818 static int CountNativeContextsWithGC(Isolate* isolate, int n) { 1817 static int CountNativeContextsWithGC(Isolate* isolate, int n) {
1819 Heap* heap = isolate->heap(); 1818 Heap* heap = isolate->heap();
1820 int count = 0; 1819 int count = 0;
1821 Handle<Object> object(heap->native_contexts_list(), isolate); 1820 Handle<Object> object(heap->native_contexts_list(), isolate);
1822 while (!object->IsUndefined(isolate)) { 1821 while (!object->IsUndefined()) {
1823 count++; 1822 count++;
1824 if (count == n) heap->CollectAllGarbage(); 1823 if (count == n) heap->CollectAllGarbage();
1825 object = 1824 object =
1826 Handle<Object>(Context::cast(*object)->next_context_link(), isolate); 1825 Handle<Object>(Context::cast(*object)->next_context_link(), isolate);
1827 } 1826 }
1828 return count; 1827 return count;
1829 } 1828 }
1830 1829
1831 1830
1832 // Count the number of user functions in the weak list of optimized 1831 // Count the number of user functions in the weak list of optimized
(...skipping 2824 matching lines...) Expand 10 before | Expand all | Expand 10 after
4657 4656
4658 // Run test with inline allocation re-enabled. 4657 // Run test with inline allocation re-enabled.
4659 CcTest::heap()->EnableInlineAllocation(); 4658 CcTest::heap()->EnableInlineAllocation();
4660 CompileRun("run()"); 4659 CompileRun("run()");
4661 } 4660 }
4662 4661
4663 4662
4664 static int AllocationSitesCount(Heap* heap) { 4663 static int AllocationSitesCount(Heap* heap) {
4665 int count = 0; 4664 int count = 0;
4666 for (Object* site = heap->allocation_sites_list(); 4665 for (Object* site = heap->allocation_sites_list();
4667 !(site->IsUndefined(heap->isolate())); 4666 !(site->IsUndefined());
4668 site = AllocationSite::cast(site)->weak_next()) { 4667 site = AllocationSite::cast(site)->weak_next()) {
4669 count++; 4668 count++;
4670 } 4669 }
4671 return count; 4670 return count;
4672 } 4671 }
4673 4672
4674 4673
4675 TEST(EnsureAllocationSiteDependentCodesProcessed) { 4674 TEST(EnsureAllocationSiteDependentCodesProcessed) {
4676 if (i::FLAG_always_opt || !i::FLAG_crankshaft) return; 4675 if (i::FLAG_always_opt || !i::FLAG_crankshaft) return;
4677 i::FLAG_allow_natives_syntax = true; 4676 i::FLAG_allow_natives_syntax = true;
(...skipping 2097 matching lines...) Expand 10 before | Expand all | Expand 10 after
6775 int mark_sweeps_performed = mark_sweep_count_after - mark_sweep_count_before; 6774 int mark_sweeps_performed = mark_sweep_count_after - mark_sweep_count_before;
6776 // The memory pressuer handler either performed two GCs or performed one and 6775 // The memory pressuer handler either performed two GCs or performed one and
6777 // started incremental marking. 6776 // started incremental marking.
6778 CHECK(mark_sweeps_performed == 2 || 6777 CHECK(mark_sweeps_performed == 2 ||
6779 (mark_sweeps_performed == 1 && 6778 (mark_sweeps_performed == 1 &&
6780 !heap->incremental_marking()->IsStopped())); 6779 !heap->incremental_marking()->IsStopped()));
6781 } 6780 }
6782 6781
6783 } // namespace internal 6782 } // namespace internal
6784 } // namespace v8 6783 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/heap/test-alloc.cc ('k') | test/cctest/test-api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698