[ES6] Implement Reflect.getPrototypeOf and Reflect.setPrototypeOf
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Aug 2015 17:57:08 +0000 (17:57 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Aug 2015 17:57:08 +0000 (17:57 +0000)
commit46434740dbc507bc16aec7b03290a2ad95187b3a
treeba5c87ba0e3b3cb1904c08b5426030156bac2a64
parent20bfda6e07c62e80afd3191d61a8445352c886fa
[ES6] Implement Reflect.getPrototypeOf and Reflect.setPrototypeOf
https://bugs.webkit.org/show_bug.cgi?id=147874

Reviewed by Darin Adler.

This patch implements ES6 Reflect.{getPrototypeOf, setPrototypeOf}.
The difference from the Object.* one is

1. They dont not perform ToObject onto the non-object arguments. They make it as a TypeError.
2. Reflect.setPrototyeOf returns false when the operation is failed. In Object.setPrototypeOf, it raises a TypeError.

* runtime/ObjectConstructor.cpp:
(JSC::ObjectConstructorGetPrototypeOfFunctor::ObjectConstructorGetPrototypeOfFunctor):
(JSC::ObjectConstructorGetPrototypeOfFunctor::result):
(JSC::ObjectConstructorGetPrototypeOfFunctor::operator()):
(JSC::objectConstructorGetPrototypeOf):
* runtime/ObjectConstructor.h:
* runtime/ReflectObject.cpp:
(JSC::reflectObjectGetPrototypeOf):
(JSC::reflectObjectSetPrototypeOf):
* tests/stress/reflect-get-prototype-of.js: Added.
(shouldBe):
(shouldThrow):
(Base):
(Derived):
* tests/stress/reflect-set-prototype-of.js: Added.
(shouldBe):
(shouldThrow):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188262 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/ObjectConstructor.cpp
Source/JavaScriptCore/runtime/ObjectConstructor.h
Source/JavaScriptCore/runtime/ReflectObject.cpp
Source/JavaScriptCore/tests/stress/reflect-get-prototype-of.js [new file with mode: 0644]
Source/JavaScriptCore/tests/stress/reflect-set-prototype-of.js [new file with mode: 0644]