jsc commandline's run() function should take extra arguments
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Sep 2013 17:53:40 +0000 (17:53 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Sep 2013 17:53:40 +0000 (17:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=121098

Reviewed by Michael Saboff.

* jsc.cpp:
(functionRun):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@155455 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/jsc.cpp

index 1f2b0b3..3ffede1 100644 (file)
@@ -1,3 +1,13 @@
+2013-09-10  Filip Pizlo  <fpizlo@apple.com>
+
+        jsc commandline's run() function should take extra arguments
+        https://bugs.webkit.org/show_bug.cgi?id=121098
+
+        Reviewed by Michael Saboff.
+
+        * jsc.cpp:
+        (functionRun):
+
 2013-09-09  Michael Saboff  <msaboff@apple.com>
 
         There should be one "invalid" virtual register constant
index 5f2b41c..7783d8f 100644 (file)
@@ -389,6 +389,12 @@ EncodedJSValue JSC_HOST_CALL functionRun(ExecState* exec)
 
     GlobalObject* globalObject = GlobalObject::create(exec->vm(), GlobalObject::createStructure(exec->vm(), jsNull()), Vector<String>());
 
+    JSArray* array = constructEmptyArray(globalObject->globalExec(), 0);
+    for (unsigned i = 1; i < exec->argumentCount(); ++i)
+        array->putDirectIndex(globalObject->globalExec(), i - 1, exec->argument(i));
+    globalObject->putDirect(
+        exec->vm(), Identifier(globalObject->globalExec(), "arguments"), array);
+
     JSValue exception;
     StopWatch stopWatch;
     stopWatch.start();