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

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

Issue 2090983002: Revert of Reland [heap] Avoid the use of cells to point from code to new-space objects. (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 | « src/x87/assembler-x87-inl.h ('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 4799 matching lines...) Expand 10 before | Expand all | Expand 10 after
4810 } 4810 }
4811 4811
4812 // Now make sure that a gc should get rid of the function 4812 // Now make sure that a gc should get rid of the function
4813 for (int i = 0; i < 4; i++) { 4813 for (int i = 0; i < 4; i++) {
4814 heap->CollectAllGarbage(); 4814 heap->CollectAllGarbage();
4815 } 4815 }
4816 4816
4817 CHECK(code->marked_for_deoptimization()); 4817 CHECK(code->marked_for_deoptimization());
4818 } 4818 }
4819 4819
4820 TEST(NewSpaceObjectsInOptimizedCode) {
4821 if (i::FLAG_always_opt || !i::FLAG_crankshaft || i::FLAG_turbo) return;
4822 i::FLAG_weak_embedded_objects_in_optimized_code = true;
4823 i::FLAG_allow_natives_syntax = true;
4824 CcTest::InitializeVM();
4825 Isolate* isolate = CcTest::i_isolate();
4826 v8::internal::Heap* heap = CcTest::heap();
4827
4828 if (!isolate->use_crankshaft()) return;
4829 HandleScope outer_scope(heap->isolate());
4830 Handle<Code> code;
4831 {
4832 LocalContext context;
4833 HandleScope scope(heap->isolate());
4834
4835 CompileRun(
4836 "var foo;"
4837 "var bar;"
4838 "(function() {"
4839 " function foo_func(x) { with (x) { return 1 + x; } };"
4840 " %NeverOptimizeFunction(foo_func);"
4841 " function bar_func() {"
4842 " return foo(1);"
4843 " };"
4844 " bar = bar_func;"
4845 " foo = foo_func;"
4846 " bar_func();"
4847 " bar_func();"
4848 " bar_func();"
4849 " %OptimizeFunctionOnNextCall(bar_func);"
4850 " bar_func();"
4851 "})();");
4852
4853 Handle<JSFunction> bar = Handle<JSFunction>::cast(v8::Utils::OpenHandle(
4854 *v8::Local<v8::Function>::Cast(CcTest::global()
4855 ->Get(context.local(), v8_str("bar"))
4856 .ToLocalChecked())));
4857
4858 Handle<JSFunction> foo = Handle<JSFunction>::cast(v8::Utils::OpenHandle(
4859 *v8::Local<v8::Function>::Cast(CcTest::global()
4860 ->Get(context.local(), v8_str("foo"))
4861 .ToLocalChecked())));
4862
4863 CHECK(heap->InNewSpace(*foo));
4864 heap->CollectGarbage(NEW_SPACE);
4865 heap->CollectGarbage(NEW_SPACE);
4866 CHECK(!heap->InNewSpace(*foo));
4867 #ifdef VERIFY_HEAP
4868 heap->Verify();
4869 #endif
4870 CHECK(!bar->code()->marked_for_deoptimization());
4871 code = scope.CloseAndEscape(Handle<Code>(bar->code()));
4872 }
4873
4874 // Now make sure that a gc should get rid of the function
4875 for (int i = 0; i < 4; i++) {
4876 heap->CollectAllGarbage();
4877 }
4878
4879 CHECK(code->marked_for_deoptimization());
4880 }
4881 4820
4882 TEST(NoWeakHashTableLeakWithIncrementalMarking) { 4821 TEST(NoWeakHashTableLeakWithIncrementalMarking) {
4883 if (i::FLAG_always_opt || !i::FLAG_crankshaft) return; 4822 if (i::FLAG_always_opt || !i::FLAG_crankshaft) return;
4884 if (!i::FLAG_incremental_marking) return; 4823 if (!i::FLAG_incremental_marking) return;
4885 i::FLAG_weak_embedded_objects_in_optimized_code = true; 4824 i::FLAG_weak_embedded_objects_in_optimized_code = true;
4886 i::FLAG_allow_natives_syntax = true; 4825 i::FLAG_allow_natives_syntax = true;
4887 i::FLAG_compilation_cache = false; 4826 i::FLAG_compilation_cache = false;
4888 i::FLAG_retain_maps_for_n_gc = 0; 4827 i::FLAG_retain_maps_for_n_gc = 0;
4889 CcTest::InitializeVM(); 4828 CcTest::InitializeVM();
4890 Isolate* isolate = CcTest::i_isolate(); 4829 Isolate* isolate = CcTest::i_isolate();
(...skipping 1895 matching lines...) Expand 10 before | Expand all | Expand 10 after
6786 int mark_sweeps_performed = mark_sweep_count_after - mark_sweep_count_before; 6725 int mark_sweeps_performed = mark_sweep_count_after - mark_sweep_count_before;
6787 // The memory pressuer handler either performed two GCs or performed one and 6726 // The memory pressuer handler either performed two GCs or performed one and
6788 // started incremental marking. 6727 // started incremental marking.
6789 CHECK(mark_sweeps_performed == 2 || 6728 CHECK(mark_sweeps_performed == 2 ||
6790 (mark_sweeps_performed == 1 && 6729 (mark_sweeps_performed == 1 &&
6791 !heap->incremental_marking()->IsStopped())); 6730 !heap->incremental_marking()->IsStopped()));
6792 } 6731 }
6793 6732
6794 } // namespace internal 6733 } // namespace internal
6795 } // namespace v8 6734 } // namespace v8
OLDNEW
« no previous file with comments | « src/x87/assembler-x87-inl.h ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698