Commit 58d56eb7 authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[cleanup] Several small clean-ups in our concurrent tests

Clean-ups:
 * Remove the detaching of persistent handles from the LocalHeap if the
main thread will not get the handles from the background thread.
 * Remove unused isolate member.
 * Make members private/protected as needed.

Bug: v8:7790
Change-Id: I23bf4a41124bd04d4a848edfa1ef8f9e8e77182c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2463234Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70442}
parent f91acaa1
......@@ -56,11 +56,9 @@ class ConcurrentSearchThread final : public v8::base::Thread {
}
CHECK_EQ(handles_.size(), kNumHandles * 2);
CHECK(!ph_);
ph_ = local_heap.DetachPersistentHandles();
}
private:
Heap* heap_;
std::vector<Handle<JSObject>> handles_;
std::unique_ptr<PersistentHandles> ph_;
......
......@@ -55,11 +55,9 @@ class ConcurrentSearchThread final : public v8::base::Thread {
}
CHECK_EQ(handles_.size(), kNumHandles * 2);
CHECK(!ph_);
ph_ = local_heap.DetachPersistentHandles();
}
private:
Heap* heap_;
std::vector<Handle<JSObject>> handles_;
std::unique_ptr<PersistentHandles> ph_;
......
......@@ -28,7 +28,6 @@ class ScriptContextTableAccessUsedThread final : public v8::base::Thread {
Handle<ScriptContextTable> script_context_table)
: v8::base::Thread(
base::Thread::Options("ScriptContextTableAccessUsedThread")),
isolate_(isolate),
heap_(heap),
sema_started_(sema_started),
ph_(std::move(ph)),
......@@ -44,12 +43,9 @@ class ScriptContextTableAccessUsedThread final : public v8::base::Thread {
Context context = script_context_table_->get_context(i);
CHECK(context.IsScriptContext());
}
CHECK(!ph_);
ph_ = local_heap.DetachPersistentHandles();
}
Isolate* isolate_;
private:
Heap* heap_;
base::Semaphore* sema_started_;
std::unique_ptr<PersistentHandles> ph_;
......@@ -64,7 +60,6 @@ class AccessScriptContextTableThread final : public v8::base::Thread {
Handle<NativeContext> native_context)
: v8::base::Thread(
base::Thread::Options("AccessScriptContextTableThread")),
isolate_(isolate),
heap_(heap),
sema_started_(sema_started),
ph_(std::move(ph)),
......@@ -87,12 +82,9 @@ class AccessScriptContextTableThread final : public v8::base::Thread {
&local_heap);
CHECK(!context.is_null());
}
CHECK(!ph_);
ph_ = local_heap.DetachPersistentHandles();
}
Isolate* isolate_;
private:
Heap* heap_;
base::Semaphore* sema_started_;
std::unique_ptr<PersistentHandles> ph_;
......
......@@ -41,11 +41,10 @@ class ConcurrentSearchThread : public v8::base::Thread {
CHECK_EQ(TransitionsAccessor(CcTest::i_isolate(), map_, true)
.SearchTransition(*name_, kData, NONE),
result_map_ ? **result_map_ : Map());
CHECK(!ph_);
ph_ = local_heap.DetachPersistentHandles();
}
// protected instead of private due to having a subclass.
protected:
Heap* heap_;
base::Semaphore* background_thread_started_;
std::unique_ptr<PersistentHandles> ph_;
......
......@@ -65,6 +65,12 @@ class PersistentHandlesThread final : public v8::base::Thread {
ph_ = local_heap.DetachPersistentHandles();
}
std::unique_ptr<PersistentHandles> DetachPersistentHandles() {
CHECK(ph_);
return std::move(ph_);
}
private:
Heap* heap_;
std::vector<Handle<HeapNumber>> handles_;
std::unique_ptr<PersistentHandles> ph_;
......@@ -105,7 +111,7 @@ TEST(CreatePersistentHandles) {
thread->Join();
// get persistent handles back to main thread
ph = std::move(thread->ph_);
ph = thread->DetachPersistentHandles();
ph->NewHandle(number);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment