Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Side by Side Diff: src/execution.cc

Issue 1777883002: Add memory pressure interrupt for memory pressure notification Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/execution.h" 5 #include "src/execution.h"
6 6
7 #include "src/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/isolate-inl.h" 9 #include "src/isolate-inl.h"
10 #include "src/messages.h" 10 #include "src/messages.h"
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 } 445 }
446 } 446 }
447 447
448 448
449 Object* StackGuard::HandleInterrupts() { 449 Object* StackGuard::HandleInterrupts() {
450 if (FLAG_verify_predictable) { 450 if (FLAG_verify_predictable) {
451 // Advance synthetic time by making a time request. 451 // Advance synthetic time by making a time request.
452 isolate_->heap()->MonotonicallyIncreasingTimeInMs(); 452 isolate_->heap()->MonotonicallyIncreasingTimeInMs();
453 } 453 }
454 454
455 if (CheckAndClearInterrupt(GC_REQUEST)) { 455 if (CheckAndClearInterrupt(MEMORY_PRESSURE_INTERRUPT)) {
456 isolate_->heap()->HandleGCRequest(); 456 isolate_->heap()->CollectAllAvailableGarbage("low memory notification");
457 CheckAndClearInterrupt(GC_REQUEST);
458 } else {
459 if (CheckAndClearInterrupt(GC_REQUEST)) {
460 isolate_->heap()->HandleGCRequest();
461 }
457 } 462 }
458 463
459 if (CheckDebugBreak() || CheckDebugCommand()) { 464 if (CheckDebugBreak() || CheckDebugCommand()) {
460 isolate_->debug()->HandleDebugBreak(); 465 isolate_->debug()->HandleDebugBreak();
461 } 466 }
462 467
463 if (CheckAndClearInterrupt(TERMINATE_EXECUTION)) { 468 if (CheckAndClearInterrupt(TERMINATE_EXECUTION)) {
464 return isolate_->TerminateExecution(); 469 return isolate_->TerminateExecution();
465 } 470 }
466 471
(...skipping 11 matching lines...) Expand all
478 isolate_->InvokeApiInterruptCallbacks(); 483 isolate_->InvokeApiInterruptCallbacks();
479 } 484 }
480 485
481 isolate_->counters()->stack_interrupts()->Increment(); 486 isolate_->counters()->stack_interrupts()->Increment();
482 isolate_->counters()->runtime_profiler_ticks()->Increment(); 487 isolate_->counters()->runtime_profiler_ticks()->Increment();
483 isolate_->runtime_profiler()->MarkCandidatesForOptimization(); 488 isolate_->runtime_profiler()->MarkCandidatesForOptimization();
484 489
485 return isolate_->heap()->undefined_value(); 490 return isolate_->heap()->undefined_value();
486 } 491 }
487 492
493 bool StackGuard::NeedMemoryPressureGC() {
494 return CheckInterrupt(MEMORY_PRESSURE_INTERRUPT);
495 }
496
497 void StackGuard::MemoryPressureGCDone() {
498 CheckAndClearInterrupt(MEMORY_PRESSURE_INTERRUPT);
499 }
500
488 } // namespace internal 501 } // namespace internal
489 } // namespace v8 502 } // namespace v8
OLDNEW
« include/v8.h ('K') | « src/execution.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698