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