Commit 148bf7fc authored by Keishi Hattori's avatar Keishi Hattori Committed by Commit Bot

Cleanup script_regexp_script_state_

ScriptState assumes DisposePerContextData() and DissociateContext() gets called on it before destruction.
This was not happening for ScriptRegexpContext's ScriptState because it was only ever used on the main isolate and so it was never destroyed.
To use it on the worker threads, we need to add cleanup code for it, script_regexp_script_state_.

Bug: 1136219,1105265
Change-Id: Ifde0bf416bd68b15b55fe1dc266e7b6ae57a3432
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2494243
Commit-Queue: Keishi Hattori <keishi@chromium.org>
Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#820851}
parent 93f72e66
......@@ -157,6 +157,8 @@ void V8PerIsolateData::WillBeDestroyed(v8::Isolate* isolate) {
data->profiler_group_ = nullptr;
}
data->ClearScriptRegexpContext();
// Detach V8's garbage collector.
// Need to finalize an already running garbage collection as otherwise
// callbacks are missing and state gets out of sync.
......@@ -320,8 +322,10 @@ v8::Local<v8::Context> V8PerIsolateData::EnsureScriptRegexpContext() {
}
void V8PerIsolateData::ClearScriptRegexpContext() {
if (script_regexp_script_state_)
if (script_regexp_script_state_) {
script_regexp_script_state_->DisposePerContextData();
script_regexp_script_state_->DissociateContext();
}
script_regexp_script_state_ = nullptr;
}
......
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