OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 | 889 |
890 | 890 |
891 // Return the names of the own indexed properties. | 891 // Return the names of the own indexed properties. |
892 // args[0]: object | 892 // args[0]: object |
893 RUNTIME_FUNCTION(Runtime_GetOwnElementNames) { | 893 RUNTIME_FUNCTION(Runtime_GetOwnElementNames) { |
894 HandleScope scope(isolate); | 894 HandleScope scope(isolate); |
895 DCHECK(args.length() == 1); | 895 DCHECK(args.length() == 1); |
896 if (!args[0]->IsJSObject()) { | 896 if (!args[0]->IsJSObject()) { |
897 return isolate->heap()->undefined_value(); | 897 return isolate->heap()->undefined_value(); |
898 } | 898 } |
899 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); | 899 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); |
900 | 900 |
901 int n = obj->NumberOfOwnElements(NONE); | 901 // TODO(cbruni): implement proper prototype lookup like in GetOwnPropertyNames |
| 902 if (object->IsJSGlobalProxy()) { |
| 903 // All the elements are stored on the globa_object and not directly on the |
| 904 // global object proxy. |
| 905 PrototypeIterator iter(isolate, object, |
| 906 PrototypeIterator::START_AT_PROTOTYPE); |
| 907 if (iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)) { |
| 908 return *isolate->factory()->NewJSArray(0); |
| 909 } |
| 910 object = PrototypeIterator::GetCurrent<JSObject>(iter); |
| 911 } |
| 912 |
| 913 int n = object->NumberOfOwnElements(NONE); |
902 Handle<FixedArray> names = isolate->factory()->NewFixedArray(n); | 914 Handle<FixedArray> names = isolate->factory()->NewFixedArray(n); |
903 obj->GetOwnElementKeys(*names, NONE); | 915 object->GetOwnElementKeys(*names, NONE); |
904 return *isolate->factory()->NewJSArrayWithElements(names); | 916 return *isolate->factory()->NewJSArrayWithElements(names); |
905 } | 917 } |
906 | 918 |
907 | 919 |
908 // Return information on whether an object has a named or indexed interceptor. | 920 // Return information on whether an object has a named or indexed interceptor. |
909 // args[0]: object | 921 // args[0]: object |
910 RUNTIME_FUNCTION(Runtime_GetInterceptorInfo) { | 922 RUNTIME_FUNCTION(Runtime_GetInterceptorInfo) { |
911 HandleScope scope(isolate); | 923 HandleScope scope(isolate); |
912 DCHECK(args.length() == 1); | 924 DCHECK(args.length() == 1); |
913 if (!args[0]->IsJSObject()) { | 925 if (!args[0]->IsJSObject()) { |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1606 RUNTIME_FUNCTION(Runtime_IsAccessCheckNeeded) { | 1618 RUNTIME_FUNCTION(Runtime_IsAccessCheckNeeded) { |
1607 SealHandleScope shs(isolate); | 1619 SealHandleScope shs(isolate); |
1608 DCHECK_EQ(1, args.length()); | 1620 DCHECK_EQ(1, args.length()); |
1609 CONVERT_ARG_CHECKED(Object, object, 0); | 1621 CONVERT_ARG_CHECKED(Object, object, 0); |
1610 return isolate->heap()->ToBoolean(object->IsAccessCheckNeeded()); | 1622 return isolate->heap()->ToBoolean(object->IsAccessCheckNeeded()); |
1611 } | 1623 } |
1612 | 1624 |
1613 | 1625 |
1614 } // namespace internal | 1626 } // namespace internal |
1615 } // namespace v8 | 1627 } // namespace v8 |
OLD | NEW |