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

Unified Diff: src/objects.h

Issue 1502983002: [proxies] Make Object.{isFrozen,isSealed} behave correctly for proxies. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index e8e7f221d355ca641063050538a9da61dd196a4e..f6c3477d6eb99b7ef37c88fdfbc024cb3677f52f 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -1864,8 +1864,19 @@ class JSReceiver: public HeapObject {
static bool GetOwnPropertyDescriptor(LookupIterator* it,
PropertyDescriptor* desc);
- // Disallow further properties to be added to the object. This is
- // ES6's [[PreventExtensions]] when passed DONT_THROW.
+ typedef PropertyAttributes IntegrityLevel;
+
+ // ES6 7.3.14 (when passed DONT_THROW)
+ // 'level' must be SEALED or FROZEN.
+ MUST_USE_RESULT static Maybe<bool> SetIntegrityLevel(
+ Handle<JSReceiver> object, IntegrityLevel lvl, ShouldThrow should_throw);
+
+ // ES6 7.3.15
+ // 'level' must be SEALED or FROZEN.
+ MUST_USE_RESULT static Maybe<bool> TestIntegrityLevel(
+ Handle<JSReceiver> object, IntegrityLevel lvl);
+
+ // ES6 [[PreventExtensions]] (when passed DONT_THROW)
MUST_USE_RESULT static Maybe<bool> PreventExtensions(
Handle<JSReceiver> object, ShouldThrow should_throw);
@@ -1919,6 +1930,13 @@ class JSReceiver: public HeapObject {
enum KeyCollectionType { OWN_ONLY, INCLUDE_PROTOS };
+ // ES6 [[OwnPropertyKeys]] (modulo return type)
+ MUST_USE_RESULT static MaybeHandle<FixedArray> OwnPropertyKeys(
+ Handle<JSReceiver> object) {
+ return GetKeys(object, JSReceiver::OWN_ONLY, ALL_PROPERTIES,
+ CONVERT_TO_STRING);
+ }
+
// Computes the enumerable keys for a JSObject. Used for implementing
// "for (n in object) { }".
MUST_USE_RESULT static MaybeHandle<FixedArray> GetKeys(
@@ -2342,12 +2360,6 @@ class JSObject: public JSReceiver {
static bool IsExtensible(Handle<JSObject> object);
- // ES5 Object.seal
- MUST_USE_RESULT static MaybeHandle<Object> Seal(Handle<JSObject> object);
-
- // ES5 Object.freeze
- MUST_USE_RESULT static MaybeHandle<Object> Freeze(Handle<JSObject> object);
-
// Called the first time an object is observed with ES7 Object.observe.
static void SetObserved(Handle<JSObject> object);
« no previous file with comments | « src/js/v8natives.js ('k') | src/objects.cc » ('j') | test/mjsunit/harmony/proxies-integrity.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698