| 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 4016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4027 Local<Context> context, Local<Name> key) { | 4027 Local<Context> context, Local<Name> key) { |
| 4028 PREPARE_FOR_EXECUTION( | 4028 PREPARE_FOR_EXECUTION( |
| 4029 context, "v8::Object::GetRealNamedPropertyInPrototypeChain()", Value); | 4029 context, "v8::Object::GetRealNamedPropertyInPrototypeChain()", Value); |
| 4030 auto self = Utils::OpenHandle(this); | 4030 auto self = Utils::OpenHandle(this); |
| 4031 auto key_obj = Utils::OpenHandle(*key); | 4031 auto key_obj = Utils::OpenHandle(*key); |
| 4032 i::PrototypeIterator iter(isolate, self); | 4032 i::PrototypeIterator iter(isolate, self); |
| 4033 if (iter.IsAtEnd()) return MaybeLocal<Value>(); | 4033 if (iter.IsAtEnd()) return MaybeLocal<Value>(); |
| 4034 auto proto = i::PrototypeIterator::GetCurrent(iter); | 4034 auto proto = i::PrototypeIterator::GetCurrent(iter); |
| 4035 i::LookupIterator it(self, key_obj, i::Handle<i::JSReceiver>::cast(proto), | 4035 i::LookupIterator it(self, key_obj, i::Handle<i::JSReceiver>::cast(proto), |
| 4036 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); | 4036 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); |
| 4037 if (!it.IsFound()) return MaybeLocal<Value>(); | |
| 4038 Local<Value> result; | 4037 Local<Value> result; |
| 4039 has_pending_exception = !ToLocal<Value>(i::Object::GetProperty(&it), &result); | 4038 has_pending_exception = !ToLocal<Value>(i::Object::GetProperty(&it), &result); |
| 4040 RETURN_ON_FAILED_EXECUTION(Value); | 4039 RETURN_ON_FAILED_EXECUTION(Value); |
| 4040 if (!it.IsFound()) return MaybeLocal<Value>(); |
| 4041 RETURN_ESCAPED(result); | 4041 RETURN_ESCAPED(result); |
| 4042 } | 4042 } |
| 4043 | 4043 |
| 4044 | 4044 |
| 4045 Local<Value> v8::Object::GetRealNamedPropertyInPrototypeChain( | 4045 Local<Value> v8::Object::GetRealNamedPropertyInPrototypeChain( |
| 4046 Handle<String> key) { | 4046 Handle<String> key) { |
| 4047 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); | 4047 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); |
| 4048 RETURN_TO_LOCAL_UNCHECKED(GetRealNamedPropertyInPrototypeChain(context, key), | 4048 RETURN_TO_LOCAL_UNCHECKED(GetRealNamedPropertyInPrototypeChain(context, key), |
| 4049 Value); | 4049 Value); |
| 4050 } | 4050 } |
| 4051 | 4051 |
| 4052 | 4052 |
| 4053 Maybe<PropertyAttribute> | 4053 Maybe<PropertyAttribute> |
| 4054 v8::Object::GetRealNamedPropertyAttributesInPrototypeChain( | 4054 v8::Object::GetRealNamedPropertyAttributesInPrototypeChain( |
| 4055 Local<Context> context, Local<Name> key) { | 4055 Local<Context> context, Local<Name> key) { |
| 4056 PREPARE_FOR_EXECUTION_PRIMITIVE( | 4056 PREPARE_FOR_EXECUTION_PRIMITIVE( |
| 4057 context, "v8::Object::GetRealNamedPropertyAttributesInPrototypeChain()", | 4057 context, "v8::Object::GetRealNamedPropertyAttributesInPrototypeChain()", |
| 4058 PropertyAttribute); | 4058 PropertyAttribute); |
| 4059 auto self = Utils::OpenHandle(this); | 4059 auto self = Utils::OpenHandle(this); |
| 4060 auto key_obj = Utils::OpenHandle(*key); | 4060 auto key_obj = Utils::OpenHandle(*key); |
| 4061 i::PrototypeIterator iter(isolate, self); | 4061 i::PrototypeIterator iter(isolate, self); |
| 4062 if (iter.IsAtEnd()) return Nothing<PropertyAttribute>(); | 4062 if (iter.IsAtEnd()) return Nothing<PropertyAttribute>(); |
| 4063 auto proto = i::PrototypeIterator::GetCurrent(iter); | 4063 auto proto = i::PrototypeIterator::GetCurrent(iter); |
| 4064 i::LookupIterator it(self, key_obj, i::Handle<i::JSReceiver>::cast(proto), | 4064 i::LookupIterator it(self, key_obj, i::Handle<i::JSReceiver>::cast(proto), |
| 4065 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); | 4065 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); |
| 4066 if (!it.IsFound()) return Nothing<PropertyAttribute>(); | |
| 4067 auto result = i::JSReceiver::GetPropertyAttributes(&it); | 4066 auto result = i::JSReceiver::GetPropertyAttributes(&it); |
| 4068 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(PropertyAttribute); | 4067 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(PropertyAttribute); |
| 4068 if (!it.IsFound()) return Nothing<PropertyAttribute>(); |
| 4069 if (result.FromJust() == ABSENT) { | 4069 if (result.FromJust() == ABSENT) { |
| 4070 return Just(static_cast<PropertyAttribute>(NONE)); | 4070 return Just(static_cast<PropertyAttribute>(NONE)); |
| 4071 } | 4071 } |
| 4072 return Just<PropertyAttribute>( | 4072 return Just<PropertyAttribute>( |
| 4073 static_cast<PropertyAttribute>(result.FromJust())); | 4073 static_cast<PropertyAttribute>(result.FromJust())); |
| 4074 } | 4074 } |
| 4075 | 4075 |
| 4076 | 4076 |
| 4077 Maybe<PropertyAttribute> | 4077 Maybe<PropertyAttribute> |
| 4078 v8::Object::GetRealNamedPropertyAttributesInPrototypeChain(Handle<String> key) { | 4078 v8::Object::GetRealNamedPropertyAttributesInPrototypeChain(Handle<String> key) { |
| 4079 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); | 4079 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); |
| 4080 return GetRealNamedPropertyAttributesInPrototypeChain(context, key); | 4080 return GetRealNamedPropertyAttributesInPrototypeChain(context, key); |
| 4081 } | 4081 } |
| 4082 | 4082 |
| 4083 | 4083 |
| 4084 MaybeLocal<Value> v8::Object::GetRealNamedProperty(Local<Context> context, | 4084 MaybeLocal<Value> v8::Object::GetRealNamedProperty(Local<Context> context, |
| 4085 Local<Name> key) { | 4085 Local<Name> key) { |
| 4086 PREPARE_FOR_EXECUTION( | 4086 PREPARE_FOR_EXECUTION(context, "v8::Object::GetRealNamedProperty()", Value); |
| 4087 context, "v8::Object::GetRealNamedPropertyInPrototypeChain()", Value); | |
| 4088 auto self = Utils::OpenHandle(this); | 4087 auto self = Utils::OpenHandle(this); |
| 4089 auto key_obj = Utils::OpenHandle(*key); | 4088 auto key_obj = Utils::OpenHandle(*key); |
| 4090 i::LookupIterator it(self, key_obj, | 4089 i::LookupIterator it(self, key_obj, |
| 4091 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); | 4090 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); |
| 4092 if (!it.IsFound()) return MaybeLocal<Value>(); | |
| 4093 Local<Value> result; | 4091 Local<Value> result; |
| 4094 has_pending_exception = !ToLocal<Value>(i::Object::GetProperty(&it), &result); | 4092 has_pending_exception = !ToLocal<Value>(i::Object::GetProperty(&it), &result); |
| 4095 RETURN_ON_FAILED_EXECUTION(Value); | 4093 RETURN_ON_FAILED_EXECUTION(Value); |
| 4094 if (!it.IsFound()) return MaybeLocal<Value>(); |
| 4096 RETURN_ESCAPED(result); | 4095 RETURN_ESCAPED(result); |
| 4097 } | 4096 } |
| 4098 | 4097 |
| 4099 | 4098 |
| 4100 Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) { | 4099 Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) { |
| 4101 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); | 4100 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); |
| 4102 RETURN_TO_LOCAL_UNCHECKED(GetRealNamedProperty(context, key), Value); | 4101 RETURN_TO_LOCAL_UNCHECKED(GetRealNamedProperty(context, key), Value); |
| 4103 } | 4102 } |
| 4104 | 4103 |
| 4105 | 4104 |
| 4106 Maybe<PropertyAttribute> v8::Object::GetRealNamedPropertyAttributes( | 4105 Maybe<PropertyAttribute> v8::Object::GetRealNamedPropertyAttributes( |
| 4107 Local<Context> context, Local<Name> key) { | 4106 Local<Context> context, Local<Name> key) { |
| 4108 PREPARE_FOR_EXECUTION_PRIMITIVE( | 4107 PREPARE_FOR_EXECUTION_PRIMITIVE( |
| 4109 context, "v8::Object::GetRealNamedPropertyAttributes()", | 4108 context, "v8::Object::GetRealNamedPropertyAttributes()", |
| 4110 PropertyAttribute); | 4109 PropertyAttribute); |
| 4111 auto self = Utils::OpenHandle(this); | 4110 auto self = Utils::OpenHandle(this); |
| 4112 auto key_obj = Utils::OpenHandle(*key); | 4111 auto key_obj = Utils::OpenHandle(*key); |
| 4113 i::LookupIterator it(self, key_obj, | 4112 i::LookupIterator it(self, key_obj, |
| 4114 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); | 4113 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); |
| 4115 if (!it.IsFound()) return Nothing<PropertyAttribute>(); | |
| 4116 auto result = i::JSReceiver::GetPropertyAttributes(&it); | 4114 auto result = i::JSReceiver::GetPropertyAttributes(&it); |
| 4117 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(PropertyAttribute); | 4115 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(PropertyAttribute); |
| 4116 if (!it.IsFound()) return Nothing<PropertyAttribute>(); |
| 4118 if (result.FromJust() == ABSENT) { | 4117 if (result.FromJust() == ABSENT) { |
| 4119 return Just(static_cast<PropertyAttribute>(NONE)); | 4118 return Just(static_cast<PropertyAttribute>(NONE)); |
| 4120 } | 4119 } |
| 4121 return Just<PropertyAttribute>( | 4120 return Just<PropertyAttribute>( |
| 4122 static_cast<PropertyAttribute>(result.FromJust())); | 4121 static_cast<PropertyAttribute>(result.FromJust())); |
| 4123 } | 4122 } |
| 4124 | 4123 |
| 4125 | 4124 |
| 4126 Maybe<PropertyAttribute> v8::Object::GetRealNamedPropertyAttributes( | 4125 Maybe<PropertyAttribute> v8::Object::GetRealNamedPropertyAttributes( |
| 4127 Handle<String> key) { | 4126 Handle<String> key) { |
| (...skipping 3904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8032 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 8031 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 8033 Address callback_address = | 8032 Address callback_address = |
| 8034 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8033 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 8035 VMState<EXTERNAL> state(isolate); | 8034 VMState<EXTERNAL> state(isolate); |
| 8036 ExternalCallbackScope call_scope(isolate, callback_address); | 8035 ExternalCallbackScope call_scope(isolate, callback_address); |
| 8037 callback(info); | 8036 callback(info); |
| 8038 } | 8037 } |
| 8039 | 8038 |
| 8040 | 8039 |
| 8041 } } // namespace v8::internal | 8040 } } // namespace v8::internal |
| OLD | NEW |