From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Keeley Hammond Date: Tue, 7 May 2024 15:50:31 -0700 Subject: Revert "[heap] Add checks for ensuring position info slow path is not used in heap snapshot" These two CLs were causing several heap-related tests to fail, and the issue seems to be under construction in future Chrome rolls. This patch can be removed when the issue is fixed upstream. CR Bug: https://issues.chromium.org/issues/42204564 This reverts commit ca51566b53be5507ff184704767c7a9220a68733 and commit 6e70dc9e73af2a930074f4f000864fbc65515b74. diff --git a/src/common/assert-scope.cc b/src/common/assert-scope.cc index 0ea1a04fed062658fa36c239d323e70d0358b57d..1b996b14e490a6fe1b3636f9147728f07cca141f 100644 --- a/src/common/assert-scope.cc +++ b/src/common/assert-scope.cc @@ -108,8 +108,6 @@ template class PerThreadAssertScope; template class PerThreadAssertScope; template class PerThreadAssertScope; template class PerThreadAssertScope; -template class PerThreadAssertScope; -template class PerThreadAssertScope; } // namespace internal } // namespace v8 diff --git a/src/common/assert-scope.h b/src/common/assert-scope.h index 27fbc04bc880f2ea68dc7a126b8091a3b5ab4025..42d9649c5250c06a4d39ba0306cbdea0b0e5a8c3 100644 --- a/src/common/assert-scope.h +++ b/src/common/assert-scope.h @@ -30,7 +30,6 @@ enum PerThreadAssertType { CODE_ALLOCATION_ASSERT, // Dummy type for disabling GC mole. GC_MOLE, - POSITION_INFO_SLOW_ASSERT, }; template @@ -258,14 +257,6 @@ using DisallowGarbageCollection = // work. using DisableGCMole = PerThreadAssertScopeDebugOnly; -// Scope to ensure slow path for obtaining position info is not called -using DisallowPositionInfoSlow = - PerThreadAssertScopeDebugOnly; - -// Scope to add an exception to disallowing position info slow path -using AllowPositionInfoSlow = - PerThreadAssertScopeDebugOnly; - // The DISALLOW_GARBAGE_COLLECTION macro can be used to define a // DisallowGarbageCollection field in classes that isn't present in release // builds. @@ -337,8 +328,6 @@ extern template class PerThreadAssertScope; extern template class PerThreadAssertScope; extern template class PerThreadAssertScope; extern template class PerThreadAssertScope; -extern template class PerThreadAssertScope; -extern template class PerThreadAssertScope; } // namespace internal } // namespace v8 diff --git a/src/objects/objects.cc b/src/objects/objects.cc index a46fd52e924ac7f00f2c9135dc147d7daee153f8..0c75410dc2a20c1243c02da4a67c2b6ad32ea13c 100644 --- a/src/objects/objects.cc +++ b/src/objects/objects.cc @@ -4361,7 +4361,6 @@ namespace { template bool GetPositionInfoSlowImpl(base::Vector source, int position, Script::PositionInfo* info) { - DCHECK(DisallowPositionInfoSlow::IsAllowed()); if (position < 0) { position = 0; } @@ -4408,11 +4407,25 @@ int GetLength(const String::LineEndsVector& vector) { } int GetLength(const Tagged& array) { return array->length(); } +} // namespace + +void Script::AddPositionInfoOffset(PositionInfo* info, + OffsetFlag offset_flag) const { + // Add offsets if requested. + if (offset_flag == OffsetFlag::kWithOffset) { + if (info->line == 0) { + info->column += column_offset(); + } + info->line += line_offset(); + } else { + DCHECK_EQ(offset_flag, OffsetFlag::kNoOffset); + } +} template -bool GetLineEndsContainerPositionInfo(const LineEndsContainer& ends, - int position, Script::PositionInfo* info, - const DisallowGarbageCollection& no_gc) { +bool Script::GetPositionInfoInternal( + const LineEndsContainer& ends, int position, Script::PositionInfo* info, + const DisallowGarbageCollection& no_gc) const { const int ends_len = GetLength(ends); if (ends_len == 0) return false; @@ -4451,31 +4464,6 @@ bool GetLineEndsContainerPositionInfo(const LineEndsContainer& ends, info->column = position - info->line_start; } - return true; -} - -} // namespace - -void Script::AddPositionInfoOffset(PositionInfo* info, - OffsetFlag offset_flag) const { - // Add offsets if requested. - if (offset_flag == OffsetFlag::kWithOffset) { - if (info->line == 0) { - info->column += column_offset(); - } - info->line += line_offset(); - } else { - DCHECK_EQ(offset_flag, OffsetFlag::kNoOffset); - } -} - -template -bool Script::GetPositionInfoInternal( - const LineEndsContainer& ends, int position, Script::PositionInfo* info, - const DisallowGarbageCollection& no_gc) const { - if (!GetLineEndsContainerPositionInfo(ends, position, info, no_gc)) - return false; - // Line end is position of the linebreak character. info->line_end = GetLineEnd(ends, info->line); if (info->line_end > 0) { @@ -4544,23 +4532,6 @@ bool Script::GetPositionInfoWithLineEnds( return true; } -bool Script::GetLineColumnWithLineEnds( - int position, int& line, int& column, - const String::LineEndsVector& line_ends) { - DisallowGarbageCollection no_gc; - PositionInfo info; - if (!GetLineEndsContainerPositionInfo(line_ends, position, &info, no_gc)) { - line = -1; - column = -1; - return false; - } - - line = info.line; - column = info.column; - - return true; -} - int Script::GetColumnNumber(Handle