| 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 3737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3748 // IsTemplateFor() ensures that iter.GetCurrent() can't be a Proxy here. | 3748 // IsTemplateFor() ensures that iter.GetCurrent() can't be a Proxy here. |
| 3749 return Utils::ToLocal(i::handle(iter.GetCurrent<i::JSObject>(), isolate)); | 3749 return Utils::ToLocal(i::handle(iter.GetCurrent<i::JSObject>(), isolate)); |
| 3750 } | 3750 } |
| 3751 | 3751 |
| 3752 | 3752 |
| 3753 MaybeLocal<Array> v8::Object::GetPropertyNames(Local<Context> context) { | 3753 MaybeLocal<Array> v8::Object::GetPropertyNames(Local<Context> context) { |
| 3754 PREPARE_FOR_EXECUTION(context, "v8::Object::GetPropertyNames()", Array); | 3754 PREPARE_FOR_EXECUTION(context, "v8::Object::GetPropertyNames()", Array); |
| 3755 auto self = Utils::OpenHandle(this); | 3755 auto self = Utils::OpenHandle(this); |
| 3756 i::Handle<i::FixedArray> value; | 3756 i::Handle<i::FixedArray> value; |
| 3757 has_pending_exception = | 3757 has_pending_exception = |
| 3758 !i::JSReceiver::GetKeys(self, i::JSReceiver::INCLUDE_PROTOS, | 3758 !i::JSReceiver::GetKeys(self, i::KeyCollectionType::INCLUDE_PROTOS, |
| 3759 i::ENUMERABLE_STRINGS) | 3759 i::ENUMERABLE_STRINGS) |
| 3760 .ToHandle(&value); | 3760 .ToHandle(&value); |
| 3761 RETURN_ON_FAILED_EXECUTION(Array); | 3761 RETURN_ON_FAILED_EXECUTION(Array); |
| 3762 // Because we use caching to speed up enumeration it is important | 3762 // Because we use caching to speed up enumeration it is important |
| 3763 // to never change the result of the basic enumeration function so | 3763 // to never change the result of the basic enumeration function so |
| 3764 // we clone the result. | 3764 // we clone the result. |
| 3765 auto elms = isolate->factory()->CopyFixedArray(value); | 3765 auto elms = isolate->factory()->CopyFixedArray(value); |
| 3766 auto result = isolate->factory()->NewJSArrayWithElements(elms); | 3766 auto result = isolate->factory()->NewJSArrayWithElements(elms); |
| 3767 RETURN_ESCAPED(Utils::ToLocal(result)); | 3767 RETURN_ESCAPED(Utils::ToLocal(result)); |
| 3768 } | 3768 } |
| 3769 | 3769 |
| 3770 | 3770 |
| 3771 Local<Array> v8::Object::GetPropertyNames() { | 3771 Local<Array> v8::Object::GetPropertyNames() { |
| 3772 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); | 3772 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); |
| 3773 RETURN_TO_LOCAL_UNCHECKED(GetPropertyNames(context), Array); | 3773 RETURN_TO_LOCAL_UNCHECKED(GetPropertyNames(context), Array); |
| 3774 } | 3774 } |
| 3775 | 3775 |
| 3776 | 3776 |
| 3777 MaybeLocal<Array> v8::Object::GetOwnPropertyNames(Local<Context> context) { | 3777 MaybeLocal<Array> v8::Object::GetOwnPropertyNames(Local<Context> context) { |
| 3778 PREPARE_FOR_EXECUTION(context, "v8::Object::GetOwnPropertyNames()", Array); | 3778 PREPARE_FOR_EXECUTION(context, "v8::Object::GetOwnPropertyNames()", Array); |
| 3779 auto self = Utils::OpenHandle(this); | 3779 auto self = Utils::OpenHandle(this); |
| 3780 i::Handle<i::FixedArray> value; | 3780 i::Handle<i::FixedArray> value; |
| 3781 has_pending_exception = !i::JSReceiver::GetKeys(self, i::JSReceiver::OWN_ONLY, | 3781 has_pending_exception = |
| 3782 i::ENUMERABLE_STRINGS) | 3782 !i::JSReceiver::GetKeys(self, i::KeyCollectionType::OWN_ONLY, |
| 3783 .ToHandle(&value); | 3783 i::ENUMERABLE_STRINGS) |
| 3784 .ToHandle(&value); |
| 3784 RETURN_ON_FAILED_EXECUTION(Array); | 3785 RETURN_ON_FAILED_EXECUTION(Array); |
| 3785 // Because we use caching to speed up enumeration it is important | 3786 // Because we use caching to speed up enumeration it is important |
| 3786 // to never change the result of the basic enumeration function so | 3787 // to never change the result of the basic enumeration function so |
| 3787 // we clone the result. | 3788 // we clone the result. |
| 3788 auto elms = isolate->factory()->CopyFixedArray(value); | 3789 auto elms = isolate->factory()->CopyFixedArray(value); |
| 3789 auto result = isolate->factory()->NewJSArrayWithElements(elms); | 3790 auto result = isolate->factory()->NewJSArrayWithElements(elms); |
| 3790 RETURN_ESCAPED(Utils::ToLocal(result)); | 3791 RETURN_ESCAPED(Utils::ToLocal(result)); |
| 3791 } | 3792 } |
| 3792 | 3793 |
| 3793 | 3794 |
| (...skipping 4763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8557 Address callback_address = | 8558 Address callback_address = |
| 8558 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8559 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 8559 VMState<EXTERNAL> state(isolate); | 8560 VMState<EXTERNAL> state(isolate); |
| 8560 ExternalCallbackScope call_scope(isolate, callback_address); | 8561 ExternalCallbackScope call_scope(isolate, callback_address); |
| 8561 callback(info); | 8562 callback(info); |
| 8562 } | 8563 } |
| 8563 | 8564 |
| 8564 | 8565 |
| 8565 } // namespace internal | 8566 } // namespace internal |
| 8566 } // namespace v8 | 8567 } // namespace v8 |
| OLD | NEW |