| 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 8688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8699 | 8699 |
| 8700 | 8700 |
| 8701 bool Isolate::IdleNotificationDeadline(double deadline_in_seconds) { | 8701 bool Isolate::IdleNotificationDeadline(double deadline_in_seconds) { |
| 8702 // Returning true tells the caller that it need not | 8702 // Returning true tells the caller that it need not |
| 8703 // continue to call IdleNotification. | 8703 // continue to call IdleNotification. |
| 8704 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 8704 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| 8705 if (!i::FLAG_use_idle_notification) return true; | 8705 if (!i::FLAG_use_idle_notification) return true; |
| 8706 return isolate->heap()->IdleNotification(deadline_in_seconds); | 8706 return isolate->heap()->IdleNotification(deadline_in_seconds); |
| 8707 } | 8707 } |
| 8708 | 8708 |
| 8709 | |
| 8710 void Isolate::LowMemoryNotification() { | 8709 void Isolate::LowMemoryNotification() { |
| 8711 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 8710 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| 8712 { | 8711 { |
| 8713 i::HistogramTimerScope idle_notification_scope( | 8712 i::HistogramTimerScope idle_notification_scope( |
| 8714 isolate->counters()->gc_low_memory_notification()); | 8713 isolate->counters()->gc_low_memory_notification()); |
| 8715 TRACE_EVENT0("v8", "V8.GCLowMemoryNotification"); | 8714 TRACE_EVENT0("v8", "V8.GCLowMemoryNotification"); |
| 8716 isolate->heap()->CollectAllAvailableGarbage( | 8715 isolate->heap()->CollectAllAvailableGarbage( |
| 8717 i::GarbageCollectionReason::kLowMemoryNotification); | 8716 i::GarbageCollectionReason::kLowMemoryNotification); |
| 8718 } | 8717 } |
| 8718 { |
| 8719 i::HeapIterator iterator(isolate->heap()); |
| 8720 i::HeapObject* obj; |
| 8721 while ((obj = iterator.next()) != nullptr) { |
| 8722 if (obj->IsAbstractCode()) { |
| 8723 i::AbstractCode::cast(obj)->DropStackFrameCache(); |
| 8724 } |
| 8725 } |
| 8726 } |
| 8719 } | 8727 } |
| 8720 | 8728 |
| 8721 | 8729 |
| 8722 int Isolate::ContextDisposedNotification(bool dependant_context) { | 8730 int Isolate::ContextDisposedNotification(bool dependant_context) { |
| 8723 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 8731 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| 8724 return isolate->heap()->NotifyContextDisposed(dependant_context); | 8732 return isolate->heap()->NotifyContextDisposed(dependant_context); |
| 8725 } | 8733 } |
| 8726 | 8734 |
| 8727 | 8735 |
| 8728 void Isolate::IsolateInForegroundNotification() { | 8736 void Isolate::IsolateInForegroundNotification() { |
| (...skipping 1690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10419 Address callback_address = | 10427 Address callback_address = |
| 10420 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 10428 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 10421 VMState<EXTERNAL> state(isolate); | 10429 VMState<EXTERNAL> state(isolate); |
| 10422 ExternalCallbackScope call_scope(isolate, callback_address); | 10430 ExternalCallbackScope call_scope(isolate, callback_address); |
| 10423 callback(info); | 10431 callback(info); |
| 10424 } | 10432 } |
| 10425 | 10433 |
| 10426 | 10434 |
| 10427 } // namespace internal | 10435 } // namespace internal |
| 10428 } // namespace v8 | 10436 } // namespace v8 |
| OLD | NEW |