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(MemoryPressureLevel level) { |
| 7157 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| 7158 isolate->RequestMemoryPressureInterrupt(level); |
| 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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7732 | 7736 |
7733 | 7737 |
7734 void Isolate::VisitWeakHandles(PersistentHandleVisitor* visitor) { | 7738 void Isolate::VisitWeakHandles(PersistentHandleVisitor* visitor) { |
7735 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 7739 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
7736 i::DisallowHeapAllocation no_allocation; | 7740 i::DisallowHeapAllocation no_allocation; |
7737 VisitorAdapter visitor_adapter(visitor); | 7741 VisitorAdapter visitor_adapter(visitor); |
7738 isolate->global_handles()->IterateWeakRootsInNewSpaceWithClassIds( | 7742 isolate->global_handles()->IterateWeakRootsInNewSpaceWithClassIds( |
7739 &visitor_adapter); | 7743 &visitor_adapter); |
7740 } | 7744 } |
7741 | 7745 |
| 7746 void Isolate::HandleMemoryPressureInterrupt() { |
| 7747 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| 7748 { |
| 7749 i::HistogramTimerScope idle_notification_scope( |
| 7750 isolate->counters()->gc_low_memory_notification()); |
| 7751 isolate->stack_guard()->HandleMemoryPressureInterrupt(); |
| 7752 } |
| 7753 } |
7742 | 7754 |
7743 MicrotasksScope::MicrotasksScope(Isolate* isolate, MicrotasksScope::Type type) | 7755 MicrotasksScope::MicrotasksScope(Isolate* isolate, MicrotasksScope::Type type) |
7744 : isolate_(reinterpret_cast<i::Isolate*>(isolate)), | 7756 : isolate_(reinterpret_cast<i::Isolate*>(isolate)), |
7745 run_(type == MicrotasksScope::kRunMicrotasks) { | 7757 run_(type == MicrotasksScope::kRunMicrotasks) { |
7746 auto handle_scope_implementer = isolate_->handle_scope_implementer(); | 7758 auto handle_scope_implementer = isolate_->handle_scope_implementer(); |
7747 if (run_) handle_scope_implementer->IncrementMicrotasksScopeDepth(); | 7759 if (run_) handle_scope_implementer->IncrementMicrotasksScopeDepth(); |
7748 #ifdef V8_ENABLE_CHECKS | 7760 #ifdef V8_ENABLE_CHECKS |
7749 if (!run_) handle_scope_implementer->IncrementDebugMicrotasksScopeDepth(); | 7761 if (!run_) handle_scope_implementer->IncrementDebugMicrotasksScopeDepth(); |
7750 #endif | 7762 #endif |
7751 } | 7763 } |
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8694 Address callback_address = | 8706 Address callback_address = |
8695 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8707 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8696 VMState<EXTERNAL> state(isolate); | 8708 VMState<EXTERNAL> state(isolate); |
8697 ExternalCallbackScope call_scope(isolate, callback_address); | 8709 ExternalCallbackScope call_scope(isolate, callback_address); |
8698 callback(info); | 8710 callback(info); |
8699 } | 8711 } |
8700 | 8712 |
8701 | 8713 |
8702 } // namespace internal | 8714 } // namespace internal |
8703 } // namespace v8 | 8715 } // namespace v8 |
OLD | NEW |