[compiler] Support background finalization for Modules
Bug: chromium:1011762, chromium:1061857 Change-Id: I2b2661023215b7b2d05067e6f9fb894ad6274acd Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2617084 Commit-Queue: Camillo Bruni <cbruni@chromium.org> Reviewed-by: Leszek Swirski <leszeks@chromium.org> Cr-Commit-Position: refs/heads/master@{#75600}
This commit is contained in:
parent
97a6c014ef
commit
2f50d30f57
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "src/ast/ast-value-factory.h"
|
#include "src/ast/ast-value-factory.h"
|
||||||
#include "src/ast/scopes.h"
|
#include "src/ast/scopes.h"
|
||||||
|
#include "src/common/globals.h"
|
||||||
#include "src/heap/local-factory-inl.h"
|
#include "src/heap/local-factory-inl.h"
|
||||||
#include "src/objects/module-inl.h"
|
#include "src/objects/module-inl.h"
|
||||||
#include "src/objects/objects-inl.h"
|
#include "src/objects/objects-inl.h"
|
||||||
@ -130,8 +131,10 @@ Handle<ModuleRequest> SourceTextModuleDescriptor::AstModuleRequest::Serialize(
|
|||||||
// The import assertions will be stored in this array in the form:
|
// The import assertions will be stored in this array in the form:
|
||||||
// [key1, value1, location1, key2, value2, location2, ...]
|
// [key1, value1, location1, key2, value2, location2, ...]
|
||||||
Handle<FixedArray> import_assertions_array =
|
Handle<FixedArray> import_assertions_array =
|
||||||
isolate->factory()->NewFixedArray(static_cast<int>(
|
isolate->factory()->NewFixedArray(
|
||||||
import_assertions()->size() * ModuleRequest::kAssertionEntrySize));
|
static_cast<int>(import_assertions()->size() *
|
||||||
|
ModuleRequest::kAssertionEntrySize),
|
||||||
|
AllocationType::kOld);
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (auto iter = import_assertions()->cbegin();
|
for (auto iter = import_assertions()->cbegin();
|
||||||
@ -189,7 +192,8 @@ Handle<FixedArray> SourceTextModuleDescriptor::SerializeRegularExports(
|
|||||||
++count;
|
++count;
|
||||||
} while (next != regular_exports_.end() && next->first == it->first);
|
} while (next != regular_exports_.end() && next->first == it->first);
|
||||||
|
|
||||||
Handle<FixedArray> export_names = isolate->factory()->NewFixedArray(count);
|
Handle<FixedArray> export_names =
|
||||||
|
isolate->factory()->NewFixedArray(count, AllocationType::kOld);
|
||||||
data[index + SourceTextModuleInfo::kRegularExportLocalNameOffset] =
|
data[index + SourceTextModuleInfo::kRegularExportLocalNameOffset] =
|
||||||
it->second->local_name->string();
|
it->second->local_name->string();
|
||||||
data[index + SourceTextModuleInfo::kRegularExportCellIndexOffset] =
|
data[index + SourceTextModuleInfo::kRegularExportCellIndexOffset] =
|
||||||
@ -213,7 +217,8 @@ Handle<FixedArray> SourceTextModuleDescriptor::SerializeRegularExports(
|
|||||||
|
|
||||||
// We cannot create the FixedArray earlier because we only now know the
|
// We cannot create the FixedArray earlier because we only now know the
|
||||||
// precise size.
|
// precise size.
|
||||||
Handle<FixedArray> result = isolate->factory()->NewFixedArray(index);
|
Handle<FixedArray> result =
|
||||||
|
isolate->factory()->NewFixedArray(index, AllocationType::kOld);
|
||||||
for (int i = 0; i < index; ++i) {
|
for (int i = 0; i < index; ++i) {
|
||||||
result->set(i, *data[i]);
|
result->set(i, *data[i]);
|
||||||
}
|
}
|
||||||
|
@ -1609,7 +1609,7 @@ void BackgroundCompileTask::Run() {
|
|||||||
// Save the language mode.
|
// Save the language mode.
|
||||||
language_mode_ = info_->language_mode();
|
language_mode_ = info_->language_mode();
|
||||||
|
|
||||||
if (!FLAG_finalize_streaming_on_background || info_->flags().is_module()) {
|
if (!FLAG_finalize_streaming_on_background) {
|
||||||
if (info_->literal() != nullptr) {
|
if (info_->literal() != nullptr) {
|
||||||
CompileOnBackgroundThread(info_.get(), compile_state_.allocator(),
|
CompileOnBackgroundThread(info_.get(), compile_state_.allocator(),
|
||||||
&compilation_jobs_);
|
&compilation_jobs_);
|
||||||
@ -3034,7 +3034,7 @@ Compiler::GetSharedFunctionInfoForStreamedScript(
|
|||||||
DCHECK_EQ(task->flags().is_module(), origin_options.IsModule());
|
DCHECK_EQ(task->flags().is_module(), origin_options.IsModule());
|
||||||
|
|
||||||
Handle<Script> script;
|
Handle<Script> script;
|
||||||
if (FLAG_finalize_streaming_on_background && !origin_options.IsModule()) {
|
if (FLAG_finalize_streaming_on_background) {
|
||||||
RCS_SCOPE(isolate,
|
RCS_SCOPE(isolate,
|
||||||
RuntimeCallCounterId::kCompilePublishBackgroundFinalization);
|
RuntimeCallCounterId::kCompilePublishBackgroundFinalization);
|
||||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
|
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
|
||||||
|
@ -1127,7 +1127,8 @@ Handle<SourceTextModuleInfo> SourceTextModuleInfo::New(
|
|||||||
IsolateT* isolate, Zone* zone, SourceTextModuleDescriptor* descr) {
|
IsolateT* isolate, Zone* zone, SourceTextModuleDescriptor* descr) {
|
||||||
// Serialize module requests.
|
// Serialize module requests.
|
||||||
int size = static_cast<int>(descr->module_requests().size());
|
int size = static_cast<int>(descr->module_requests().size());
|
||||||
Handle<FixedArray> module_requests = isolate->factory()->NewFixedArray(size);
|
Handle<FixedArray> module_requests =
|
||||||
|
isolate->factory()->NewFixedArray(size, AllocationType::kOld);
|
||||||
for (const auto& elem : descr->module_requests()) {
|
for (const auto& elem : descr->module_requests()) {
|
||||||
Handle<ModuleRequest> serialized_module_request = elem->Serialize(isolate);
|
Handle<ModuleRequest> serialized_module_request = elem->Serialize(isolate);
|
||||||
module_requests->set(elem->index(), *serialized_module_request);
|
module_requests->set(elem->index(), *serialized_module_request);
|
||||||
@ -1135,7 +1136,7 @@ Handle<SourceTextModuleInfo> SourceTextModuleInfo::New(
|
|||||||
|
|
||||||
// Serialize special exports.
|
// Serialize special exports.
|
||||||
Handle<FixedArray> special_exports = isolate->factory()->NewFixedArray(
|
Handle<FixedArray> special_exports = isolate->factory()->NewFixedArray(
|
||||||
static_cast<int>(descr->special_exports().size()));
|
static_cast<int>(descr->special_exports().size()), AllocationType::kOld);
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (auto entry : descr->special_exports()) {
|
for (auto entry : descr->special_exports()) {
|
||||||
@ -1147,7 +1148,8 @@ Handle<SourceTextModuleInfo> SourceTextModuleInfo::New(
|
|||||||
|
|
||||||
// Serialize namespace imports.
|
// Serialize namespace imports.
|
||||||
Handle<FixedArray> namespace_imports = isolate->factory()->NewFixedArray(
|
Handle<FixedArray> namespace_imports = isolate->factory()->NewFixedArray(
|
||||||
static_cast<int>(descr->namespace_imports().size()));
|
static_cast<int>(descr->namespace_imports().size()),
|
||||||
|
AllocationType::kOld);
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (auto entry : descr->namespace_imports()) {
|
for (auto entry : descr->namespace_imports()) {
|
||||||
@ -1163,7 +1165,7 @@ Handle<SourceTextModuleInfo> SourceTextModuleInfo::New(
|
|||||||
|
|
||||||
// Serialize regular imports.
|
// Serialize regular imports.
|
||||||
Handle<FixedArray> regular_imports = isolate->factory()->NewFixedArray(
|
Handle<FixedArray> regular_imports = isolate->factory()->NewFixedArray(
|
||||||
static_cast<int>(descr->regular_imports().size()));
|
static_cast<int>(descr->regular_imports().size()), AllocationType::kOld);
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (const auto& elem : descr->regular_imports()) {
|
for (const auto& elem : descr->regular_imports()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user