| 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 3641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3652 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); | 3652 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); |
| 3653 return GetPropertyAttributes(context, key) | 3653 return GetPropertyAttributes(context, key) |
| 3654 .FromMaybe(static_cast<PropertyAttribute>(i::NONE)); | 3654 .FromMaybe(static_cast<PropertyAttribute>(i::NONE)); |
| 3655 } | 3655 } |
| 3656 | 3656 |
| 3657 | 3657 |
| 3658 MaybeLocal<Value> v8::Object::GetOwnPropertyDescriptor(Local<Context> context, | 3658 MaybeLocal<Value> v8::Object::GetOwnPropertyDescriptor(Local<Context> context, |
| 3659 Local<String> key) { | 3659 Local<String> key) { |
| 3660 PREPARE_FOR_EXECUTION(context, "v8::Object::GetOwnPropertyDescriptor()", | 3660 PREPARE_FOR_EXECUTION(context, "v8::Object::GetOwnPropertyDescriptor()", |
| 3661 Value); | 3661 Value); |
| 3662 auto obj = Utils::OpenHandle(this); | 3662 i::Handle<i::JSReceiver> obj = Utils::OpenHandle(this); |
| 3663 auto key_name = Utils::OpenHandle(*key); | 3663 i::Handle<i::String> key_name = Utils::OpenHandle(*key); |
| 3664 i::Handle<i::Object> args[] = { obj, key_name }; | 3664 |
| 3665 i::Handle<i::JSFunction> fun = isolate->object_get_own_property_descriptor(); | 3665 i::PropertyDescriptor desc; |
| 3666 i::Handle<i::Object> undefined = isolate->factory()->undefined_value(); | 3666 bool found = |
| 3667 i::Handle<i::Object> result; | 3667 i::JSReceiver::GetOwnPropertyDescriptor(isolate, obj, key_name, &desc); |
| 3668 has_pending_exception = | 3668 has_pending_exception = isolate->has_pending_exception(); |
| 3669 !i::Execution::Call(isolate, fun, undefined, arraysize(args), args) | |
| 3670 .ToHandle(&result); | |
| 3671 RETURN_ON_FAILED_EXECUTION(Value); | 3669 RETURN_ON_FAILED_EXECUTION(Value); |
| 3672 RETURN_ESCAPED(Utils::ToLocal(result)); | 3670 if (!found) { |
| 3671 return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
| 3672 } |
| 3673 RETURN_ESCAPED(Utils::ToLocal(desc.ToObject(isolate))); |
| 3673 } | 3674 } |
| 3674 | 3675 |
| 3675 | 3676 |
| 3676 Local<Value> v8::Object::GetOwnPropertyDescriptor(Local<String> key) { | 3677 Local<Value> v8::Object::GetOwnPropertyDescriptor(Local<String> key) { |
| 3677 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); | 3678 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); |
| 3678 RETURN_TO_LOCAL_UNCHECKED(GetOwnPropertyDescriptor(context, key), Value); | 3679 RETURN_TO_LOCAL_UNCHECKED(GetOwnPropertyDescriptor(context, key), Value); |
| 3679 } | 3680 } |
| 3680 | 3681 |
| 3681 | 3682 |
| 3682 Local<Value> v8::Object::GetPrototype() { | 3683 Local<Value> v8::Object::GetPrototype() { |
| (...skipping 4838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8521 Address callback_address = | 8522 Address callback_address = |
| 8522 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8523 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 8523 VMState<EXTERNAL> state(isolate); | 8524 VMState<EXTERNAL> state(isolate); |
| 8524 ExternalCallbackScope call_scope(isolate, callback_address); | 8525 ExternalCallbackScope call_scope(isolate, callback_address); |
| 8525 callback(info); | 8526 callback(info); |
| 8526 } | 8527 } |
| 8527 | 8528 |
| 8528 | 8529 |
| 8529 } // namespace internal | 8530 } // namespace internal |
| 8530 } // namespace v8 | 8531 } // namespace v8 |
| OLD | NEW |