Chromium Code Reviews| Index: src/v8natives.js |
| diff --git a/src/v8natives.js b/src/v8natives.js |
| index e987baf6d6b36ff3708c770a76ab8f463b657a46..71b1e4880b7bd75fb7a9e95f25697e7323651861 100644 |
| --- a/src/v8natives.js |
| +++ b/src/v8natives.js |
| @@ -1015,6 +1015,24 @@ function ObjectGetPrototypeOf(obj) { |
| return %GetPrototype(obj); |
| } |
| +// ES6 section 19.1.2.19. |
| +function ObjectSetPrototypeOf(obj, proto) { |
| + if (IS_NULL_OR_UNDEFINED(obj) && !IS_UNDETECTABLE(obj)) { |
|
arv (Not doing code reviews)
2014/01/17 17:43:23
The ES6 spec uses CheckObjectCoercible. It comes u
Dmitry Lomov (no reviews)
2014/01/17 20:17:36
Agreed, good idea.
|
| + throw MakeTypeError("called_on_null_or_undefined", |
| + ["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 +1461,7 @@ function SetUpObject() { |
| "defineProperties", ObjectDefineProperties, |
| "freeze", ObjectFreeze, |
| "getPrototypeOf", ObjectGetPrototypeOf, |
| + "setPrototypeOf", ObjectSetPrototypeOf, |
| "getOwnPropertyDescriptor", ObjectGetOwnPropertyDescriptor, |
| "getOwnPropertyNames", ObjectGetOwnPropertyNames, |
| // getOwnPropertySymbols is added in symbol.js. |