| 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 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); | 3519 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); |
| 3520 return Just(result->BooleanValue()); | 3520 return Just(result->BooleanValue()); |
| 3521 } | 3521 } |
| 3522 | 3522 |
| 3523 | 3523 |
| 3524 MUST_USE_RESULT | 3524 MUST_USE_RESULT |
| 3525 static i::MaybeHandle<i::Object> DefineObjectProperty( | 3525 static i::MaybeHandle<i::Object> DefineObjectProperty( |
| 3526 i::Handle<i::JSObject> js_object, i::Handle<i::Object> key, | 3526 i::Handle<i::JSObject> js_object, i::Handle<i::Object> key, |
| 3527 i::Handle<i::Object> value, PropertyAttributes attrs) { | 3527 i::Handle<i::Object> value, PropertyAttributes attrs) { |
| 3528 i::Isolate* isolate = js_object->GetIsolate(); | 3528 i::Isolate* isolate = js_object->GetIsolate(); |
| 3529 // Check if the given key is an array index. | 3529 bool success = false; |
| 3530 uint32_t index = 0; | 3530 i::LookupIterator it = i::LookupIterator::PropertyOrElement( |
| 3531 if (key->ToArrayIndex(&index)) { | 3531 isolate, js_object, key, &success, i::LookupIterator::OWN); |
| 3532 return i::JSObject::SetOwnElementIgnoreAttributes(js_object, index, value, | 3532 if (!success) return i::MaybeHandle<i::Object>(); |
| 3533 attrs); | |
| 3534 } | |
| 3535 | 3533 |
| 3536 i::Handle<i::Name> name; | 3534 return i::JSObject::DefineOwnPropertyIgnoreAttributes(&it, value, attrs); |
| 3537 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, name, | |
| 3538 i::Object::ToName(isolate, key), | |
| 3539 i::MaybeHandle<i::Object>()); | |
| 3540 | |
| 3541 return i::JSObject::DefinePropertyOrElementIgnoreAttributes(js_object, name, | |
| 3542 value, attrs); | |
| 3543 } | 3535 } |
| 3544 | 3536 |
| 3545 | 3537 |
| 3546 Maybe<bool> v8::Object::ForceSet(v8::Local<v8::Context> context, | 3538 Maybe<bool> v8::Object::ForceSet(v8::Local<v8::Context> context, |
| 3547 v8::Local<Value> key, v8::Local<Value> value, | 3539 v8::Local<Value> key, v8::Local<Value> value, |
| 3548 v8::PropertyAttribute attribs) { | 3540 v8::PropertyAttribute attribs) { |
| 3549 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "v8::Object::Set()", bool); | 3541 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "v8::Object::Set()", bool); |
| 3550 auto self = Utils::OpenHandle(this); | 3542 auto self = Utils::OpenHandle(this); |
| 3551 auto key_obj = Utils::OpenHandle(*key); | 3543 auto key_obj = Utils::OpenHandle(*key); |
| 3552 auto value_obj = Utils::OpenHandle(*value); | 3544 auto value_obj = Utils::OpenHandle(*value); |
| (...skipping 4825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8378 Address callback_address = | 8370 Address callback_address = |
| 8379 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8371 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 8380 VMState<EXTERNAL> state(isolate); | 8372 VMState<EXTERNAL> state(isolate); |
| 8381 ExternalCallbackScope call_scope(isolate, callback_address); | 8373 ExternalCallbackScope call_scope(isolate, callback_address); |
| 8382 callback(info); | 8374 callback(info); |
| 8383 } | 8375 } |
| 8384 | 8376 |
| 8385 | 8377 |
| 8386 } // namespace internal | 8378 } // namespace internal |
| 8387 } // namespace v8 | 8379 } // namespace v8 |
| OLD | NEW |