OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/api.h" | 5 #include "src/api.h" |
6 | 6 |
7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
8 #ifdef V8_USE_ADDRESS_SANITIZER | 8 #ifdef V8_USE_ADDRESS_SANITIZER |
9 #include <sanitizer/asan_interface.h> | 9 #include <sanitizer/asan_interface.h> |
10 #endif // V8_USE_ADDRESS_SANITIZER | 10 #endif // V8_USE_ADDRESS_SANITIZER |
(...skipping 7135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7146 isolate->stack_guard()->ClearTerminateExecution(); | 7146 isolate->stack_guard()->ClearTerminateExecution(); |
7147 isolate->CancelTerminateExecution(); | 7147 isolate->CancelTerminateExecution(); |
7148 } | 7148 } |
7149 | 7149 |
7150 | 7150 |
7151 void Isolate::RequestInterrupt(InterruptCallback callback, void* data) { | 7151 void Isolate::RequestInterrupt(InterruptCallback callback, void* data) { |
7152 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 7152 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
7153 isolate->RequestInterrupt(callback, data); | 7153 isolate->RequestInterrupt(callback, data); |
7154 } | 7154 } |
7155 | 7155 |
| 7156 void Isolate::RequestMemoryPressureInterrupt() { |
| 7157 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| 7158 isolate->RequestMemoryPressureInterrupt(); |
| 7159 } |
7156 | 7160 |
7157 void Isolate::RequestGarbageCollectionForTesting(GarbageCollectionType type) { | 7161 void Isolate::RequestGarbageCollectionForTesting(GarbageCollectionType type) { |
7158 CHECK(i::FLAG_expose_gc); | 7162 CHECK(i::FLAG_expose_gc); |
7159 if (type == kMinorGarbageCollection) { | 7163 if (type == kMinorGarbageCollection) { |
7160 reinterpret_cast<i::Isolate*>(this)->heap()->CollectGarbage( | 7164 reinterpret_cast<i::Isolate*>(this)->heap()->CollectGarbage( |
7161 i::NEW_SPACE, "Isolate::RequestGarbageCollection", | 7165 i::NEW_SPACE, "Isolate::RequestGarbageCollection", |
7162 kGCCallbackFlagForced); | 7166 kGCCallbackFlagForced); |
7163 } else { | 7167 } else { |
7164 DCHECK_EQ(kFullGarbageCollection, type); | 7168 DCHECK_EQ(kFullGarbageCollection, type); |
7165 reinterpret_cast<i::Isolate*>(this)->heap()->CollectAllGarbage( | 7169 reinterpret_cast<i::Isolate*>(this)->heap()->CollectAllGarbage( |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7570 void Isolate::LowMemoryNotification() { | 7574 void Isolate::LowMemoryNotification() { |
7571 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 7575 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
7572 { | 7576 { |
7573 i::HistogramTimerScope idle_notification_scope( | 7577 i::HistogramTimerScope idle_notification_scope( |
7574 isolate->counters()->gc_low_memory_notification()); | 7578 isolate->counters()->gc_low_memory_notification()); |
7575 TRACE_EVENT0("v8", "V8.GCLowMemoryNotification"); | 7579 TRACE_EVENT0("v8", "V8.GCLowMemoryNotification"); |
7576 isolate->heap()->CollectAllAvailableGarbage("low memory notification"); | 7580 isolate->heap()->CollectAllAvailableGarbage("low memory notification"); |
7577 } | 7581 } |
7578 } | 7582 } |
7579 | 7583 |
| 7584 void Isolate::GCNotificationBasedOnMemoryPressureInterrupt() { |
| 7585 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| 7586 { |
| 7587 i::HistogramTimerScope idle_notification_scope( |
| 7588 isolate->counters()->gc_low_memory_notification()); |
| 7589 if (isolate->stack_guard()->NeedMemoryPressureGC()) { |
| 7590 TRACE_EVENT0("v8", "V8.GCLowMemoryNotification"); |
| 7591 isolate->heap()->CollectAllAvailableGarbage("low memory notification"); |
| 7592 isolate->stack_guard()->MemoryPressureGCDone(); |
| 7593 } |
| 7594 } |
| 7595 } |
7580 | 7596 |
7581 int Isolate::ContextDisposedNotification(bool dependant_context) { | 7597 int Isolate::ContextDisposedNotification(bool dependant_context) { |
7582 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 7598 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
7583 return isolate->heap()->NotifyContextDisposed(dependant_context); | 7599 return isolate->heap()->NotifyContextDisposed(dependant_context); |
7584 } | 7600 } |
7585 | 7601 |
7586 | 7602 |
7587 void Isolate::IsolateInForegroundNotification() { | 7603 void Isolate::IsolateInForegroundNotification() { |
7588 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 7604 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
7589 return isolate->heap()->SetOptimizeForLatency(); | 7605 return isolate->heap()->SetOptimizeForLatency(); |
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8694 Address callback_address = | 8710 Address callback_address = |
8695 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8711 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8696 VMState<EXTERNAL> state(isolate); | 8712 VMState<EXTERNAL> state(isolate); |
8697 ExternalCallbackScope call_scope(isolate, callback_address); | 8713 ExternalCallbackScope call_scope(isolate, callback_address); |
8698 callback(info); | 8714 callback(info); |
8699 } | 8715 } |
8700 | 8716 |
8701 | 8717 |
8702 } // namespace internal | 8718 } // namespace internal |
8703 } // namespace v8 | 8719 } // namespace v8 |
OLD | NEW |