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 6644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6655 } | 6655 } |
6656 } | 6656 } |
6657 | 6657 |
6658 | 6658 |
6659 Isolate* Isolate::GetCurrent() { | 6659 Isolate* Isolate::GetCurrent() { |
6660 i::Isolate* isolate = i::Isolate::Current(); | 6660 i::Isolate* isolate = i::Isolate::Current(); |
6661 return reinterpret_cast<Isolate*>(isolate); | 6661 return reinterpret_cast<Isolate*>(isolate); |
6662 } | 6662 } |
6663 | 6663 |
6664 | 6664 |
6665 Isolate* Isolate::New() { | 6665 Isolate* Isolate::New(Isolate::CreateParams params) { |
6666 i::Isolate* isolate = new i::Isolate(); | 6666 i::Isolate* isolate = new i::Isolate(); |
| 6667 if (params.entry_hook) { |
| 6668 isolate->set_function_entry_hook(params.entry_hook); |
| 6669 } |
| 6670 if (params.code_event_handler) { |
| 6671 isolate->InitializeLoggingAndCounters(); |
| 6672 isolate->logger()->SetCodeEventHandler(kJitCodeEventDefault, |
| 6673 params.code_event_handler); |
| 6674 } |
6667 return reinterpret_cast<Isolate*>(isolate); | 6675 return reinterpret_cast<Isolate*>(isolate); |
6668 } | 6676 } |
6669 | 6677 |
6670 | 6678 |
6671 void Isolate::Dispose() { | 6679 void Isolate::Dispose() { |
6672 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 6680 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
6673 if (!Utils::ApiCheck(!isolate->IsInUse(), | 6681 if (!Utils::ApiCheck(!isolate->IsInUse(), |
6674 "v8::Isolate::Dispose()", | 6682 "v8::Isolate::Dispose()", |
6675 "Disposing the isolate that is entered by a thread.")) { | 6683 "Disposing the isolate that is entered by a thread.")) { |
6676 return; | 6684 return; |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6865 } | 6873 } |
6866 } | 6874 } |
6867 | 6875 |
6868 | 6876 |
6869 int v8::Isolate::ContextDisposedNotification() { | 6877 int v8::Isolate::ContextDisposedNotification() { |
6870 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 6878 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
6871 return isolate->heap()->NotifyContextDisposed(); | 6879 return isolate->heap()->NotifyContextDisposed(); |
6872 } | 6880 } |
6873 | 6881 |
6874 | 6882 |
| 6883 void v8::Isolate::SetJitCodeEventHandler(JitCodeEventOptions options, |
| 6884 JitCodeEventHandler event_handler) { |
| 6885 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| 6886 // Ensure that logging is initialized for our isolate. |
| 6887 isolate->InitializeLoggingAndCounters(); |
| 6888 isolate->logger()->SetCodeEventHandler(options, event_handler); |
| 6889 } |
| 6890 |
| 6891 |
6875 String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj) | 6892 String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj) |
6876 : str_(NULL), length_(0) { | 6893 : str_(NULL), length_(0) { |
6877 i::Isolate* isolate = i::Isolate::Current(); | 6894 i::Isolate* isolate = i::Isolate::Current(); |
6878 if (obj.IsEmpty()) return; | 6895 if (obj.IsEmpty()) return; |
6879 ENTER_V8(isolate); | 6896 ENTER_V8(isolate); |
6880 i::HandleScope scope(isolate); | 6897 i::HandleScope scope(isolate); |
6881 TryCatch try_catch; | 6898 TryCatch try_catch; |
6882 Handle<String> str = obj->ToString(); | 6899 Handle<String> str = obj->ToString(); |
6883 if (str.IsEmpty()) return; | 6900 if (str.IsEmpty()) return; |
6884 i::Handle<i::String> i_str = Utils::OpenHandle(*str); | 6901 i::Handle<i::String> i_str = Utils::OpenHandle(*str); |
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7718 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7735 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7719 Address callback_address = | 7736 Address callback_address = |
7720 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7737 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7721 VMState<EXTERNAL> state(isolate); | 7738 VMState<EXTERNAL> state(isolate); |
7722 ExternalCallbackScope call_scope(isolate, callback_address); | 7739 ExternalCallbackScope call_scope(isolate, callback_address); |
7723 callback(info); | 7740 callback(info); |
7724 } | 7741 } |
7725 | 7742 |
7726 | 7743 |
7727 } } // namespace v8::internal | 7744 } } // namespace v8::internal |
OLD | NEW |