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 6694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6705 | 6705 |
6706 | 6706 |
6707 void Isolate::SetAddHistogramSampleFunction( | 6707 void Isolate::SetAddHistogramSampleFunction( |
6708 AddHistogramSampleCallback callback) { | 6708 AddHistogramSampleCallback callback) { |
6709 reinterpret_cast<i::Isolate*>(this) | 6709 reinterpret_cast<i::Isolate*>(this) |
6710 ->stats_table() | 6710 ->stats_table() |
6711 ->SetAddHistogramSampleFunction(callback); | 6711 ->SetAddHistogramSampleFunction(callback); |
6712 } | 6712 } |
6713 | 6713 |
6714 | 6714 |
6715 bool v8::Isolate::IdleNotification(int idle_time_hint_ms) { | |
Hannes Payer (out of office)
2014/07/24 08:25:55
idle_time_in_ms
| |
6716 // Returning true tells the caller that it need not | |
6717 // continue to call IdleNotification. | |
6718 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | |
6719 if (!i::FLAG_use_idle_notification) return true; | |
6720 return isolate->heap()->IdleNotification(idle_time_hint_ms); | |
6721 } | |
6722 | |
6723 | |
6724 void v8::Isolate::LowMemoryNotification() { | |
6725 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | |
6726 isolate->heap()->CollectAllAvailableGarbage("low memory notification"); | |
6727 } | |
6728 | |
6729 | |
6730 int v8::Isolate::ContextDisposedNotification() { | |
6731 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | |
6732 return isolate->heap()->NotifyContextDisposed(); | |
6733 } | |
6734 | |
6735 | |
6715 String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj) | 6736 String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj) |
6716 : str_(NULL), length_(0) { | 6737 : str_(NULL), length_(0) { |
6717 i::Isolate* isolate = i::Isolate::Current(); | 6738 i::Isolate* isolate = i::Isolate::Current(); |
6718 if (obj.IsEmpty()) return; | 6739 if (obj.IsEmpty()) return; |
6719 ENTER_V8(isolate); | 6740 ENTER_V8(isolate); |
6720 i::HandleScope scope(isolate); | 6741 i::HandleScope scope(isolate); |
6721 TryCatch try_catch; | 6742 TryCatch try_catch; |
6722 Handle<String> str = obj->ToString(); | 6743 Handle<String> str = obj->ToString(); |
6723 if (str.IsEmpty()) return; | 6744 if (str.IsEmpty()) return; |
6724 i::Handle<i::String> i_str = Utils::OpenHandle(*str); | 6745 i::Handle<i::String> i_str = Utils::OpenHandle(*str); |
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7605 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7626 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7606 Address callback_address = | 7627 Address callback_address = |
7607 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7628 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7608 VMState<EXTERNAL> state(isolate); | 7629 VMState<EXTERNAL> state(isolate); |
7609 ExternalCallbackScope call_scope(isolate, callback_address); | 7630 ExternalCallbackScope call_scope(isolate, callback_address); |
7610 callback(info); | 7631 callback(info); |
7611 } | 7632 } |
7612 | 7633 |
7613 | 7634 |
7614 } } // namespace v8::internal | 7635 } } // namespace v8::internal |
OLD | NEW |