PNG  IHDR* pHYs+ IDATx]n#; cdLb Ǚ[at¤_:uP}>!Usă cag޿ ֵNu`ݼTâabO7uL&y^wFٝA"l[|ŲHLN밪4*sG3|Dv}?+y߉{OuOAt4Jj.u]Gz*҉sP'VQKbA1u\`& Af;HWj hsO;ogTu uj7S3/QzUr&wS`M$X_L7r2;aE+ώ%vikDA:dR+%KzƉo>eOth$z%: :{WwaQ:wz%4foɹE[9<]#ERINƻv溂E%P1i01 |Jvҗ&{b?9g=^wζXn/lK::90KwrюO\!ջ3uzuGv^;騢wq<Iatv09:tt~hEG`v;3@MNZD.1]L:{ծI3`L(÷ba")Y.iljCɄae#I"1 `3*Bdz>j<fU40⨬%O$3cGt]j%Fߠ_twJ;ABU8vP3uEԑwQ V:h%))LfraqX-ۿX]v-\9I gl8tzX ]ecm)-cgʒ#Uw=Wlێn(0hPP/ӨtQ“&J35 $=]r1{tLuǮ*i0_;NƝ8;-vݏr8+U-kruȕYr0RnC]*ެ(M:]gE;{]tg(#ZJ9y>utRDRMdr9㪩̞zֹb<ģ&wzJM"iI( .ꮅX)Qw:9,i좜\Ԛi7&N0:asϓc];=ΗOӣ APqz93 y $)A*kVHZwBƺnWNaby>XMN*45~ղM6Nvm;A=jֲ.~1}(9`KJ/V F9[=`~[;sRuk]rєT!)iQO)Y$V ی ۤmzWz5IM Zb )ˆC`6 rRa}qNmUfDsWuˤV{ Pݝ'=Kֳbg,UҘVz2ﴻnjNgBb{? ߮tcsͻQuxVCIY۠:(V뺕 ٥2;t`@Fo{Z9`;]wMzU~%UA蛚dI vGq\r82iu +St`cR.6U/M9IENDB`// Copyright 2021 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef INCLUDE_CPPGC_TESTING_H_ #define INCLUDE_CPPGC_TESTING_H_ #include "cppgc/common.h" #include "cppgc/macros.h" #include "v8config.h" // NOLINT(build/include_directory) namespace cppgc { class HeapHandle; /** * Namespace contains testing helpers. */ namespace testing { /** * Overrides the state of the stack with the provided value. Parameters passed * to explicit garbage collection calls still take precedence. Must not be * nested. * * This scope is useful to make the garbage collector consider the stack when * tasks that invoke garbage collection (through the provided platform) contain * interesting pointers on its stack. */ class V8_EXPORT V8_NODISCARD OverrideEmbedderStackStateScope final { CPPGC_STACK_ALLOCATED(); public: /** * Constructs a scoped object that automatically enters and leaves the scope. * * \param heap_handle The corresponding heap. */ explicit OverrideEmbedderStackStateScope(HeapHandle& heap_handle, EmbedderStackState state); ~OverrideEmbedderStackStateScope(); OverrideEmbedderStackStateScope(const OverrideEmbedderStackStateScope&) = delete; OverrideEmbedderStackStateScope& operator=( const OverrideEmbedderStackStateScope&) = delete; private: HeapHandle& heap_handle_; }; /** * Testing interface for managed heaps that allows for controlling garbage * collection timings. Embedders should use this class when testing the * interaction of their code with incremental/concurrent garbage collection. */ class V8_EXPORT StandaloneTestingHeap final { public: explicit StandaloneTestingHeap(HeapHandle&); /** * Start an incremental garbage collection. */ void StartGarbageCollection(); /** * Perform an incremental step. This will also schedule concurrent steps if * needed. * * \param stack_state The state of the stack during the step. */ bool PerformMarkingStep(EmbedderStackState stack_state); /** * Finalize the current garbage collection cycle atomically. * Assumes that garbage collection is in progress. * * \param stack_state The state of the stack for finalizing the garbage * collection cycle. */ void FinalizeGarbageCollection(EmbedderStackState stack_state); /** * Toggle main thread marking on/off. Allows to stress concurrent marking * (e.g. to better detect data races). * * \param should_mark Denotes whether the main thread should contribute to * marking. Defaults to true. */ void ToggleMainThreadMarking(bool should_mark); /** * Force enable compaction for the next garbage collection cycle. */ void ForceCompactionForNextGarbageCollection(); private: HeapHandle& heap_handle_; }; V8_EXPORT bool IsHeapObjectOld(void*); } // namespace testing } // namespace cppgc #endif // INCLUDE_CPPGC_TESTING_H_