Commit b3aefb32 authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[explicit isolates] Delete last GetIsolate in parsing

Pass Isolate to ConsumedPreParsedScopeData::SetData (guaranteed to be
called on main thread) and use it to create the handle in
ConsumedPreParsedScopeData::GetDataForSkippableFunction, rather than
calling GetIsolate.

Bug: v8:7786
Change-Id: Ibd632bb57f35a921f37c620d77dd6dfdb1f092c6
Reviewed-on: https://chromium-review.googlesource.com/1088703
Commit-Queue: Dan Elphick <delphick@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54138}
parent 7b3ad00a
...@@ -1095,7 +1095,7 @@ bool Compiler::Compile(Handle<SharedFunctionInfo> shared_info, ...@@ -1095,7 +1095,7 @@ bool Compiler::Compile(Handle<SharedFunctionInfo> shared_info,
Handle<PreParsedScopeData> data( Handle<PreParsedScopeData> data(
PreParsedScopeData::cast(shared_info->preparsed_scope_data()), PreParsedScopeData::cast(shared_info->preparsed_scope_data()),
isolate); isolate);
parse_info.consumed_preparsed_scope_data()->SetData(data); parse_info.consumed_preparsed_scope_data()->SetData(isolate, data);
// After we've compiled the function, we don't need data about its // After we've compiled the function, we don't need data about its
// skippable functions any more. // skippable functions any more.
shared_info->ClearPreParsedScopeData(); shared_info->ClearPreParsedScopeData();
......
...@@ -481,12 +481,15 @@ uint8_t ConsumedPreParsedScopeData::ByteData::ReadQuarter() { ...@@ -481,12 +481,15 @@ uint8_t ConsumedPreParsedScopeData::ByteData::ReadQuarter() {
} }
ConsumedPreParsedScopeData::ConsumedPreParsedScopeData() ConsumedPreParsedScopeData::ConsumedPreParsedScopeData()
: scope_data_(new ByteData()), child_index_(0) {} : isolate_(nullptr), scope_data_(new ByteData()), child_index_(0) {}
ConsumedPreParsedScopeData::~ConsumedPreParsedScopeData() {} ConsumedPreParsedScopeData::~ConsumedPreParsedScopeData() {}
void ConsumedPreParsedScopeData::SetData(Handle<PreParsedScopeData> data) { void ConsumedPreParsedScopeData::SetData(Isolate* isolate,
Handle<PreParsedScopeData> data) {
DCHECK_NOT_NULL(isolate);
DCHECK(data->IsPreParsedScopeData()); DCHECK(data->IsPreParsedScopeData());
isolate_ = isolate;
data_ = data; data_ = data;
#ifdef DEBUG #ifdef DEBUG
ByteData::ReadingScope reading_scope(this); ByteData::ReadingScope reading_scope(this);
...@@ -529,8 +532,7 @@ ConsumedPreParsedScopeData::GetDataForSkippableFunction( ...@@ -529,8 +532,7 @@ ConsumedPreParsedScopeData::GetDataForSkippableFunction(
return nullptr; return nullptr;
} }
Handle<PreParsedScopeData> child_data_handle( Handle<PreParsedScopeData> child_data_handle(
PreParsedScopeData::cast(child_data), PreParsedScopeData::cast(child_data), isolate_);
PreParsedScopeData::cast(child_data)->GetIsolate());
return new (zone) ProducedPreParsedScopeData(child_data_handle, zone); return new (zone) ProducedPreParsedScopeData(child_data_handle, zone);
} }
......
...@@ -225,7 +225,7 @@ class ConsumedPreParsedScopeData { ...@@ -225,7 +225,7 @@ class ConsumedPreParsedScopeData {
ConsumedPreParsedScopeData(); ConsumedPreParsedScopeData();
~ConsumedPreParsedScopeData(); ~ConsumedPreParsedScopeData();
void SetData(Handle<PreParsedScopeData> data); void SetData(Isolate* isolate, Handle<PreParsedScopeData> data);
bool HasData() const { return !data_.is_null(); } bool HasData() const { return !data_.is_null(); }
...@@ -243,6 +243,7 @@ class ConsumedPreParsedScopeData { ...@@ -243,6 +243,7 @@ class ConsumedPreParsedScopeData {
void RestoreDataForVariable(Variable* var); void RestoreDataForVariable(Variable* var);
void RestoreDataForInnerScopes(Scope* scope); void RestoreDataForInnerScopes(Scope* scope);
Isolate* isolate_;
Handle<PreParsedScopeData> data_; Handle<PreParsedScopeData> data_;
std::unique_ptr<ByteData> scope_data_; std::unique_ptr<ByteData> scope_data_;
// When consuming the data, these indexes point to the data we're going to // When consuming the data, these indexes point to the data we're going to
......
...@@ -746,7 +746,7 @@ TEST(PreParserScopeAnalysis) { ...@@ -746,7 +746,7 @@ TEST(PreParserScopeAnalysis) {
i::ParseInfo using_scope_data(isolate, shared); i::ParseInfo using_scope_data(isolate, shared);
using_scope_data.set_lazy_compile(); using_scope_data.set_lazy_compile();
using_scope_data.consumed_preparsed_scope_data()->SetData( using_scope_data.consumed_preparsed_scope_data()->SetData(
produced_data_on_heap); isolate, produced_data_on_heap);
CHECK(i::parsing::ParseFunction(&using_scope_data, shared, isolate)); CHECK(i::parsing::ParseFunction(&using_scope_data, shared, isolate));
// Verify that we skipped at least one function inside that scope. // Verify that we skipped at least one function inside that scope.
......
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