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

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

Issue 2534763003: [Interpreter] Add bytecode aging and use it enable CompilationCache for bytecode (Closed)
Patch Set: Rebase Created 4 years 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/cctest.status ('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 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 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after
1612 // g should now have available an optimized function, unmarked by gc. The 1612 // g should now have available an optimized function, unmarked by gc. The
1613 // CompileLazy built-in will discover it and install it in the closure, and 1613 // CompileLazy built-in will discover it and install it in the closure, and
1614 // the incremental write barrier should be used. 1614 // the incremental write barrier should be used.
1615 CompileRun("g();"); 1615 CompileRun("g();");
1616 CHECK(g_function->is_compiled()); 1616 CHECK(g_function->is_compiled());
1617 } 1617 }
1618 1618
1619 TEST(CompilationCacheCachingBehavior) { 1619 TEST(CompilationCacheCachingBehavior) {
1620 // If we do not flush code, or have the compilation cache turned off, this 1620 // If we do not flush code, or have the compilation cache turned off, this
1621 // test is invalid. 1621 // test is invalid.
1622 i::FLAG_allow_natives_syntax = true;
1623 if (!FLAG_flush_code || !FLAG_compilation_cache) { 1622 if (!FLAG_flush_code || !FLAG_compilation_cache) {
1624 return; 1623 return;
1625 } 1624 }
1626 CcTest::InitializeVM(); 1625 CcTest::InitializeVM();
1627 Isolate* isolate = CcTest::i_isolate(); 1626 Isolate* isolate = CcTest::i_isolate();
1628 Factory* factory = isolate->factory(); 1627 Factory* factory = isolate->factory();
1629 CompilationCache* compilation_cache = isolate->compilation_cache(); 1628 CompilationCache* compilation_cache = isolate->compilation_cache();
1630 LanguageMode language_mode = construct_language_mode(FLAG_use_strict); 1629 LanguageMode language_mode = construct_language_mode(FLAG_use_strict);
1631 1630
1632 v8::HandleScope scope(CcTest::isolate()); 1631 v8::HandleScope scope(CcTest::isolate());
(...skipping 23 matching lines...) Expand all
1656 // immediately.) 1655 // immediately.)
1657 if (!FLAG_optimize_for_size) { 1656 if (!FLAG_optimize_for_size) {
1658 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); 1657 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
1659 info = compilation_cache->LookupScript(source, Handle<Object>(), 0, 0, 1658 info = compilation_cache->LookupScript(source, Handle<Object>(), 0, 0,
1660 v8::ScriptOriginOptions(true, false), 1659 v8::ScriptOriginOptions(true, false),
1661 native_context, language_mode); 1660 native_context, language_mode);
1662 CHECK(!info.is_null()); 1661 CHECK(!info.is_null());
1663 } 1662 }
1664 1663
1665 // Progress code age until it's old and ready for GC. 1664 // Progress code age until it's old and ready for GC.
1666 while (!info.ToHandleChecked()->code()->IsOld()) { 1665 const int kAgingThreshold = 6;
1666 for (int i = 0; i < kAgingThreshold; i++) {
1667 info.ToHandleChecked()->code()->MakeOlder(); 1667 info.ToHandleChecked()->code()->MakeOlder();
1668 if (info.ToHandleChecked()->HasBytecodeArray()) {
1669 info.ToHandleChecked()->bytecode_array()->MakeOlder();
1670 }
1668 } 1671 }
1669 1672
1670 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); 1673 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
1671 // Ensure code aging cleared the entry from the cache. 1674 // Ensure code aging cleared the entry from the cache.
1672 info = compilation_cache->LookupScript(source, Handle<Object>(), 0, 0, 1675 info = compilation_cache->LookupScript(source, Handle<Object>(), 0, 0,
1673 v8::ScriptOriginOptions(true, false), 1676 v8::ScriptOriginOptions(true, false),
1674 native_context, language_mode); 1677 native_context, language_mode);
1675 CHECK(info.is_null()); 1678 CHECK(info.is_null());
1676 } 1679 }
1677 1680
(...skipping 5366 matching lines...) Expand 10 before | Expand all | Expand 10 after
7044 SlotSet::FREE_EMPTY_BUCKETS); 7047 SlotSet::FREE_EMPTY_BUCKETS);
7045 slots[chunk->area_end() - kPointerSize] = false; 7048 slots[chunk->area_end() - kPointerSize] = false;
7046 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { 7049 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) {
7047 CHECK(slots[addr]); 7050 CHECK(slots[addr]);
7048 return KEEP_SLOT; 7051 return KEEP_SLOT;
7049 }); 7052 });
7050 } 7053 }
7051 7054
7052 } // namespace internal 7055 } // namespace internal
7053 } // namespace v8 7056 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/cctest.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698