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 5045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5056 i::Isolate* isolate = i::Isolate::Current(); | 5056 i::Isolate* isolate = i::Isolate::Current(); |
5057 if (isolate == NULL || !isolate->IsInitialized()) return true; | 5057 if (isolate == NULL || !isolate->IsInitialized()) return true; |
5058 if (!i::FLAG_use_idle_notification) return true; | 5058 if (!i::FLAG_use_idle_notification) return true; |
5059 return isolate->heap()->IdleNotification(hint); | 5059 return isolate->heap()->IdleNotification(hint); |
5060 } | 5060 } |
5061 | 5061 |
5062 | 5062 |
5063 void v8::V8::LowMemoryNotification() { | 5063 void v8::V8::LowMemoryNotification() { |
5064 i::Isolate* isolate = i::Isolate::Current(); | 5064 i::Isolate* isolate = i::Isolate::Current(); |
5065 if (isolate == NULL || !isolate->IsInitialized()) return; | 5065 if (isolate == NULL || !isolate->IsInitialized()) return; |
5066 isolate->heap()->CollectAllAvailableGarbage("low memory notification"); | 5066 { |
| 5067 i::HistogramTimerScope idle_notification_scope( |
| 5068 isolate->counters()->gc_low_memory_notification()); |
| 5069 isolate->heap()->CollectAllAvailableGarbage("low memory notification"); |
| 5070 } |
5067 } | 5071 } |
5068 | 5072 |
5069 | 5073 |
5070 int v8::V8::ContextDisposedNotification() { | 5074 int v8::V8::ContextDisposedNotification() { |
5071 i::Isolate* isolate = i::Isolate::Current(); | 5075 i::Isolate* isolate = i::Isolate::Current(); |
5072 if (!isolate->IsInitialized()) return 0; | 5076 if (!isolate->IsInitialized()) return 0; |
5073 return isolate->heap()->NotifyContextDisposed(); | 5077 return isolate->heap()->NotifyContextDisposed(); |
5074 } | 5078 } |
5075 | 5079 |
5076 | 5080 |
(...skipping 1639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6716 // Returning true tells the caller that it need not | 6720 // Returning true tells the caller that it need not |
6717 // continue to call IdleNotification. | 6721 // continue to call IdleNotification. |
6718 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 6722 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
6719 if (!i::FLAG_use_idle_notification) return true; | 6723 if (!i::FLAG_use_idle_notification) return true; |
6720 return isolate->heap()->IdleNotification(idle_time_in_ms); | 6724 return isolate->heap()->IdleNotification(idle_time_in_ms); |
6721 } | 6725 } |
6722 | 6726 |
6723 | 6727 |
6724 void v8::Isolate::LowMemoryNotification() { | 6728 void v8::Isolate::LowMemoryNotification() { |
6725 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 6729 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
6726 isolate->heap()->CollectAllAvailableGarbage("low memory notification"); | 6730 { |
| 6731 i::HistogramTimerScope idle_notification_scope( |
| 6732 isolate->counters()->gc_low_memory_notification()); |
| 6733 isolate->heap()->CollectAllAvailableGarbage("low memory notification"); |
| 6734 } |
6727 } | 6735 } |
6728 | 6736 |
6729 | 6737 |
6730 int v8::Isolate::ContextDisposedNotification() { | 6738 int v8::Isolate::ContextDisposedNotification() { |
6731 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 6739 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
6732 return isolate->heap()->NotifyContextDisposed(); | 6740 return isolate->heap()->NotifyContextDisposed(); |
6733 } | 6741 } |
6734 | 6742 |
6735 | 6743 |
6736 String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj) | 6744 String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj) |
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7626 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7634 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7627 Address callback_address = | 7635 Address callback_address = |
7628 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7636 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7629 VMState<EXTERNAL> state(isolate); | 7637 VMState<EXTERNAL> state(isolate); |
7630 ExternalCallbackScope call_scope(isolate, callback_address); | 7638 ExternalCallbackScope call_scope(isolate, callback_address); |
7631 callback(info); | 7639 callback(info); |
7632 } | 7640 } |
7633 | 7641 |
7634 | 7642 |
7635 } } // namespace v8::internal | 7643 } } // namespace v8::internal |
OLD | NEW |