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 3895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3906 return SetPrototype(context, value).FromMaybe(false); | 3906 return SetPrototype(context, value).FromMaybe(false); |
3907 } | 3907 } |
3908 | 3908 |
3909 | 3909 |
3910 Local<Object> v8::Object::FindInstanceInPrototypeChain( | 3910 Local<Object> v8::Object::FindInstanceInPrototypeChain( |
3911 v8::Local<FunctionTemplate> tmpl) { | 3911 v8::Local<FunctionTemplate> tmpl) { |
3912 auto isolate = Utils::OpenHandle(this)->GetIsolate(); | 3912 auto isolate = Utils::OpenHandle(this)->GetIsolate(); |
3913 i::PrototypeIterator iter(isolate, *Utils::OpenHandle(this), | 3913 i::PrototypeIterator iter(isolate, *Utils::OpenHandle(this), |
3914 i::kStartAtReceiver); | 3914 i::kStartAtReceiver); |
3915 auto tmpl_info = *Utils::OpenHandle(*tmpl); | 3915 auto tmpl_info = *Utils::OpenHandle(*tmpl); |
3916 while (!tmpl_info->IsTemplateFor(iter.GetCurrent())) { | 3916 while (!tmpl_info->IsTemplateFor(iter.GetCurrent<i::JSObject>())) { |
3917 iter.Advance(); | 3917 iter.Advance(); |
3918 if (iter.IsAtEnd()) { | 3918 if (iter.IsAtEnd()) return Local<Object>(); |
3919 return Local<Object>(); | 3919 if (!iter.GetCurrent()->IsJSObject()) return Local<Object>(); |
3920 } | |
3921 } | 3920 } |
3922 // IsTemplateFor() ensures that iter.GetCurrent() can't be a Proxy here. | 3921 // IsTemplateFor() ensures that iter.GetCurrent() can't be a Proxy here. |
3923 return Utils::ToLocal(i::handle(iter.GetCurrent<i::JSObject>(), isolate)); | 3922 return Utils::ToLocal(i::handle(iter.GetCurrent<i::JSObject>(), isolate)); |
3924 } | 3923 } |
3925 | 3924 |
3926 MaybeLocal<Array> v8::Object::GetPropertyNames(Local<Context> context) { | 3925 MaybeLocal<Array> v8::Object::GetPropertyNames(Local<Context> context) { |
3927 return GetPropertyNames( | 3926 return GetPropertyNames( |
3928 context, v8::KeyCollectionMode::kIncludePrototypes, | 3927 context, v8::KeyCollectionMode::kIncludePrototypes, |
3929 static_cast<v8::PropertyFilter>(ONLY_ENUMERABLE | SKIP_SYMBOLS), | 3928 static_cast<v8::PropertyFilter>(ONLY_ENUMERABLE | SKIP_SYMBOLS), |
3930 v8::IndexFilter::kIncludeIndices); | 3929 v8::IndexFilter::kIncludeIndices); |
(...skipping 1872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5803 | 5802 |
5804 Local<v8::Function> FunctionTemplate::GetFunction() { | 5803 Local<v8::Function> FunctionTemplate::GetFunction() { |
5805 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); | 5804 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); |
5806 RETURN_TO_LOCAL_UNCHECKED(GetFunction(context), Function); | 5805 RETURN_TO_LOCAL_UNCHECKED(GetFunction(context), Function); |
5807 } | 5806 } |
5808 | 5807 |
5809 | 5808 |
5810 bool FunctionTemplate::HasInstance(v8::Local<v8::Value> value) { | 5809 bool FunctionTemplate::HasInstance(v8::Local<v8::Value> value) { |
5811 auto self = Utils::OpenHandle(this); | 5810 auto self = Utils::OpenHandle(this); |
5812 auto obj = Utils::OpenHandle(*value); | 5811 auto obj = Utils::OpenHandle(*value); |
5813 return self->IsTemplateFor(*obj); | 5812 return obj->IsJSObject() && self->IsTemplateFor(i::JSObject::cast(*obj)); |
5814 } | 5813 } |
5815 | 5814 |
5816 | 5815 |
5817 Local<External> v8::External::New(Isolate* isolate, void* value) { | 5816 Local<External> v8::External::New(Isolate* isolate, void* value) { |
5818 STATIC_ASSERT(sizeof(value) == sizeof(i::Address)); | 5817 STATIC_ASSERT(sizeof(value) == sizeof(i::Address)); |
5819 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 5818 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
5820 LOG_API(i_isolate, External, New); | 5819 LOG_API(i_isolate, External, New); |
5821 ENTER_V8(i_isolate); | 5820 ENTER_V8(i_isolate); |
5822 i::Handle<i::JSObject> external = i_isolate->factory()->NewExternal(value); | 5821 i::Handle<i::JSObject> external = i_isolate->factory()->NewExternal(value); |
5823 return Utils::ExternalToLocal(external); | 5822 return Utils::ExternalToLocal(external); |
(...skipping 3054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8878 Address callback_address = | 8877 Address callback_address = |
8879 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8878 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8880 VMState<EXTERNAL> state(isolate); | 8879 VMState<EXTERNAL> state(isolate); |
8881 ExternalCallbackScope call_scope(isolate, callback_address); | 8880 ExternalCallbackScope call_scope(isolate, callback_address); |
8882 callback(info); | 8881 callback(info); |
8883 } | 8882 } |
8884 | 8883 |
8885 | 8884 |
8886 } // namespace internal | 8885 } // namespace internal |
8887 } // namespace v8 | 8886 } // namespace v8 |
OLD | NEW |