OLD | NEW |
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 Loading... |
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 if (isolate_->memory_pressure_level_ != |
| 457 v8::Isolate::MemoryPressureLevel::kNone) { |
| 458 isolate_->heap()->CollectAllAvailableGarbage("low memory notification"); |
| 459 CheckAndClearInterrupt(GC_REQUEST); |
| 460 } |
| 461 } else { |
| 462 if (CheckAndClearInterrupt(GC_REQUEST)) { |
| 463 isolate_->heap()->HandleGCRequest(); |
| 464 } |
457 } | 465 } |
458 | 466 |
459 if (CheckDebugBreak() || CheckDebugCommand()) { | 467 if (CheckDebugBreak() || CheckDebugCommand()) { |
460 isolate_->debug()->HandleDebugBreak(); | 468 isolate_->debug()->HandleDebugBreak(); |
461 } | 469 } |
462 | 470 |
463 if (CheckAndClearInterrupt(TERMINATE_EXECUTION)) { | 471 if (CheckAndClearInterrupt(TERMINATE_EXECUTION)) { |
464 return isolate_->TerminateExecution(); | 472 return isolate_->TerminateExecution(); |
465 } | 473 } |
466 | 474 |
(...skipping 11 matching lines...) Expand all Loading... |
478 isolate_->InvokeApiInterruptCallbacks(); | 486 isolate_->InvokeApiInterruptCallbacks(); |
479 } | 487 } |
480 | 488 |
481 isolate_->counters()->stack_interrupts()->Increment(); | 489 isolate_->counters()->stack_interrupts()->Increment(); |
482 isolate_->counters()->runtime_profiler_ticks()->Increment(); | 490 isolate_->counters()->runtime_profiler_ticks()->Increment(); |
483 isolate_->runtime_profiler()->MarkCandidatesForOptimization(); | 491 isolate_->runtime_profiler()->MarkCandidatesForOptimization(); |
484 | 492 |
485 return isolate_->heap()->undefined_value(); | 493 return isolate_->heap()->undefined_value(); |
486 } | 494 } |
487 | 495 |
| 496 void StackGuard::HandleMemoryPressureInterrupt() { |
| 497 if (CheckAndClearInterrupt(MEMORY_PRESSURE_INTERRUPT)) { |
| 498 if (isolate_->memory_pressure_level_ != |
| 499 v8::Isolate::MemoryPressureLevel::kNone) { |
| 500 isolate_->heap()->CollectAllAvailableGarbage("low memory notification"); |
| 501 } |
| 502 } |
| 503 } |
| 504 |
488 } // namespace internal | 505 } // namespace internal |
489 } // namespace v8 | 506 } // namespace v8 |
OLD | NEW |