| 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 3514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3525 i::Isolate* isolate = js_object->GetIsolate(); | 3525 i::Isolate* isolate = js_object->GetIsolate(); |
| 3526 // Check if the given key is an array index. | 3526 // Check if the given key is an array index. |
| 3527 uint32_t index = 0; | 3527 uint32_t index = 0; |
| 3528 if (key->ToArrayIndex(&index)) { | 3528 if (key->ToArrayIndex(&index)) { |
| 3529 return i::JSObject::SetOwnElementIgnoreAttributes(js_object, index, value, | 3529 return i::JSObject::SetOwnElementIgnoreAttributes(js_object, index, value, |
| 3530 attrs); | 3530 attrs); |
| 3531 } | 3531 } |
| 3532 | 3532 |
| 3533 i::Handle<i::Name> name; | 3533 i::Handle<i::Name> name; |
| 3534 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, name, | 3534 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, name, |
| 3535 i::Runtime::ToName(isolate, key), | 3535 i::Object::ToName(isolate, key), |
| 3536 i::MaybeHandle<i::Object>()); | 3536 i::MaybeHandle<i::Object>()); |
| 3537 | 3537 |
| 3538 return i::JSObject::DefinePropertyOrElementIgnoreAttributes(js_object, name, | 3538 return i::JSObject::DefinePropertyOrElementIgnoreAttributes(js_object, name, |
| 3539 value, attrs); | 3539 value, attrs); |
| 3540 } | 3540 } |
| 3541 | 3541 |
| 3542 | 3542 |
| 3543 Maybe<bool> v8::Object::ForceSet(v8::Local<v8::Context> context, | 3543 Maybe<bool> v8::Object::ForceSet(v8::Local<v8::Context> context, |
| 3544 v8::Local<Value> key, v8::Local<Value> value, | 3544 v8::Local<Value> key, v8::Local<Value> value, |
| 3545 v8::PropertyAttribute attribs) { | 3545 v8::PropertyAttribute attribs) { |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3849 auto self = Utils::OpenHandle(this); | 3849 auto self = Utils::OpenHandle(this); |
| 3850 auto key_obj = Utils::OpenHandle(*key); | 3850 auto key_obj = Utils::OpenHandle(*key); |
| 3851 Maybe<bool> maybe = Nothing<bool>(); | 3851 Maybe<bool> maybe = Nothing<bool>(); |
| 3852 // Check if the given key is an array index. | 3852 // Check if the given key is an array index. |
| 3853 uint32_t index = 0; | 3853 uint32_t index = 0; |
| 3854 if (key_obj->ToArrayIndex(&index)) { | 3854 if (key_obj->ToArrayIndex(&index)) { |
| 3855 maybe = i::JSReceiver::HasElement(self, index); | 3855 maybe = i::JSReceiver::HasElement(self, index); |
| 3856 } else { | 3856 } else { |
| 3857 // Convert the key to a name - possibly by calling back into JavaScript. | 3857 // Convert the key to a name - possibly by calling back into JavaScript. |
| 3858 i::Handle<i::Name> name; | 3858 i::Handle<i::Name> name; |
| 3859 if (i::Runtime::ToName(isolate, key_obj).ToHandle(&name)) { | 3859 if (i::Object::ToName(isolate, key_obj).ToHandle(&name)) { |
| 3860 maybe = i::JSReceiver::HasProperty(self, name); | 3860 maybe = i::JSReceiver::HasProperty(self, name); |
| 3861 } | 3861 } |
| 3862 } | 3862 } |
| 3863 has_pending_exception = maybe.IsNothing(); | 3863 has_pending_exception = maybe.IsNothing(); |
| 3864 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); | 3864 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); |
| 3865 return maybe; | 3865 return maybe; |
| 3866 } | 3866 } |
| 3867 | 3867 |
| 3868 | 3868 |
| 3869 bool v8::Object::Has(v8::Local<Value> key) { | 3869 bool v8::Object::Has(v8::Local<Value> key) { |
| (...skipping 4539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8409 Address callback_address = | 8409 Address callback_address = |
| 8410 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8410 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 8411 VMState<EXTERNAL> state(isolate); | 8411 VMState<EXTERNAL> state(isolate); |
| 8412 ExternalCallbackScope call_scope(isolate, callback_address); | 8412 ExternalCallbackScope call_scope(isolate, callback_address); |
| 8413 callback(info); | 8413 callback(info); |
| 8414 } | 8414 } |
| 8415 | 8415 |
| 8416 | 8416 |
| 8417 } // namespace internal | 8417 } // namespace internal |
| 8418 } // namespace v8 | 8418 } // namespace v8 |
| OLD | NEW |