[ES6] Implement Reflect.apply
https://bugs.webkit.org/show_bug.cgi?id=147306

Reviewed by Sam Weinig.

Implement Reflect.apply.
The large part of this can be implemented by the @apply builtin annotation.
The only thing which is different from the Funciton.prototype.apply is the third parameter,
"argumentsList" is needed to be an object.

* builtins/ReflectObject.js:
(apply):
(deleteProperty):
* runtime/ReflectObject.cpp:
* tests/stress/reflect-apply.js: Added.
(shouldBe):
(shouldThrow):
(get shouldThrow):
(.get shouldThrow):
(get var.array.get length):
(get var.array.get 0):
(.get var):
* tests/stress/reflect-delete-property.js:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@187407 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/builtins/ReflectObject.js b/Source/JavaScriptCore/builtins/ReflectObject.js
index 15013ac..166af07 100644
--- a/Source/JavaScriptCore/builtins/ReflectObject.js
+++ b/Source/JavaScriptCore/builtins/ReflectObject.js
@@ -23,13 +23,26 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+function apply(target, thisArgument, argumentsList)
+{
+    "use strict";
+
+    if (typeof target !== "function")
+        throw new @TypeError("Reflect.apply requires the first argument be a function");
+
+    if (!@isObject(argumentsList))
+        throw new @TypeError("Reflect.apply requires the third argument be an object");
+
+    return target.@apply(thisArgument, argumentsList);
+}
+
 function deleteProperty(target, propertyKey)
 {
     // Intentionally keep the code the sloppy mode to suppress the TypeError
     // raised by the delete operator under the strict mode.
 
     if (!@isObject(target))
-        throw new @TypeError("Reflect.deleteProperty requires the first argument be a object");
+        throw new @TypeError("Reflect.deleteProperty requires the first argument be an object");
 
     return delete target[propertyKey];
 }