| 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 8926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8937 Local<Value> value) { | 8937 Local<Value> value) { |
| 8938 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); | 8938 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
| 8939 ENTER_V8(isolate); | 8939 ENTER_V8(isolate); |
| 8940 i::Handle<i::Object> val = Utils::OpenHandle(*value); | 8940 i::Handle<i::Object> val = Utils::OpenHandle(*value); |
| 8941 i::Handle<i::JSArray> result; | 8941 i::Handle<i::JSArray> result; |
| 8942 if (!i::Runtime::GetInternalProperties(isolate, val).ToHandle(&result)) | 8942 if (!i::Runtime::GetInternalProperties(isolate, val).ToHandle(&result)) |
| 8943 return MaybeLocal<Array>(); | 8943 return MaybeLocal<Array>(); |
| 8944 return Utils::ToLocal(result); | 8944 return Utils::ToLocal(result); |
| 8945 } | 8945 } |
| 8946 | 8946 |
| 8947 bool debug::SetDebugEventListener(Isolate* isolate, debug::EventCallback that, | |
| 8948 Local<Value> data) { | |
| 8949 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | |
| 8950 ENTER_V8(i_isolate); | |
| 8951 i::HandleScope scope(i_isolate); | |
| 8952 i::Handle<i::Object> foreign = i_isolate->factory()->undefined_value(); | |
| 8953 if (that != NULL) { | |
| 8954 foreign = i_isolate->factory()->NewForeign(FUNCTION_ADDR(that)); | |
| 8955 } | |
| 8956 i_isolate->debug()->SetEventListener(foreign, Utils::OpenHandle(*data, true)); | |
| 8957 return true; | |
| 8958 } | |
| 8959 | |
| 8960 Local<Context> debug::GetDebugContext(Isolate* isolate) { | 8947 Local<Context> debug::GetDebugContext(Isolate* isolate) { |
| 8961 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 8948 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 8962 ENTER_V8(i_isolate); | 8949 ENTER_V8(i_isolate); |
| 8963 return Utils::ToLocal(i_isolate->debug()->GetDebugContext()); | 8950 return Utils::ToLocal(i_isolate->debug()->GetDebugContext()); |
| 8964 } | 8951 } |
| 8965 | 8952 |
| 8966 MaybeLocal<Value> debug::Call(Local<Context> context, | 8953 MaybeLocal<Value> debug::Call(Local<Context> context, |
| 8967 v8::Local<v8::Function> fun, | 8954 v8::Local<v8::Function> fun, |
| 8968 v8::Local<v8::Value> data) { | 8955 v8::Local<v8::Value> data) { |
| 8969 return Debug::Call(context, fun, data); | 8956 return Debug::Call(context, fun, data); |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9297 } | 9284 } |
| 9298 | 9285 |
| 9299 void debug::SetCompileEventListener(Isolate* v8_isolate, | 9286 void debug::SetCompileEventListener(Isolate* v8_isolate, |
| 9300 debug::CompileEventListener listener, | 9287 debug::CompileEventListener listener, |
| 9301 void* data) { | 9288 void* data) { |
| 9302 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); | 9289 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
| 9303 ENTER_V8(isolate); | 9290 ENTER_V8(isolate); |
| 9304 isolate->debug()->SetCompileEventListener(listener, data); | 9291 isolate->debug()->SetCompileEventListener(listener, data); |
| 9305 } | 9292 } |
| 9306 | 9293 |
| 9294 void debug::SetBreakEventListener(Isolate* v8_isolate, |
| 9295 debug::BreakEventListener listener, |
| 9296 void* data) { |
| 9297 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
| 9298 ENTER_V8(isolate); |
| 9299 isolate->debug()->SetBreakEventListener(listener, data); |
| 9300 } |
| 9301 |
| 9302 void debug::SetExceptionEventListener(Isolate* v8_isolate, |
| 9303 debug::ExceptionEventListener listener, |
| 9304 void* data) { |
| 9305 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
| 9306 ENTER_V8(isolate); |
| 9307 isolate->debug()->SetExceptionEventListener(listener, data); |
| 9308 } |
| 9309 |
| 9307 Local<String> CpuProfileNode::GetFunctionName() const { | 9310 Local<String> CpuProfileNode::GetFunctionName() const { |
| 9308 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); | 9311 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); |
| 9309 i::Isolate* isolate = node->isolate(); | 9312 i::Isolate* isolate = node->isolate(); |
| 9310 const i::CodeEntry* entry = node->entry(); | 9313 const i::CodeEntry* entry = node->entry(); |
| 9311 i::Handle<i::String> name = | 9314 i::Handle<i::String> name = |
| 9312 isolate->factory()->InternalizeUtf8String(entry->name()); | 9315 isolate->factory()->InternalizeUtf8String(entry->name()); |
| 9313 if (!entry->has_name_prefix()) { | 9316 if (!entry->has_name_prefix()) { |
| 9314 return ToApiHandle<String>(name); | 9317 return ToApiHandle<String>(name); |
| 9315 } else { | 9318 } else { |
| 9316 // We do not expect this to fail. Change this if it does. | 9319 // We do not expect this to fail. Change this if it does. |
| (...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9984 Address callback_address = | 9987 Address callback_address = |
| 9985 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 9988 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 9986 VMState<EXTERNAL> state(isolate); | 9989 VMState<EXTERNAL> state(isolate); |
| 9987 ExternalCallbackScope call_scope(isolate, callback_address); | 9990 ExternalCallbackScope call_scope(isolate, callback_address); |
| 9988 callback(info); | 9991 callback(info); |
| 9989 } | 9992 } |
| 9990 | 9993 |
| 9991 | 9994 |
| 9992 } // namespace internal | 9995 } // namespace internal |
| 9993 } // namespace v8 | 9996 } // namespace v8 |
| OLD | NEW |