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 1991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2002 } | 2002 } |
2003 RETURN_ON_FAILED_EXECUTION(Function); | 2003 RETURN_ON_FAILED_EXECUTION(Function); |
2004 | 2004 |
2005 i::Handle<i::Object> result; | 2005 i::Handle<i::Object> result; |
2006 has_pending_exception = | 2006 has_pending_exception = |
2007 !i::Execution::Call(isolate, fun, | 2007 !i::Execution::Call(isolate, fun, |
2008 Utils::OpenHandle(*v8_context->Global()), 0, | 2008 Utils::OpenHandle(*v8_context->Global()), 0, |
2009 nullptr).ToHandle(&result); | 2009 nullptr).ToHandle(&result); |
2010 RETURN_ON_FAILED_EXECUTION(Function); | 2010 RETURN_ON_FAILED_EXECUTION(Function); |
2011 RETURN_ESCAPED( | 2011 RETURN_ESCAPED( |
2012 Utils::FunctionToLocal(i::Handle<i::JSFunction>::cast(result))); | 2012 Utils::CallableToLocal(i::Handle<i::JSFunction>::cast(result))); |
2013 } | 2013 } |
2014 | 2014 |
2015 | 2015 |
2016 Local<Function> ScriptCompiler::CompileFunctionInContext( | 2016 Local<Function> ScriptCompiler::CompileFunctionInContext( |
2017 Isolate* v8_isolate, Source* source, Local<Context> v8_context, | 2017 Isolate* v8_isolate, Source* source, Local<Context> v8_context, |
2018 size_t arguments_count, Local<String> arguments[], | 2018 size_t arguments_count, Local<String> arguments[], |
2019 size_t context_extension_count, Local<Object> context_extensions[]) { | 2019 size_t context_extension_count, Local<Object> context_extensions[]) { |
2020 RETURN_TO_LOCAL_UNCHECKED( | 2020 RETURN_TO_LOCAL_UNCHECKED( |
2021 CompileFunctionInContext(v8_context, source, arguments_count, arguments, | 2021 CompileFunctionInContext(v8_context, source, arguments_count, arguments, |
2022 context_extension_count, context_extensions), | 2022 context_extension_count, context_extensions), |
(...skipping 2510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4533 return v8::Undefined(reinterpret_cast<v8::Isolate*>(self->GetIsolate())); | 4533 return v8::Undefined(reinterpret_cast<v8::Isolate*>(self->GetIsolate())); |
4534 } | 4534 } |
4535 auto func = i::Handle<i::JSFunction>::cast(self); | 4535 auto func = i::Handle<i::JSFunction>::cast(self); |
4536 if (!func->shared()->bound()) { | 4536 if (!func->shared()->bound()) { |
4537 return v8::Undefined(reinterpret_cast<v8::Isolate*>(func->GetIsolate())); | 4537 return v8::Undefined(reinterpret_cast<v8::Isolate*>(func->GetIsolate())); |
4538 } | 4538 } |
4539 i::Handle<i::BindingsArray> bound_args = i::Handle<i::BindingsArray>( | 4539 i::Handle<i::BindingsArray> bound_args = i::Handle<i::BindingsArray>( |
4540 i::BindingsArray::cast(func->function_bindings())); | 4540 i::BindingsArray::cast(func->function_bindings())); |
4541 i::Handle<i::Object> original(bound_args->bound_function(), | 4541 i::Handle<i::Object> original(bound_args->bound_function(), |
4542 func->GetIsolate()); | 4542 func->GetIsolate()); |
4543 return Utils::FunctionToLocal(i::Handle<i::JSFunction>::cast(original)); | 4543 return Utils::CallableToLocal(i::Handle<i::JSFunction>::cast(original)); |
4544 } | 4544 } |
4545 | 4545 |
4546 | 4546 |
4547 int Name::GetIdentityHash() { | 4547 int Name::GetIdentityHash() { |
4548 auto self = Utils::OpenHandle(this); | 4548 auto self = Utils::OpenHandle(this); |
4549 return static_cast<int>(self->Hash()); | 4549 return static_cast<int>(self->Hash()); |
4550 } | 4550 } |
4551 | 4551 |
4552 | 4552 |
4553 int String::Length() const { | 4553 int String::Length() const { |
(...skipping 3207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7761 | 7761 |
7762 MaybeLocal<Value> Debug::GetMirror(Local<Context> context, | 7762 MaybeLocal<Value> Debug::GetMirror(Local<Context> context, |
7763 v8::Local<v8::Value> obj) { | 7763 v8::Local<v8::Value> obj) { |
7764 PREPARE_FOR_EXECUTION(context, "v8::Debug::GetMirror()", Value); | 7764 PREPARE_FOR_EXECUTION(context, "v8::Debug::GetMirror()", Value); |
7765 i::Debug* isolate_debug = isolate->debug(); | 7765 i::Debug* isolate_debug = isolate->debug(); |
7766 has_pending_exception = !isolate_debug->Load(); | 7766 has_pending_exception = !isolate_debug->Load(); |
7767 RETURN_ON_FAILED_EXECUTION(Value); | 7767 RETURN_ON_FAILED_EXECUTION(Value); |
7768 i::Handle<i::JSObject> debug(isolate_debug->debug_context()->global_object()); | 7768 i::Handle<i::JSObject> debug(isolate_debug->debug_context()->global_object()); |
7769 auto name = isolate->factory()->NewStringFromStaticChars("MakeMirror"); | 7769 auto name = isolate->factory()->NewStringFromStaticChars("MakeMirror"); |
7770 auto fun_obj = i::Object::GetProperty(debug, name).ToHandleChecked(); | 7770 auto fun_obj = i::Object::GetProperty(debug, name).ToHandleChecked(); |
7771 auto v8_fun = Utils::FunctionToLocal(i::Handle<i::JSFunction>::cast(fun_obj)); | 7771 auto v8_fun = Utils::CallableToLocal(i::Handle<i::JSFunction>::cast(fun_obj)); |
7772 const int kArgc = 1; | 7772 const int kArgc = 1; |
7773 v8::Local<v8::Value> argv[kArgc] = {obj}; | 7773 v8::Local<v8::Value> argv[kArgc] = {obj}; |
7774 Local<Value> result; | 7774 Local<Value> result; |
7775 has_pending_exception = !v8_fun->Call(context, Utils::ToLocal(debug), kArgc, | 7775 has_pending_exception = !v8_fun->Call(context, Utils::ToLocal(debug), kArgc, |
7776 argv).ToLocal(&result); | 7776 argv).ToLocal(&result); |
7777 RETURN_ON_FAILED_EXECUTION(Value); | 7777 RETURN_ON_FAILED_EXECUTION(Value); |
7778 RETURN_ESCAPED(result); | 7778 RETURN_ESCAPED(result); |
7779 } | 7779 } |
7780 | 7780 |
7781 | 7781 |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8453 Address callback_address = | 8453 Address callback_address = |
8454 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8454 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8455 VMState<EXTERNAL> state(isolate); | 8455 VMState<EXTERNAL> state(isolate); |
8456 ExternalCallbackScope call_scope(isolate, callback_address); | 8456 ExternalCallbackScope call_scope(isolate, callback_address); |
8457 callback(info); | 8457 callback(info); |
8458 } | 8458 } |
8459 | 8459 |
8460 | 8460 |
8461 } // namespace internal | 8461 } // namespace internal |
8462 } // namespace v8 | 8462 } // namespace v8 |
OLD | NEW |