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

Unified Diff: src/js/v8natives.js

Issue 2415173003: Revert of [builtins] Also port the Object.prototype.__proto__ accessors to C++. (Closed)
Patch Set: Created 4 years, 2 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/builtins/builtins-object.cc ('k') | src/runtime/runtime.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 9098e82bf2424b6733748f8956bfaff8a0709313..3ba39cf4b76051cfab6f28fda7d7eba706b690a7 100644
--- a/src/js/v8natives.js
+++ b/src/js/v8natives.js
@@ -104,6 +104,22 @@
throw %make_type_error(kCalledNonCallable, typeof func);
}
+// ES6 B.2.2.1.1
+function ObjectGetProto() {
+ return %object_get_prototype_of(this);
+}
+
+
+// ES6 B.2.2.1.2
+function ObjectSetProto(proto) {
+ CHECK_OBJECT_COERCIBLE(this, "Object.prototype.__proto__");
+
+ if ((IS_RECEIVER(proto) || IS_NULL(proto)) && IS_RECEIVER(this)) {
+ %SetPrototype(this, proto);
+ }
+}
+
+
// ES6 19.1.1.1
function ObjectConstructor(x) {
if (GlobalObject != new.target && !IS_UNDEFINED(new.target)) {
@@ -135,6 +151,8 @@
// __defineSetter__ is added in bootstrapper.cc.
// __lookupSetter__ is added in bootstrapper.cc.
]);
+utils.InstallGetterSetter(
+ GlobalObject.prototype, "__proto__", ObjectGetProto, ObjectSetProto);
// ----------------------------------------------------------------------------
« no previous file with comments | « src/builtins/builtins-object.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698