Changeset 262570 in webkit
- Timestamp:
- Jun 4, 2020, 2:07:42 PM (5 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r262568 r262570 1 2020-06-04 Mark Lam <mark.lam@apple.com> 2 3 Add Options::validateDoesGC() for turning DoesGC validation on/off. 4 https://bugs.webkit.org/show_bug.cgi?id=212773 5 6 Reviewed by Saam Barati. 7 8 It will default to on if ASSERT_ENABLED because we want testing to be done with 9 the validation on. When needed, we can turn it off if we need to e.g. to 10 de-clutter disassembly dumps while debugging. 11 12 If Options::validateDoesGC() is false, we turn off JIT code emission for this 13 check, as well as skip the validation checks. There are still places in C++ 14 code that store to DoesGC::m_value without checking Options::validateDoesGC(). 15 It doesn't hurt to just let these stores proceed, and performance-wise, it's 16 probably cheaper to just do the store unconditionally than to gate it on a load of 17 Options::validateDoesGC() first. 18 19 Also made it explicit that the check on validateDFGDoesGC is a constexpr check. 20 21 * dfg/DFGDoesGCCheck.cpp: 22 (JSC::DFG::DoesGCCheck::verifyCanGC): 23 * dfg/DFGOSRExit.cpp: 24 (JSC::DFG::OSRExit::compileExit): 25 * dfg/DFGSpeculativeJIT32_64.cpp: 26 (JSC::DFG::SpeculativeJIT::compile): 27 * dfg/DFGSpeculativeJIT64.cpp: 28 (JSC::DFG::SpeculativeJIT::compile): 29 * ftl/FTLLowerDFGToB3.cpp: 30 (JSC::FTL::DFG::LowerDFGToB3::compileNode): 31 * ftl/FTLOSRExitCompiler.cpp: 32 (JSC::FTL::compileStub): 33 * runtime/OptionsList.h: 34 1 35 2020-06-04 Ross Kirsling <ross.kirsling@sony.com> 2 36 -
trunk/Source/JavaScriptCore/dfg/DFGDoesGCCheck.cpp
r262562 r262570 31 31 #include "DFGNodeType.h" 32 32 #include "Heap.h" 33 #include "Options.h" 33 34 #include "VMInspector.h" 34 35 #include <wtf/DataLog.h> … … 46 47 // in the header file. 47 48 static_assert(numberOfNodeTypes <= (1 << nodeOpBits)); 49 50 if (!Options::validateDoesGC()) 51 return; 48 52 49 53 if (!expectDoesGC()) { -
trunk/Source/JavaScriptCore/dfg/DFGOSRExit.cpp
r262562 r262570 144 144 auto scope = DECLARE_THROW_SCOPE(vm); 145 145 146 if (validateDFGDoesGC) {146 if constexpr (validateDFGDoesGC) { 147 147 // We're about to exit optimized code. So, there's no longer any optimized 148 148 // code running that expects no GC. … … 552 552 553 553 #if USE(JSVALUE64) 554 if (validateDFGDoesGC) { 555 // We're about to exit optimized code. So, there's no longer any optimized 556 // code running that expects no GC. We need to set this before arguments 557 // materialization below (see emitRestoreArguments()). 558 559 // Even though we set Heap::m_doesGC in compileOSRExit(), we also need 560 // to set it here because compileOSRExit() is only called on the first time 561 // we exit from this site, but all subsequent exits will take this compiled 562 // ramp without calling compileOSRExit() first. 563 jit.store32(CCallHelpers::TrustedImm32(DoesGCCheck::encode(true, DoesGCCheck::Special::DFGOSRExit)), vm.heap.addressOfDoesGC()); 554 if constexpr (validateDFGDoesGC) { 555 if (Options::validateDoesGC()) { 556 // We're about to exit optimized code. So, there's no longer any optimized 557 // code running that expects no GC. We need to set this before arguments 558 // materialization below (see emitRestoreArguments()). 559 560 // Even though we set Heap::m_doesGC in compileOSRExit(), we also need 561 // to set it here because compileOSRExit() is only called on the first time 562 // we exit from this site, but all subsequent exits will take this compiled 563 // ramp without calling compileOSRExit() first. 564 jit.store32(CCallHelpers::TrustedImm32(DoesGCCheck::encode(true, DoesGCCheck::Special::DFGOSRExit)), vm.heap.addressOfDoesGC()); 565 } 564 566 } 565 567 #endif -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
r262562 r262570 1808 1808 NodeType op = node->op(); 1809 1809 1810 if (validateDFGDoesGC) { 1811 bool expectDoesGC = doesGC(m_jit.graph(), node); 1812 m_jit.store32(TrustedImm32(DoesGCCheck::encode(expectDoesGC, node->index(), node->op())), vm().heap.addressOfDoesGC()); 1810 if constexpr (validateDFGDoesGC) { 1811 if (Options::validateDoesGC()) { 1812 bool expectDoesGC = doesGC(m_jit.graph(), node); 1813 m_jit.store32(TrustedImm32(DoesGCCheck::encode(expectDoesGC, node->index(), node->op())), vm().heap.addressOfDoesGC()); 1814 } 1813 1815 } 1814 1816 -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
r262562 r262570 2137 2137 NodeType op = node->op(); 2138 2138 2139 if (validateDFGDoesGC) { 2140 bool expectDoesGC = doesGC(m_jit.graph(), node); 2141 m_jit.store32(TrustedImm32(DoesGCCheck::encode(expectDoesGC, node->index(), node->op())), vm().heap.addressOfDoesGC()); 2139 if constexpr (validateDFGDoesGC) { 2140 if (Options::validateDoesGC()) { 2141 bool expectDoesGC = doesGC(m_jit.graph(), node); 2142 m_jit.store32(TrustedImm32(DoesGCCheck::encode(expectDoesGC, node->index(), node->op())), vm().heap.addressOfDoesGC()); 2143 } 2142 2144 } 2143 2145 -
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
r262562 r262570 703 703 validateAIState(m_node); 704 704 705 if (validateDFGDoesGC) { 706 bool expectDoesGC = doesGC(m_graph, m_node); 707 m_out.store(m_out.constInt32(DoesGCCheck::encode(expectDoesGC, m_node->index(), m_node->op())), m_out.absolute(vm().heap.addressOfDoesGC())); 705 if constexpr (validateDFGDoesGC) { 706 if (Options::validateDoesGC()) { 707 bool expectDoesGC = doesGC(m_graph, m_node); 708 m_out.store(m_out.constInt32(DoesGCCheck::encode(expectDoesGC, m_node->index(), m_node->op())), m_out.absolute(vm().heap.addressOfDoesGC())); 709 } 708 710 } 709 711 -
trunk/Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp
r262562 r262570 207 207 saveAllRegisters(jit, registerScratch); 208 208 209 if (validateDFGDoesGC) { 210 // We're about to exit optimized code. So, there's no longer any optimized 211 // code running that expects no GC. We need to set this before object 212 // materialization below. 213 214 // Even though we set Heap::m_doesGC in compileFTLOSRExit(), we also need 215 // to set it here because compileFTLOSRExit() is only called on the first time 216 // we exit from this site, but all subsequent exits will take this compiled 217 // ramp without calling compileFTLOSRExit() first. 218 jit.store32(CCallHelpers::TrustedImm32(DoesGCCheck::encode(true, DoesGCCheck::Special::FTLOSRExit)), vm.heap.addressOfDoesGC()); 209 if constexpr (validateDFGDoesGC) { 210 if (Options::validateDoesGC()) { 211 // We're about to exit optimized code. So, there's no longer any optimized 212 // code running that expects no GC. We need to set this before object 213 // materialization below. 214 215 // Even though we set Heap::m_doesGC in compileFTLOSRExit(), we also need 216 // to set it here because compileFTLOSRExit() is only called on the first time 217 // we exit from this site, but all subsequent exits will take this compiled 218 // ramp without calling compileFTLOSRExit() first. 219 jit.store32(CCallHelpers::TrustedImm32(DoesGCCheck::encode(true, DoesGCCheck::Special::FTLOSRExit)), vm.heap.addressOfDoesGC()); 220 } 219 221 } 220 222 … … 546 548 VM& vm = callFrame->deprecatedVM(); 547 549 548 if (validateDFGDoesGC) {550 if constexpr (validateDFGDoesGC) { 549 551 // We're about to exit optimized code. So, there's no longer any optimized 550 552 // code running that expects no GC. -
trunk/Source/JavaScriptCore/heap/CompleteSubspace.cpp
r262513 r262570 120 120 void* CompleteSubspace::tryAllocateSlow(VM& vm, size_t size, GCDeferralContext* deferralContext) 121 121 { 122 if (validateDFGDoesGC)122 if constexpr (validateDFGDoesGC) 123 123 vm.heap.verifyCanGC(); 124 124 … … 156 156 void* CompleteSubspace::reallocatePreciseAllocationNonVirtual(VM& vm, HeapCell* oldCell, size_t size, GCDeferralContext* deferralContext, AllocationFailureMode failureMode) 157 157 { 158 if (validateDFGDoesGC)158 if constexpr (validateDFGDoesGC) 159 159 vm.heap.verifyCanGC(); 160 160 -
trunk/Source/JavaScriptCore/heap/CompleteSubspaceInlines.h
r262513 r262570 33 33 ALWAYS_INLINE void* CompleteSubspace::allocateNonVirtual(VM& vm, size_t size, GCDeferralContext* deferralContext, AllocationFailureMode failureMode) 34 34 { 35 if (validateDFGDoesGC)35 if constexpr (validateDFGDoesGC) 36 36 vm.heap.verifyCanGC(); 37 37 -
trunk/Source/JavaScriptCore/heap/DeferGC.h
r262513 r262570 45 45 ~DeferGC() 46 46 { 47 if (validateDFGDoesGC)47 if constexpr (validateDFGDoesGC) 48 48 m_heap.verifyCanGC(); 49 49 m_heap.decrementDeferralDepthAndGCIfNeeded(); -
trunk/Source/JavaScriptCore/heap/GCDeferralContextInlines.h
r262513 r262570 38 38 ALWAYS_INLINE GCDeferralContext::~GCDeferralContext() 39 39 { 40 if (validateDFGDoesGC)40 if constexpr (validateDFGDoesGC) 41 41 m_heap.verifyCanGC(); 42 42 -
trunk/Source/JavaScriptCore/heap/Heap.cpp
r262513 r262570 1064 1064 void Heap::collectNow(Synchronousness synchronousness, GCRequest request) 1065 1065 { 1066 if (validateDFGDoesGC)1066 if constexpr (validateDFGDoesGC) 1067 1067 verifyCanGC(); 1068 1068 … … 1097 1097 void Heap::collectAsync(GCRequest request) 1098 1098 { 1099 if (validateDFGDoesGC)1099 if constexpr (validateDFGDoesGC) 1100 1100 verifyCanGC(); 1101 1101 … … 1121 1121 void Heap::collectSync(GCRequest request) 1122 1122 { 1123 if (validateDFGDoesGC)1123 if constexpr (validateDFGDoesGC) 1124 1124 verifyCanGC(); 1125 1125 … … 1784 1784 void Heap::stopIfNecessarySlow() 1785 1785 { 1786 if (validateDFGDoesGC)1786 if constexpr (validateDFGDoesGC) 1787 1787 verifyCanGC(); 1788 1788 … … 1799 1799 bool Heap::stopIfNecessarySlow(unsigned oldState) 1800 1800 { 1801 if (validateDFGDoesGC)1801 if constexpr (validateDFGDoesGC) 1802 1802 verifyCanGC(); 1803 1803 … … 2601 2601 { 2602 2602 ASSERT(deferralContext || isDeferred() || !DisallowGC::isInEffectOnCurrentThread()); 2603 if (validateDFGDoesGC)2603 if constexpr (validateDFGDoesGC) 2604 2604 verifyCanGC(); 2605 2605 -
trunk/Source/JavaScriptCore/heap/HeapInlines.h
r262513 r262570 1 1 /* 2 * Copyright (C) 2014-20 19Apple Inc. All rights reserved.2 * Copyright (C) 2014-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 236 236 inline void Heap::acquireAccess() 237 237 { 238 if (validateDFGDoesGC)238 if constexpr (validateDFGDoesGC) 239 239 verifyCanGC(); 240 240 … … 263 263 inline void Heap::stopIfNecessary() 264 264 { 265 if (validateDFGDoesGC)265 if constexpr (validateDFGDoesGC) 266 266 verifyCanGC(); 267 267 -
trunk/Source/JavaScriptCore/heap/LocalAllocatorInlines.h
r262513 r262570 1 1 /* 2 * Copyright (C) 2018-20 19Apple Inc. All rights reserved.2 * Copyright (C) 2018-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 33 33 ALWAYS_INLINE void* LocalAllocator::allocate(Heap& heap, GCDeferralContext* deferralContext, AllocationFailureMode failureMode) 34 34 { 35 if (validateDFGDoesGC)35 if constexpr (validateDFGDoesGC) 36 36 heap.verifyCanGC(); 37 37 return m_freeList.allocate( -
trunk/Source/JavaScriptCore/heap/PreciseAllocation.cpp
r262513 r262570 1 1 /* 2 * Copyright (C) 2016-20 19Apple Inc. All rights reserved.2 * Copyright (C) 2016-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 43 43 PreciseAllocation* PreciseAllocation::tryCreate(Heap& heap, size_t size, Subspace* subspace, unsigned indexInSpace) 44 44 { 45 if (validateDFGDoesGC)45 if constexpr (validateDFGDoesGC) 46 46 heap.verifyCanGC(); 47 47 … … 123 123 PreciseAllocation* PreciseAllocation::createForLowerTier(Heap& heap, size_t size, Subspace* subspace, uint8_t lowerTierIndex) 124 124 { 125 if (validateDFGDoesGC)125 if constexpr (validateDFGDoesGC) 126 126 heap.verifyCanGC(); 127 127 -
trunk/Source/JavaScriptCore/runtime/JSString.h
r262513 r262570 733 733 ALWAYS_INLINE JSString* jsSingleCharacterString(VM& vm, UChar c) 734 734 { 735 if (validateDFGDoesGC)735 if constexpr (validateDFGDoesGC) 736 736 vm.heap.verifyCanGC(); 737 737 if (c <= maxSingleCharacterString) … … 763 763 ALWAYS_INLINE AtomString JSString::toAtomString(JSGlobalObject* globalObject) const 764 764 { 765 if (validateDFGDoesGC)765 if constexpr (validateDFGDoesGC) 766 766 vm().heap.verifyCanGC(); 767 767 if (isRope()) … … 772 772 ALWAYS_INLINE RefPtr<AtomStringImpl> JSString::toExistingAtomString(JSGlobalObject* globalObject) const 773 773 { 774 if (validateDFGDoesGC)774 if constexpr (validateDFGDoesGC) 775 775 vm().heap.verifyCanGC(); 776 776 if (isRope()) … … 783 783 inline const String& JSString::value(JSGlobalObject* globalObject) const 784 784 { 785 if (validateDFGDoesGC)785 if constexpr (validateDFGDoesGC) 786 786 vm().heap.verifyCanGC(); 787 787 if (isRope()) … … 793 793 { 794 794 if (allocationAllowed) { 795 if (validateDFGDoesGC)795 if constexpr (validateDFGDoesGC) 796 796 vm().heap.verifyCanGC(); 797 797 if (isRope()) { … … 983 983 ALWAYS_INLINE StringView JSRopeString::unsafeView(JSGlobalObject* globalObject) const 984 984 { 985 if (validateDFGDoesGC)985 if constexpr (validateDFGDoesGC) 986 986 vm().heap.verifyCanGC(); 987 987 if (isSubstring()) { … … 996 996 ALWAYS_INLINE StringViewWithUnderlyingString JSRopeString::viewWithUnderlyingString(JSGlobalObject* globalObject) const 997 997 { 998 if (validateDFGDoesGC)998 if constexpr (validateDFGDoesGC) 999 999 vm().heap.verifyCanGC(); 1000 1000 if (isSubstring()) { … … 1010 1010 ALWAYS_INLINE StringView JSString::unsafeView(JSGlobalObject* globalObject) const 1011 1011 { 1012 if (validateDFGDoesGC)1012 if constexpr (validateDFGDoesGC) 1013 1013 vm().heap.verifyCanGC(); 1014 1014 if (isRope()) -
trunk/Source/JavaScriptCore/runtime/OptionsList.h
r262523 r262570 154 154 v(Bool, useProbeOSRExit, false, Normal, nullptr) \ 155 155 v(Bool, printEachOSRExit, false, Normal, nullptr) \ 156 v(Bool, validateDoesGC, ASSERT_ENABLED, Normal, nullptr) \ 156 157 v(Bool, validateGraph, false, Normal, nullptr) \ 157 158 v(Bool, validateGraphAtEachPhase, false, Normal, nullptr) \ -
trunk/Source/JavaScriptCore/runtime/RegExpMatchesArray.h
r262513 r262570 1 1 /* 2 * Copyright (C) 2008-20 19Apple Inc. All Rights Reserved.2 * Copyright (C) 2008-2020 Apple Inc. All Rights Reserved. 3 3 * 4 4 * This library is free software; you can redistribute it and/or … … 64 64 RegExp* regExp, unsigned startOffset, MatchResult& result) 65 65 { 66 if (validateDFGDoesGC)66 if constexpr (validateDFGDoesGC) 67 67 vm.heap.verifyCanGC(); 68 68
Note:
See TracChangeset
for help on using the changeset viewer.