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