| 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 3990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4001 Local<Context> context, Local<Name> key) { | 4001 Local<Context> context, Local<Name> key) { |
| 4002 PREPARE_FOR_EXECUTION( | 4002 PREPARE_FOR_EXECUTION( |
| 4003 context, "v8::Object::GetRealNamedPropertyInPrototypeChain()", Value); | 4003 context, "v8::Object::GetRealNamedPropertyInPrototypeChain()", Value); |
| 4004 auto self = Utils::OpenHandle(this); | 4004 auto self = Utils::OpenHandle(this); |
| 4005 auto key_obj = Utils::OpenHandle(*key); | 4005 auto key_obj = Utils::OpenHandle(*key); |
| 4006 i::PrototypeIterator iter(isolate, self); | 4006 i::PrototypeIterator iter(isolate, self); |
| 4007 if (iter.IsAtEnd()) return MaybeLocal<Value>(); | 4007 if (iter.IsAtEnd()) return MaybeLocal<Value>(); |
| 4008 auto proto = i::PrototypeIterator::GetCurrent(iter); | 4008 auto proto = i::PrototypeIterator::GetCurrent(iter); |
| 4009 i::LookupIterator it(self, key_obj, i::Handle<i::JSReceiver>::cast(proto), | 4009 i::LookupIterator it(self, key_obj, i::Handle<i::JSReceiver>::cast(proto), |
| 4010 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); | 4010 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); |
| 4011 if (!it.IsFound()) return MaybeLocal<Value>(); | |
| 4012 Local<Value> result; | 4011 Local<Value> result; |
| 4013 has_pending_exception = !ToLocal<Value>(i::Object::GetProperty(&it), &result); | 4012 has_pending_exception = !ToLocal<Value>(i::Object::GetProperty(&it), &result); |
| 4014 RETURN_ON_FAILED_EXECUTION(Value); | 4013 RETURN_ON_FAILED_EXECUTION(Value); |
| 4014 if (!it.IsFound()) return MaybeLocal<Value>(); |
| 4015 RETURN_ESCAPED(result); | 4015 RETURN_ESCAPED(result); |
| 4016 } | 4016 } |
| 4017 | 4017 |
| 4018 | 4018 |
| 4019 Local<Value> v8::Object::GetRealNamedPropertyInPrototypeChain( | 4019 Local<Value> v8::Object::GetRealNamedPropertyInPrototypeChain( |
| 4020 Handle<String> key) { | 4020 Handle<String> key) { |
| 4021 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); | 4021 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); |
| 4022 RETURN_TO_LOCAL_UNCHECKED(GetRealNamedPropertyInPrototypeChain(context, key), | 4022 RETURN_TO_LOCAL_UNCHECKED(GetRealNamedPropertyInPrototypeChain(context, key), |
| 4023 Value); | 4023 Value); |
| 4024 } | 4024 } |
| 4025 | 4025 |
| 4026 | 4026 |
| 4027 Maybe<PropertyAttribute> | 4027 Maybe<PropertyAttribute> |
| 4028 v8::Object::GetRealNamedPropertyAttributesInPrototypeChain( | 4028 v8::Object::GetRealNamedPropertyAttributesInPrototypeChain( |
| 4029 Local<Context> context, Local<Name> key) { | 4029 Local<Context> context, Local<Name> key) { |
| 4030 PREPARE_FOR_EXECUTION_PRIMITIVE( | 4030 PREPARE_FOR_EXECUTION_PRIMITIVE( |
| 4031 context, "v8::Object::GetRealNamedPropertyAttributesInPrototypeChain()", | 4031 context, "v8::Object::GetRealNamedPropertyAttributesInPrototypeChain()", |
| 4032 PropertyAttribute); | 4032 PropertyAttribute); |
| 4033 auto self = Utils::OpenHandle(this); | 4033 auto self = Utils::OpenHandle(this); |
| 4034 auto key_obj = Utils::OpenHandle(*key); | 4034 auto key_obj = Utils::OpenHandle(*key); |
| 4035 i::PrototypeIterator iter(isolate, self); | 4035 i::PrototypeIterator iter(isolate, self); |
| 4036 if (iter.IsAtEnd()) return Nothing<PropertyAttribute>(); | 4036 if (iter.IsAtEnd()) return Nothing<PropertyAttribute>(); |
| 4037 auto proto = i::PrototypeIterator::GetCurrent(iter); | 4037 auto proto = i::PrototypeIterator::GetCurrent(iter); |
| 4038 i::LookupIterator it(self, key_obj, i::Handle<i::JSReceiver>::cast(proto), | 4038 i::LookupIterator it(self, key_obj, i::Handle<i::JSReceiver>::cast(proto), |
| 4039 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); | 4039 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); |
| 4040 if (!it.IsFound()) return Nothing<PropertyAttribute>(); | |
| 4041 auto result = i::JSReceiver::GetPropertyAttributes(&it); | 4040 auto result = i::JSReceiver::GetPropertyAttributes(&it); |
| 4042 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(PropertyAttribute); | 4041 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(PropertyAttribute); |
| 4042 if (!it.IsFound()) return Nothing<PropertyAttribute>(); |
| 4043 if (result.FromJust() == ABSENT) { | 4043 if (result.FromJust() == ABSENT) { |
| 4044 return Just(static_cast<PropertyAttribute>(NONE)); | 4044 return Just(static_cast<PropertyAttribute>(NONE)); |
| 4045 } | 4045 } |
| 4046 return Just<PropertyAttribute>( | 4046 return Just<PropertyAttribute>( |
| 4047 static_cast<PropertyAttribute>(result.FromJust())); | 4047 static_cast<PropertyAttribute>(result.FromJust())); |
| 4048 } | 4048 } |
| 4049 | 4049 |
| 4050 | 4050 |
| 4051 Maybe<PropertyAttribute> | 4051 Maybe<PropertyAttribute> |
| 4052 v8::Object::GetRealNamedPropertyAttributesInPrototypeChain(Handle<String> key) { | 4052 v8::Object::GetRealNamedPropertyAttributesInPrototypeChain(Handle<String> key) { |
| 4053 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); | 4053 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); |
| 4054 return GetRealNamedPropertyAttributesInPrototypeChain(context, key); | 4054 return GetRealNamedPropertyAttributesInPrototypeChain(context, key); |
| 4055 } | 4055 } |
| 4056 | 4056 |
| 4057 | 4057 |
| 4058 MaybeLocal<Value> v8::Object::GetRealNamedProperty(Local<Context> context, | 4058 MaybeLocal<Value> v8::Object::GetRealNamedProperty(Local<Context> context, |
| 4059 Local<Name> key) { | 4059 Local<Name> key) { |
| 4060 PREPARE_FOR_EXECUTION( | 4060 PREPARE_FOR_EXECUTION(context, "v8::Object::GetRealNamedProperty()", Value); |
| 4061 context, "v8::Object::GetRealNamedPropertyInPrototypeChain()", Value); | |
| 4062 auto self = Utils::OpenHandle(this); | 4061 auto self = Utils::OpenHandle(this); |
| 4063 auto key_obj = Utils::OpenHandle(*key); | 4062 auto key_obj = Utils::OpenHandle(*key); |
| 4064 i::LookupIterator it(self, key_obj, | 4063 i::LookupIterator it(self, key_obj, |
| 4065 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); | 4064 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); |
| 4066 if (!it.IsFound()) return MaybeLocal<Value>(); | |
| 4067 Local<Value> result; | 4065 Local<Value> result; |
| 4068 has_pending_exception = !ToLocal<Value>(i::Object::GetProperty(&it), &result); | 4066 has_pending_exception = !ToLocal<Value>(i::Object::GetProperty(&it), &result); |
| 4069 RETURN_ON_FAILED_EXECUTION(Value); | 4067 RETURN_ON_FAILED_EXECUTION(Value); |
| 4068 if (!it.IsFound()) return MaybeLocal<Value>(); |
| 4070 RETURN_ESCAPED(result); | 4069 RETURN_ESCAPED(result); |
| 4071 } | 4070 } |
| 4072 | 4071 |
| 4073 | 4072 |
| 4074 Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) { | 4073 Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) { |
| 4075 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); | 4074 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); |
| 4076 RETURN_TO_LOCAL_UNCHECKED(GetRealNamedProperty(context, key), Value); | 4075 RETURN_TO_LOCAL_UNCHECKED(GetRealNamedProperty(context, key), Value); |
| 4077 } | 4076 } |
| 4078 | 4077 |
| 4079 | 4078 |
| 4080 Maybe<PropertyAttribute> v8::Object::GetRealNamedPropertyAttributes( | 4079 Maybe<PropertyAttribute> v8::Object::GetRealNamedPropertyAttributes( |
| 4081 Local<Context> context, Local<Name> key) { | 4080 Local<Context> context, Local<Name> key) { |
| 4082 PREPARE_FOR_EXECUTION_PRIMITIVE( | 4081 PREPARE_FOR_EXECUTION_PRIMITIVE( |
| 4083 context, "v8::Object::GetRealNamedPropertyAttributes()", | 4082 context, "v8::Object::GetRealNamedPropertyAttributes()", |
| 4084 PropertyAttribute); | 4083 PropertyAttribute); |
| 4085 auto self = Utils::OpenHandle(this); | 4084 auto self = Utils::OpenHandle(this); |
| 4086 auto key_obj = Utils::OpenHandle(*key); | 4085 auto key_obj = Utils::OpenHandle(*key); |
| 4087 i::LookupIterator it(self, key_obj, | 4086 i::LookupIterator it(self, key_obj, |
| 4088 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); | 4087 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); |
| 4089 if (!it.IsFound()) return Nothing<PropertyAttribute>(); | |
| 4090 auto result = i::JSReceiver::GetPropertyAttributes(&it); | 4088 auto result = i::JSReceiver::GetPropertyAttributes(&it); |
| 4091 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(PropertyAttribute); | 4089 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(PropertyAttribute); |
| 4090 if (!it.IsFound()) return Nothing<PropertyAttribute>(); |
| 4092 if (result.FromJust() == ABSENT) { | 4091 if (result.FromJust() == ABSENT) { |
| 4093 return Just(static_cast<PropertyAttribute>(NONE)); | 4092 return Just(static_cast<PropertyAttribute>(NONE)); |
| 4094 } | 4093 } |
| 4095 return Just<PropertyAttribute>( | 4094 return Just<PropertyAttribute>( |
| 4096 static_cast<PropertyAttribute>(result.FromJust())); | 4095 static_cast<PropertyAttribute>(result.FromJust())); |
| 4097 } | 4096 } |
| 4098 | 4097 |
| 4099 | 4098 |
| 4100 Maybe<PropertyAttribute> v8::Object::GetRealNamedPropertyAttributes( | 4099 Maybe<PropertyAttribute> v8::Object::GetRealNamedPropertyAttributes( |
| 4101 Handle<String> key) { | 4100 Handle<String> key) { |
| (...skipping 4010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8112 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 8111 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 8113 Address callback_address = | 8112 Address callback_address = |
| 8114 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8113 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 8115 VMState<EXTERNAL> state(isolate); | 8114 VMState<EXTERNAL> state(isolate); |
| 8116 ExternalCallbackScope call_scope(isolate, callback_address); | 8115 ExternalCallbackScope call_scope(isolate, callback_address); |
| 8117 callback(info); | 8116 callback(info); |
| 8118 } | 8117 } |
| 8119 | 8118 |
| 8120 | 8119 |
| 8121 } } // namespace v8::internal | 8120 } } // namespace v8::internal |
| OLD | NEW |