Chromium Code Reviews| Index: runtime/vm/service.cc |
| diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc |
| index de7c7fe7afed65b6de794f3fe14f56fa9d458862..c0959e3510c12e8a6425d68a4f1b5b7a28234294 100644 |
| --- a/runtime/vm/service.cc |
| +++ b/runtime/vm/service.cc |
| @@ -37,6 +37,9 @@ |
| namespace dart { |
| +#define Z (T->zone()) |
|
srdjan
2015/09/02 22:24:09
Instead I would add Zone* Z = T->zone() in method
Ivan Posva
2015/09/02 22:59:26
See explanation below why you cannot cache the cur
|
| + |
| + |
| DECLARE_FLAG(bool, trace_service); |
| DECLARE_FLAG(bool, trace_service_pause_events); |
| @@ -511,10 +514,9 @@ void Service::PostError(const String& method_name, |
| const Instance& reply_port, |
| const Instance& id, |
| const Error& error) { |
| - Thread* thread = Thread::Current(); |
| - Isolate* isolate = thread->isolate(); |
| - StackZone zone(isolate); |
| - HANDLESCOPE(thread); |
| + Thread* T = Thread::Current(); |
| + StackZone zone(T); |
| + HANDLESCOPE(T); |
| JSONStream js; |
| js.Setup(zone.GetZone(), SendPort::Cast(reply_port).Id(), |
| id, method_name, parameter_keys, parameter_values); |
| @@ -525,22 +527,22 @@ void Service::PostError(const String& method_name, |
| } |
| -void Service::InvokeMethod(Isolate* isolate, const Array& msg) { |
| - Thread* thread = Thread::Current(); |
| - ASSERT(isolate == thread->isolate()); |
| - ASSERT(isolate != NULL); |
| +void Service::InvokeMethod(Isolate* I, const Array& msg) { |
| + Thread* T = Thread::Current(); |
| + ASSERT(I == T->isolate()); |
| + ASSERT(I != NULL); |
| ASSERT(!msg.IsNull()); |
| ASSERT(msg.Length() == 6); |
| { |
| - StackZone zone(isolate); |
| - HANDLESCOPE(thread); |
| - |
| - Instance& reply_port = Instance::Handle(isolate); |
| - Instance& seq = String::Handle(isolate); |
| - String& method_name = String::Handle(isolate); |
| - Array& param_keys = Array::Handle(isolate); |
| - Array& param_values = Array::Handle(isolate); |
| + StackZone zone(T); |
| + HANDLESCOPE(T); |
| + |
| + Instance& reply_port = Instance::Handle(Z); |
|
srdjan
2015/09/02 22:24:09
Why not zone instead of Z?
Ivan Posva
2015/09/02 22:59:26
Because zone is a StackZone defined above on line
|
| + Instance& seq = String::Handle(Z); |
| + String& method_name = String::Handle(Z); |
| + Array& param_keys = Array::Handle(Z); |
| + Array& param_values = Array::Handle(Z); |
| reply_port ^= msg.At(1); |
| seq ^= msg.At(2); |
| method_name ^= msg.At(3); |
| @@ -592,7 +594,7 @@ void Service::InvokeMethod(Isolate* isolate, const Array& msg) { |
| js.PostReply(); |
| return; |
| } |
| - if (method->entry(isolate, &js)) { |
| + if (method->entry(I, &js)) { |
| js.PostReply(); |
| } else { |
| // NOTE(turnidge): All message handlers currently return true, |
| @@ -613,8 +615,8 @@ void Service::InvokeMethod(Isolate* isolate, const Array& msg) { |
| return; |
| } |
| - const Instance& extension_handler = |
| - Instance::Handle(isolate->LookupServiceExtensionHandler(method_name)); |
| + const Instance& extension_handler = Instance::Handle(Z, |
| + I->LookupServiceExtensionHandler(method_name)); |
| if (!extension_handler.IsNull()) { |
| ScheduleExtensionHandler(extension_handler, |
| method_name, |