| 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/v8.h" | 5 #include "src/v8.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.h" | 9 #include "src/debug.h" |
| 10 #include "src/runtime/runtime.h" | 10 #include "src/runtime/runtime.h" |
| (...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 | 808 |
| 809 uint32_t index; | 809 uint32_t index; |
| 810 const bool key_is_array_index = key->AsArrayIndex(&index); | 810 const bool key_is_array_index = key->AsArrayIndex(&index); |
| 811 | 811 |
| 812 // Only JS objects can have properties. | 812 // Only JS objects can have properties. |
| 813 if (object->IsJSObject()) { | 813 if (object->IsJSObject()) { |
| 814 Handle<JSObject> js_obj = Handle<JSObject>::cast(object); | 814 Handle<JSObject> js_obj = Handle<JSObject>::cast(object); |
| 815 // Fast case: either the key is a real named property or it is not | 815 // Fast case: either the key is a real named property or it is not |
| 816 // an array index and there are no interceptors or hidden | 816 // an array index and there are no interceptors or hidden |
| 817 // prototypes. | 817 // prototypes. |
| 818 Maybe<bool> maybe = JSObject::HasRealNamedProperty(js_obj, key); | 818 Maybe<bool> maybe; |
| 819 if (key_is_array_index) { |
| 820 maybe = JSObject::HasOwnElement(js_obj, index); |
| 821 } else { |
| 822 maybe = JSObject::HasRealNamedProperty(js_obj, key); |
| 823 } |
| 819 if (!maybe.has_value) return isolate->heap()->exception(); | 824 if (!maybe.has_value) return isolate->heap()->exception(); |
| 820 DCHECK(!isolate->has_pending_exception()); | 825 DCHECK(!isolate->has_pending_exception()); |
| 821 if (maybe.value) { | 826 if (maybe.value) { |
| 822 return isolate->heap()->true_value(); | 827 return isolate->heap()->true_value(); |
| 823 } | 828 } |
| 824 Map* map = js_obj->map(); | 829 Map* map = js_obj->map(); |
| 825 if (!key_is_array_index && !map->has_named_interceptor() && | 830 if (!key_is_array_index && !map->has_named_interceptor() && |
| 826 !HeapObject::cast(map->prototype())->map()->is_hidden_prototype()) { | 831 !HeapObject::cast(map->prototype())->map()->is_hidden_prototype()) { |
| 827 return isolate->heap()->false_value(); | 832 return isolate->heap()->false_value(); |
| 828 } | 833 } |
| (...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1600 | 1605 |
| 1601 RUNTIME_FUNCTION(RuntimeReference_ClassOf) { | 1606 RUNTIME_FUNCTION(RuntimeReference_ClassOf) { |
| 1602 SealHandleScope shs(isolate); | 1607 SealHandleScope shs(isolate); |
| 1603 DCHECK(args.length() == 1); | 1608 DCHECK(args.length() == 1); |
| 1604 CONVERT_ARG_CHECKED(Object, obj, 0); | 1609 CONVERT_ARG_CHECKED(Object, obj, 0); |
| 1605 if (!obj->IsJSReceiver()) return isolate->heap()->null_value(); | 1610 if (!obj->IsJSReceiver()) return isolate->heap()->null_value(); |
| 1606 return JSReceiver::cast(obj)->class_name(); | 1611 return JSReceiver::cast(obj)->class_name(); |
| 1607 } | 1612 } |
| 1608 } | 1613 } |
| 1609 } // namespace v8::internal | 1614 } // namespace v8::internal |
| OLD | NEW |