Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: cherry-pick 22858cb from V8 upstream #11998

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deps/v8/include/v8-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 5
#define V8_MINOR_VERSION 5
#define V8_BUILD_NUMBER 372
#define V8_PATCH_LEVEL 42
#define V8_PATCH_LEVEL 43

// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
Expand Down
18 changes: 17 additions & 1 deletion deps/v8/src/compiler-dispatcher/optimizing-compile-dispatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,23 @@ void OptimizingCompileDispatcher::FlushOutputQueue(bool restore_function_code) {
}
}

void OptimizingCompileDispatcher::Flush() {
void OptimizingCompileDispatcher::Flush(BlockingBehavior blocking_behavior) {
if (FLAG_block_concurrent_recompilation) Unblock();
if (blocking_behavior == BlockingBehavior::kDontBlock) {
base::LockGuard<base::Mutex> access_input_queue_(&input_queue_mutex_);
while (input_queue_length_ > 0) {
CompilationJob* job = input_queue_[InputQueueIndex(0)];
DCHECK_NOT_NULL(job);
input_queue_shift_ = InputQueueIndex(1);
input_queue_length_--;
DisposeCompilationJob(job, true);
}
FlushOutputQueue(true);
if (FLAG_trace_concurrent_recompilation) {
PrintF(" ** Flushed concurrent recompilation queues (not blocking).\n");
}
return;
}
base::Release_Store(&mode_, static_cast<base::AtomicWord>(FLUSH));
if (FLAG_block_concurrent_recompilation) Unblock();
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class SharedFunctionInfo;

class OptimizingCompileDispatcher {
public:
enum class BlockingBehavior { kBlock, kDontBlock };

explicit OptimizingCompileDispatcher(Isolate* isolate)
: isolate_(isolate),
input_queue_capacity_(FLAG_concurrent_recompilation_queue_length),
Expand All @@ -38,7 +40,7 @@ class OptimizingCompileDispatcher {

void Run();
void Stop();
void Flush();
void Flush(BlockingBehavior blocking_behavior);
void QueueForOptimization(CompilationJob* job);
void Unblock();
void InstallOptimizedFunctions();
Expand Down
3 changes: 2 additions & 1 deletion deps/v8/src/debug/debug.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,8 @@ bool Debug::PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared) {
DCHECK(shared->is_compiled());

if (isolate_->concurrent_recompilation_enabled()) {
isolate_->optimizing_compile_dispatcher()->Flush();
isolate_->optimizing_compile_dispatcher()->Flush(
OptimizingCompileDispatcher::BlockingBehavior::kBlock);
}

List<Handle<JSFunction> > functions;
Expand Down
9 changes: 6 additions & 3 deletions deps/v8/src/heap/heap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,8 @@ void Heap::CollectAllAvailableGarbage(GarbageCollectionReason gc_reason) {
if (isolate()->concurrent_recompilation_enabled()) {
// The optimizing compiler may be unnecessarily holding on to memory.
DisallowHeapAllocation no_recursive_gc;
isolate()->optimizing_compile_dispatcher()->Flush();
isolate()->optimizing_compile_dispatcher()->Flush(
OptimizingCompileDispatcher::BlockingBehavior::kDontBlock);
}
isolate()->ClearSerializerData();
set_current_gc_flags(kMakeHeapIterableMask | kReduceMemoryFootprintMask);
Expand Down Expand Up @@ -1056,7 +1057,8 @@ int Heap::NotifyContextDisposed(bool dependant_context) {
}
if (isolate()->concurrent_recompilation_enabled()) {
// Flush the queued recompilation tasks.
isolate()->optimizing_compile_dispatcher()->Flush();
isolate()->optimizing_compile_dispatcher()->Flush(
OptimizingCompileDispatcher::BlockingBehavior::kDontBlock);
}
AgeInlineCaches();
number_of_disposed_maps_ = retained_maps()->Length();
Expand Down Expand Up @@ -4457,7 +4459,8 @@ void Heap::CheckMemoryPressure() {
if (isolate()->concurrent_recompilation_enabled()) {
// The optimizing compiler may be unnecessarily holding on to memory.
DisallowHeapAllocation no_recursive_gc;
isolate()->optimizing_compile_dispatcher()->Flush();
isolate()->optimizing_compile_dispatcher()->Flush(
OptimizingCompileDispatcher::BlockingBehavior::kDontBlock);
}
}
if (memory_pressure_level_.Value() == MemoryPressureLevel::kCritical) {
Expand Down