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

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

Issue 2065453002: [module] Track script "module code" status Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Extend compilation cache to recognize module code 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
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 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after
1624 1624
1625 { 1625 {
1626 v8::HandleScope scope(CcTest::isolate()); 1626 v8::HandleScope scope(CcTest::isolate());
1627 CompileRun(raw_source); 1627 CompileRun(raw_source);
1628 } 1628 }
1629 1629
1630 // The script should be in the cache now. 1630 // The script should be in the cache now.
1631 MaybeHandle<SharedFunctionInfo> info = compilation_cache->LookupScript( 1631 MaybeHandle<SharedFunctionInfo> info = compilation_cache->LookupScript(
1632 source, Handle<Object>(), 0, 0, 1632 source, Handle<Object>(), 0, 0,
1633 v8::ScriptOriginOptions(false, true, false), native_context, 1633 v8::ScriptOriginOptions(false, true, false), native_context,
1634 language_mode); 1634 language_mode, false);
1635 CHECK(!info.is_null()); 1635 CHECK(!info.is_null());
1636 1636
1637 // Check that the code cache entry survives at least on GC. 1637 // Check that the code cache entry survives at least on GC.
1638 // (Unless --optimize-for-size, in which case it might get collected 1638 // (Unless --optimize-for-size, in which case it might get collected
1639 // immediately.) 1639 // immediately.)
1640 if (!FLAG_optimize_for_size) { 1640 if (!FLAG_optimize_for_size) {
1641 heap->CollectAllGarbage(); 1641 heap->CollectAllGarbage();
1642 info = compilation_cache->LookupScript( 1642 info = compilation_cache->LookupScript(
1643 source, Handle<Object>(), 0, 0, 1643 source, Handle<Object>(), 0, 0,
1644 v8::ScriptOriginOptions(false, true, false), native_context, 1644 v8::ScriptOriginOptions(false, true, false), native_context,
1645 language_mode); 1645 language_mode, false);
1646 CHECK(!info.is_null()); 1646 CHECK(!info.is_null());
1647 } 1647 }
1648 1648
1649 // Progress code age until it's old and ready for GC. 1649 // Progress code age until it's old and ready for GC.
1650 while (!info.ToHandleChecked()->code()->IsOld()) { 1650 while (!info.ToHandleChecked()->code()->IsOld()) {
1651 // To guarantee progress, we have to MakeOlder with different parities. 1651 // To guarantee progress, we have to MakeOlder with different parities.
1652 // We can't just use NO_MARKING_PARITY, since e.g. kExecutedOnceCodeAge is 1652 // We can't just use NO_MARKING_PARITY, since e.g. kExecutedOnceCodeAge is
1653 // always NO_MARKING_PARITY and the code age only progresses if the parity 1653 // always NO_MARKING_PARITY and the code age only progresses if the parity
1654 // is different. 1654 // is different.
1655 info.ToHandleChecked()->code()->MakeOlder(ODD_MARKING_PARITY); 1655 info.ToHandleChecked()->code()->MakeOlder(ODD_MARKING_PARITY);
1656 info.ToHandleChecked()->code()->MakeOlder(EVEN_MARKING_PARITY); 1656 info.ToHandleChecked()->code()->MakeOlder(EVEN_MARKING_PARITY);
1657 } 1657 }
1658 1658
1659 heap->CollectAllGarbage(); 1659 heap->CollectAllGarbage();
1660 // Ensure code aging cleared the entry from the cache. 1660 // Ensure code aging cleared the entry from the cache.
1661 info = compilation_cache->LookupScript( 1661 info = compilation_cache->LookupScript(
1662 source, Handle<Object>(), 0, 0, 1662 source, Handle<Object>(), 0, 0,
1663 v8::ScriptOriginOptions(false, true, false), native_context, 1663 v8::ScriptOriginOptions(false, true, false), native_context,
1664 language_mode); 1664 language_mode, false);
mike3 2016/06/19 17:11:41 Does this repetition justify a dedicated "not modu
vogelheim 2016/06/23 14:53:20 IMHO, no. I'd suspect that most callers of LookupS
mike3 2016/06/25 19:31:45 Acknowledged.
1665 CHECK(info.is_null()); 1665 CHECK(info.is_null());
1666 } 1666 }
1667 1667
1668 1668
1669 static void OptimizeEmptyFunction(const char* name) { 1669 static void OptimizeEmptyFunction(const char* name) {
1670 HandleScope scope(CcTest::i_isolate()); 1670 HandleScope scope(CcTest::i_isolate());
1671 EmbeddedVector<char, 256> source; 1671 EmbeddedVector<char, 256> source;
1672 SNPrintF(source, 1672 SNPrintF(source,
1673 "function %s() { return 0; }" 1673 "function %s() { return 0; }"
1674 "%s(); %s();" 1674 "%s(); %s();"
(...skipping 5100 matching lines...) Expand 10 before | Expand all | Expand 10 after
6775 int mark_sweeps_performed = mark_sweep_count_after - mark_sweep_count_before; 6775 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 6776 // The memory pressuer handler either performed two GCs or performed one and
6777 // started incremental marking. 6777 // started incremental marking.
6778 CHECK(mark_sweeps_performed == 2 || 6778 CHECK(mark_sweeps_performed == 2 ||
6779 (mark_sweeps_performed == 1 && 6779 (mark_sweeps_performed == 1 &&
6780 !heap->incremental_marking()->IsStopped())); 6780 !heap->incremental_marking()->IsStopped()));
6781 } 6781 }
6782 6782
6783 } // namespace internal 6783 } // namespace internal
6784 } // namespace v8 6784 } // namespace v8
OLDNEW
« src/objects.cc ('K') | « src/parsing/parser.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698