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 8651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8662 | 8662 |
8663 | 8663 |
8664 bool Isolate::IdleNotificationDeadline(double deadline_in_seconds) { | 8664 bool Isolate::IdleNotificationDeadline(double deadline_in_seconds) { |
8665 // Returning true tells the caller that it need not | 8665 // Returning true tells the caller that it need not |
8666 // continue to call IdleNotification. | 8666 // continue to call IdleNotification. |
8667 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 8667 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
8668 if (!i::FLAG_use_idle_notification) return true; | 8668 if (!i::FLAG_use_idle_notification) return true; |
8669 return isolate->heap()->IdleNotification(deadline_in_seconds); | 8669 return isolate->heap()->IdleNotification(deadline_in_seconds); |
8670 } | 8670 } |
8671 | 8671 |
8672 | |
8673 void Isolate::LowMemoryNotification() { | 8672 void Isolate::LowMemoryNotification() { |
8674 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 8673 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
8675 { | 8674 { |
8676 i::HistogramTimerScope idle_notification_scope( | 8675 i::HistogramTimerScope idle_notification_scope( |
8677 isolate->counters()->gc_low_memory_notification()); | 8676 isolate->counters()->gc_low_memory_notification()); |
8678 TRACE_EVENT0("v8", "V8.GCLowMemoryNotification"); | 8677 TRACE_EVENT0("v8", "V8.GCLowMemoryNotification"); |
8679 isolate->heap()->CollectAllAvailableGarbage( | 8678 isolate->heap()->CollectAllAvailableGarbage( |
8680 i::GarbageCollectionReason::kLowMemoryNotification); | 8679 i::GarbageCollectionReason::kLowMemoryNotification); |
8681 } | 8680 } |
| 8681 { |
| 8682 i::HeapIterator iterator(isolate->heap()); |
| 8683 i::HeapObject* obj; |
| 8684 while ((obj = iterator.next()) != nullptr) { |
| 8685 if (obj->IsCode() || obj->IsBytecodeArray()) { |
| 8686 i::AbstractCode::cast(obj)->DropStackFrameCache(); |
| 8687 } |
| 8688 } |
| 8689 } |
8682 } | 8690 } |
8683 | 8691 |
8684 | 8692 |
8685 int Isolate::ContextDisposedNotification(bool dependant_context) { | 8693 int Isolate::ContextDisposedNotification(bool dependant_context) { |
8686 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 8694 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
8687 return isolate->heap()->NotifyContextDisposed(dependant_context); | 8695 return isolate->heap()->NotifyContextDisposed(dependant_context); |
8688 } | 8696 } |
8689 | 8697 |
8690 | 8698 |
8691 void Isolate::IsolateInForegroundNotification() { | 8699 void Isolate::IsolateInForegroundNotification() { |
(...skipping 1681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10373 Address callback_address = | 10381 Address callback_address = |
10374 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 10382 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
10375 VMState<EXTERNAL> state(isolate); | 10383 VMState<EXTERNAL> state(isolate); |
10376 ExternalCallbackScope call_scope(isolate, callback_address); | 10384 ExternalCallbackScope call_scope(isolate, callback_address); |
10377 callback(info); | 10385 callback(info); |
10378 } | 10386 } |
10379 | 10387 |
10380 | 10388 |
10381 } // namespace internal | 10389 } // namespace internal |
10382 } // namespace v8 | 10390 } // namespace v8 |
OLD | NEW |