Added method to IsolateVisitor to check for special isolates (i.e., service / vm isolates) since this check is done frequently.

BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2567193002 .
This commit is contained in:
Ben Konyi 2016-12-12 14:54:05 -08:00
parent f125cc7d0b
commit 7eef11a0e8
4 changed files with 13 additions and 7 deletions

View file

@ -51,8 +51,7 @@ class RegisterRunningIsolatesVisitor : public IsolateVisitor {
virtual void VisitIsolate(Isolate* isolate) {
ASSERT(ServiceIsolate::IsServiceIsolate(Isolate::Current()));
if (ServiceIsolate::IsServiceIsolateDescendant(isolate) ||
(isolate == Dart::vm_isolate())) {
if (IsVMInternalIsolate(isolate)) {
// We do not register the service (and descendants) or the vm-isolate.
return;
}

View file

@ -128,6 +128,12 @@ static Message* SerializeMessage(Dart_Port dest_port, const Instance& obj) {
}
bool IsolateVisitor::IsVMInternalIsolate(Isolate* isolate) const {
return ((isolate == Dart::vm_isolate()) ||
ServiceIsolate::IsServiceIsolateDescendant(isolate));
}
NoOOBMessageScope::NoOOBMessageScope(Thread* thread) : StackResource(thread) {
thread->DeferOOBMessageInterrupts();
}
@ -2573,9 +2579,7 @@ class IsolateKillerVisitor : public IsolateVisitor {
// If a target_ is specified, then only kill the target_.
// Otherwise, don't kill the service isolate or vm isolate.
return (((target_ != NULL) && (isolate == target_)) ||
((target_ == NULL) &&
!ServiceIsolate::IsServiceIsolateDescendant(isolate) &&
(isolate != Dart::vm_isolate())));
((target_ == NULL) && !IsVMInternalIsolate(isolate)));
}
Isolate* target_;

View file

@ -91,6 +91,10 @@ class IsolateVisitor {
virtual void VisitIsolate(Isolate* isolate) = 0;
protected:
// Returns true if |isolate| is the VM or service isolate.
bool IsVMInternalIsolate(Isolate* isolate) const;
private:
DISALLOW_COPY_AND_ASSIGN(IsolateVisitor);
};

View file

@ -3762,8 +3762,7 @@ class ServiceIsolateVisitor : public IsolateVisitor {
virtual ~ServiceIsolateVisitor() {}
void VisitIsolate(Isolate* isolate) {
if ((isolate != Dart::vm_isolate()) &&
!ServiceIsolate::IsServiceIsolateDescendant(isolate)) {
if (!IsVMInternalIsolate(isolate)) {
jsarr_->AddValue(isolate);
}
}