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

Unified Diff: src/v8natives.js

Issue 141913002: ES6: Implement Object.setPrototypeOf (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add macro and add lookup test Created 6 years, 11 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/string.js ('k') | test/mjsunit/set-prototype-of.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/v8natives.js
diff --git a/src/v8natives.js b/src/v8natives.js
index e987baf6d6b36ff3708c770a76ab8f463b657a46..b0b66e760b32118be5876b223a3292844a0ae439 100644
--- a/src/v8natives.js
+++ b/src/v8natives.js
@@ -1015,6 +1015,21 @@ function ObjectGetPrototypeOf(obj) {
return %GetPrototype(obj);
}
+// ES6 section 19.1.2.19.
+function ObjectSetPrototypeOf(obj, proto) {
+ CHECK_OBJECT_COERCIBLE(obj, "Object.setPrototypeOf");
+
+ if (proto !== null && !IS_SPEC_OBJECT(proto)) {
+ throw MakeTypeError("proto_object_or_null", [proto]);
+ }
+
+ if (IS_SPEC_OBJECT(obj)) {
+ %SetPrototype(obj, proto);
+ }
+
+ return obj;
+}
+
// ES5 section 15.2.3.3
function ObjectGetOwnPropertyDescriptor(obj, p) {
@@ -1443,6 +1458,7 @@ function SetUpObject() {
"defineProperties", ObjectDefineProperties,
"freeze", ObjectFreeze,
"getPrototypeOf", ObjectGetPrototypeOf,
+ "setPrototypeOf", ObjectSetPrototypeOf,
"getOwnPropertyDescriptor", ObjectGetOwnPropertyDescriptor,
"getOwnPropertyNames", ObjectGetOwnPropertyNames,
// getOwnPropertySymbols is added in symbol.js.
« no previous file with comments | « src/string.js ('k') | test/mjsunit/set-prototype-of.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698