Commit 2ff27b46 authored by Camillo Bruni's avatar Camillo Bruni Committed by V8 LUCI CQ

[profiler] Minor CollectSourcePositionsForAllBytecodeArrays improvement

Skip over SFIs that already have source position available.

Bug: v8:7790
Change-Id: Iaea51fe1e4cec9e3291a258a1c60b2354afa8525
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3074239Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#76112}
parent fffcbaea
......@@ -4816,14 +4816,12 @@ void Isolate::CollectSourcePositionsForAllBytecodeArrays() {
HeapObjectIterator iterator(heap());
for (HeapObject obj = iterator.Next(); !obj.is_null();
obj = iterator.Next()) {
if (obj.IsSharedFunctionInfo()) {
if (!obj.IsSharedFunctionInfo()) continue;
SharedFunctionInfo sfi = SharedFunctionInfo::cast(obj);
if (sfi.HasBytecodeArray()) {
if (!sfi.CanCollectSourcePosition(this)) continue;
sfis.push_back(Handle<SharedFunctionInfo>(sfi, this));
}
}
}
}
for (auto sfi : sfis) {
SharedFunctionInfo::EnsureSourcePositionsAvailable(this, sfi);
}
......
......@@ -502,6 +502,11 @@ bool SharedFunctionInfo::has_simple_parameters() {
return scope_info(kAcquireLoad).HasSimpleParameters();
}
bool SharedFunctionInfo::CanCollectSourcePosition(Isolate* isolate) {
return FLAG_enable_lazy_source_positions && HasBytecodeArray() &&
!GetBytecodeArray(isolate).HasSourcePositionTable();
}
bool SharedFunctionInfo::IsApiFunction() const {
return function_data(kAcquireLoad).IsFunctionTemplateInfo();
}
......
......@@ -670,8 +670,7 @@ void SharedFunctionInfo::SetPosition(int start_position, int end_position) {
// static
void SharedFunctionInfo::EnsureSourcePositionsAvailable(
Isolate* isolate, Handle<SharedFunctionInfo> shared_info) {
if (FLAG_enable_lazy_source_positions && shared_info->HasBytecodeArray() &&
!shared_info->GetBytecodeArray(isolate).HasSourcePositionTable()) {
if (shared_info->CanCollectSourcePosition(isolate)) {
Compiler::CollectSourcePositions(isolate, shared_info);
}
}
......
......@@ -572,6 +572,7 @@ class SharedFunctionInfo
void SetFunctionTokenPosition(int function_token_position,
int start_position);
inline bool CanCollectSourcePosition(Isolate* isolate);
static void EnsureSourcePositionsAvailable(
Isolate* isolate, Handle<SharedFunctionInfo> shared_info);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment