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