OLD | NEW |
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 1625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1636 Handle<String> source = factory->InternalizeUtf8String(raw_source); | 1636 Handle<String> source = factory->InternalizeUtf8String(raw_source); |
1637 Handle<Context> native_context = isolate->native_context(); | 1637 Handle<Context> native_context = isolate->native_context(); |
1638 | 1638 |
1639 { | 1639 { |
1640 v8::HandleScope scope(CcTest::isolate()); | 1640 v8::HandleScope scope(CcTest::isolate()); |
1641 CompileRun(raw_source); | 1641 CompileRun(raw_source); |
1642 } | 1642 } |
1643 | 1643 |
1644 // The script should be in the cache now. | 1644 // The script should be in the cache now. |
1645 MaybeHandle<SharedFunctionInfo> info = compilation_cache->LookupScript( | 1645 MaybeHandle<SharedFunctionInfo> info = compilation_cache->LookupScript( |
1646 source, Handle<Object>(), 0, 0, | 1646 source, Handle<Object>(), 0, 0, v8::ScriptOriginOptions(true, false), |
1647 v8::ScriptOriginOptions(false, true, false), native_context, | 1647 native_context, language_mode); |
1648 language_mode); | |
1649 CHECK(!info.is_null()); | 1648 CHECK(!info.is_null()); |
1650 | 1649 |
1651 // Check that the code cache entry survives at least on GC. | 1650 // Check that the code cache entry survives at least on GC. |
1652 // (Unless --optimize-for-size, in which case it might get collected | 1651 // (Unless --optimize-for-size, in which case it might get collected |
1653 // immediately.) | 1652 // immediately.) |
1654 if (!FLAG_optimize_for_size) { | 1653 if (!FLAG_optimize_for_size) { |
1655 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); | 1654 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); |
1656 info = compilation_cache->LookupScript( | 1655 info = compilation_cache->LookupScript(source, Handle<Object>(), 0, 0, |
1657 source, Handle<Object>(), 0, 0, | 1656 v8::ScriptOriginOptions(true, false), |
1658 v8::ScriptOriginOptions(false, true, false), native_context, | 1657 native_context, language_mode); |
1659 language_mode); | |
1660 CHECK(!info.is_null()); | 1658 CHECK(!info.is_null()); |
1661 } | 1659 } |
1662 | 1660 |
1663 // Progress code age until it's old and ready for GC. | 1661 // Progress code age until it's old and ready for GC. |
1664 while (!info.ToHandleChecked()->code()->IsOld()) { | 1662 while (!info.ToHandleChecked()->code()->IsOld()) { |
1665 // To guarantee progress, we have to MakeOlder with different parities. | 1663 // To guarantee progress, we have to MakeOlder with different parities. |
1666 // We can't just use NO_MARKING_PARITY, since e.g. kExecutedOnceCodeAge is | 1664 // We can't just use NO_MARKING_PARITY, since e.g. kExecutedOnceCodeAge is |
1667 // always NO_MARKING_PARITY and the code age only progresses if the parity | 1665 // always NO_MARKING_PARITY and the code age only progresses if the parity |
1668 // is different. | 1666 // is different. |
1669 info.ToHandleChecked()->code()->MakeOlder(ODD_MARKING_PARITY); | 1667 info.ToHandleChecked()->code()->MakeOlder(ODD_MARKING_PARITY); |
1670 info.ToHandleChecked()->code()->MakeOlder(EVEN_MARKING_PARITY); | 1668 info.ToHandleChecked()->code()->MakeOlder(EVEN_MARKING_PARITY); |
1671 } | 1669 } |
1672 | 1670 |
1673 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); | 1671 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); |
1674 // Ensure code aging cleared the entry from the cache. | 1672 // Ensure code aging cleared the entry from the cache. |
1675 info = compilation_cache->LookupScript( | 1673 info = compilation_cache->LookupScript(source, Handle<Object>(), 0, 0, |
1676 source, Handle<Object>(), 0, 0, | 1674 v8::ScriptOriginOptions(true, false), |
1677 v8::ScriptOriginOptions(false, true, false), native_context, | 1675 native_context, language_mode); |
1678 language_mode); | |
1679 CHECK(info.is_null()); | 1676 CHECK(info.is_null()); |
1680 } | 1677 } |
1681 | 1678 |
1682 | 1679 |
1683 static void OptimizeEmptyFunction(const char* name) { | 1680 static void OptimizeEmptyFunction(const char* name) { |
1684 HandleScope scope(CcTest::i_isolate()); | 1681 HandleScope scope(CcTest::i_isolate()); |
1685 EmbeddedVector<char, 256> source; | 1682 EmbeddedVector<char, 256> source; |
1686 SNPrintF(source, | 1683 SNPrintF(source, |
1687 "function %s() { return 0; }" | 1684 "function %s() { return 0; }" |
1688 "%s(); %s();" | 1685 "%s(); %s();" |
(...skipping 5331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7020 SlotSet::FREE_EMPTY_BUCKETS); | 7017 SlotSet::FREE_EMPTY_BUCKETS); |
7021 slots[chunk->area_end() - kPointerSize] = false; | 7018 slots[chunk->area_end() - kPointerSize] = false; |
7022 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { | 7019 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { |
7023 CHECK(slots[addr]); | 7020 CHECK(slots[addr]); |
7024 return KEEP_SLOT; | 7021 return KEEP_SLOT; |
7025 }); | 7022 }); |
7026 } | 7023 } |
7027 | 7024 |
7028 } // namespace internal | 7025 } // namespace internal |
7029 } // namespace v8 | 7026 } // namespace v8 |
OLD | NEW |