Commit bcd85d34 authored by Dominik Inführ's avatar Dominik Inführ Committed by Commit Bot

Reset last_stack_frame_info_id to 0 when reaching kSmiMaxValue

Avoid crash when id isn't a valid Smi value anymore.

Bug: v8:10543
Change-Id: Id1be497cf5b8e8c01b97cc5d76f38f73927c6cea
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2214831Reviewed-by: 's avatarSimon Zünd <szuend@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68066}
parent 8877b268
......@@ -4204,6 +4204,13 @@ void Isolate::CountUsage(v8::Isolate::UseCounterFeature feature) {
int Isolate::GetNextScriptId() { return heap()->NextScriptId(); }
int Isolate::GetNextStackFrameInfoId() {
int id = last_stack_frame_info_id();
int next_id = id == Smi::kMaxValue ? 0 : (id + 1);
set_last_stack_frame_info_id(next_id);
return next_id;
}
// static
std::string Isolate::GetTurboCfgFileName(Isolate* isolate) {
if (FLAG_trace_turbo_cfg_file == nullptr) {
......
......@@ -1293,6 +1293,8 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
int GetNextScriptId();
int GetNextStackFrameInfoId();
#if V8_SFI_HAS_UNIQUE_ID
int GetNextUniqueSharedFunctionInfoId() {
int current_id = next_unique_sfi_id_.load(std::memory_order_relaxed);
......
......@@ -3125,9 +3125,7 @@ Handle<StackTraceFrame> Factory::NewStackTraceFrame(
frame->set_frame_index(index);
frame->set_frame_info(*undefined_value());
int id = isolate()->last_stack_frame_info_id() + 1;
isolate()->set_last_stack_frame_info_id(id);
frame->set_id(id);
frame->set_id(isolate()->GetNextStackFrameInfoId());
return frame;
}
......
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