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 3854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3865 } | 3865 } |
3866 // IsTemplateFor() ensures that iter.GetCurrent() can't be a Proxy here. | 3866 // IsTemplateFor() ensures that iter.GetCurrent() can't be a Proxy here. |
3867 return Utils::ToLocal(i::handle(iter.GetCurrent<i::JSObject>(), isolate)); | 3867 return Utils::ToLocal(i::handle(iter.GetCurrent<i::JSObject>(), isolate)); |
3868 } | 3868 } |
3869 | 3869 |
3870 | 3870 |
3871 MaybeLocal<Array> v8::Object::GetPropertyNames(Local<Context> context) { | 3871 MaybeLocal<Array> v8::Object::GetPropertyNames(Local<Context> context) { |
3872 PREPARE_FOR_EXECUTION(context, Object, GetPropertyNames, Array); | 3872 PREPARE_FOR_EXECUTION(context, Object, GetPropertyNames, Array); |
3873 auto self = Utils::OpenHandle(this); | 3873 auto self = Utils::OpenHandle(this); |
3874 i::Handle<i::FixedArray> value; | 3874 i::Handle<i::FixedArray> value; |
3875 has_pending_exception = | 3875 has_pending_exception = !i::KeyAccumulator::GetKeys(self, i::INCLUDE_PROTOS, |
3876 !i::JSReceiver::GetKeys(self, i::INCLUDE_PROTOS, i::ENUMERABLE_STRINGS) | 3876 i::ENUMERABLE_STRINGS) |
3877 .ToHandle(&value); | 3877 .ToHandle(&value); |
3878 RETURN_ON_FAILED_EXECUTION(Array); | 3878 RETURN_ON_FAILED_EXECUTION(Array); |
3879 DCHECK(self->map()->EnumLength() == i::kInvalidEnumCacheSentinel || | 3879 DCHECK(self->map()->EnumLength() == i::kInvalidEnumCacheSentinel || |
3880 self->map()->EnumLength() == 0 || | 3880 self->map()->EnumLength() == 0 || |
3881 self->map()->instance_descriptors()->GetEnumCache() != *value); | 3881 self->map()->instance_descriptors()->GetEnumCache() != *value); |
3882 auto result = isolate->factory()->NewJSArrayWithElements(value); | 3882 auto result = isolate->factory()->NewJSArrayWithElements(value); |
3883 RETURN_ESCAPED(Utils::ToLocal(result)); | 3883 RETURN_ESCAPED(Utils::ToLocal(result)); |
3884 } | 3884 } |
3885 | 3885 |
3886 | 3886 |
3887 Local<Array> v8::Object::GetPropertyNames() { | 3887 Local<Array> v8::Object::GetPropertyNames() { |
(...skipping 10 matching lines...) Expand all Loading... |
3898 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); | 3898 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); |
3899 RETURN_TO_LOCAL_UNCHECKED(GetOwnPropertyNames(context), Array); | 3899 RETURN_TO_LOCAL_UNCHECKED(GetOwnPropertyNames(context), Array); |
3900 } | 3900 } |
3901 | 3901 |
3902 MaybeLocal<Array> v8::Object::GetOwnPropertyNames(Local<Context> context, | 3902 MaybeLocal<Array> v8::Object::GetOwnPropertyNames(Local<Context> context, |
3903 PropertyFilter filter) { | 3903 PropertyFilter filter) { |
3904 PREPARE_FOR_EXECUTION(context, Object, GetOwnPropertyNames, Array); | 3904 PREPARE_FOR_EXECUTION(context, Object, GetOwnPropertyNames, Array); |
3905 auto self = Utils::OpenHandle(this); | 3905 auto self = Utils::OpenHandle(this); |
3906 i::Handle<i::FixedArray> value; | 3906 i::Handle<i::FixedArray> value; |
3907 has_pending_exception = | 3907 has_pending_exception = |
3908 !i::JSReceiver::GetKeys(self, i::OWN_ONLY, | 3908 !i::KeyAccumulator::GetKeys(self, i::OWN_ONLY, |
3909 static_cast<i::PropertyFilter>(filter)) | 3909 static_cast<i::PropertyFilter>(filter)) |
3910 .ToHandle(&value); | 3910 .ToHandle(&value); |
3911 RETURN_ON_FAILED_EXECUTION(Array); | 3911 RETURN_ON_FAILED_EXECUTION(Array); |
3912 DCHECK(self->map()->EnumLength() == i::kInvalidEnumCacheSentinel || | 3912 DCHECK(self->map()->EnumLength() == i::kInvalidEnumCacheSentinel || |
3913 self->map()->EnumLength() == 0 || | 3913 self->map()->EnumLength() == 0 || |
3914 self->map()->instance_descriptors()->GetEnumCache() != *value); | 3914 self->map()->instance_descriptors()->GetEnumCache() != *value); |
3915 auto result = isolate->factory()->NewJSArrayWithElements(value); | 3915 auto result = isolate->factory()->NewJSArrayWithElements(value); |
3916 RETURN_ESCAPED(Utils::ToLocal(result)); | 3916 RETURN_ESCAPED(Utils::ToLocal(result)); |
3917 } | 3917 } |
3918 | 3918 |
3919 MaybeLocal<String> v8::Object::ObjectProtoToString(Local<Context> context) { | 3919 MaybeLocal<String> v8::Object::ObjectProtoToString(Local<Context> context) { |
(...skipping 4890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8810 Address callback_address = | 8810 Address callback_address = |
8811 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8811 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8812 VMState<EXTERNAL> state(isolate); | 8812 VMState<EXTERNAL> state(isolate); |
8813 ExternalCallbackScope call_scope(isolate, callback_address); | 8813 ExternalCallbackScope call_scope(isolate, callback_address); |
8814 callback(info); | 8814 callback(info); |
8815 } | 8815 } |
8816 | 8816 |
8817 | 8817 |
8818 } // namespace internal | 8818 } // namespace internal |
8819 } // namespace v8 | 8819 } // namespace v8 |
OLD | NEW |