Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1019)

Side by Side Diff: src/runtime/runtime-object.cc

Issue 1484313003: [runtime] [proxy] Fix Object.prototype.propertyIsEnumerable to support proxies (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: more tests + proper argument conversion Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/js/v8natives.js ('k') | test/mjsunit/harmony/proxies-property-is-enumerable.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 Maybe<bool> maybe = JSReceiver::HasProperty(receiver, name); 743 Maybe<bool> maybe = JSReceiver::HasProperty(receiver, name);
744 if (!maybe.IsJust()) return isolate->heap()->exception(); 744 if (!maybe.IsJust()) return isolate->heap()->exception();
745 return isolate->heap()->ToBoolean(maybe.FromJust()); 745 return isolate->heap()->ToBoolean(maybe.FromJust());
746 } 746 }
747 747
748 748
749 RUNTIME_FUNCTION(Runtime_IsPropertyEnumerable) { 749 RUNTIME_FUNCTION(Runtime_IsPropertyEnumerable) {
750 HandleScope scope(isolate); 750 HandleScope scope(isolate);
751 DCHECK(args.length() == 2); 751 DCHECK(args.length() == 2);
752 752
753 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); 753 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0);
754 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1); 754 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1);
755 755
756 Maybe<PropertyAttributes> maybe = 756 Maybe<PropertyAttributes> maybe =
757 JSReceiver::GetOwnPropertyAttributes(object, key); 757 JSReceiver::GetOwnPropertyAttributes(object, key);
758 if (!maybe.IsJust()) return isolate->heap()->exception(); 758 if (!maybe.IsJust()) return isolate->heap()->exception();
759 if (maybe.FromJust() == ABSENT) maybe = Just(DONT_ENUM); 759 if (maybe.FromJust() == ABSENT) return isolate->heap()->false_value();
760 return isolate->heap()->ToBoolean((maybe.FromJust() & DONT_ENUM) == 0); 760 return isolate->heap()->ToBoolean((maybe.FromJust() & DONT_ENUM) == 0);
761 } 761 }
762 762
763 763
764 // Returns either a FixedArray or, if the given object has an enum cache that 764 // Returns either a FixedArray or, if the given object has an enum cache that
765 // contains all enumerable properties of the object and its prototypes have 765 // contains all enumerable properties of the object and its prototypes have
766 // none, the map of the object. This is used to speed up the check for 766 // none, the map of the object. This is used to speed up the check for
767 // deletions during a for-in. 767 // deletions during a for-in.
768 RUNTIME_FUNCTION(Runtime_GetPropertyNamesFast) { 768 RUNTIME_FUNCTION(Runtime_GetPropertyNamesFast) {
769 SealHandleScope shs(isolate); 769 SealHandleScope shs(isolate);
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
1574 1574
1575 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { 1575 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) {
1576 HandleScope scope(isolate); 1576 HandleScope scope(isolate);
1577 DCHECK(args.length() == 2); 1577 DCHECK(args.length() == 2);
1578 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); 1578 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0);
1579 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); 1579 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1);
1580 return JSReceiver::DefineProperties(isolate, o, properties); 1580 return JSReceiver::DefineProperties(isolate, o, properties);
1581 } 1581 }
1582 } // namespace internal 1582 } // namespace internal
1583 } // namespace v8 1583 } // namespace v8
OLDNEW
« no previous file with comments | « src/js/v8natives.js ('k') | test/mjsunit/harmony/proxies-property-is-enumerable.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698