Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9f73df5

Browse filesBrowse files
ofrobotsItalo A. Casas
authored andcommitted
deps: cherry-pick 22858cb from V8 upstream
Original commit message: Only flush not yet started and finished compile jobs from gc We shouldn't block during GC for arbitrarily long intervals. BUG=chromium:686153,chromium:642532 R=verwaest@chromium.org,hpayer@chromium.org Review-Url: https://codereview.chromium.org/2658313002 Cr-Commit-Position: refs/heads/master@{#42761} PR-URL: #11998 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 211dd16 commit 9f73df5
Copy full SHA for 9f73df5

File tree

Expand file treeCollapse file tree

4 files changed

+28
-6
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

4 files changed

+28
-6
lines changed
Open diff view settings
Collapse file

‎deps/v8/src/compiler-dispatcher/optimizing-compile-dispatcher.cc‎

Copy file name to clipboardExpand all lines: deps/v8/src/compiler-dispatcher/optimizing-compile-dispatcher.cc
+17-1Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,23 @@ void OptimizingCompileDispatcher::FlushOutputQueue(bool restore_function_code) {
134134
}
135135
}
136136

137-
void OptimizingCompileDispatcher::Flush() {
137+
void OptimizingCompileDispatcher::Flush(BlockingBehavior blocking_behavior) {
138+
if (FLAG_block_concurrent_recompilation) Unblock();
139+
if (blocking_behavior == BlockingBehavior::kDontBlock) {
140+
base::LockGuard<base::Mutex> access_input_queue_(&input_queue_mutex_);
141+
while (input_queue_length_ > 0) {
142+
CompilationJob* job = input_queue_[InputQueueIndex(0)];
143+
DCHECK_NOT_NULL(job);
144+
input_queue_shift_ = InputQueueIndex(1);
145+
input_queue_length_--;
146+
DisposeCompilationJob(job, true);
147+
}
148+
FlushOutputQueue(true);
149+
if (FLAG_trace_concurrent_recompilation) {
150+
PrintF(" ** Flushed concurrent recompilation queues (not blocking).\n");
151+
}
152+
return;
153+
}
138154
base::Release_Store(&mode_, static_cast<base::AtomicWord>(FLUSH));
139155
if (FLAG_block_concurrent_recompilation) Unblock();
140156
{
Collapse file

‎deps/v8/src/compiler-dispatcher/optimizing-compile-dispatcher.h‎

Copy file name to clipboardExpand all lines: deps/v8/src/compiler-dispatcher/optimizing-compile-dispatcher.h
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ class SharedFunctionInfo;
2222

2323
class OptimizingCompileDispatcher {
2424
public:
25+
enum class BlockingBehavior { kBlock, kDontBlock };
26+
2527
explicit OptimizingCompileDispatcher(Isolate* isolate)
2628
: isolate_(isolate),
2729
input_queue_capacity_(FLAG_concurrent_recompilation_queue_length),
@@ -38,7 +40,7 @@ class OptimizingCompileDispatcher {
3840

3941
void Run();
4042
void Stop();
41-
void Flush();
43+
void Flush(BlockingBehavior blocking_behavior);
4244
void QueueForOptimization(CompilationJob* job);
4345
void Unblock();
4446
void InstallOptimizedFunctions();
Collapse file

‎deps/v8/src/debug/debug.cc‎

Copy file name to clipboardExpand all lines: deps/v8/src/debug/debug.cc
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1264,7 +1264,8 @@ bool Debug::PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared) {
12641264
DCHECK(shared->is_compiled());
12651265

12661266
if (isolate_->concurrent_recompilation_enabled()) {
1267-
isolate_->optimizing_compile_dispatcher()->Flush();
1267+
isolate_->optimizing_compile_dispatcher()->Flush(
1268+
OptimizingCompileDispatcher::BlockingBehavior::kBlock);
12681269
}
12691270

12701271
List<Handle<JSFunction> > functions;
Collapse file

‎deps/v8/src/heap/heap.cc‎

Copy file name to clipboardExpand all lines: deps/v8/src/heap/heap.cc
+6-3Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,8 @@ void Heap::CollectAllAvailableGarbage(GarbageCollectionReason gc_reason) {
862862
if (isolate()->concurrent_recompilation_enabled()) {
863863
// The optimizing compiler may be unnecessarily holding on to memory.
864864
DisallowHeapAllocation no_recursive_gc;
865-
isolate()->optimizing_compile_dispatcher()->Flush();
865+
isolate()->optimizing_compile_dispatcher()->Flush(
866+
OptimizingCompileDispatcher::BlockingBehavior::kDontBlock);
866867
}
867868
isolate()->ClearSerializerData();
868869
set_current_gc_flags(kMakeHeapIterableMask | kReduceMemoryFootprintMask);
@@ -1056,7 +1057,8 @@ int Heap::NotifyContextDisposed(bool dependant_context) {
10561057
}
10571058
if (isolate()->concurrent_recompilation_enabled()) {
10581059
// Flush the queued recompilation tasks.
1059-
isolate()->optimizing_compile_dispatcher()->Flush();
1060+
isolate()->optimizing_compile_dispatcher()->Flush(
1061+
OptimizingCompileDispatcher::BlockingBehavior::kDontBlock);
10601062
}
10611063
AgeInlineCaches();
10621064
number_of_disposed_maps_ = retained_maps()->Length();
@@ -4457,7 +4459,8 @@ void Heap::CheckMemoryPressure() {
44574459
if (isolate()->concurrent_recompilation_enabled()) {
44584460
// The optimizing compiler may be unnecessarily holding on to memory.
44594461
DisallowHeapAllocation no_recursive_gc;
4460-
isolate()->optimizing_compile_dispatcher()->Flush();
4462+
isolate()->optimizing_compile_dispatcher()->Flush(
4463+
OptimizingCompileDispatcher::BlockingBehavior::kDontBlock);
44614464
}
44624465
}
44634466
if (memory_pressure_level_.Value() == MemoryPressureLevel::kCritical) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.