| 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 3739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3750 EXCEPTION_PREAMBLE(it->isolate()); | 3750 EXCEPTION_PREAMBLE(it->isolate()); |
| 3751 i::Handle<i::Object> result; | 3751 i::Handle<i::Object> result; |
| 3752 has_pending_exception = !i::Object::GetProperty(it).ToHandle(&result); | 3752 has_pending_exception = !i::Object::GetProperty(it).ToHandle(&result); |
| 3753 EXCEPTION_BAILOUT_CHECK(it->isolate(), Local<Value>()); | 3753 EXCEPTION_BAILOUT_CHECK(it->isolate(), Local<Value>()); |
| 3754 | 3754 |
| 3755 if (it->IsFound()) return Utils::ToLocal(result); | 3755 if (it->IsFound()) return Utils::ToLocal(result); |
| 3756 return Local<Value>(); | 3756 return Local<Value>(); |
| 3757 } | 3757 } |
| 3758 | 3758 |
| 3759 | 3759 |
| 3760 static Maybe<PropertyAttribute> GetPropertyAttributesByLookup( |
| 3761 i::LookupIterator* it) { |
| 3762 Maybe<PropertyAttributes> attr = i::JSReceiver::GetPropertyAttributes(it); |
| 3763 if (!it->IsFound()) return Maybe<PropertyAttribute>(); |
| 3764 return Maybe<PropertyAttribute>(static_cast<PropertyAttribute>(attr.value)); |
| 3765 } |
| 3766 |
| 3767 |
| 3760 Local<Value> v8::Object::GetRealNamedPropertyInPrototypeChain( | 3768 Local<Value> v8::Object::GetRealNamedPropertyInPrototypeChain( |
| 3761 Handle<String> key) { | 3769 Handle<String> key) { |
| 3762 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3770 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3763 ON_BAILOUT(isolate, | 3771 ON_BAILOUT(isolate, |
| 3764 "v8::Object::GetRealNamedPropertyInPrototypeChain()", | 3772 "v8::Object::GetRealNamedPropertyInPrototypeChain()", |
| 3765 return Local<Value>()); | 3773 return Local<Value>()); |
| 3766 ENTER_V8(isolate); | 3774 ENTER_V8(isolate); |
| 3767 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this); | 3775 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this); |
| 3768 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); | 3776 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); |
| 3769 i::PrototypeIterator iter(isolate, self_obj); | 3777 i::PrototypeIterator iter(isolate, self_obj); |
| 3770 if (iter.IsAtEnd()) return Local<Value>(); | 3778 if (iter.IsAtEnd()) return Local<Value>(); |
| 3771 i::Handle<i::Object> proto = i::PrototypeIterator::GetCurrent(iter); | 3779 i::Handle<i::Object> proto = i::PrototypeIterator::GetCurrent(iter); |
| 3772 i::LookupIterator it(self_obj, key_obj, i::Handle<i::JSReceiver>::cast(proto), | 3780 i::LookupIterator it(self_obj, key_obj, i::Handle<i::JSReceiver>::cast(proto), |
| 3773 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); | 3781 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); |
| 3774 return GetPropertyByLookup(&it); | 3782 return GetPropertyByLookup(&it); |
| 3775 } | 3783 } |
| 3776 | 3784 |
| 3777 | 3785 |
| 3786 Maybe<PropertyAttribute> |
| 3787 v8::Object::GetRealNamedPropertyAttributesInPrototypeChain(Handle<String> key) { |
| 3788 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3789 ON_BAILOUT(isolate, |
| 3790 "v8::Object::GetRealNamedPropertyAttributesInPrototypeChain()", |
| 3791 return Maybe<PropertyAttribute>()); |
| 3792 ENTER_V8(isolate); |
| 3793 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this); |
| 3794 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); |
| 3795 i::PrototypeIterator iter(isolate, self_obj); |
| 3796 if (iter.IsAtEnd()) return Maybe<PropertyAttribute>(); |
| 3797 i::Handle<i::Object> proto = i::PrototypeIterator::GetCurrent(iter); |
| 3798 i::LookupIterator it(self_obj, key_obj, i::Handle<i::JSReceiver>::cast(proto), |
| 3799 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); |
| 3800 return GetPropertyAttributesByLookup(&it); |
| 3801 } |
| 3802 |
| 3803 |
| 3778 Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) { | 3804 Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) { |
| 3779 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3805 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3780 ON_BAILOUT(isolate, "v8::Object::GetRealNamedProperty()", | 3806 ON_BAILOUT(isolate, "v8::Object::GetRealNamedProperty()", |
| 3781 return Local<Value>()); | 3807 return Local<Value>()); |
| 3782 ENTER_V8(isolate); | 3808 ENTER_V8(isolate); |
| 3783 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this); | 3809 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this); |
| 3784 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); | 3810 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); |
| 3785 i::LookupIterator it(self_obj, key_obj, | 3811 i::LookupIterator it(self_obj, key_obj, |
| 3786 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); | 3812 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); |
| 3787 return GetPropertyByLookup(&it); | 3813 return GetPropertyByLookup(&it); |
| 3788 } | 3814 } |
| 3789 | 3815 |
| 3790 | 3816 |
| 3817 Maybe<PropertyAttribute> v8::Object::GetRealNamedPropertyAttributes( |
| 3818 Handle<String> key) { |
| 3819 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3820 ON_BAILOUT(isolate, "v8::Object::GetRealNamedPropertyAttributes()", |
| 3821 return Maybe<PropertyAttribute>()); |
| 3822 ENTER_V8(isolate); |
| 3823 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this); |
| 3824 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); |
| 3825 i::LookupIterator it(self_obj, key_obj, |
| 3826 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); |
| 3827 return GetPropertyAttributesByLookup(&it); |
| 3828 } |
| 3829 |
| 3830 |
| 3791 // Turns on access checks by copying the map and setting the check flag. | 3831 // Turns on access checks by copying the map and setting the check flag. |
| 3792 // Because the object gets a new map, existing inline cache caching | 3832 // Because the object gets a new map, existing inline cache caching |
| 3793 // the old map of this object will fail. | 3833 // the old map of this object will fail. |
| 3794 void v8::Object::TurnOnAccessCheck() { | 3834 void v8::Object::TurnOnAccessCheck() { |
| 3795 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3835 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3796 ON_BAILOUT(isolate, "v8::Object::TurnOnAccessCheck()", return); | 3836 ON_BAILOUT(isolate, "v8::Object::TurnOnAccessCheck()", return); |
| 3797 ENTER_V8(isolate); | 3837 ENTER_V8(isolate); |
| 3798 i::HandleScope scope(isolate); | 3838 i::HandleScope scope(isolate); |
| 3799 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); | 3839 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); |
| 3800 | 3840 |
| (...skipping 3982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7783 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7823 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7784 Address callback_address = | 7824 Address callback_address = |
| 7785 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7825 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7786 VMState<EXTERNAL> state(isolate); | 7826 VMState<EXTERNAL> state(isolate); |
| 7787 ExternalCallbackScope call_scope(isolate, callback_address); | 7827 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7788 callback(info); | 7828 callback(info); |
| 7789 } | 7829 } |
| 7790 | 7830 |
| 7791 | 7831 |
| 7792 } } // namespace v8::internal | 7832 } } // namespace v8::internal |
| OLD | NEW |