| 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 3467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3478 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); | 3478 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); |
| 3479 return Set(context, key, value).FromMaybe(false); | 3479 return Set(context, key, value).FromMaybe(false); |
| 3480 } | 3480 } |
| 3481 | 3481 |
| 3482 | 3482 |
| 3483 Maybe<bool> v8::Object::Set(v8::Local<v8::Context> context, uint32_t index, | 3483 Maybe<bool> v8::Object::Set(v8::Local<v8::Context> context, uint32_t index, |
| 3484 v8::Local<Value> value) { | 3484 v8::Local<Value> value) { |
| 3485 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "v8::Object::Set()", bool); | 3485 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "v8::Object::Set()", bool); |
| 3486 auto self = Utils::OpenHandle(this); | 3486 auto self = Utils::OpenHandle(this); |
| 3487 auto value_obj = Utils::OpenHandle(*value); | 3487 auto value_obj = Utils::OpenHandle(*value); |
| 3488 has_pending_exception = i::JSObject::SetElement( | 3488 has_pending_exception = |
| 3489 self, index, value_obj, NONE, i::SLOPPY).is_null(); | 3489 i::JSReceiver::SetElement(self, index, value_obj, i::SLOPPY).is_null(); |
| 3490 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); | 3490 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); |
| 3491 return Just(true); | 3491 return Just(true); |
| 3492 } | 3492 } |
| 3493 | 3493 |
| 3494 | 3494 |
| 3495 bool v8::Object::Set(uint32_t index, v8::Handle<Value> value) { | 3495 bool v8::Object::Set(uint32_t index, v8::Handle<Value> value) { |
| 3496 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); | 3496 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); |
| 3497 return Set(context, index, value).FromMaybe(false); | 3497 return Set(context, index, value).FromMaybe(false); |
| 3498 } | 3498 } |
| 3499 | 3499 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 3526 // to create a configurable property, so we just fail here. | 3526 // to create a configurable property, so we just fail here. |
| 3527 return Just(false); | 3527 return Just(false); |
| 3528 } | 3528 } |
| 3529 | 3529 |
| 3530 i::LookupIterator it(self, key_obj, i::LookupIterator::OWN_SKIP_INTERCEPTOR); | 3530 i::LookupIterator it(self, key_obj, i::LookupIterator::OWN_SKIP_INTERCEPTOR); |
| 3531 if (it.IsFound() && it.state() == i::LookupIterator::ACCESS_CHECK) { | 3531 if (it.IsFound() && it.state() == i::LookupIterator::ACCESS_CHECK) { |
| 3532 DCHECK(isolate->MayAccess(self)); | 3532 DCHECK(isolate->MayAccess(self)); |
| 3533 it.Next(); | 3533 it.Next(); |
| 3534 } | 3534 } |
| 3535 | 3535 |
| 3536 if (it.state() == i::LookupIterator::DATA || | 3536 if (it.IsFound() && !it.IsConfigurable()) return Just(false); |
| 3537 it.state() == i::LookupIterator::ACCESSOR) { | |
| 3538 if (!it.IsConfigurable()) return Just(false); | |
| 3539 | |
| 3540 if (it.state() == i::LookupIterator::ACCESSOR) { | |
| 3541 has_pending_exception = i::JSObject::SetOwnPropertyIgnoreAttributes( | |
| 3542 self, key_obj, value_obj, NONE, | |
| 3543 i::JSObject::DONT_FORCE_FIELD).is_null(); | |
| 3544 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); | |
| 3545 return Just(true); | |
| 3546 } | |
| 3547 } | |
| 3548 | 3537 |
| 3549 has_pending_exception = i::Runtime::DefineObjectProperty( | 3538 has_pending_exception = i::Runtime::DefineObjectProperty( |
| 3550 self, key_obj, value_obj, NONE).is_null(); | 3539 self, key_obj, value_obj, NONE).is_null(); |
| 3551 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); | 3540 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); |
| 3552 return Just(true); | 3541 return Just(true); |
| 3553 } | 3542 } |
| 3554 | 3543 |
| 3555 | 3544 |
| 3556 Maybe<bool> v8::Object::CreateDataProperty(v8::Local<v8::Context> context, | 3545 Maybe<bool> v8::Object::CreateDataProperty(v8::Local<v8::Context> context, |
| 3557 uint32_t index, | 3546 uint32_t index, |
| (...skipping 4870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8428 Address callback_address = | 8417 Address callback_address = |
| 8429 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8418 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 8430 VMState<EXTERNAL> state(isolate); | 8419 VMState<EXTERNAL> state(isolate); |
| 8431 ExternalCallbackScope call_scope(isolate, callback_address); | 8420 ExternalCallbackScope call_scope(isolate, callback_address); |
| 8432 callback(info); | 8421 callback(info); |
| 8433 } | 8422 } |
| 8434 | 8423 |
| 8435 | 8424 |
| 8436 } // namespace internal | 8425 } // namespace internal |
| 8437 } // namespace v8 | 8426 } // namespace v8 |
| OLD | NEW |