| 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 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1); | 707 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1); |
| 708 | 708 |
| 709 Maybe<PropertyAttributes> maybe = | 709 Maybe<PropertyAttributes> maybe = |
| 710 JSReceiver::GetOwnPropertyAttributes(object, key); | 710 JSReceiver::GetOwnPropertyAttributes(object, key); |
| 711 if (!maybe.IsJust()) return isolate->heap()->exception(); | 711 if (!maybe.IsJust()) return isolate->heap()->exception(); |
| 712 if (maybe.FromJust() == ABSENT) return isolate->heap()->false_value(); | 712 if (maybe.FromJust() == ABSENT) return isolate->heap()->false_value(); |
| 713 return isolate->heap()->ToBoolean((maybe.FromJust() & DONT_ENUM) == 0); | 713 return isolate->heap()->ToBoolean((maybe.FromJust() & DONT_ENUM) == 0); |
| 714 } | 714 } |
| 715 | 715 |
| 716 | 716 |
| 717 // Returns either a FixedArray or, if the given object has an enum cache that | |
| 718 // contains all enumerable properties of the object and its prototypes have | |
| 719 // none, the map of the object. This is used to speed up the check for | |
| 720 // deletions during a for-in. | |
| 721 RUNTIME_FUNCTION(Runtime_GetPropertyNamesFast) { | |
| 722 SealHandleScope shs(isolate); | |
| 723 DCHECK(args.length() == 1); | |
| 724 | |
| 725 CONVERT_ARG_CHECKED(JSReceiver, raw_object, 0); | |
| 726 | |
| 727 if (raw_object->IsSimpleEnum()) return raw_object->map(); | |
| 728 | |
| 729 HandleScope scope(isolate); | |
| 730 Handle<JSReceiver> object(raw_object); | |
| 731 Handle<FixedArray> content; | |
| 732 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | |
| 733 isolate, content, JSReceiver::GetKeys(object, JSReceiver::INCLUDE_PROTOS, | |
| 734 ENUMERABLE_STRINGS)); | |
| 735 | |
| 736 // Test again, since cache may have been built by preceding call. | |
| 737 if (object->IsSimpleEnum()) return object->map(); | |
| 738 | |
| 739 return *content; | |
| 740 } | |
| 741 | |
| 742 | |
| 743 RUNTIME_FUNCTION(Runtime_GetOwnPropertyKeys) { | 717 RUNTIME_FUNCTION(Runtime_GetOwnPropertyKeys) { |
| 744 HandleScope scope(isolate); | 718 HandleScope scope(isolate); |
| 745 DCHECK(args.length() == 2); | 719 DCHECK(args.length() == 2); |
| 746 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0); | 720 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0); |
| 747 CONVERT_SMI_ARG_CHECKED(filter_value, 1); | 721 CONVERT_SMI_ARG_CHECKED(filter_value, 1); |
| 748 PropertyFilter filter = static_cast<PropertyFilter>(filter_value); | 722 PropertyFilter filter = static_cast<PropertyFilter>(filter_value); |
| 749 | 723 |
| 750 Handle<FixedArray> keys; | 724 Handle<FixedArray> keys; |
| 751 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 725 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 752 isolate, keys, JSReceiver::GetKeys(object, JSReceiver::OWN_ONLY, filter, | 726 isolate, keys, JSReceiver::GetKeys(object, JSReceiver::OWN_ONLY, filter, |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1314 DCHECK(args.length() == 2); | 1288 DCHECK(args.length() == 2); |
| 1315 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); | 1289 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); |
| 1316 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); | 1290 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); |
| 1317 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 1291 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 1318 isolate, o, JSReceiver::DefineProperties(isolate, o, properties)); | 1292 isolate, o, JSReceiver::DefineProperties(isolate, o, properties)); |
| 1319 return *o; | 1293 return *o; |
| 1320 } | 1294 } |
| 1321 | 1295 |
| 1322 } // namespace internal | 1296 } // namespace internal |
| 1323 } // namespace v8 | 1297 } // namespace v8 |
| OLD | NEW |