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 3508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3519 i::Handle<i::JSObject>::cast(self))) { | 3519 i::Handle<i::JSObject>::cast(self))) { |
3520 isolate->ReportFailedAccessCheck(i::Handle<i::JSObject>::cast(self)); | 3520 isolate->ReportFailedAccessCheck(i::Handle<i::JSObject>::cast(self)); |
3521 return Nothing<bool>(); | 3521 return Nothing<bool>(); |
3522 } | 3522 } |
3523 | 3523 |
3524 i::PropertyDescriptor desc; | 3524 i::PropertyDescriptor desc; |
3525 desc.set_writable(!(attributes & v8::ReadOnly)); | 3525 desc.set_writable(!(attributes & v8::ReadOnly)); |
3526 desc.set_enumerable(!(attributes & v8::DontEnum)); | 3526 desc.set_enumerable(!(attributes & v8::DontEnum)); |
3527 desc.set_configurable(!(attributes & v8::DontDelete)); | 3527 desc.set_configurable(!(attributes & v8::DontDelete)); |
3528 desc.set_value(value_obj); | 3528 desc.set_value(value_obj); |
3529 bool success = i::JSReceiver::DefineOwnProperty(isolate, self, key_obj, &desc, | 3529 Maybe<bool> success = i::JSReceiver::DefineOwnProperty( |
3530 i::Object::DONT_THROW); | 3530 isolate, self, key_obj, &desc, i::Object::DONT_THROW); |
3531 // Even though we said DONT_THROW, there might be accessors that do throw. | 3531 // Even though we said DONT_THROW, there might be accessors that do throw. |
3532 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); | 3532 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); |
3533 return Just(success); | 3533 return success; |
3534 } | 3534 } |
3535 | 3535 |
3536 | 3536 |
3537 MUST_USE_RESULT | 3537 MUST_USE_RESULT |
3538 static i::MaybeHandle<i::Object> DefineObjectProperty( | 3538 static i::MaybeHandle<i::Object> DefineObjectProperty( |
3539 i::Handle<i::JSObject> js_object, i::Handle<i::Object> key, | 3539 i::Handle<i::JSObject> js_object, i::Handle<i::Object> key, |
3540 i::Handle<i::Object> value, i::PropertyAttributes attrs) { | 3540 i::Handle<i::Object> value, i::PropertyAttributes attrs) { |
3541 i::Isolate* isolate = js_object->GetIsolate(); | 3541 i::Isolate* isolate = js_object->GetIsolate(); |
3542 bool success = false; | 3542 bool success = false; |
3543 i::LookupIterator it = i::LookupIterator::PropertyOrElement( | 3543 i::LookupIterator it = i::LookupIterator::PropertyOrElement( |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3662 | 3662 |
3663 | 3663 |
3664 MaybeLocal<Value> v8::Object::GetOwnPropertyDescriptor(Local<Context> context, | 3664 MaybeLocal<Value> v8::Object::GetOwnPropertyDescriptor(Local<Context> context, |
3665 Local<String> key) { | 3665 Local<String> key) { |
3666 PREPARE_FOR_EXECUTION(context, "v8::Object::GetOwnPropertyDescriptor()", | 3666 PREPARE_FOR_EXECUTION(context, "v8::Object::GetOwnPropertyDescriptor()", |
3667 Value); | 3667 Value); |
3668 i::Handle<i::JSReceiver> obj = Utils::OpenHandle(this); | 3668 i::Handle<i::JSReceiver> obj = Utils::OpenHandle(this); |
3669 i::Handle<i::String> key_name = Utils::OpenHandle(*key); | 3669 i::Handle<i::String> key_name = Utils::OpenHandle(*key); |
3670 | 3670 |
3671 i::PropertyDescriptor desc; | 3671 i::PropertyDescriptor desc; |
3672 bool found = | 3672 Maybe<bool> found = |
3673 i::JSReceiver::GetOwnPropertyDescriptor(isolate, obj, key_name, &desc); | 3673 i::JSReceiver::GetOwnPropertyDescriptor(isolate, obj, key_name, &desc); |
3674 has_pending_exception = isolate->has_pending_exception(); | 3674 has_pending_exception = found.IsNothing(); |
3675 RETURN_ON_FAILED_EXECUTION(Value); | 3675 RETURN_ON_FAILED_EXECUTION(Value); |
3676 if (!found) { | 3676 if (!found.FromJust()) { |
3677 return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); | 3677 return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
3678 } | 3678 } |
3679 RETURN_ESCAPED(Utils::ToLocal(desc.ToObject(isolate))); | 3679 RETURN_ESCAPED(Utils::ToLocal(desc.ToObject(isolate))); |
3680 } | 3680 } |
3681 | 3681 |
3682 | 3682 |
3683 Local<Value> v8::Object::GetOwnPropertyDescriptor(Local<String> key) { | 3683 Local<Value> v8::Object::GetOwnPropertyDescriptor(Local<String> key) { |
3684 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); | 3684 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); |
3685 RETURN_TO_LOCAL_UNCHECKED(GetOwnPropertyDescriptor(context, key), Value); | 3685 RETURN_TO_LOCAL_UNCHECKED(GetOwnPropertyDescriptor(context, key), Value); |
3686 } | 3686 } |
(...skipping 4846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8533 Address callback_address = | 8533 Address callback_address = |
8534 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8534 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8535 VMState<EXTERNAL> state(isolate); | 8535 VMState<EXTERNAL> state(isolate); |
8536 ExternalCallbackScope call_scope(isolate, callback_address); | 8536 ExternalCallbackScope call_scope(isolate, callback_address); |
8537 callback(info); | 8537 callback(info); |
8538 } | 8538 } |
8539 | 8539 |
8540 | 8540 |
8541 } // namespace internal | 8541 } // namespace internal |
8542 } // namespace v8 | 8542 } // namespace v8 |
OLD | NEW |