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 8668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8679 | 8679 |
8680 | 8680 |
8681 bool Isolate::IdleNotificationDeadline(double deadline_in_seconds) { | 8681 bool Isolate::IdleNotificationDeadline(double deadline_in_seconds) { |
8682 // Returning true tells the caller that it need not | 8682 // Returning true tells the caller that it need not |
8683 // continue to call IdleNotification. | 8683 // continue to call IdleNotification. |
8684 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 8684 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
8685 if (!i::FLAG_use_idle_notification) return true; | 8685 if (!i::FLAG_use_idle_notification) return true; |
8686 return isolate->heap()->IdleNotification(deadline_in_seconds); | 8686 return isolate->heap()->IdleNotification(deadline_in_seconds); |
8687 } | 8687 } |
8688 | 8688 |
8689 | |
8690 void Isolate::LowMemoryNotification() { | 8689 void Isolate::LowMemoryNotification() { |
8691 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 8690 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
8692 { | 8691 { |
8693 i::HistogramTimerScope idle_notification_scope( | 8692 i::HistogramTimerScope idle_notification_scope( |
8694 isolate->counters()->gc_low_memory_notification()); | 8693 isolate->counters()->gc_low_memory_notification()); |
8695 TRACE_EVENT0("v8", "V8.GCLowMemoryNotification"); | 8694 TRACE_EVENT0("v8", "V8.GCLowMemoryNotification"); |
8696 isolate->heap()->CollectAllAvailableGarbage( | 8695 isolate->heap()->CollectAllAvailableGarbage( |
8697 i::GarbageCollectionReason::kLowMemoryNotification); | 8696 i::GarbageCollectionReason::kLowMemoryNotification); |
8698 } | 8697 } |
8698 { | |
8699 i::HeapIterator iterator(isolate->heap()); | |
8700 i::HeapObject* obj; | |
8701 while ((obj = iterator.next()) != nullptr) { | |
8702 if (obj->IsCode() || obj->IsBytecodeArray()) { | |
Yang
2017/04/11 13:09:46
IsAbstractCode
kozy
2017/04/12 15:05:17
Done.
| |
8703 i::AbstractCode::cast(obj)->DropStackFrameCache(); | |
8704 } | |
8705 } | |
8706 } | |
8699 } | 8707 } |
8700 | 8708 |
8701 | 8709 |
8702 int Isolate::ContextDisposedNotification(bool dependant_context) { | 8710 int Isolate::ContextDisposedNotification(bool dependant_context) { |
8703 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 8711 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
8704 return isolate->heap()->NotifyContextDisposed(dependant_context); | 8712 return isolate->heap()->NotifyContextDisposed(dependant_context); |
8705 } | 8713 } |
8706 | 8714 |
8707 | 8715 |
8708 void Isolate::IsolateInForegroundNotification() { | 8716 void Isolate::IsolateInForegroundNotification() { |
(...skipping 1681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10390 Address callback_address = | 10398 Address callback_address = |
10391 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 10399 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
10392 VMState<EXTERNAL> state(isolate); | 10400 VMState<EXTERNAL> state(isolate); |
10393 ExternalCallbackScope call_scope(isolate, callback_address); | 10401 ExternalCallbackScope call_scope(isolate, callback_address); |
10394 callback(info); | 10402 callback(info); |
10395 } | 10403 } |
10396 | 10404 |
10397 | 10405 |
10398 } // namespace internal | 10406 } // namespace internal |
10399 } // namespace v8 | 10407 } // namespace v8 |
OLD | NEW |