Index: runtime/vm/scavenger.cc |
diff --git a/runtime/vm/scavenger.cc b/runtime/vm/scavenger.cc |
index f68145990d582f609f570401a232c8630bebb2d9..306a78a4978ac104cb62f3d870690a344235ff12 100644 |
--- a/runtime/vm/scavenger.cc |
+++ b/runtime/vm/scavenger.cc |
@@ -193,13 +193,10 @@ class ScavengerVisitor : public ObjectPointerVisitor { |
class ScavengerWeakVisitor : public HandleVisitor { |
public: |
- ScavengerWeakVisitor(Thread* thread, |
- Scavenger* scavenger, |
- FinalizationQueue* finalization_queue) : |
- HandleVisitor(thread), |
- scavenger_(scavenger), |
- queue_(finalization_queue) { |
- ASSERT(scavenger->heap_->isolate() == thread->isolate()); |
+ explicit ScavengerWeakVisitor(Scavenger* scavenger) |
+ : HandleVisitor(Thread::Current()), |
+ scavenger_(scavenger) { |
+ ASSERT(scavenger->heap_->isolate() == Thread::Current()->isolate()); |
} |
void VisitHandle(uword addr) { |
@@ -207,7 +204,7 @@ class ScavengerWeakVisitor : public HandleVisitor { |
reinterpret_cast<FinalizablePersistentHandle*>(addr); |
RawObject** p = handle->raw_addr(); |
if (scavenger_->IsUnreachable(p)) { |
- handle->UpdateUnreachable(thread()->isolate(), queue_); |
+ handle->UpdateUnreachable(thread()->isolate()); |
} else { |
handle->UpdateRelocated(thread()->isolate()); |
} |
@@ -215,7 +212,6 @@ class ScavengerWeakVisitor : public HandleVisitor { |
private: |
Scavenger* scavenger_; |
- FinalizationQueue* queue_; |
DISALLOW_COPY_AND_ASSIGN(ScavengerWeakVisitor); |
}; |
@@ -816,14 +812,8 @@ void Scavenger::Scavenge(bool invoke_api_callbacks) { |
int64_t middle = OS::GetCurrentTimeMicros(); |
{ |
TIMELINE_FUNCTION_GC_DURATION(thread, "WeakHandleProcessing"); |
- FinalizationQueue* queue = new FinalizationQueue(); |
- ScavengerWeakVisitor weak_visitor(thread, this, queue); |
+ ScavengerWeakVisitor weak_visitor(this); |
IterateWeakRoots(isolate, &weak_visitor); |
- if (queue->length() > 0) { |
- Dart::thread_pool()->Run(new BackgroundFinalizer(isolate, queue)); |
- } else { |
- delete queue; |
- } |
} |
ProcessWeakReferences(); |
page_space->ReleaseDataLock(); |