Commit ddcdbf6f authored by Wiktor Garbacz's avatar Wiktor Garbacz Committed by Commit Bot

Completely remove isolate from parse_info

A step towards removing isolate from ParseInfo.
Removing isolate from ParseInfo will make it easier to create and
execute parse tasks on background threads.

BUG=v8:6093

Change-Id: Ic189610a943251b6b0cbd316afbf422c0da7a4cd
Reviewed-on: https://chromium-review.googlesource.com/458007
Commit-Queue: Wiktor Garbacz <wiktorg@google.com>
Reviewed-by: 's avatarDaniel Vogelheim <vogelheim@chromium.org>
Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44178}
parent bc39a514
...@@ -29,9 +29,9 @@ BackgroundParsingTask::BackgroundParsingTask( ...@@ -29,9 +29,9 @@ BackgroundParsingTask::BackgroundParsingTask(
// Prepare the data for the internalization phase and compilation phase, which // Prepare the data for the internalization phase and compilation phase, which
// will happen in the main thread after parsing. // will happen in the main thread after parsing.
ParseInfo* info = new ParseInfo(isolate->allocator()); ParseInfo* info = new ParseInfo(isolate->allocator());
info->InitFromIsolate(isolate);
info->set_toplevel(); info->set_toplevel();
source->info.reset(info); source->info.reset(info);
info->set_isolate(isolate);
info->set_source_stream(source->source_stream.get()); info->set_source_stream(source->source_stream.get());
info->set_source_stream_encoding(source->encoding); info->set_source_stream_encoding(source->encoding);
info->set_unicode_cache(&source_->unicode_cache); info->set_unicode_cache(&source_->unicode_cache);
...@@ -57,11 +57,6 @@ void BackgroundParsingTask::Run() { ...@@ -57,11 +57,6 @@ void BackgroundParsingTask::Run() {
uintptr_t stack_limit = GetCurrentStackPosition() - stack_size_ * KB; uintptr_t stack_limit = GetCurrentStackPosition() - stack_size_ * KB;
source_->parser->set_stack_limit(stack_limit); source_->parser->set_stack_limit(stack_limit);
// Nullify the Isolate temporarily so that the background parser doesn't
// accidentally use it.
Isolate* isolate = source_->info->isolate();
source_->info->set_isolate(nullptr);
source_->parser->ParseOnBackground(source_->info.get()); source_->parser->ParseOnBackground(source_->info.get());
if (script_data_ != nullptr) { if (script_data_ != nullptr) {
...@@ -72,7 +67,6 @@ void BackgroundParsingTask::Run() { ...@@ -72,7 +67,6 @@ void BackgroundParsingTask::Run() {
delete script_data_; delete script_data_;
script_data_ = nullptr; script_data_ = nullptr;
} }
source_->info->set_isolate(isolate);
} }
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
...@@ -206,7 +206,7 @@ void CompilerDispatcherJob::PrepareToParseOnMainThread() { ...@@ -206,7 +206,7 @@ void CompilerDispatcherJob::PrepareToParseOnMainThread() {
ScannerStream::For(wrapper_, shared_->start_position() - offset, ScannerStream::For(wrapper_, shared_->start_position() - offset,
shared_->end_position() - offset)); shared_->end_position() - offset));
} }
parse_info_->set_isolate(isolate_); parse_info_->InitFromIsolate(isolate_);
parse_info_->set_character_stream(character_stream_.get()); parse_info_->set_character_stream(character_stream_.get());
parse_info_->set_hash_seed(isolate_->heap()->HashSeed()); parse_info_->set_hash_seed(isolate_->heap()->HashSeed());
parse_info_->set_is_named_expression(shared_->is_named_expression()); parse_info_->set_is_named_expression(shared_->is_named_expression());
...@@ -244,17 +244,11 @@ void CompilerDispatcherJob::Parse() { ...@@ -244,17 +244,11 @@ void CompilerDispatcherJob::Parse() {
DisallowHandleAllocation no_handles; DisallowHandleAllocation no_handles;
DisallowHandleDereference no_deref; DisallowHandleDereference no_deref;
// Nullify the Isolate temporarily so that the parser doesn't accidentally
// use it.
parse_info_->set_isolate(nullptr);
uintptr_t stack_limit = GetCurrentStackPosition() - max_stack_size_ * KB; uintptr_t stack_limit = GetCurrentStackPosition() - max_stack_size_ * KB;
parser_->set_stack_limit(stack_limit); parser_->set_stack_limit(stack_limit);
parser_->ParseOnBackground(parse_info_.get()); parser_->ParseOnBackground(parse_info_.get());
parse_info_->set_isolate(isolate_);
status_ = CompileJobStatus::kParsed; status_ = CompileJobStatus::kParsed;
} }
......
...@@ -34,7 +34,6 @@ ParseInfo::ParseInfo(AccountingAllocator* zone_allocator) ...@@ -34,7 +34,6 @@ ParseInfo::ParseInfo(AccountingAllocator* zone_allocator)
parameters_end_pos_(kNoSourcePosition), parameters_end_pos_(kNoSourcePosition),
function_literal_id_(FunctionLiteral::kIdTypeInvalid), function_literal_id_(FunctionLiteral::kIdTypeInvalid),
max_function_literal_id_(FunctionLiteral::kIdTypeInvalid), max_function_literal_id_(FunctionLiteral::kIdTypeInvalid),
isolate_(nullptr),
cached_data_(nullptr), cached_data_(nullptr),
ast_value_factory_(nullptr), ast_value_factory_(nullptr),
ast_string_constants_(nullptr), ast_string_constants_(nullptr),
...@@ -46,8 +45,8 @@ ParseInfo::ParseInfo(AccountingAllocator* zone_allocator) ...@@ -46,8 +45,8 @@ ParseInfo::ParseInfo(AccountingAllocator* zone_allocator)
ParseInfo::ParseInfo(Handle<SharedFunctionInfo> shared) ParseInfo::ParseInfo(Handle<SharedFunctionInfo> shared)
: ParseInfo(shared->GetIsolate()->allocator()) { : ParseInfo(shared->GetIsolate()->allocator()) {
Isolate* isolate = shared->GetIsolate(); Isolate* isolate = shared->GetIsolate();
InitFromIsolate(isolate);
set_isolate(isolate);
set_toplevel(shared->is_toplevel()); set_toplevel(shared->is_toplevel());
set_allow_lazy_parsing(FLAG_lazy_inner_functions); set_allow_lazy_parsing(FLAG_lazy_inner_functions);
set_is_named_expression(shared->is_named_expression()); set_is_named_expression(shared->is_named_expression());
...@@ -81,7 +80,8 @@ ParseInfo::ParseInfo(Handle<SharedFunctionInfo> shared, ...@@ -81,7 +80,8 @@ ParseInfo::ParseInfo(Handle<SharedFunctionInfo> shared,
ParseInfo::ParseInfo(Handle<Script> script) ParseInfo::ParseInfo(Handle<Script> script)
: ParseInfo(script->GetIsolate()->allocator()) { : ParseInfo(script->GetIsolate()->allocator()) {
set_isolate(script->GetIsolate()); InitFromIsolate(script->GetIsolate());
set_allow_lazy_parsing(); set_allow_lazy_parsing();
set_toplevel(); set_toplevel();
set_script(script); set_script(script);
...@@ -103,7 +103,7 @@ ParseInfo* ParseInfo::AllocateWithoutScript(Handle<SharedFunctionInfo> shared) { ...@@ -103,7 +103,7 @@ ParseInfo* ParseInfo::AllocateWithoutScript(Handle<SharedFunctionInfo> shared) {
Isolate* isolate = shared->GetIsolate(); Isolate* isolate = shared->GetIsolate();
ParseInfo* p = new ParseInfo(isolate->allocator()); ParseInfo* p = new ParseInfo(isolate->allocator());
p->set_isolate(isolate); p->InitFromIsolate(isolate);
p->set_toplevel(shared->is_toplevel()); p->set_toplevel(shared->is_toplevel());
p->set_allow_lazy_parsing(FLAG_lazy_inner_functions); p->set_allow_lazy_parsing(FLAG_lazy_inner_functions);
p->set_is_named_expression(shared->is_named_expression()); p->set_is_named_expression(shared->is_named_expression());
......
...@@ -211,19 +211,12 @@ class V8_EXPORT_PRIVATE ParseInfo { ...@@ -211,19 +211,12 @@ class V8_EXPORT_PRIVATE ParseInfo {
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
// TODO(titzer): these should not be part of ParseInfo. // TODO(titzer): these should not be part of ParseInfo.
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
Isolate* isolate() const { return isolate_; }
Handle<SharedFunctionInfo> shared_info() const { return shared_; } Handle<SharedFunctionInfo> shared_info() const { return shared_; }
Handle<Script> script() const { return script_; } Handle<Script> script() const { return script_; }
MaybeHandle<ScopeInfo> maybe_outer_scope_info() const { MaybeHandle<ScopeInfo> maybe_outer_scope_info() const {
return maybe_outer_scope_info_; return maybe_outer_scope_info_;
} }
void clear_script() { script_ = Handle<Script>::null(); } void clear_script() { script_ = Handle<Script>::null(); }
void set_isolate(Isolate* isolate) {
if (isolate) {
InitFromIsolate(isolate);
}
isolate_ = isolate;
}
void set_shared_info(Handle<SharedFunctionInfo> shared) { shared_ = shared; } void set_shared_info(Handle<SharedFunctionInfo> shared) { shared_ = shared; }
void set_outer_scope_info(Handle<ScopeInfo> outer_scope_info) { void set_outer_scope_info(Handle<ScopeInfo> outer_scope_info) {
maybe_outer_scope_info_ = outer_scope_info; maybe_outer_scope_info_ = outer_scope_info;
...@@ -297,8 +290,7 @@ class V8_EXPORT_PRIVATE ParseInfo { ...@@ -297,8 +290,7 @@ class V8_EXPORT_PRIVATE ParseInfo {
int function_literal_id_; int function_literal_id_;
int max_function_literal_id_; int max_function_literal_id_;
// TODO(titzer): Move handles and isolate out of ParseInfo. // TODO(titzer): Move handles out of ParseInfo.
Isolate* isolate_;
Handle<SharedFunctionInfo> shared_; Handle<SharedFunctionInfo> shared_;
Handle<Script> script_; Handle<Script> script_;
MaybeHandle<ScopeInfo> maybe_outer_scope_info_; MaybeHandle<ScopeInfo> maybe_outer_scope_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