@@ -749,8 +749,7 @@ class GlobalHandles::OnStackTracedNodeSpace final {
749749
750750 void SetStackStart (void * stack_start) {
751751 CHECK (on_stack_nodes_.empty ());
752- stack_start_ =
753- GetRealStackAddressForSlot (reinterpret_cast <uintptr_t >(stack_start));
752+ stack_start_ = base::Stack::GetRealStackAddressForSlot (stack_start);
754753 }
755754
756755 V8_INLINE bool IsOnStack (uintptr_t slot) const ;
@@ -770,10 +769,6 @@ class GlobalHandles::OnStackTracedNodeSpace final {
770769 GlobalHandles* global_handles;
771770 };
772771
773- // Returns the real stack frame if slot is part of a fake frame, and slot
774- // otherwise.
775- V8_INLINE uintptr_t GetRealStackAddressForSlot (uintptr_t slot) const ;
776-
777772 // Keeps track of registered handles. The data structure is cleaned on
778773 // iteration and when adding new references using the current stack address.
779774 // Cleaning is based on current stack address and the key of the map which is
@@ -795,17 +790,6 @@ class GlobalHandles::OnStackTracedNodeSpace final {
795790 size_t acquire_count_ = 0 ;
796791};
797792
798- uintptr_t GlobalHandles::OnStackTracedNodeSpace::GetRealStackAddressForSlot (
799- uintptr_t slot) const {
800- #ifdef V8_USE_ADDRESS_SANITIZER
801- void * real_frame = __asan_addr_is_in_fake_stack (
802- __asan_get_current_fake_stack (), reinterpret_cast <void *>(slot), nullptr ,
803- nullptr );
804- return real_frame ? reinterpret_cast <uintptr_t >(real_frame) : slot;
805- #endif // V8_USE_ADDRESS_SANITIZER
806- return slot;
807- }
808-
809793bool GlobalHandles::OnStackTracedNodeSpace::IsOnStack (uintptr_t slot) const {
810794#ifdef V8_USE_ADDRESS_SANITIZER
811795 if (__asan_addr_is_in_fake_stack (__asan_get_current_fake_stack (),
@@ -814,7 +798,7 @@ bool GlobalHandles::OnStackTracedNodeSpace::IsOnStack(uintptr_t slot) const {
814798 return true ;
815799 }
816800#endif // V8_USE_ADDRESS_SANITIZER
817- return stack_start_ >= slot && slot > GetCurrentStackPosition ();
801+ return stack_start_ >= slot && slot > base::Stack:: GetCurrentStackPosition ();
818802}
819803
820804void GlobalHandles::OnStackTracedNodeSpace::NotifyEmptyEmbedderStack () {
@@ -858,12 +842,13 @@ GlobalHandles::TracedNode* GlobalHandles::OnStackTracedNodeSpace::Acquire(
858842 entry.node .Free (nullptr );
859843 entry.global_handles = global_handles_;
860844#ifdef V8_USE_ADDRESS_SANITIZER
861- auto pair = on_stack_nodes_.insert ({GetRealStackAddressForSlot (slot), {}});
845+ auto pair = on_stack_nodes_.insert (
846+ {base::Stack::GetRealStackAddressForSlot (slot), {}});
862847 pair.first ->second .push_back (std::move (entry));
863848 TracedNode* result = &(pair.first ->second .back ().node );
864849#else // !V8_USE_ADDRESS_SANITIZER
865850 auto pair = on_stack_nodes_.insert (
866- {GetRealStackAddressForSlot (slot), std::move (entry)});
851+ {base::Stack:: GetRealStackAddressForSlot (slot), std::move (entry)});
867852 if (!pair.second ) {
868853 // Insertion failed because there already was an entry present for that
869854 // stack address. This can happen because cleanup is conservative in which
@@ -880,7 +865,8 @@ GlobalHandles::TracedNode* GlobalHandles::OnStackTracedNodeSpace::Acquire(
880865
881866void GlobalHandles::OnStackTracedNodeSpace::CleanupBelowCurrentStackPosition () {
882867 if (on_stack_nodes_.empty ()) return ;
883- const auto it = on_stack_nodes_.upper_bound (GetCurrentStackPosition ());
868+ const auto it =
869+ on_stack_nodes_.upper_bound (base::Stack::GetCurrentStackPosition ());
884870 on_stack_nodes_.erase (on_stack_nodes_.begin (), it);
885871}
886872
0 commit comments