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 4205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4216 | 4216 |
4217 MaybeLocal<Value> v8::Object::GetRealNamedPropertyInPrototypeChain( | 4217 MaybeLocal<Value> v8::Object::GetRealNamedPropertyInPrototypeChain( |
4218 Local<Context> context, Local<Name> key) { | 4218 Local<Context> context, Local<Name> key) { |
4219 PREPARE_FOR_EXECUTION( | 4219 PREPARE_FOR_EXECUTION( |
4220 context, "v8::Object::GetRealNamedPropertyInPrototypeChain()", Value); | 4220 context, "v8::Object::GetRealNamedPropertyInPrototypeChain()", Value); |
4221 auto self = Utils::OpenHandle(this); | 4221 auto self = Utils::OpenHandle(this); |
4222 auto key_obj = Utils::OpenHandle(*key); | 4222 auto key_obj = Utils::OpenHandle(*key); |
4223 i::PrototypeIterator iter(isolate, self); | 4223 i::PrototypeIterator iter(isolate, self); |
4224 if (iter.IsAtEnd()) return MaybeLocal<Value>(); | 4224 if (iter.IsAtEnd()) return MaybeLocal<Value>(); |
4225 auto proto = i::PrototypeIterator::GetCurrent(iter); | 4225 auto proto = i::PrototypeIterator::GetCurrent(iter); |
4226 i::LookupIterator it(self, key_obj, i::Handle<i::JSReceiver>::cast(proto), | 4226 i::LookupIterator it = i::LookupIterator::PropertyOrElement( |
4227 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); | 4227 isolate, self, key_obj, i::Handle<i::JSReceiver>::cast(proto), |
| 4228 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); |
4228 Local<Value> result; | 4229 Local<Value> result; |
4229 has_pending_exception = !ToLocal<Value>(i::Object::GetProperty(&it), &result); | 4230 has_pending_exception = !ToLocal<Value>(i::Object::GetProperty(&it), &result); |
4230 RETURN_ON_FAILED_EXECUTION(Value); | 4231 RETURN_ON_FAILED_EXECUTION(Value); |
4231 if (!it.IsFound()) return MaybeLocal<Value>(); | 4232 if (!it.IsFound()) return MaybeLocal<Value>(); |
4232 RETURN_ESCAPED(result); | 4233 RETURN_ESCAPED(result); |
4233 } | 4234 } |
4234 | 4235 |
4235 | 4236 |
4236 Local<Value> v8::Object::GetRealNamedPropertyInPrototypeChain( | 4237 Local<Value> v8::Object::GetRealNamedPropertyInPrototypeChain( |
4237 Handle<String> key) { | 4238 Handle<String> key) { |
4238 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); | 4239 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); |
4239 RETURN_TO_LOCAL_UNCHECKED(GetRealNamedPropertyInPrototypeChain(context, key), | 4240 RETURN_TO_LOCAL_UNCHECKED(GetRealNamedPropertyInPrototypeChain(context, key), |
4240 Value); | 4241 Value); |
4241 } | 4242 } |
4242 | 4243 |
4243 | 4244 |
4244 Maybe<PropertyAttribute> | 4245 Maybe<PropertyAttribute> |
4245 v8::Object::GetRealNamedPropertyAttributesInPrototypeChain( | 4246 v8::Object::GetRealNamedPropertyAttributesInPrototypeChain( |
4246 Local<Context> context, Local<Name> key) { | 4247 Local<Context> context, Local<Name> key) { |
4247 PREPARE_FOR_EXECUTION_PRIMITIVE( | 4248 PREPARE_FOR_EXECUTION_PRIMITIVE( |
4248 context, "v8::Object::GetRealNamedPropertyAttributesInPrototypeChain()", | 4249 context, "v8::Object::GetRealNamedPropertyAttributesInPrototypeChain()", |
4249 PropertyAttribute); | 4250 PropertyAttribute); |
4250 auto self = Utils::OpenHandle(this); | 4251 auto self = Utils::OpenHandle(this); |
4251 auto key_obj = Utils::OpenHandle(*key); | 4252 auto key_obj = Utils::OpenHandle(*key); |
4252 i::PrototypeIterator iter(isolate, self); | 4253 i::PrototypeIterator iter(isolate, self); |
4253 if (iter.IsAtEnd()) return Nothing<PropertyAttribute>(); | 4254 if (iter.IsAtEnd()) return Nothing<PropertyAttribute>(); |
4254 auto proto = i::PrototypeIterator::GetCurrent(iter); | 4255 auto proto = i::PrototypeIterator::GetCurrent(iter); |
4255 i::LookupIterator it(self, key_obj, i::Handle<i::JSReceiver>::cast(proto), | 4256 i::LookupIterator it = i::LookupIterator::PropertyOrElement( |
4256 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); | 4257 isolate, self, key_obj, i::Handle<i::JSReceiver>::cast(proto), |
| 4258 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); |
4257 auto result = i::JSReceiver::GetPropertyAttributes(&it); | 4259 auto result = i::JSReceiver::GetPropertyAttributes(&it); |
4258 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(PropertyAttribute); | 4260 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(PropertyAttribute); |
4259 if (!it.IsFound()) return Nothing<PropertyAttribute>(); | 4261 if (!it.IsFound()) return Nothing<PropertyAttribute>(); |
4260 if (result.FromJust() == ABSENT) { | 4262 if (result.FromJust() == ABSENT) { |
4261 return Just(static_cast<PropertyAttribute>(NONE)); | 4263 return Just(static_cast<PropertyAttribute>(NONE)); |
4262 } | 4264 } |
4263 return Just<PropertyAttribute>( | 4265 return Just<PropertyAttribute>( |
4264 static_cast<PropertyAttribute>(result.FromJust())); | 4266 static_cast<PropertyAttribute>(result.FromJust())); |
4265 } | 4267 } |
4266 | 4268 |
4267 | 4269 |
4268 Maybe<PropertyAttribute> | 4270 Maybe<PropertyAttribute> |
4269 v8::Object::GetRealNamedPropertyAttributesInPrototypeChain(Handle<String> key) { | 4271 v8::Object::GetRealNamedPropertyAttributesInPrototypeChain(Handle<String> key) { |
4270 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); | 4272 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); |
4271 return GetRealNamedPropertyAttributesInPrototypeChain(context, key); | 4273 return GetRealNamedPropertyAttributesInPrototypeChain(context, key); |
4272 } | 4274 } |
4273 | 4275 |
4274 | 4276 |
4275 MaybeLocal<Value> v8::Object::GetRealNamedProperty(Local<Context> context, | 4277 MaybeLocal<Value> v8::Object::GetRealNamedProperty(Local<Context> context, |
4276 Local<Name> key) { | 4278 Local<Name> key) { |
4277 PREPARE_FOR_EXECUTION(context, "v8::Object::GetRealNamedProperty()", Value); | 4279 PREPARE_FOR_EXECUTION(context, "v8::Object::GetRealNamedProperty()", Value); |
4278 auto self = Utils::OpenHandle(this); | 4280 auto self = Utils::OpenHandle(this); |
4279 auto key_obj = Utils::OpenHandle(*key); | 4281 auto key_obj = Utils::OpenHandle(*key); |
4280 i::LookupIterator it(self, key_obj, | 4282 i::LookupIterator it = i::LookupIterator::PropertyOrElement( |
4281 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); | 4283 isolate, self, key_obj, |
| 4284 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); |
4282 Local<Value> result; | 4285 Local<Value> result; |
4283 has_pending_exception = !ToLocal<Value>(i::Object::GetProperty(&it), &result); | 4286 has_pending_exception = !ToLocal<Value>(i::Object::GetProperty(&it), &result); |
4284 RETURN_ON_FAILED_EXECUTION(Value); | 4287 RETURN_ON_FAILED_EXECUTION(Value); |
4285 if (!it.IsFound()) return MaybeLocal<Value>(); | 4288 if (!it.IsFound()) return MaybeLocal<Value>(); |
4286 RETURN_ESCAPED(result); | 4289 RETURN_ESCAPED(result); |
4287 } | 4290 } |
4288 | 4291 |
4289 | 4292 |
4290 Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) { | 4293 Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) { |
4291 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); | 4294 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); |
4292 RETURN_TO_LOCAL_UNCHECKED(GetRealNamedProperty(context, key), Value); | 4295 RETURN_TO_LOCAL_UNCHECKED(GetRealNamedProperty(context, key), Value); |
4293 } | 4296 } |
4294 | 4297 |
4295 | 4298 |
4296 Maybe<PropertyAttribute> v8::Object::GetRealNamedPropertyAttributes( | 4299 Maybe<PropertyAttribute> v8::Object::GetRealNamedPropertyAttributes( |
4297 Local<Context> context, Local<Name> key) { | 4300 Local<Context> context, Local<Name> key) { |
4298 PREPARE_FOR_EXECUTION_PRIMITIVE( | 4301 PREPARE_FOR_EXECUTION_PRIMITIVE( |
4299 context, "v8::Object::GetRealNamedPropertyAttributes()", | 4302 context, "v8::Object::GetRealNamedPropertyAttributes()", |
4300 PropertyAttribute); | 4303 PropertyAttribute); |
4301 auto self = Utils::OpenHandle(this); | 4304 auto self = Utils::OpenHandle(this); |
4302 auto key_obj = Utils::OpenHandle(*key); | 4305 auto key_obj = Utils::OpenHandle(*key); |
4303 i::LookupIterator it(self, key_obj, | 4306 i::LookupIterator it = i::LookupIterator::PropertyOrElement( |
4304 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); | 4307 isolate, self, key_obj, |
| 4308 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); |
4305 auto result = i::JSReceiver::GetPropertyAttributes(&it); | 4309 auto result = i::JSReceiver::GetPropertyAttributes(&it); |
4306 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(PropertyAttribute); | 4310 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(PropertyAttribute); |
4307 if (!it.IsFound()) return Nothing<PropertyAttribute>(); | 4311 if (!it.IsFound()) return Nothing<PropertyAttribute>(); |
4308 if (result.FromJust() == ABSENT) { | 4312 if (result.FromJust() == ABSENT) { |
4309 return Just(static_cast<PropertyAttribute>(NONE)); | 4313 return Just(static_cast<PropertyAttribute>(NONE)); |
4310 } | 4314 } |
4311 return Just<PropertyAttribute>( | 4315 return Just<PropertyAttribute>( |
4312 static_cast<PropertyAttribute>(result.FromJust())); | 4316 static_cast<PropertyAttribute>(result.FromJust())); |
4313 } | 4317 } |
4314 | 4318 |
(...skipping 4131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8446 Address callback_address = | 8450 Address callback_address = |
8447 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8451 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8448 VMState<EXTERNAL> state(isolate); | 8452 VMState<EXTERNAL> state(isolate); |
8449 ExternalCallbackScope call_scope(isolate, callback_address); | 8453 ExternalCallbackScope call_scope(isolate, callback_address); |
8450 callback(info); | 8454 callback(info); |
8451 } | 8455 } |
8452 | 8456 |
8453 | 8457 |
8454 } // namespace internal | 8458 } // namespace internal |
8455 } // namespace v8 | 8459 } // namespace v8 |
OLD | NEW |