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()) { | |
Toon Verwaest
2015/10/01 15:22:47
The JSGlobalProxy might be detached. In that case
| |
903 PrototypeIterator iter(isolate, object, | |
904 PrototypeIterator::START_AT_RECEIVER); | |
905 iter.Advance(); | |
906 object = PrototypeIterator::GetCurrent<JSObject>(iter); | |
907 } | |
908 | |
909 int n = object->NumberOfOwnElements(NONE); | |
902 Handle<FixedArray> names = isolate->factory()->NewFixedArray(n); | 910 Handle<FixedArray> names = isolate->factory()->NewFixedArray(n); |
903 obj->GetOwnElementKeys(*names, NONE); | 911 object->GetOwnElementKeys(*names, NONE); |
904 return *isolate->factory()->NewJSArrayWithElements(names); | 912 return *isolate->factory()->NewJSArrayWithElements(names); |
905 } | 913 } |
906 | 914 |
907 | 915 |
908 // Return information on whether an object has a named or indexed interceptor. | 916 // Return information on whether an object has a named or indexed interceptor. |
909 // args[0]: object | 917 // args[0]: object |
910 RUNTIME_FUNCTION(Runtime_GetInterceptorInfo) { | 918 RUNTIME_FUNCTION(Runtime_GetInterceptorInfo) { |
911 HandleScope scope(isolate); | 919 HandleScope scope(isolate); |
912 DCHECK(args.length() == 1); | 920 DCHECK(args.length() == 1); |
913 if (!args[0]->IsJSObject()) { | 921 if (!args[0]->IsJSObject()) { |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1606 RUNTIME_FUNCTION(Runtime_IsAccessCheckNeeded) { | 1614 RUNTIME_FUNCTION(Runtime_IsAccessCheckNeeded) { |
1607 SealHandleScope shs(isolate); | 1615 SealHandleScope shs(isolate); |
1608 DCHECK_EQ(1, args.length()); | 1616 DCHECK_EQ(1, args.length()); |
1609 CONVERT_ARG_CHECKED(Object, object, 0); | 1617 CONVERT_ARG_CHECKED(Object, object, 0); |
1610 return isolate->heap()->ToBoolean(object->IsAccessCheckNeeded()); | 1618 return isolate->heap()->ToBoolean(object->IsAccessCheckNeeded()); |
1611 } | 1619 } |
1612 | 1620 |
1613 | 1621 |
1614 } // namespace internal | 1622 } // namespace internal |
1615 } // namespace v8 | 1623 } // namespace v8 |
OLD | NEW |