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

Unified Diff: src/js/v8natives.js

Issue 1929293002: Revert of Remove more dead code after Object.observe removal (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 months 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
« no previous file with comments | « src/js/prologue.js ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/v8natives.js
diff --git a/src/js/v8natives.js b/src/js/v8natives.js
index 44be9419766b49424e1c522af9cb82c7032c4ff7..be7271b1f061dcf61b7b04e815cebc327edd7b58 100644
--- a/src/js/v8natives.js
+++ b/src/js/v8natives.js
@@ -142,6 +142,52 @@
return %PropertyIsEnumerable(TO_OBJECT(this), P);
}
+
+// Extensions for providing property getters and setters.
+function ObjectDefineGetter(name, fun) {
+ var receiver = this;
+ if (IS_NULL(receiver) || IS_UNDEFINED(receiver)) {
+ receiver = %GlobalProxy(ObjectDefineGetter);
+ }
+ if (!IS_CALLABLE(fun)) {
+ throw MakeTypeError(kObjectGetterExpectingFunction);
+ }
+ var desc = {get: fun, enumerable: true, configurable: true};
+ %reflect_define_property(receiver, name, desc);
+}
+
+
+function ObjectLookupGetter(name) {
+ var receiver = this;
+ if (IS_NULL(receiver) || IS_UNDEFINED(receiver)) {
+ receiver = %GlobalProxy(ObjectLookupGetter);
+ }
+ return %LookupAccessor(TO_OBJECT(receiver), TO_NAME(name), GETTER);
+}
+
+
+function ObjectDefineSetter(name, fun) {
+ var receiver = this;
+ if (IS_NULL(receiver) || IS_UNDEFINED(receiver)) {
+ receiver = %GlobalProxy(ObjectDefineSetter);
+ }
+ if (!IS_CALLABLE(fun)) {
+ throw MakeTypeError(kObjectSetterExpectingFunction);
+ }
+ var desc = {set: fun, enumerable: true, configurable: true};
+ %reflect_define_property(receiver, name, desc);
+}
+
+
+function ObjectLookupSetter(name) {
+ var receiver = this;
+ if (IS_NULL(receiver) || IS_UNDEFINED(receiver)) {
+ receiver = %GlobalProxy(ObjectLookupSetter);
+ }
+ return %LookupAccessor(TO_OBJECT(receiver), TO_NAME(name), SETTER);
+}
+
+
// ES6 7.3.9
function GetMethod(obj, p) {
var func = obj[p];
@@ -150,6 +196,7 @@
throw MakeTypeError(kCalledNonCallable, typeof func);
}
+
// ES6 section 19.1.2.18.
function ObjectSetPrototypeOf(obj, proto) {
CHECK_OBJECT_COERCIBLE(obj, "Object.setPrototypeOf");
@@ -164,6 +211,7 @@
return obj;
}
+
// ES6 B.2.2.1.1
function ObjectGetProto() {
@@ -207,10 +255,10 @@
"valueOf", ObjectValueOf,
"isPrototypeOf", ObjectIsPrototypeOf,
"propertyIsEnumerable", ObjectPropertyIsEnumerable,
- // __defineGetter__ is added in bootstrapper.cc.
- // __lookupGetter__ is added in bootstrapper.cc.
- // __defineSetter__ is added in bootstrapper.cc.
- // __lookupSetter__ is added in bootstrapper.cc.
+ "__defineGetter__", ObjectDefineGetter,
+ "__lookupGetter__", ObjectLookupGetter,
+ "__defineSetter__", ObjectDefineSetter,
+ "__lookupSetter__", ObjectLookupSetter
]);
utils.InstallGetterSetter(
GlobalObject.prototype, "__proto__", ObjectGetProto, ObjectSetProto);
« no previous file with comments | « src/js/prologue.js ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698