Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2692)

Unified Diff: runtime/vm/service_isolate.cc

Issue 1312813006: - Remove deprecated StackZone constructor with Isolate parameter. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/service_isolate.cc
diff --git a/runtime/vm/service_isolate.cc b/runtime/vm/service_isolate.cc
index 3e0358638dd86d267d51f39ce54ca9142c68f597..2068e4027192c70536171c32266089a9b34bcd5d 100644
--- a/runtime/vm/service_isolate.cc
+++ b/runtime/vm/service_isolate.cc
@@ -22,6 +22,9 @@
namespace dart {
+#define Z (T->zone())
+
+
DEFINE_FLAG(bool, trace_service, false, "Trace VM service requests.");
DEFINE_FLAG(bool, trace_service_pause_events, false,
"Trace VM service isolate pause events.");
@@ -526,12 +529,12 @@ void ServiceIsolate::SetLoadPort(Dart_Port port) {
}
-void ServiceIsolate::MaybeInjectVMServiceLibrary(Isolate* isolate) {
- Thread* thread = Thread::Current();
- ASSERT(isolate == thread->isolate());
- ASSERT(isolate != NULL);
- ASSERT(isolate->name() != NULL);
- if (!ServiceIsolate::NameEquals(isolate->name())) {
+void ServiceIsolate::MaybeInjectVMServiceLibrary(Isolate* I) {
+ Thread* T = Thread::Current();
+ ASSERT(I == T->isolate());
+ ASSERT(I != NULL);
+ ASSERT(I->name() != NULL);
+ if (!ServiceIsolate::NameEquals(I->name())) {
// Not service isolate.
return;
}
@@ -539,19 +542,19 @@ void ServiceIsolate::MaybeInjectVMServiceLibrary(Isolate* isolate) {
// Service isolate already exists.
return;
}
- SetServiceIsolate(isolate);
+ SetServiceIsolate(I);
- StackZone zone(isolate);
- HANDLESCOPE(thread);
+ StackZone zone(T);
+ HANDLESCOPE(T);
// Register dart:vmservice library.
- const String& url_str = String::Handle(Symbols::DartVMService().raw());
- const Library& library = Library::Handle(Library::New(url_str));
+ const String& url_str = String::Handle(Z, Symbols::DartVMService().raw());
srdjan 2015/09/02 22:24:09 ditto
Ivan Posva 2015/09/02 22:59:26 ditto
+ const Library& library = Library::Handle(Z, Library::New(url_str));
library.Register();
library.set_native_entry_resolver(ServiceNativeResolver);
// Temporarily install our library tag handler.
- isolate->set_library_tag_handler(LibraryTagHandler);
+ I->set_library_tag_handler(LibraryTagHandler);
// Get script source.
const char* resource = NULL;
@@ -559,17 +562,16 @@ void ServiceIsolate::MaybeInjectVMServiceLibrary(Isolate* isolate) {
intptr_t r = Resources::ResourceLookup(path, &resource);
ASSERT(r != Resources::kNoSuchInstance);
ASSERT(resource != NULL);
- const String& source_str = String::Handle(
+ const String& source_str = String::Handle(Z,
String::FromUTF8(reinterpret_cast<const uint8_t*>(resource), r));
ASSERT(!source_str.IsNull());
- const Script& script = Script::Handle(
- isolate, Script::New(url_str, source_str, RawScript::kLibraryTag));
+ const Script& script = Script::Handle(Z,
+ Script::New(url_str, source_str, RawScript::kLibraryTag));
// Compile script.
Dart_EnterScope(); // Need to enter scope for tag handler.
library.SetLoadInProgress();
- const Error& error = Error::Handle(isolate,
- Compiler::Compile(library, script));
+ const Error& error = Error::Handle(Z, Compiler::Compile(library, script));
if (!error.IsNull()) {
OS::PrintErr("vm-service: Isolate creation error: %s\n",
error.ToErrorCString());
@@ -580,22 +582,22 @@ void ServiceIsolate::MaybeInjectVMServiceLibrary(Isolate* isolate) {
Dart_ExitScope();
// Uninstall our library tag handler.
- isolate->set_library_tag_handler(NULL);
+ I->set_library_tag_handler(NULL);
}
-void ServiceIsolate::ConstructExitMessageAndCache(Isolate* isolate) {
+void ServiceIsolate::ConstructExitMessageAndCache(Isolate* I) {
// Construct and cache exit message here so we can send it without needing an
// isolate.
- StartIsolateScope iso_scope(isolate);
- Thread* thread = Thread::Current();
- ASSERT(isolate == thread->isolate());
- ASSERT(isolate != NULL);
- StackZone zone(isolate);
- HANDLESCOPE(thread);
+ StartIsolateScope iso_scope(I);
+ Thread* T = Thread::Current();
+ ASSERT(I == T->isolate());
+ ASSERT(I != NULL);
+ StackZone zone(T);
+ HANDLESCOPE(T);
ASSERT(exit_message_ == NULL);
ASSERT(exit_message_length_ == 0);
- const Array& list = Array::Handle(MakeServiceExitMessage());
+ const Array& list = Array::Handle(Z, MakeServiceExitMessage());
ASSERT(!list.IsNull());
MessageWriter writer(&exit_message_, &allocator, false);
writer.WriteMessage(list);
@@ -671,18 +673,18 @@ class RunServiceTask : public ThreadPool::Task {
protected:
static void ShutdownIsolate(uword parameter) {
- Isolate* isolate = reinterpret_cast<Isolate*>(parameter);
- ASSERT(ServiceIsolate::IsServiceIsolate(isolate));
+ Isolate* I = reinterpret_cast<Isolate*>(parameter);
+ ASSERT(ServiceIsolate::IsServiceIsolate(I));
{
// Print the error if there is one. This may execute dart code to
// print the exception object, so we need to use a StartIsolateScope.
- StartIsolateScope start_scope(isolate);
- Thread* thread = Thread::Current();
- ASSERT(isolate == thread->isolate());
- StackZone zone(isolate);
- HandleScope handle_scope(thread);
- Error& error = Error::Handle();
- error = isolate->object_store()->sticky_error();
+ StartIsolateScope start_scope(I);
+ Thread* T = Thread::Current();
+ ASSERT(I == T->isolate());
+ StackZone zone(T);
+ HandleScope handle_scope(T);
+ Error& error = Error::Handle(Z);
+ error = I->object_store()->sticky_error();
if (!error.IsNull()) {
OS::PrintErr("vm-service: Error: %s\n", error.ToErrorCString());
}
@@ -690,7 +692,7 @@ class RunServiceTask : public ThreadPool::Task {
}
{
// Shut the isolate down.
- SwitchIsolateScope switch_scope(isolate);
+ SwitchIsolateScope switch_scope(I);
Dart::ShutdownIsolate();
}
ServiceIsolate::SetServiceIsolate(NULL);
@@ -701,15 +703,15 @@ class RunServiceTask : public ThreadPool::Task {
ServiceIsolate::FinishedExiting();
}
- void RunMain(Isolate* isolate) {
- StartIsolateScope iso_scope(isolate);
- Thread* thread = Thread::Current();
- ASSERT(isolate == thread->isolate());
- StackZone zone(isolate);
- HANDLESCOPE(thread);
+ void RunMain(Isolate* I) {
+ StartIsolateScope iso_scope(I);
+ Thread* T = Thread::Current();
+ ASSERT(I == T->isolate());
+ StackZone zone(T);
+ HANDLESCOPE(T);
// Invoke main which will return the loadScriptPort.
- const Library& root_library =
- Library::Handle(isolate, isolate->object_store()->root_library());
+ const Library& root_library = Library::Handle(Z,
+ I->object_store()->root_library());
if (root_library.IsNull()) {
if (FLAG_trace_service) {
OS::Print("vm-service: Embedder did not install a script.");
@@ -718,11 +720,10 @@ class RunServiceTask : public ThreadPool::Task {
return;
}
ASSERT(!root_library.IsNull());
- const String& entry_name = String::Handle(isolate, String::New("main"));
+ const String& entry_name = String::Handle(Z, String::New("main"));
ASSERT(!entry_name.IsNull());
- const Function& entry =
- Function::Handle(isolate,
- root_library.LookupFunctionAllowPrivate(entry_name));
+ const Function& entry = Function::Handle(Z,
+ root_library.LookupFunctionAllowPrivate(entry_name));
if (entry.IsNull()) {
// Service isolate is not supported by embedder.
if (FLAG_trace_service) {
@@ -731,10 +732,8 @@ class RunServiceTask : public ThreadPool::Task {
return;
}
ASSERT(!entry.IsNull());
- const Object& result =
- Object::Handle(isolate,
- DartEntry::InvokeFunction(entry,
- Object::empty_array()));
+ const Object& result = Object::Handle(Z,
+ DartEntry::InvokeFunction(entry, Object::empty_array()));
ASSERT(!result.IsNull());
if (result.IsError()) {
// Service isolate did not initialize properly.
« runtime/vm/service.cc ('K') | « runtime/vm/service.cc ('k') | runtime/vm/snapshot_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698