From fd24007cac2df87aa29bf6ebc8a897702b920533 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Mon, 1 Jul 2019 15:47:49 -0700 Subject: [PATCH] Roll Dart to 67ab3be10d35d994641da167cc806f20a7ffa679 (#9638) This is a reland of #9364 with fixes for Fuchsia. 000cf0560c clean up type_literal_test 0f20911022 Improve type_literal_test a108bef7fb [vm, bytecode] Interpreter support for newer recognized natives. 2a15d38759 Revert "[llvm] Add initial scaffolding" 13b470ac46 Parse error expectations in tests. b71d2d9996 [llvm] Add initial scaffolding 5f2bcd9d6c [vm/bytecode] Reuse flow graph building for recognized methods This includes a breaking change: https://dart-review.googlesource.com/c/sdk/+/105241 ``` Dart_CreateIsolate -> Dart_CreateIsolateGroup Dart_IsolateCreateCallback -> Dart_IsolateGroupCreateCallback Dart_IsolateCleanupCallback -> Dart_IsolateGroupShutdownCallback Dart_CreateIsolateFromKernel -> Dart_CreateIsolateGroupFromKernel Dart_CurrentIsolateData -> Dart_CurrentIsolateGroupData Dart_IsolateData -> Dart_IsolateGroupData Dart_GetNativeIsolateData -> Dart_GetNativeIsolateGroupData Dart_InitializeParams.create -> Dart_InitializeParams.create_group Dart_InitializeParams.cleanup -> Dart_InitializeParams.shutdown_group Dart_InitializeParams.shutdown -> Dart_InitializeParams.shutdown_isolate ``` --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- runtime/dart_isolate.cc | 27 ++++++++++--------- runtime/dart_isolate.h | 13 ++++----- runtime/dart_vm.cc | 13 ++++----- .../fuchsia/dart/dart_component_controller.cc | 7 ++--- shell/platform/fuchsia/dart/dart_runner.cc | 26 +++++++++--------- .../platform/fuchsia/dart/service_isolate.cc | 8 +++--- 8 files changed, 52 insertions(+), 46 deletions(-) diff --git a/DEPS b/DEPS index 678f2696dc935..dd21982391aa3 100644 --- a/DEPS +++ b/DEPS @@ -34,7 +34,7 @@ vars = { # Dart is: https://github.com/dart-lang/sdk/blob/master/DEPS. # You can use //tools/dart/create_updated_flutter_deps.py to produce # updated revision list of existing dependencies. - 'dart_revision': '0abff7b2bb047cc893ea737d95656f9dabfef1e9', + 'dart_revision': '67ab3be10d35d994641da167cc806f20a7ffa679', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 21816ea59843a..d4ba48565cfaa 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 128f33291640edb36f623069120b87d6 +Signature: f1e40299965f80773c3d4983274e6c46 UNUSED LICENSES: diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index e181dd55b940e..b649ca8343820 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -163,7 +163,7 @@ bool DartIsolate::Initialize(Dart_Isolate dart_isolate, bool is_root_isolate) { } auto* isolate_data = static_cast*>( - Dart_IsolateData(dart_isolate)); + Dart_IsolateGroupData(dart_isolate)); if (isolate_data->get() != this) { return false; } @@ -174,7 +174,7 @@ bool DartIsolate::Initialize(Dart_Isolate dart_isolate, bool is_root_isolate) { // We are entering a new scope (for the first time since initialization) and // we want to restore the current scope to null when we exit out of this // method. This balances the implicit Dart_EnterIsolate call made by - // Dart_CreateIsolate (which calls the Initialize). + // Dart_CreateIsolateGroup (which calls the Initialize). Dart_ExitIsolate(); tonic::DartIsolateScope scope(isolate()); @@ -636,8 +636,8 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate( return service_isolate->isolate(); } -// |Dart_IsolateCreateCallback| -Dart_Isolate DartIsolate::DartIsolateCreateCallback( +// |Dart_IsolateGroupCreateCallback| +Dart_Isolate DartIsolate::DartIsolateGroupCreateCallback( const char* advisory_script_uri, const char* advisory_script_entrypoint, const char* package_root, @@ -720,14 +720,16 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( } // Create the Dart VM isolate and give it the embedder object as the baton. - Dart_Isolate isolate = Dart_CreateIsolate( + Dart_Isolate isolate = Dart_CreateIsolateGroup( advisory_script_uri, // advisory_script_entrypoint, // (*embedder_isolate)->GetIsolateSnapshot()->GetDataMapping(), (*embedder_isolate)->GetIsolateSnapshot()->GetInstructionsMapping(), (*embedder_isolate)->GetSharedSnapshot()->GetDataMapping(), (*embedder_isolate)->GetSharedSnapshot()->GetInstructionsMapping(), flags, - embedder_isolate.get(), error); + embedder_isolate.get(), // isolate_group_data + embedder_isolate.get(), // isolate_data + error); if (isolate == nullptr) { FML_DLOG(ERROR) << *error; @@ -770,14 +772,15 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( // |Dart_IsolateShutdownCallback| void DartIsolate::DartIsolateShutdownCallback( - std::shared_ptr* embedder_isolate) { - embedder_isolate->get()->OnShutdownCallback(); + std::shared_ptr* isolate_group_data, + std::shared_ptr* isolate_data) { + isolate_group_data->get()->OnShutdownCallback(); } -// |Dart_IsolateCleanupCallback| -void DartIsolate::DartIsolateCleanupCallback( - std::shared_ptr* embedder_isolate) { - delete embedder_isolate; +// |Dart_IsolateGroupCleanupCallback| +void DartIsolate::DartIsolateGroupCleanupCallback( + std::shared_ptr* isolate_group_data) { + delete isolate_group_data; } fml::RefPtr DartIsolate::GetIsolateSnapshot() const { diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h index 407852dc2a0f1..453810b1bdab3 100644 --- a/runtime/dart_isolate.h +++ b/runtime/dart_isolate.h @@ -156,8 +156,8 @@ class DartIsolate : public UIDartState { void OnShutdownCallback(); - // |Dart_IsolateCreateCallback| - static Dart_Isolate DartIsolateCreateCallback( + // |Dart_IsolateGroupCreateCallback| + static Dart_Isolate DartIsolateGroupCreateCallback( const char* advisory_script_uri, const char* advisory_script_entrypoint, const char* package_root, @@ -186,11 +186,12 @@ class DartIsolate : public UIDartState { // |Dart_IsolateShutdownCallback| static void DartIsolateShutdownCallback( - std::shared_ptr* embedder_isolate); + std::shared_ptr* isolate_group_data, + std::shared_ptr* isolate_data); - // |Dart_IsolateCleanupCallback| - static void DartIsolateCleanupCallback( - std::shared_ptr* embedder_isolate); + // |Dart_IsolateGroupCleanupCallback| + static void DartIsolateGroupCleanupCallback( + std::shared_ptr* isolate_group_data); FML_DISALLOW_COPY_AND_ASSIGN(DartIsolate); }; diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index 903e74b1591f7..555d0c9ee17e2 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -366,12 +366,13 @@ DartVM::DartVM(std::shared_ptr vm_data, params.vm_snapshot_data = vm_data_->GetVMSnapshot().GetDataMapping(); params.vm_snapshot_instructions = vm_data_->GetVMSnapshot().GetInstructionsMapping(); - params.create = reinterpret_cast( - DartIsolate::DartIsolateCreateCallback); - params.shutdown = reinterpret_cast( - DartIsolate::DartIsolateShutdownCallback); - params.cleanup = reinterpret_cast( - DartIsolate::DartIsolateCleanupCallback); + params.create_group = reinterpret_cast( + DartIsolate::DartIsolateGroupCreateCallback); + params.shutdown_isolate = + reinterpret_cast( + DartIsolate::DartIsolateShutdownCallback); + params.cleanup_group = reinterpret_cast( + DartIsolate::DartIsolateGroupCleanupCallback); params.thread_exit = ThreadExitCallback; params.get_service_assets = GetVMServiceAssetsArchiveCallback; params.entropy_source = dart::bin::GetEntropy; diff --git a/shell/platform/fuchsia/dart/dart_component_controller.cc b/shell/platform/fuchsia/dart/dart_component_controller.cc index 1c4f71050594d..c8e7cc5ab7950 100644 --- a/shell/platform/fuchsia/dart/dart_component_controller.cc +++ b/shell/platform/fuchsia/dart/dart_component_controller.cc @@ -324,12 +324,13 @@ bool DartComponentController::CreateIsolate( auto state = new std::shared_ptr(new tonic::DartState( namespace_fd, [this](Dart_Handle result) { MessageEpilogue(result); })); - isolate_ = Dart_CreateIsolate( + isolate_ = Dart_CreateIsolateGroup( url_.c_str(), label_.c_str(), isolate_snapshot_data, isolate_snapshot_instructions, shared_snapshot_data, - shared_snapshot_instructions, nullptr /* flags */, state, &error); + shared_snapshot_instructions, nullptr /* flags */, + state /* isolate_group_data */, state /* isolate_data */, &error); if (!isolate_) { - FX_LOGF(ERROR, LOG_TAG, "Dart_CreateIsolate failed: %s", error); + FX_LOGF(ERROR, LOG_TAG, "Dart_CreateIsolateGroup failed: %s", error); return false; } diff --git a/shell/platform/fuchsia/dart/dart_runner.cc b/shell/platform/fuchsia/dart/dart_runner.cc index 200500d2c90f6..b9ded3ac468ec 100644 --- a/shell/platform/fuchsia/dart/dart_runner.cc +++ b/shell/platform/fuchsia/dart/dart_runner.cc @@ -61,13 +61,13 @@ const char* kDartVMArgs[] = { // clang-format on }; -Dart_Isolate IsolateCreateCallback(const char* uri, - const char* name, - const char* package_root, - const char* package_config, - Dart_IsolateFlags* flags, - void* callback_data, - char** error) { +Dart_Isolate IsolateGroupCreateCallback(const char* uri, + const char* name, + const char* package_root, + const char* package_config, + Dart_IsolateFlags* flags, + void* callback_data, + char** error) { if (std::string(uri) == DART_VM_SERVICE_ISOLATE_NAME) { #if defined(DART_PRODUCT) *error = strdup("The service isolate is not implemented in product mode"); @@ -81,7 +81,7 @@ Dart_Isolate IsolateCreateCallback(const char* uri, return NULL; } -void IsolateShutdownCallback(void* callback_data) { +void IsolateShutdownCallback(void* isolate_group_data, void* isolate_data) { // The service isolate (and maybe later the kernel isolate) doesn't have an // async loop. auto dispatcher = async_get_default_dispatcher(); @@ -92,8 +92,8 @@ void IsolateShutdownCallback(void* callback_data) { } } -void IsolateCleanupCallback(void* callback_data) { - delete static_cast*>(callback_data); +void IsolateGroupCleanupCallback(void* isolate_group_data) { + delete static_cast*>(isolate_group_data); } void RunApplication( @@ -167,9 +167,9 @@ DartRunner::DartRunner() : context_(sys::ComponentContext::Create()) { params.vm_snapshot_data = vm_snapshot_data_.address(); params.vm_snapshot_instructions = vm_snapshot_instructions_.address(); #endif - params.create = IsolateCreateCallback; - params.shutdown = IsolateShutdownCallback; - params.cleanup = IsolateCleanupCallback; + params.create_group = IsolateGroupCreateCallback; + params.shutdown_isolate = IsolateShutdownCallback; + params.cleanup_group = IsolateGroupCleanupCallback; params.entropy_source = EntropySource; #if !defined(DART_PRODUCT) params.get_service_assets = GetVMServiceAssetsArchiveCallback; diff --git a/shell/platform/fuchsia/dart/service_isolate.cc b/shell/platform/fuchsia/dart/service_isolate.cc index 2e6eda2659de4..5287d638f29ab 100644 --- a/shell/platform/fuchsia/dart/service_isolate.cc +++ b/shell/platform/fuchsia/dart/service_isolate.cc @@ -123,14 +123,14 @@ Dart_Isolate CreateServiceIsolate(const char* uri, #endif auto state = new std::shared_ptr(new tonic::DartState()); - Dart_Isolate isolate = Dart_CreateIsolate( + Dart_Isolate isolate = Dart_CreateIsolateGroup( uri, DART_VM_SERVICE_ISOLATE_NAME, mapped_isolate_snapshot_data.address(), mapped_isolate_snapshot_instructions.address(), mapped_shared_snapshot_data.address(), - mapped_shared_snapshot_instructions.address(), nullptr /* flags */, state, - error); + mapped_shared_snapshot_instructions.address(), nullptr /* flags */, + state /* isolate_group_data */, state /* isolate_data */, error); if (!isolate) { - FX_LOGF(ERROR, LOG_TAG, "Dart_CreateIsolate failed: %s", *error); + FX_LOGF(ERROR, LOG_TAG, "Dart_CreateIsolateGroup failed: %s", *error); return nullptr; }