Add ExecState::uncheckedArgument and use where possible to shrink a bit
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 22 Sep 2013 04:02:59 +0000 (04:02 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 22 Sep 2013 04:02:59 +0000 (04:02 +0000)
https://bugs.webkit.org/show_bug.cgi?id=121750

Reviewed by Andreas Kling.

Source/JavaScriptCore:

* interpreter/CallFrame.h:
(JSC::ExecState::uncheckedArgument): Added. Like argument, but with an
assertion rather than a runtime check.

* API/APICallbackFunction.h:
(JSC::APICallbackFunction::call): Use uncheckedArgument because we are
already in a loop over arguments, so don't need a range check.
* API/JSCallbackConstructor.cpp:
(JSC::constructJSCallback): Ditto.
* API/JSCallbackObjectFunctions.h:
(JSC::JSCallbackObject::construct): Ditto.
(JSC::JSCallbackObject::call): Ditto.
* jsc.cpp:
(functionPrint): Ditto.
(functionRun): Ditto.
(functionSetSamplingFlags): Ditto.
(functionClearSamplingFlags): Ditto.
* runtime/ArrayPrototype.cpp:
(JSC::arrayProtoFuncConcat): Ditto.
(JSC::arrayProtoFuncPush): Use uncheckedArgument because there is already
code that explicitly checks argumentCount.
(JSC::arrayProtoFuncSplice): Ditto.
(JSC::arrayProtoFuncUnShift): Ditto.
(JSC::arrayProtoFuncReduce): Ditto.
(JSC::arrayProtoFuncReduceRight): Ditto.
(JSC::arrayProtoFuncLastIndexOf): Ditto.
* runtime/DatePrototype.cpp:
(JSC::fillStructuresUsingTimeArgs): Ditto.
(JSC::fillStructuresUsingDateArgs): Ditto.
* runtime/JSArrayBufferConstructor.cpp:
(JSC::constructArrayBuffer): Ditto.
* runtime/JSArrayBufferPrototype.cpp:
(JSC::arrayBufferProtoFuncSlice): Ditto.
* runtime/JSBoundFunction.cpp:
(JSC::boundFunctionCall): Ditto.
(JSC::boundFunctionConstruct): Ditto.
* runtime/JSDataViewPrototype.cpp:
(JSC::getData): Ditto.
(JSC::setData): Ditto.
* runtime/JSGenericTypedArrayViewConstructorInlines.h:
(JSC::constructGenericTypedArrayView): Ditto.
* runtime/JSGenericTypedArrayViewPrototypeInlines.h:
(JSC::genericTypedArrayViewProtoFuncSet): Ditto.
(JSC::genericTypedArrayViewProtoFuncSubarray): Ditto.
* runtime/JSONObject.cpp:
(JSC::JSONProtoFuncParse): Ditto.
(JSC::JSONProtoFuncStringify): Ditto.
* runtime/JSPromiseConstructor.cpp:
(JSC::constructPromise): Ditto.
(JSC::JSPromiseConstructorFuncFulfill): Ditto.
(JSC::JSPromiseConstructorFuncResolve): Ditto.
(JSC::JSPromiseConstructorFuncReject): Ditto.
* runtime/MathObject.cpp:
(JSC::mathProtoFuncMax): Ditto.
(JSC::mathProtoFuncMin): Ditto.

* runtime/NameConstructor.cpp:
(JSC::constructPrivateName): Removed unneeded check of argumentCout
that simply repeats what argument already does.
* runtime/NativeErrorConstructor.cpp:
(JSC::Interpreter::constructWithNativeErrorConstructor): Ditto.
(JSC::Interpreter::callNativeErrorConstructor): Ditto.

* runtime/NumberConstructor.cpp:
(JSC::constructWithNumberConstructor): Use uncheckedArgument since
there is already code that explicitly checks argument count.
(JSC::callNumberConstructor): Ditto.

* runtime/ObjectConstructor.cpp:
(JSC::objectConstructorCreate): Small refactoring to not call argument(0)
three times.

* runtime/SetConstructor.cpp:
(JSC::constructSet): Use uncheckedArgument since we are already in a loop
over arguments.

* runtime/StringConstructor.cpp:
(JSC::stringFromCharCodeSlowCase): In a loop.
(JSC::stringFromCharCode): Already checked count.
(JSC::constructWithStringConstructor): Ditto.
(JSC::callStringConstructor): Ditto.
* runtime/StringPrototype.cpp:
(JSC::stringProtoFuncConcat): Already checked count.
* runtime/TestRunnerUtils.cpp:
(JSC::numberOfDFGCompiles): Ditto.
(JSC::setNeverInline): Ditto.

Source/WebCore:

* bindings/js/JSHTMLCanvasElementCustom.cpp:
(WebCore::JSHTMLCanvasElement::probablySupportsContext): Already checked count.
(WebCore::JSHTMLCanvasElement::toDataURL): Ditto.
* bindings/js/JSHTMLDocumentCustom.cpp:
(WebCore::documentWrite): In a loop.
* bindings/js/JSInjectedScriptHostCustom.cpp:
(WebCore::JSInjectedScriptHost::inspectedObject): Already checked count.
(WebCore::JSInjectedScriptHost::internalConstructorName): Ditto.
(WebCore::JSInjectedScriptHost::isHTMLAllCollection): Ditto.
(WebCore::JSInjectedScriptHost::type): Ditto.
(WebCore::JSInjectedScriptHost::functionDetails): Ditto.
(WebCore::JSInjectedScriptHost::getEventListeners): Ditto.
(WebCore::JSInjectedScriptHost::inspect): Ditto.
(WebCore::JSInjectedScriptHost::databaseId): Ditto.
(WebCore::JSInjectedScriptHost::storageId): Ditto.
* bindings/js/JSSQLTransactionSyncCustom.cpp:
(WebCore::JSSQLTransactionSync::executeSql): Ditto.
* bindings/js/JSSVGLengthCustom.cpp:
(WebCore::JSSVGLength::convertToSpecifiedUnits): Ditto.
* bindings/js/JSSharedWorkerCustom.cpp:
(WebCore::JSSharedWorkerConstructor::constructJSSharedWorker): Ditto.

* bindings/js/JSWebGLRenderingContextCustom.cpp:
(WebCore::getObjectParameter): Already checked count.
(WebCore::JSWebGLRenderingContext::getAttachedShaders): Removed tortured code
to triply do the checking that the toWebGLProgram function already does, including
spurious exception checking in code that can't create an exception. Also count is
already checked.
(WebCore::JSWebGLRenderingContext::getExtension): More of the same.
(WebCore::JSWebGLRenderingContext::getFramebufferAttachmentParameter): Ditto.
(WebCore::JSWebGLRenderingContext::getParameter): Ditto.
(WebCore::JSWebGLRenderingContext::getProgramParameter): Ditto.
(WebCore::JSWebGLRenderingContext::getShaderParameter): Ditto.
(WebCore::JSWebGLRenderingContext::getUniform): Ditto.
(WebCore::dataFunctionf): Ditto.
(WebCore::dataFunctioni): Ditto.
(WebCore::dataFunctionMatrix): Ditto.

* bindings/js/JSWorkerGlobalScopeCustom.cpp:
(WebCore::JSWorkerGlobalScope::importScripts): In a loop.
* bindings/js/JSXMLHttpRequestCustom.cpp:
(WebCore::JSXMLHttpRequest::open): Already checked. Also removed some unneeded
argument count checks.
(WebCore::JSXMLHttpRequest::send): Removed unneeded special case for 0 argument
count that does the same thing as the undefined case, since asking for an
argument past the count yields undefined.

* bindings/js/JSXSLTProcessorCustom.cpp:
(WebCore::JSXSLTProcessor::setParameter): Already checked.
(WebCore::JSXSLTProcessor::getParameter): Already checked.
(WebCore::JSXSLTProcessor::removeParameter): Already checked.

* bindings/js/ScheduledAction.cpp:
(WebCore::ScheduledAction::ScheduledAction): In a loop.
* bindings/js/ScriptCallStackFactory.cpp:
(WebCore::createScriptArguments): Ditto.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateParametersCheck): Removed some excess argumentCount checks.
Used uncheckedArgument in a few places. More needs to be done, especially for
overloaded functions.

* bridge/c/c_instance.cpp:
(JSC::Bindings::CInstance::invokeMethod): In a loop.
(JSC::Bindings::CInstance::invokeDefaultMethod): Ditto.
* bridge/objc/objc_instance.mm:
(ObjcInstance::invokeObjcMethod): Ditto.
(ObjcInstance::invokeDefaultMethod): Ditto.

* bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
Updated.

Source/WebKit2:

* WebProcess/Plugins/Netscape/JSNPObject.cpp:
(WebKit::JSNPObject::callMethod): In a loop.
(WebKit::JSNPObject::callObject): Ditto.
(WebKit::JSNPObject::callConstructor): Ditto.

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

46 files changed:
Source/JavaScriptCore/API/APICallbackFunction.h
Source/JavaScriptCore/API/JSCallbackConstructor.cpp
Source/JavaScriptCore/API/JSCallbackObjectFunctions.h
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/interpreter/CallFrame.h
Source/JavaScriptCore/jsc.cpp
Source/JavaScriptCore/runtime/ArrayPrototype.cpp
Source/JavaScriptCore/runtime/DatePrototype.cpp
Source/JavaScriptCore/runtime/JSArrayBufferConstructor.cpp
Source/JavaScriptCore/runtime/JSArrayBufferPrototype.cpp
Source/JavaScriptCore/runtime/JSBoundFunction.cpp
Source/JavaScriptCore/runtime/JSDataViewPrototype.cpp
Source/JavaScriptCore/runtime/JSGenericTypedArrayViewConstructorInlines.h
Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeInlines.h
Source/JavaScriptCore/runtime/JSONObject.cpp
Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp
Source/JavaScriptCore/runtime/MathObject.cpp
Source/JavaScriptCore/runtime/NameConstructor.cpp
Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp
Source/JavaScriptCore/runtime/NumberConstructor.cpp
Source/JavaScriptCore/runtime/ObjectConstructor.cpp
Source/JavaScriptCore/runtime/SetConstructor.cpp
Source/JavaScriptCore/runtime/StringConstructor.cpp
Source/JavaScriptCore/runtime/StringPrototype.cpp
Source/JavaScriptCore/runtime/TestRunnerUtils.cpp
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp
Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp
Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
Source/WebCore/bindings/js/JSSQLTransactionSyncCustom.cpp
Source/WebCore/bindings/js/JSSVGLengthCustom.cpp
Source/WebCore/bindings/js/JSSharedWorkerCustom.cpp
Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp
Source/WebCore/bindings/js/JSWorkerGlobalScopeCustom.cpp
Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
Source/WebCore/bindings/js/JSXSLTProcessorCustom.cpp
Source/WebCore/bindings/js/ScheduledAction.cpp
Source/WebCore/bindings/js/ScriptCallStackFactory.cpp
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp
Source/WebCore/bridge/c/c_instance.cpp
Source/WebCore/bridge/objc/objc_instance.mm
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp

index 683b638..d91c50b 100644 (file)
@@ -50,7 +50,7 @@ EncodedJSValue JSC_HOST_CALL APICallbackFunction::call(ExecState* exec)
     Vector<JSValueRef, 16> arguments;
     arguments.reserveInitialCapacity(argumentCount);
     for (int i = 0; i < argumentCount; i++)
-        arguments.uncheckedAppend(toRef(exec, exec->argument(i)));
+        arguments.uncheckedAppend(toRef(exec, exec->uncheckedArgument(i)));
 
     JSValueRef exception = 0;
     JSValueRef result;
index 371d583..dc9ccc6 100644 (file)
@@ -77,7 +77,7 @@ static EncodedJSValue JSC_HOST_CALL constructJSCallback(ExecState* exec)
         Vector<JSValueRef, 16> arguments;
         arguments.reserveInitialCapacity(argumentCount);
         for (size_t i = 0; i < argumentCount; ++i)
-            arguments.uncheckedAppend(toRef(exec, exec->argument(i)));
+            arguments.uncheckedAppend(toRef(exec, exec->uncheckedArgument(i)));
 
         JSValueRef exception = 0;
         JSObjectRef result;
index d1a89fa..3b035a3 100644 (file)
@@ -407,7 +407,7 @@ EncodedJSValue JSCallbackObject<Parent>::construct(ExecState* exec)
             Vector<JSValueRef, 16> arguments;
             arguments.reserveInitialCapacity(argumentCount);
             for (size_t i = 0; i < argumentCount; ++i)
-                arguments.uncheckedAppend(toRef(exec, exec->argument(i)));
+                arguments.uncheckedAppend(toRef(exec, exec->uncheckedArgument(i)));
             JSValueRef exception = 0;
             JSObject* result;
             {
@@ -474,7 +474,7 @@ EncodedJSValue JSCallbackObject<Parent>::call(ExecState* exec)
             Vector<JSValueRef, 16> arguments;
             arguments.reserveInitialCapacity(argumentCount);
             for (size_t i = 0; i < argumentCount; ++i)
-                arguments.uncheckedAppend(toRef(exec, exec->argument(i)));
+                arguments.uncheckedAppend(toRef(exec, exec->uncheckedArgument(i)));
             JSValueRef exception = 0;
             JSValue result;
             {
index a4eae44..9fe71e7 100644 (file)
@@ -1,3 +1,97 @@
+2013-09-21  Darin Adler  <darin@apple.com>
+
+        Add ExecState::uncheckedArgument and use where possible to shrink a bit
+        https://bugs.webkit.org/show_bug.cgi?id=121750
+
+        Reviewed by Andreas Kling.
+
+        * interpreter/CallFrame.h:
+        (JSC::ExecState::uncheckedArgument): Added. Like argument, but with an
+        assertion rather than a runtime check.
+
+        * API/APICallbackFunction.h:
+        (JSC::APICallbackFunction::call): Use uncheckedArgument because we are
+        already in a loop over arguments, so don't need a range check.
+        * API/JSCallbackConstructor.cpp:
+        (JSC::constructJSCallback): Ditto.
+        * API/JSCallbackObjectFunctions.h:
+        (JSC::JSCallbackObject::construct): Ditto.
+        (JSC::JSCallbackObject::call): Ditto.
+        * jsc.cpp:
+        (functionPrint): Ditto.
+        (functionRun): Ditto.
+        (functionSetSamplingFlags): Ditto.
+        (functionClearSamplingFlags): Ditto.
+        * runtime/ArrayPrototype.cpp:
+        (JSC::arrayProtoFuncConcat): Ditto.
+        (JSC::arrayProtoFuncPush): Use uncheckedArgument because there is already
+        code that explicitly checks argumentCount.
+        (JSC::arrayProtoFuncSplice): Ditto.
+        (JSC::arrayProtoFuncUnShift): Ditto.
+        (JSC::arrayProtoFuncReduce): Ditto.
+        (JSC::arrayProtoFuncReduceRight): Ditto.
+        (JSC::arrayProtoFuncLastIndexOf): Ditto.
+        * runtime/DatePrototype.cpp:
+        (JSC::fillStructuresUsingTimeArgs): Ditto.
+        (JSC::fillStructuresUsingDateArgs): Ditto.
+        * runtime/JSArrayBufferConstructor.cpp:
+        (JSC::constructArrayBuffer): Ditto.
+        * runtime/JSArrayBufferPrototype.cpp:
+        (JSC::arrayBufferProtoFuncSlice): Ditto.
+        * runtime/JSBoundFunction.cpp:
+        (JSC::boundFunctionCall): Ditto.
+        (JSC::boundFunctionConstruct): Ditto.
+        * runtime/JSDataViewPrototype.cpp:
+        (JSC::getData): Ditto.
+        (JSC::setData): Ditto.
+        * runtime/JSGenericTypedArrayViewConstructorInlines.h:
+        (JSC::constructGenericTypedArrayView): Ditto.
+        * runtime/JSGenericTypedArrayViewPrototypeInlines.h:
+        (JSC::genericTypedArrayViewProtoFuncSet): Ditto.
+        (JSC::genericTypedArrayViewProtoFuncSubarray): Ditto.
+        * runtime/JSONObject.cpp:
+        (JSC::JSONProtoFuncParse): Ditto.
+        (JSC::JSONProtoFuncStringify): Ditto.
+        * runtime/JSPromiseConstructor.cpp:
+        (JSC::constructPromise): Ditto.
+        (JSC::JSPromiseConstructorFuncFulfill): Ditto.
+        (JSC::JSPromiseConstructorFuncResolve): Ditto.
+        (JSC::JSPromiseConstructorFuncReject): Ditto.
+        * runtime/MathObject.cpp:
+        (JSC::mathProtoFuncMax): Ditto.
+        (JSC::mathProtoFuncMin): Ditto.
+
+        * runtime/NameConstructor.cpp:
+        (JSC::constructPrivateName): Removed unneeded check of argumentCout
+        that simply repeats what argument already does.
+        * runtime/NativeErrorConstructor.cpp:
+        (JSC::Interpreter::constructWithNativeErrorConstructor): Ditto.
+        (JSC::Interpreter::callNativeErrorConstructor): Ditto.
+
+        * runtime/NumberConstructor.cpp:
+        (JSC::constructWithNumberConstructor): Use uncheckedArgument since
+        there is already code that explicitly checks argument count.
+        (JSC::callNumberConstructor): Ditto.
+
+        * runtime/ObjectConstructor.cpp:
+        (JSC::objectConstructorCreate): Small refactoring to not call argument(0)
+        three times.
+
+        * runtime/SetConstructor.cpp:
+        (JSC::constructSet): Use uncheckedArgument since we are already in a loop
+        over arguments.
+
+        * runtime/StringConstructor.cpp:
+        (JSC::stringFromCharCodeSlowCase): In a loop.
+        (JSC::stringFromCharCode): Already checked count.
+        (JSC::constructWithStringConstructor): Ditto.
+        (JSC::callStringConstructor): Ditto.
+        * runtime/StringPrototype.cpp:
+        (JSC::stringProtoFuncConcat): Already checked count.
+        * runtime/TestRunnerUtils.cpp:
+        (JSC::numberOfDFGCompiles): Ditto.
+        (JSC::setNeverInline): Ditto.
+
 2013-09-21  Filip Pizlo  <fpizlo@apple.com>
 
         Remove the notion that a CallFrame can have a pointer to an InlineCallFrame, since that doesn't happen anymore
index 9e878a3..e06e322 100644 (file)
@@ -229,7 +229,12 @@ namespace JSC  {
         {
             if (argument >= argumentCount())
                  return jsUndefined();
-            return this[argumentOffset(argument)].jsValue();
+            return getArgumentUnsafe(argument);
+        }
+        JSValue uncheckedArgument(size_t argument)
+        {
+            ASSERT(argument < argumentCount());
+            return getArgumentUnsafe(argument);
         }
         void setArgument(size_t argument, JSValue value)
         {
index 50b184b..bd23d66 100644 (file)
@@ -300,7 +300,7 @@ EncodedJSValue JSC_HOST_CALL functionPrint(ExecState* exec)
         if (i)
             putchar(' ');
 
-        printf("%s", exec->argument(i).toString(exec)->value(exec).utf8().data());
+        printf("%s", exec->uncheckedArgument(i).toString(exec)->value(exec).utf8().data());
     }
 
     putchar('\n');
@@ -391,7 +391,7 @@ EncodedJSValue JSC_HOST_CALL functionRun(ExecState* exec)
 
     JSArray* array = constructEmptyArray(globalObject->globalExec(), 0);
     for (unsigned i = 1; i < exec->argumentCount(); ++i)
-        array->putDirectIndex(globalObject->globalExec(), i - 1, exec->argument(i));
+        array->putDirectIndex(globalObject->globalExec(), i - 1, exec->uncheckedArgument(i));
     globalObject->putDirect(
         exec->vm(), Identifier(globalObject->globalExec(), "arguments"), array);
 
@@ -450,7 +450,7 @@ EncodedJSValue JSC_HOST_CALL functionCheckSyntax(ExecState* exec)
 EncodedJSValue JSC_HOST_CALL functionSetSamplingFlags(ExecState* exec)
 {
     for (unsigned i = 0; i < exec->argumentCount(); ++i) {
-        unsigned flag = static_cast<unsigned>(exec->argument(i).toNumber(exec));
+        unsigned flag = static_cast<unsigned>(exec->uncheckedArgument(i).toNumber(exec));
         if ((flag >= 1) && (flag <= 32))
             SamplingFlags::setFlag(flag);
     }
@@ -460,7 +460,7 @@ EncodedJSValue JSC_HOST_CALL functionSetSamplingFlags(ExecState* exec)
 EncodedJSValue JSC_HOST_CALL functionClearSamplingFlags(ExecState* exec)
 {
     for (unsigned i = 0; i < exec->argumentCount(); ++i) {
-        unsigned flag = static_cast<unsigned>(exec->argument(i).toNumber(exec));
+        unsigned flag = static_cast<unsigned>(exec->uncheckedArgument(i).toNumber(exec));
         if ((flag >= 1) && (flag <= 32))
             SamplingFlags::clearFlag(flag);
     }
index 2f8ddba..fcc082e 100644 (file)
@@ -439,7 +439,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncConcat(ExecState* exec)
         }
         if (i == argCount)
             break;
-        curArg = (exec->argument(i));
+        curArg = exec->uncheckedArgument(i);
         ++i;
     }
     arr->setLength(exec, n);
@@ -481,7 +481,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncPush(ExecState* exec)
 
     if (isJSArray(thisValue) && exec->argumentCount() == 1) {
         JSArray* array = asArray(thisValue);
-        array->push(exec, exec->argument(0));
+        array->push(exec, exec->uncheckedArgument(0));
         return JSValue::encode(jsNumber(array->length()));
     }
     
@@ -493,11 +493,11 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncPush(ExecState* exec)
     for (unsigned n = 0; n < exec->argumentCount(); n++) {
         // Check for integer overflow; where safe we can do a fast put by index.
         if (length + n >= length)
-            thisObj->methodTable()->putByIndex(thisObj, exec, length + n, exec->argument(n), true);
+            thisObj->methodTable()->putByIndex(thisObj, exec, length + n, exec->uncheckedArgument(n), true);
         else {
             PutPropertySlot slot;
             Identifier propertyName(exec, JSValue(static_cast<int64_t>(length) + static_cast<int64_t>(n)).toWTFString(exec));
-            thisObj->methodTable()->put(thisObj, exec, propertyName, exec->argument(n), slot);
+            thisObj->methodTable()->put(thisObj, exec, propertyName, exec->uncheckedArgument(n), slot);
         }
         if (exec->hadException())
             return JSValue::encode(jsUndefined());
@@ -767,7 +767,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncSplice(ExecState* exec)
 
     unsigned deleteCount = length - begin;
     if (exec->argumentCount() > 1) {
-        double deleteDouble = exec->argument(1).toInteger(exec);
+        double deleteDouble = exec->uncheckedArgument(1).toInteger(exec);
         if (deleteDouble < 0)
             deleteCount = 0;
         else if (deleteDouble > length - begin)
@@ -800,7 +800,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncSplice(ExecState* exec)
             return JSValue::encode(jsUndefined());
     }
     for (unsigned k = 0; k < additionalArgs; ++k) {
-        thisObj->methodTable()->putByIndex(thisObj, exec, k + begin, exec->argument(k + 2), true);
+        thisObj->methodTable()->putByIndex(thisObj, exec, k + begin, exec->uncheckedArgument(k + 2), true);
         if (exec->hadException())
             return JSValue::encode(jsUndefined());
     }
@@ -825,7 +825,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncUnShift(ExecState* exec)
             return JSValue::encode(jsUndefined());
     }
     for (unsigned k = 0; k < nrArgs; ++k) {
-        thisObj->methodTable()->putByIndex(thisObj, exec, k, exec->argument(k), true);
+        thisObj->methodTable()->putByIndex(thisObj, exec, k, exec->uncheckedArgument(k), true);
         if (exec->hadException())
             return JSValue::encode(jsUndefined());
     }
@@ -1143,7 +1143,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncReduce(ExecState* exec)
         array = asArray(thisObj);
 
     if (exec->argumentCount() >= 2)
-        rv = exec->argument(1);
+        rv = exec->uncheckedArgument(1);
     else if (array && array->canGetIndexQuickly(0)) {
         rv = array->getIndexQuickly(0);
         i = 1;
@@ -1220,7 +1220,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncReduceRight(ExecState* exec)
         array = asArray(thisObj);
     
     if (exec->argumentCount() >= 2)
-        rv = exec->argument(1);
+        rv = exec->uncheckedArgument(1);
     else if (array && array->canGetIndexQuickly(length - 1)) {
         rv = array->getIndexQuickly(length - 1);
         i = 1;
@@ -1306,7 +1306,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncLastIndexOf(ExecState* exec)
 
     unsigned index = length - 1;
     if (exec->argumentCount() >= 2) {
-        JSValue fromValue = exec->argument(1);
+        JSValue fromValue = exec->uncheckedArgument(1);
         double fromDouble = fromValue.toInteger(exec);
         if (fromDouble < 0) {
             fromDouble += length;
index 74a04d6..d4f746b 100644 (file)
@@ -373,7 +373,7 @@ static bool fillStructuresUsingTimeArgs(ExecState* exec, int maxArgs, double* ms
     // hours
     if (maxArgs >= 4 && idx < numArgs) {
         t->setHour(0);
-        double hours = exec->argument(idx++).toIntegerPreserveNaN(exec);
+        double hours = exec->uncheckedArgument(idx++).toIntegerPreserveNaN(exec);
         ok = std::isfinite(hours);
         milliseconds += hours * msPerHour;
     }
@@ -381,7 +381,7 @@ static bool fillStructuresUsingTimeArgs(ExecState* exec, int maxArgs, double* ms
     // minutes
     if (maxArgs >= 3 && idx < numArgs && ok) {
         t->setMinute(0);
-        double minutes = exec->argument(idx++).toIntegerPreserveNaN(exec);
+        double minutes = exec->uncheckedArgument(idx++).toIntegerPreserveNaN(exec);
         ok = std::isfinite(minutes);
         milliseconds += minutes * msPerMinute;
     }
@@ -389,7 +389,7 @@ static bool fillStructuresUsingTimeArgs(ExecState* exec, int maxArgs, double* ms
     // seconds
     if (maxArgs >= 2 && idx < numArgs && ok) {
         t->setSecond(0);
-        double seconds = exec->argument(idx++).toIntegerPreserveNaN(exec);
+        double seconds = exec->uncheckedArgument(idx++).toIntegerPreserveNaN(exec);
         ok = std::isfinite(seconds);
         milliseconds += seconds * msPerSecond;
     }
@@ -399,7 +399,7 @@ static bool fillStructuresUsingTimeArgs(ExecState* exec, int maxArgs, double* ms
         
     // milliseconds
     if (idx < numArgs) {
-        double millis = exec->argument(idx).toIntegerPreserveNaN(exec);
+        double millis = exec->uncheckedArgument(idx).toIntegerPreserveNaN(exec);
         ok = std::isfinite(millis);
         milliseconds += millis;
     } else
@@ -425,19 +425,19 @@ static bool fillStructuresUsingDateArgs(ExecState *exec, int maxArgs, double *ms
   
     // years
     if (maxArgs >= 3 && idx < numArgs) {
-        double years = exec->argument(idx++).toIntegerPreserveNaN(exec);
+        double years = exec->uncheckedArgument(idx++).toIntegerPreserveNaN(exec);
         ok = std::isfinite(years);
         t->setYear(toInt32(years));
     }
     // months
     if (maxArgs >= 2 && idx < numArgs && ok) {
-        double months = exec->argument(idx++).toIntegerPreserveNaN(exec);
+        double months = exec->uncheckedArgument(idx++).toIntegerPreserveNaN(exec);
         ok = std::isfinite(months);
         t->setMonth(toInt32(months));
     }
     // days
     if (idx < numArgs && ok) {
-        double days = exec->argument(idx++).toIntegerPreserveNaN(exec);
+        double days = exec->uncheckedArgument(idx++).toIntegerPreserveNaN(exec);
         ok = std::isfinite(days);
         t->setMonthDay(0);
         *ms += days * msPerDay;
index 821b853..82a214c 100644 (file)
@@ -77,7 +77,7 @@ static EncodedJSValue JSC_HOST_CALL constructArrayBuffer(ExecState* exec)
     
     unsigned length;
     if (exec->argumentCount()) {
-        length = exec->argument(0).toUInt32(exec);
+        length = exec->uncheckedArgument(0).toUInt32(exec);
         if (exec->hadException())
             return JSValue::encode(jsUndefined());
     } else {
index db58139..0b6bf7d 100644 (file)
@@ -52,7 +52,7 @@ static EncodedJSValue JSC_HOST_CALL arrayBufferProtoFuncSlice(ExecState* exec)
     
     int32_t end;
     if (exec->argumentCount() >= 2) {
-        end = exec->argument(1).toInt32(exec);
+        end = exec->uncheckedArgument(1).toInt32(exec);
         if (exec->hadException())
             return JSValue::encode(jsUndefined());
     } else
index 5e2466e..34d24a0 100644 (file)
@@ -45,7 +45,7 @@ EncodedJSValue JSC_HOST_CALL boundFunctionCall(ExecState* exec)
     for (unsigned i = 0; i < boundArgs->length(); ++i)
         args.append(boundArgs->getIndexQuickly(i));
     for (unsigned i = 0; i < exec->argumentCount(); ++i)
-        args.append(exec->argument(i));
+        args.append(exec->uncheckedArgument(i));
 
     JSObject* targetFunction = boundFunction->targetFunction();
     CallData callData;
@@ -65,7 +65,7 @@ EncodedJSValue JSC_HOST_CALL boundFunctionConstruct(ExecState* exec)
     for (unsigned i = 0; i < boundArgs->length(); ++i)
         args.append(boundArgs->getIndexQuickly(i));
     for (unsigned i = 0; i < exec->argumentCount(); ++i)
-        args.append(exec->argument(i));
+        args.append(exec->uncheckedArgument(i));
 
     JSObject* targetFunction = boundFunction->targetFunction();
     ConstructData constructData;
index 5af7872..8342a83 100644 (file)
@@ -101,14 +101,14 @@ EncodedJSValue getData(ExecState* exec)
     if (!exec->argumentCount())
         return throwVMError(exec, createTypeError(exec, "Need at least one argument (the byteOffset)"));
     
-    unsigned byteOffset = exec->argument(0).toUInt32(exec);
+    unsigned byteOffset = exec->uncheckedArgument(0).toUInt32(exec);
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
     
     bool littleEndian = false;
     unsigned elementSize = sizeof(typename Adaptor::Type);
     if (elementSize > 1 && exec->argumentCount() >= 2) {
-        littleEndian = exec->argument(1).toBoolean(exec);
+        littleEndian = exec->uncheckedArgument(1).toBoolean(exec);
         if (exec->hadException())
             return JSValue::encode(jsUndefined());
     }
@@ -135,18 +135,18 @@ EncodedJSValue setData(ExecState* exec)
     if (exec->argumentCount() < 2)
         return throwVMError(exec, createTypeError(exec, "Need at least two argument (the byteOffset and value)"));
     
-    unsigned byteOffset = exec->argument(0).toUInt32(exec);
+    unsigned byteOffset = exec->uncheckedArgument(0).toUInt32(exec);
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
     
-    typename Adaptor::Type value = toNativeFromValue<Adaptor>(exec, exec->argument(1));
+    typename Adaptor::Type value = toNativeFromValue<Adaptor>(exec, exec->uncheckedArgument(1));
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
     
     bool littleEndian = false;
     unsigned elementSize = sizeof(typename Adaptor::Type);
     if (elementSize > 1 && exec->argumentCount() >= 3) {
-        littleEndian = exec->argument(2).toBoolean(exec);
+        littleEndian = exec->uncheckedArgument(2).toBoolean(exec);
         if (exec->hadException())
             return JSValue::encode(jsUndefined());
     }
index 481b899..ce8ba63 100644 (file)
@@ -90,12 +90,12 @@ static EncodedJSValue JSC_HOST_CALL constructGenericTypedArrayView(ExecState* ex
     if (JSArrayBuffer* jsBuffer = jsDynamicCast<JSArrayBuffer*>(exec->argument(0))) {
         RefPtr<ArrayBuffer> buffer = jsBuffer->impl();
         
-        unsigned offset = (exec->argumentCount() > 1) ? exec->argument(1).toUInt32(exec) : 0;
+        unsigned offset = (exec->argumentCount() > 1) ? exec->uncheckedArgument(1).toUInt32(exec) : 0;
         if (exec->hadException())
             return JSValue::encode(jsUndefined());
         unsigned length = 0;
         if (exec->argumentCount() > 2) {
-            length = exec->argument(2).toUInt32(exec);
+            length = exec->uncheckedArgument(2).toUInt32(exec);
             if (exec->hadException())
                 return JSValue::encode(jsUndefined());
         } else {
@@ -113,7 +113,7 @@ static EncodedJSValue JSC_HOST_CALL constructGenericTypedArrayView(ExecState* ex
     // - Another array. This creates a copy of the of that array.
     // - An integer. This creates a new typed array of that length and zero-initializes it.
     
-    if (JSObject* object = jsDynamicCast<JSObject*>(exec->argument(0))) {
+    if (JSObject* object = jsDynamicCast<JSObject*>(exec->uncheckedArgument(0))) {
         unsigned length =
             object->get(exec, exec->vm().propertyNames->length).toUInt32(exec);
         if (exec->hadException())
@@ -132,13 +132,13 @@ static EncodedJSValue JSC_HOST_CALL constructGenericTypedArrayView(ExecState* ex
     }
     
     int length;
-    if (exec->argument(0).isInt32())
-        length = exec->argument(0).asInt32();
-    else if (!exec->argument(0).isNumber())
+    if (exec->uncheckedArgument(0).isInt32())
+        length = exec->uncheckedArgument(0).asInt32();
+    else if (!exec->uncheckedArgument(0).isNumber())
         return throwVMError(exec, createTypeError(exec, "Invalid array length argument"));
     else {
-        length = static_cast<int>(exec->argument(0).asNumber());
-        if (length != exec->argument(0).asNumber())
+        length = static_cast<int>(exec->uncheckedArgument(0).asNumber());
+        if (length != exec->uncheckedArgument(0).asNumber())
             return throwVMError(exec, createTypeError(exec, "Invalid array length argument (fractional lengths not allowed)"));
     }
 
index 628b256..7400149 100644 (file)
@@ -44,13 +44,13 @@ EncodedJSValue JSC_HOST_CALL genericTypedArrayViewProtoFuncSet(ExecState* exec)
     if (!exec->argumentCount())
         return throwVMError(exec, createTypeError(exec, "Expected at least one argument"));
     
-    JSObject* sourceArray = jsDynamicCast<JSObject*>(exec->argument(0));
+    JSObject* sourceArray = jsDynamicCast<JSObject*>(exec->uncheckedArgument(0));
     if (!sourceArray)
         return throwVMError(exec, createTypeError(exec, "First argument should be an object"));
     
     unsigned offset;
     if (exec->argumentCount() >= 2) {
-        offset = exec->argument(1).toUInt32(exec);
+        offset = exec->uncheckedArgument(1).toUInt32(exec);
         if (exec->hadException())
             return JSValue::encode(jsUndefined());
     } else
@@ -76,13 +76,13 @@ EncodedJSValue JSC_HOST_CALL genericTypedArrayViewProtoFuncSubarray(ExecState* e
     if (!exec->argumentCount())
         return throwVMError(exec, createTypeError(exec, "Expected at least one argument"));
     
-    int32_t begin = exec->argument(0).toInt32(exec);
+    int32_t begin = exec->uncheckedArgument(0).toInt32(exec);
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
     
     int32_t end;
     if (exec->argumentCount() >= 2) {
-        end = exec->argument(1).toInt32(exec);
+        end = exec->uncheckedArgument(1).toInt32(exec);
         if (exec->hadException())
             return JSValue::encode(jsUndefined());
     } else
index 8c7c8b8..1e14f3a 100644 (file)
@@ -777,7 +777,7 @@ EncodedJSValue JSC_HOST_CALL JSONProtoFuncParse(ExecState* exec)
 {
     if (!exec->argumentCount())
         return throwVMError(exec, createError(exec, ASCIILiteral("JSON.parse requires at least one parameter")));
-    String source = exec->argument(0).toString(exec)->value(exec);
+    String source = exec->uncheckedArgument(0).toString(exec)->value(exec);
     if (exec->hadException())
         return JSValue::encode(jsNull());
 
@@ -798,7 +798,7 @@ EncodedJSValue JSC_HOST_CALL JSONProtoFuncParse(ExecState* exec)
     if (exec->argumentCount() < 2)
         return JSValue::encode(unfiltered);
     
-    JSValue function = exec->argument(1);
+    JSValue function = exec->uncheckedArgument(1);
     CallData callData;
     CallType callType = getCallData(function, callData);
     if (callType == CallTypeNone)
@@ -812,7 +812,7 @@ EncodedJSValue JSC_HOST_CALL JSONProtoFuncStringify(ExecState* exec)
     if (!exec->argumentCount())
         return throwVMError(exec, createError(exec, ASCIILiteral("No input to stringify")));
     LocalScope scope(exec->vm());
-    Local<Unknown> value(exec->vm(), exec->argument(0));
+    Local<Unknown> value(exec->vm(), exec->uncheckedArgument(0));
     Local<Unknown> replacer(exec->vm(), exec->argument(1));
     Local<Unknown> space(exec->vm(), exec->argument(2));
     JSValue result = Stringifier(exec, replacer, space).stringify(value).get();
index b5c09e9..a0c7002 100644 (file)
@@ -94,7 +94,7 @@ static EncodedJSValue JSC_HOST_CALL constructPromise(ExecState* exec)
     if (!exec->argumentCount())
         return throwVMError(exec, createTypeError(exec, "Expected at least one argument"));
 
-    JSValue function = exec->argument(0);
+    JSValue function = exec->uncheckedArgument(0);
 
     CallData callData;
     CallType callType = getCallData(function, callData);
@@ -151,7 +151,7 @@ EncodedJSValue JSC_HOST_CALL JSPromiseConstructorFuncFulfill(ExecState* exec)
     JSGlobalObject* globalObject = exec->callee()->globalObject();
 
     JSPromise* promise = JSPromise::createWithResolver(exec->vm(), globalObject);
-    promise->resolver()->fulfill(exec, exec->argument(0));
+    promise->resolver()->fulfill(exec, exec->uncheckedArgument(0));
 
     return JSValue::encode(promise);
 }
@@ -164,7 +164,7 @@ EncodedJSValue JSC_HOST_CALL JSPromiseConstructorFuncResolve(ExecState* exec)
     JSGlobalObject* globalObject = exec->callee()->globalObject();
 
     JSPromise* promise = JSPromise::createWithResolver(exec->vm(), globalObject);
-    promise->resolver()->resolve(exec, exec->argument(0));
+    promise->resolver()->resolve(exec, exec->uncheckedArgument(0));
 
     return JSValue::encode(promise);
 }
@@ -177,7 +177,7 @@ EncodedJSValue JSC_HOST_CALL JSPromiseConstructorFuncReject(ExecState* exec)
     JSGlobalObject* globalObject = exec->callee()->globalObject();
 
     JSPromise* promise = JSPromise::createWithResolver(exec->vm(), globalObject);
-    promise->resolver()->reject(exec, exec->argument(0));
+    promise->resolver()->reject(exec, exec->uncheckedArgument(0));
 
     return JSValue::encode(promise);
 }
index 9e395af..8ba4e04 100644 (file)
@@ -159,7 +159,7 @@ EncodedJSValue JSC_HOST_CALL mathProtoFuncMax(ExecState* exec)
     unsigned argsCount = exec->argumentCount();
     double result = -std::numeric_limits<double>::infinity();
     for (unsigned k = 0; k < argsCount; ++k) {
-        double val = exec->argument(k).toNumber(exec);
+        double val = exec->uncheckedArgument(k).toNumber(exec);
         if (std::isnan(val)) {
             result = QNaN;
             break;
@@ -175,7 +175,7 @@ EncodedJSValue JSC_HOST_CALL mathProtoFuncMin(ExecState* exec)
     unsigned argsCount = exec->argumentCount();
     double result = +std::numeric_limits<double>::infinity();
     for (unsigned k = 0; k < argsCount; ++k) {
-        double val = exec->argument(k).toNumber(exec);
+        double val = exec->uncheckedArgument(k).toNumber(exec);
         if (std::isnan(val)) {
             result = QNaN;
             break;
index f820a1f..99cf6d7 100644 (file)
@@ -50,7 +50,7 @@ void NameConstructor::finishCreation(ExecState* exec, NamePrototype* prototype)
 
 static EncodedJSValue JSC_HOST_CALL constructPrivateName(ExecState* exec)
 {
-    JSValue publicName = exec->argumentCount() ? exec->argument(0) : jsUndefined();
+    JSValue publicName = exec->argument(0);
     return JSValue::encode(NameInstance::create(exec->vm(), exec->lexicalGlobalObject()->privateNameStructure(), publicName.toString(exec)));
 }
 
index ce61ae0..0a0ec8b 100644 (file)
@@ -51,7 +51,7 @@ void NativeErrorConstructor::visitChildren(JSCell* cell, SlotVisitor& visitor)
 
 EncodedJSValue JSC_HOST_CALL Interpreter::constructWithNativeErrorConstructor(ExecState* exec)
 {
-    JSValue message = exec->argumentCount() ? exec->argument(0) : jsUndefined();
+    JSValue message = exec->argument(0);
     Structure* errorStructure = static_cast<NativeErrorConstructor*>(exec->callee())->errorStructure();
     ASSERT(errorStructure);
     Vector<StackFrame> stackTrace;
@@ -68,7 +68,7 @@ ConstructType NativeErrorConstructor::getConstructData(JSCell*, ConstructData& c
     
 EncodedJSValue JSC_HOST_CALL Interpreter::callNativeErrorConstructor(ExecState* exec)
 {
-    JSValue message = exec->argumentCount() ? exec->argument(0) : jsUndefined();
+    JSValue message = exec->argument(0);
     Structure* errorStructure = static_cast<NativeErrorConstructor*>(exec->callee())->errorStructure();
     Vector<StackFrame> stackTrace;
     exec->vm().interpreter->getStackTrace(stackTrace, std::numeric_limits<size_t>::max());
index 7590df0..04f2438 100644 (file)
@@ -111,7 +111,7 @@ static JSValue numberConstructorMinValue(ExecState*, JSValue, PropertyName)
 static EncodedJSValue JSC_HOST_CALL constructWithNumberConstructor(ExecState* exec)
 {
     NumberObject* object = NumberObject::create(exec->vm(), asInternalFunction(exec->callee())->globalObject()->numberObjectStructure());
-    double n = exec->argumentCount() ? exec->argument(0).toNumber(exec) : 0;
+    double n = exec->argumentCount() ? exec->uncheckedArgument(0).toNumber(exec) : 0;
     object->setInternalValue(exec->vm(), jsNumber(n));
     return JSValue::encode(object);
 }
@@ -125,7 +125,7 @@ ConstructType NumberConstructor::getConstructData(JSCell*, ConstructData& constr
 // ECMA 15.7.2
 static EncodedJSValue JSC_HOST_CALL callNumberConstructor(ExecState* exec)
 {
-    return JSValue::encode(jsNumber(!exec->argumentCount() ? 0 : exec->argument(0).toNumber(exec)));
+    return JSValue::encode(jsNumber(!exec->argumentCount() ? 0 : exec->uncheckedArgument(0).toNumber(exec)));
 }
 
 CallType NumberConstructor::getCallData(JSCell*, CallData& callData)
index 9365286..4487443 100644 (file)
@@ -371,9 +371,9 @@ EncodedJSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState* exec)
 
 EncodedJSValue JSC_HOST_CALL objectConstructorCreate(ExecState* exec)
 {
-    if (!exec->argument(0).isObject() && !exec->argument(0).isNull())
-        return throwVMError(exec, createTypeError(exec, ASCIILiteral("Object prototype may only be an Object or null.")));
     JSValue proto = exec->argument(0);
+    if (!proto.isObject() && !proto.isNull())
+        return throwVMError(exec, createTypeError(exec, ASCIILiteral("Object prototype may only be an Object or null.")));
     JSObject* newObject = proto.isObject()
         ? constructEmptyObject(exec, asObject(proto))
         : constructEmptyObject(exec, exec->lexicalGlobalObject()->nullPrototypeObjectStructure());
index 944f67f..ba9d85f 100644 (file)
@@ -67,7 +67,7 @@ static EncodedJSValue JSC_HOST_CALL constructSet(CallFrame* callFrame)
     MapData* mapData = set->mapData();
     size_t count = callFrame->argumentCount();
     for (size_t i = 0; i < count; i++) {
-        JSValue item = callFrame->argument(i);
+        JSValue item = callFrame->uncheckedArgument(i);
         mapData->set(callFrame, item, item);
     }
     return JSValue::encode(set);
index 2ccbdb2..1c61e43 100644 (file)
@@ -73,14 +73,14 @@ static NEVER_INLINE JSValue stringFromCharCodeSlowCase(ExecState* exec)
     UChar* buf;
     PassRefPtr<StringImpl> impl = StringImpl::createUninitialized(length, buf);
     for (unsigned i = 0; i < length; ++i)
-        buf[i] = static_cast<UChar>(exec->argument(i).toUInt32(exec));
+        buf[i] = static_cast<UChar>(exec->uncheckedArgument(i).toUInt32(exec));
     return jsString(exec, impl);
 }
 
 static EncodedJSValue JSC_HOST_CALL stringFromCharCode(ExecState* exec)
 {
     if (LIKELY(exec->argumentCount() == 1))
-        return JSValue::encode(jsSingleCharacterString(exec, exec->argument(0).toUInt32(exec)));
+        return JSValue::encode(jsSingleCharacterString(exec, exec->uncheckedArgument(0).toUInt32(exec)));
     return JSValue::encode(stringFromCharCodeSlowCase(exec));
 }
 
@@ -95,7 +95,7 @@ static EncodedJSValue JSC_HOST_CALL constructWithStringConstructor(ExecState* ex
     if (!exec->argumentCount())
         return JSValue::encode(StringObject::create(exec, globalObject->stringObjectStructure()));
     
-    return JSValue::encode(StringObject::create(exec, globalObject->stringObjectStructure(), exec->argument(0).toString(exec)));
+    return JSValue::encode(StringObject::create(exec, globalObject->stringObjectStructure(), exec->uncheckedArgument(0).toString(exec)));
 }
 
 ConstructType StringConstructor::getConstructData(JSCell*, ConstructData& constructData)
@@ -108,7 +108,7 @@ static EncodedJSValue JSC_HOST_CALL callStringConstructor(ExecState* exec)
 {
     if (!exec->argumentCount())
         return JSValue::encode(jsEmptyString(exec));
-    return JSValue::encode(exec->argument(0).toString(exec));
+    return JSValue::encode(exec->uncheckedArgument(0).toString(exec));
 }
 
 CallType StringConstructor::getCallData(JSCell*, CallData& callData)
index c214025..e2175d3 100644 (file)
@@ -750,8 +750,8 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncCharCodeAt(ExecState* exec)
 EncodedJSValue JSC_HOST_CALL stringProtoFuncConcat(ExecState* exec)
 {
     JSValue thisValue = exec->hostThisValue();
-    if (thisValue.isString() && (exec->argumentCount() == 1))
-        return JSValue::encode(jsString(exec, asString(thisValue), exec->argument(0).toString(exec)));
+    if (thisValue.isString() && exec->argumentCount() == 1)
+        return JSValue::encode(jsString(exec, asString(thisValue), exec->uncheckedArgument(0).toString(exec)));
 
     if (!checkObjectCoercible(thisValue))
         return throwVMTypeError(exec);
index 2d21b7f..337c00e 100644 (file)
@@ -81,14 +81,14 @@ JSValue numberOfDFGCompiles(ExecState* exec)
 {
     if (exec->argumentCount() < 1)
         return jsUndefined();
-    return numberOfDFGCompiles(exec->argument(0));
+    return numberOfDFGCompiles(exec->uncheckedArgument(0));
 }
 
 JSValue setNeverInline(ExecState* exec)
 {
     if (exec->argumentCount() < 1)
         return jsUndefined();
-    return setNeverInline(exec->argument(0));
+    return setNeverInline(exec->uncheckedArgument(0));
 }
 
 } // namespace JSC
index 72c4f0c..af659fc 100644 (file)
@@ -1,3 +1,84 @@
+2013-09-21  Darin Adler  <darin@apple.com>
+
+        Add ExecState::uncheckedArgument and use where possible to shrink a bit
+        https://bugs.webkit.org/show_bug.cgi?id=121750
+
+        Reviewed by Andreas Kling.
+
+        * bindings/js/JSHTMLCanvasElementCustom.cpp:
+        (WebCore::JSHTMLCanvasElement::probablySupportsContext): Already checked count.
+        (WebCore::JSHTMLCanvasElement::toDataURL): Ditto.
+        * bindings/js/JSHTMLDocumentCustom.cpp:
+        (WebCore::documentWrite): In a loop.
+        * bindings/js/JSInjectedScriptHostCustom.cpp:
+        (WebCore::JSInjectedScriptHost::inspectedObject): Already checked count.
+        (WebCore::JSInjectedScriptHost::internalConstructorName): Ditto.
+        (WebCore::JSInjectedScriptHost::isHTMLAllCollection): Ditto.
+        (WebCore::JSInjectedScriptHost::type): Ditto.
+        (WebCore::JSInjectedScriptHost::functionDetails): Ditto.
+        (WebCore::JSInjectedScriptHost::getEventListeners): Ditto.
+        (WebCore::JSInjectedScriptHost::inspect): Ditto.
+        (WebCore::JSInjectedScriptHost::databaseId): Ditto.
+        (WebCore::JSInjectedScriptHost::storageId): Ditto.
+        * bindings/js/JSSQLTransactionSyncCustom.cpp:
+        (WebCore::JSSQLTransactionSync::executeSql): Ditto.
+        * bindings/js/JSSVGLengthCustom.cpp:
+        (WebCore::JSSVGLength::convertToSpecifiedUnits): Ditto.
+        * bindings/js/JSSharedWorkerCustom.cpp:
+        (WebCore::JSSharedWorkerConstructor::constructJSSharedWorker): Ditto.
+
+        * bindings/js/JSWebGLRenderingContextCustom.cpp:
+        (WebCore::getObjectParameter): Already checked count.
+        (WebCore::JSWebGLRenderingContext::getAttachedShaders): Removed tortured code
+        to triply do the checking that the toWebGLProgram function already does, including
+        spurious exception checking in code that can't create an exception. Also count is
+        already checked.
+        (WebCore::JSWebGLRenderingContext::getExtension): More of the same.
+        (WebCore::JSWebGLRenderingContext::getFramebufferAttachmentParameter): Ditto.
+        (WebCore::JSWebGLRenderingContext::getParameter): Ditto.
+        (WebCore::JSWebGLRenderingContext::getProgramParameter): Ditto.
+        (WebCore::JSWebGLRenderingContext::getShaderParameter): Ditto.
+        (WebCore::JSWebGLRenderingContext::getUniform): Ditto.
+        (WebCore::dataFunctionf): Ditto.
+        (WebCore::dataFunctioni): Ditto.
+        (WebCore::dataFunctionMatrix): Ditto.
+
+        * bindings/js/JSWorkerGlobalScopeCustom.cpp:
+        (WebCore::JSWorkerGlobalScope::importScripts): In a loop.
+        * bindings/js/JSXMLHttpRequestCustom.cpp:
+        (WebCore::JSXMLHttpRequest::open): Already checked. Also removed some unneeded
+        argument count checks.
+        (WebCore::JSXMLHttpRequest::send): Removed unneeded special case for 0 argument
+        count that does the same thing as the undefined case, since asking for an
+        argument past the count yields undefined.
+
+        * bindings/js/JSXSLTProcessorCustom.cpp:
+        (WebCore::JSXSLTProcessor::setParameter): Already checked.
+        (WebCore::JSXSLTProcessor::getParameter): Already checked.
+        (WebCore::JSXSLTProcessor::removeParameter): Already checked.
+
+        * bindings/js/ScheduledAction.cpp:
+        (WebCore::ScheduledAction::ScheduledAction): In a loop.
+        * bindings/js/ScriptCallStackFactory.cpp:
+        (WebCore::createScriptArguments): Ditto.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateParametersCheck): Removed some excess argumentCount checks.
+        Used uncheckedArgument in a few places. More needs to be done, especially for
+        overloaded functions.
+
+        * bridge/c/c_instance.cpp:
+        (JSC::Bindings::CInstance::invokeMethod): In a loop.
+        (JSC::Bindings::CInstance::invokeDefaultMethod): Ditto.
+        * bridge/objc/objc_instance.mm:
+        (ObjcInstance::invokeObjcMethod): Ditto.
+        (ObjcInstance::invokeDefaultMethod): Ditto.
+
+        * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        * bindings/scripts/test/JS/JSTestTypedefs.cpp:
+        Updated.
+
 2013-09-21  Jon Lee  <jonlee@apple.com>
 
         Fix Obj-C bindings test expectations.
index eb345c9..59631d6 100644 (file)
@@ -104,7 +104,7 @@ JSValue JSHTMLCanvasElement::probablySupportsContext(ExecState* exec)
     HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(impl());
     if (!exec->argumentCount())
         return jsBoolean(false);
-    const String& contextId = exec->argument(0).toString(exec)->value(exec);
+    const String& contextId = exec->uncheckedArgument(0).toString(exec)->value(exec);
     if (exec->hadException())
         return jsUndefined();
     
@@ -129,7 +129,7 @@ JSValue JSHTMLCanvasElement::toDataURL(ExecState* exec)
     double quality;
     double* qualityPtr = 0;
     if (exec->argumentCount() > 1) {
-        JSValue v = exec->argument(1);
+        JSValue v = exec->uncheckedArgument(1);
         if (v.isNumber()) {
             quality = v.toNumber(exec);
             qualityPtr = &quality;
index a5c1605..9314823 100644 (file)
@@ -144,7 +144,7 @@ static inline void documentWrite(ExecState* exec, HTMLDocument* document, Newlin
             segmentedString.clear();
         else {
             for (size_t i = 1; i < size; ++i) {
-                String subsequentString = exec->argument(i).toString(exec)->value(exec);
+                String subsequentString = exec->uncheckedArgument(i).toString(exec)->value(exec);
                 segmentedString.append(SegmentedString(subsequentString));
             }
         }
index 72c486f..1a29c35 100644 (file)
@@ -90,7 +90,7 @@ JSValue JSInjectedScriptHost::inspectedObject(ExecState* exec)
     if (exec->argumentCount() < 1)
         return jsUndefined();
 
-    InjectedScriptHost::InspectableObject* object = impl()->inspectedObject(exec->argument(0).toInt32(exec));
+    InjectedScriptHost::InspectableObject* object = impl()->inspectedObject(exec->uncheckedArgument(0).toInt32(exec));
     if (!object)
         return jsUndefined();
 
@@ -107,7 +107,7 @@ JSValue JSInjectedScriptHost::internalConstructorName(ExecState* exec)
     if (exec->argumentCount() < 1)
         return jsUndefined();
 
-    JSObject* thisObject = jsCast<JSObject*>(exec->argument(0).toThis(exec, NotStrictMode));
+    JSObject* thisObject = jsCast<JSObject*>(exec->uncheckedArgument(0).toThis(exec, NotStrictMode));
     String result = thisObject->methodTable()->className(thisObject);
     return jsStringWithCache(exec, result);
 }
@@ -117,7 +117,7 @@ JSValue JSInjectedScriptHost::isHTMLAllCollection(ExecState* exec)
     if (exec->argumentCount() < 1)
         return jsUndefined();
 
-    JSValue value = exec->argument(0);
+    JSValue value = exec->uncheckedArgument(0);
     return jsBoolean(value.inherits(JSHTMLAllCollection::info()));
 }
 
@@ -126,7 +126,7 @@ JSValue JSInjectedScriptHost::type(ExecState* exec)
     if (exec->argumentCount() < 1)
         return jsUndefined();
 
-    JSValue value = exec->argument(0);
+    JSValue value = exec->uncheckedArgument(0);
     if (value.isString())
         return jsString(exec, String("string"));
     if (value.inherits(JSArray::info()))
@@ -158,7 +158,7 @@ JSValue JSInjectedScriptHost::functionDetails(ExecState* exec)
 {
     if (exec->argumentCount() < 1)
         return jsUndefined();
-    JSValue value = exec->argument(0);
+    JSValue value = exec->uncheckedArgument(0);
     if (!value.asCell()->inherits(JSFunction::info()))
         return jsUndefined();
     JSFunction* function = jsCast<JSFunction*>(value);
@@ -222,7 +222,7 @@ JSValue JSInjectedScriptHost::getEventListeners(ExecState* exec)
 {
     if (exec->argumentCount() < 1)
         return jsUndefined();
-    JSValue value = exec->argument(0);
+    JSValue value = exec->uncheckedArgument(0);
     if (!value.isObject() || value.isNull())
         return jsUndefined();
     Node* node = toNode(value);
@@ -247,8 +247,8 @@ JSValue JSInjectedScriptHost::getEventListeners(ExecState* exec)
 JSValue JSInjectedScriptHost::inspect(ExecState* exec)
 {
     if (exec->argumentCount() >= 2) {
-        ScriptValue object(exec->vm(), exec->argument(0));
-        ScriptValue hints(exec->vm(), exec->argument(1));
+        ScriptValue object(exec->vm(), exec->uncheckedArgument(0));
+        ScriptValue hints(exec->vm(), exec->uncheckedArgument(1));
         impl()->inspectImpl(object.toInspectorValue(exec), hints.toInspectorValue(exec));
     }
     return jsUndefined();
@@ -259,7 +259,7 @@ JSValue JSInjectedScriptHost::databaseId(ExecState* exec)
     if (exec->argumentCount() < 1)
         return jsUndefined();
 #if ENABLE(SQL_DATABASE)
-    Database* database = toDatabase(exec->argument(0));
+    Database* database = toDatabase(exec->uncheckedArgument(0));
     if (database)
         return jsStringWithCache(exec, impl()->databaseIdImpl(database));
 #endif
@@ -270,7 +270,7 @@ JSValue JSInjectedScriptHost::storageId(ExecState* exec)
 {
     if (exec->argumentCount() < 1)
         return jsUndefined();
-    Storage* storage = toStorage(exec->argument(0));
+    Storage* storage = toStorage(exec->uncheckedArgument(0));
     if (storage)
         return jsStringWithCache(exec, impl()->storageIdImpl(storage));
     return jsUndefined();
index 33f8434..b682c45 100644 (file)
@@ -49,7 +49,7 @@ JSValue JSSQLTransactionSync::executeSql(ExecState* exec)
         return jsUndefined();
     }
 
-    String sqlStatement = exec->argument(0).toString(exec)->value(exec);
+    String sqlStatement = exec->uncheckedArgument(0).toString(exec)->value(exec);
     if (exec->hadException())
         return jsUndefined();
 
index 5b92c35..bad8d38 100644 (file)
@@ -83,7 +83,7 @@ JSValue JSSVGLength::convertToSpecifiedUnits(ExecState* exec)
     if (exec->argumentCount() < 1)
         return exec->vm().throwException(exec, createNotEnoughArgumentsError(exec));
 
-    unsigned short unitType = exec->argument(0).toUInt32(exec);
+    unsigned short unitType = exec->uncheckedArgument(0).toUInt32(exec);
     if (exec->hadException())
         return jsUndefined();
 
index c14612d..5cebf87 100644 (file)
@@ -63,10 +63,10 @@ EncodedJSValue JSC_HOST_CALL JSSharedWorkerConstructor::constructJSSharedWorker(
     if (exec->argumentCount() < 1)
         return throwVMError(exec, createNotEnoughArgumentsError(exec));
 
-    String scriptURL = exec->argument(0).toString(exec)->value(exec);
+    String scriptURL = exec->uncheckedArgument(0).toString(exec)->value(exec);
     String name;
     if (exec->argumentCount() > 1)
-        name = exec->argument(1).toString(exec)->value(exec);
+        name = exec->uncheckedArgument(1).toString(exec)->value(exec);
 
     if (exec->hadException())
         return JSValue::encode(JSValue());
index 4426037..ca0aedf 100644 (file)
@@ -156,10 +156,10 @@ static JSValue getObjectParameter(JSWebGLRenderingContext* obj, ExecState* exec,
 
     ExceptionCode ec = 0;
     WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(obj->impl());
-    unsigned target = exec->argument(0).toInt32(exec);
+    unsigned target = exec->uncheckedArgument(0).toInt32(exec);
     if (exec->hadException())
         return jsUndefined();
-    unsigned pname = exec->argument(1).toInt32(exec);
+    unsigned pname = exec->uncheckedArgument(1).toInt32(exec);
     if (exec->hadException())
         return jsUndefined();
     WebGLGetInfo info;
@@ -246,11 +246,9 @@ JSValue JSWebGLRenderingContext::getAttachedShaders(ExecState* exec)
         return exec->vm().throwException(exec, createNotEnoughArgumentsError(exec));
     ExceptionCode ec = 0;
     WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
-    if (exec->argumentCount() > 0 && !exec->argument(0).isUndefinedOrNull() && !exec->argument(0).inherits(JSWebGLProgram::info()))
+    WebGLProgram* program = toWebGLProgram(exec->uncheckedArgument(0));
+    if (!program)
         return throwTypeError(exec);
-    WebGLProgram* program = toWebGLProgram(exec->argument(0));
-    if (exec->hadException())
-        return jsNull();
     Vector<RefPtr<WebGLShader> > shaders;
     bool succeed = context->getAttachedShaders(program, shaders, ec);
     if (ec) {
@@ -271,7 +269,7 @@ JSValue JSWebGLRenderingContext::getExtension(ExecState* exec)
         return exec->vm().throwException(exec, createNotEnoughArgumentsError(exec));
 
     WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
-    const String name = exec->argument(0).toString(exec)->value(exec);
+    const String name = exec->uncheckedArgument(0).toString(exec)->value(exec);
     if (exec->hadException())
         return jsUndefined();
     WebGLExtension* extension = context->getExtension(name);
@@ -290,13 +288,13 @@ JSValue JSWebGLRenderingContext::getFramebufferAttachmentParameter(ExecState* ex
 
     ExceptionCode ec = 0;
     WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
-    unsigned target = exec->argument(0).toInt32(exec);
+    unsigned target = exec->uncheckedArgument(0).toInt32(exec);
     if (exec->hadException())
         return jsUndefined();
-    unsigned attachment = exec->argument(1).toInt32(exec);
+    unsigned attachment = exec->uncheckedArgument(1).toInt32(exec);
     if (exec->hadException())
         return jsUndefined();
-    unsigned pname = exec->argument(2).toInt32(exec);
+    unsigned pname = exec->uncheckedArgument(2).toInt32(exec);
     if (exec->hadException())
         return jsUndefined();
     WebGLGetInfo info = context->getFramebufferAttachmentParameter(target, attachment, pname, ec);
@@ -314,7 +312,7 @@ JSValue JSWebGLRenderingContext::getParameter(ExecState* exec)
 
     ExceptionCode ec = 0;
     WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
-    unsigned pname = exec->argument(0).toInt32(exec);
+    unsigned pname = exec->uncheckedArgument(0).toInt32(exec);
     if (exec->hadException())
         return jsUndefined();
     WebGLGetInfo info = context->getParameter(pname, ec);
@@ -332,10 +330,10 @@ JSValue JSWebGLRenderingContext::getProgramParameter(ExecState* exec)
 
     ExceptionCode ec = 0;
     WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
-    if (exec->argumentCount() > 0 && !exec->argument(0).isUndefinedOrNull() && !exec->argument(0).inherits(JSWebGLProgram::info()))
+    WebGLProgram* program = toWebGLProgram(exec->uncheckedArgument(0));
+    if (!program)
         return throwTypeError(exec);
-    WebGLProgram* program = toWebGLProgram(exec->argument(0));
-    unsigned pname = exec->argument(1).toInt32(exec);
+    unsigned pname = exec->uncheckedArgument(1).toInt32(exec);
     if (exec->hadException())
         return jsUndefined();
     WebGLGetInfo info = context->getProgramParameter(program, pname, ec);
@@ -358,10 +356,10 @@ JSValue JSWebGLRenderingContext::getShaderParameter(ExecState* exec)
 
     ExceptionCode ec = 0;
     WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
-    if (exec->argumentCount() > 0 && !exec->argument(0).isUndefinedOrNull() && !exec->argument(0).inherits(JSWebGLShader::info()))
+    if (!exec->uncheckedArgument(0).isUndefinedOrNull() && !exec->uncheckedArgument(0).inherits(JSWebGLShader::info()))
         return throwTypeError(exec);
-    WebGLShader* shader = toWebGLShader(exec->argument(0));
-    unsigned pname = exec->argument(1).toInt32(exec);
+    WebGLShader* shader = toWebGLShader(exec->uncheckedArgument(0));
+    unsigned pname = exec->uncheckedArgument(1).toInt32(exec);
     if (exec->hadException())
         return jsUndefined();
     WebGLGetInfo info = context->getShaderParameter(shader, pname, ec);
@@ -396,15 +394,13 @@ JSValue JSWebGLRenderingContext::getUniform(ExecState* exec)
 
     ExceptionCode ec = 0;
     WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
-    if (exec->argumentCount() > 0 && !exec->argument(0).isUndefinedOrNull() && !exec->argument(0).inherits(JSWebGLProgram::info()))
+    WebGLProgram* program = toWebGLProgram(exec->uncheckedArgument(0));
+    if (!program)
         return throwTypeError(exec);
-    WebGLProgram* program = toWebGLProgram(exec->argument(0));
-    if (exec->argumentCount() > 1 && !exec->argument(1).isUndefinedOrNull() && !exec->argument(1).inherits(JSWebGLUniformLocation::info()))
+    WebGLUniformLocation* location = toWebGLUniformLocation(exec->uncheckedArgument(1));
+    if (!location)
         return throwTypeError(exec);
-    WebGLUniformLocation* loc = toWebGLUniformLocation(exec->argument(1));
-    if (exec->hadException())
-        return jsUndefined();
-    WebGLGetInfo info = context->getUniform(program, loc, ec);
+    WebGLGetInfo info = context->getUniform(program, location, ec);
     if (ec) {
         setDOMException(exec, ec);
         return jsUndefined();
@@ -472,16 +468,16 @@ static JSC::JSValue dataFunctionf(DataFunctionToCall f, JSC::ExecState* exec, We
     long index = -1;
     
     if (functionForUniform(f)) {
-        if (exec->argumentCount() > 0 && !exec->argument(0).isUndefinedOrNull() && !exec->argument(0).inherits(JSWebGLUniformLocation::info()))
+        location = toWebGLUniformLocation(exec->uncheckedArgument(0));
+        if (!location)
             return throwTypeError(exec);
-        location = toWebGLUniformLocation(exec->argument(0));
     } else
-        index = exec->argument(0).toInt32(exec);
+        index = exec->uncheckedArgument(0).toInt32(exec);
 
     if (exec->hadException())
         return jsUndefined();
         
-    RefPtr<Float32Array> webGLArray = toFloat32Array(exec->argument(1));
+    RefPtr<Float32Array> webGLArray = toFloat32Array(exec->uncheckedArgument(1));
     if (exec->hadException())    
         return jsUndefined();
         
@@ -519,7 +515,7 @@ static JSC::JSValue dataFunctionf(DataFunctionToCall f, JSC::ExecState* exec, We
     }
 
     Vector<float, 64> array;
-    if (!toVector(exec, exec->argument(1), array))
+    if (!toVector(exec, exec->uncheckedArgument(1), array))
         return throwTypeError(exec);
 
     switch (f) {
@@ -558,17 +554,12 @@ static JSC::JSValue dataFunctioni(DataFunctionToCall f, JSC::ExecState* exec, We
     if (exec->argumentCount() != 2)
         return exec->vm().throwException(exec, createNotEnoughArgumentsError(exec));
 
-    if (exec->argumentCount() > 0 && !exec->argument(0).isUndefinedOrNull() && !exec->argument(0).inherits(JSWebGLUniformLocation::info()))
+    WebGLUniformLocation* location = toWebGLUniformLocation(exec->uncheckedArgument(0));
+    if (!location)
         return throwTypeError(exec);
-    WebGLUniformLocation* location = toWebGLUniformLocation(exec->argument(0));
   
-    if (exec->hadException())
-        return jsUndefined();
-        
-    RefPtr<Int32Array> webGLArray = toInt32Array(exec->argument(1));
-    if (exec->hadException())    
-        return jsUndefined();
-        
+    RefPtr<Int32Array> webGLArray = toInt32Array(exec->uncheckedArgument(1));
+
     ExceptionCode ec = 0;
     if (webGLArray) {
         switch (f) {
@@ -594,7 +585,7 @@ static JSC::JSValue dataFunctioni(DataFunctionToCall f, JSC::ExecState* exec, We
 
 
     Vector<int, 64> array;
-    if (!toVector(exec, exec->argument(1), array))
+    if (!toVector(exec, exec->uncheckedArgument(1), array))
         return throwTypeError(exec);
 
     switch (f) {
@@ -623,20 +614,15 @@ static JSC::JSValue dataFunctionMatrix(DataFunctionMatrixToCall f, JSC::ExecStat
     if (exec->argumentCount() != 3)
         return exec->vm().throwException(exec, createNotEnoughArgumentsError(exec));
 
-    if (exec->argumentCount() > 0 && !exec->argument(0).isUndefinedOrNull() && !exec->argument(0).inherits(JSWebGLUniformLocation::info()))
+    WebGLUniformLocation* location = toWebGLUniformLocation(exec->uncheckedArgument(0));
+    if (!location)
         return throwTypeError(exec);
-    WebGLUniformLocation* location = toWebGLUniformLocation(exec->argument(0));
 
+    bool transpose = exec->uncheckedArgument(1).toBoolean(exec);
     if (exec->hadException())    
         return jsUndefined();
         
-    bool transpose = exec->argument(1).toBoolean(exec);
-    if (exec->hadException())    
-        return jsUndefined();
-        
-    RefPtr<Float32Array> webGLArray = toFloat32Array(exec->argument(2));
-    if (exec->hadException())    
-        return jsUndefined();
+    RefPtr<Float32Array> webGLArray = toFloat32Array(exec->uncheckedArgument(2));
         
     ExceptionCode ec = 0;
     if (webGLArray) {
@@ -657,7 +643,7 @@ static JSC::JSValue dataFunctionMatrix(DataFunctionMatrixToCall f, JSC::ExecStat
     }
 
     Vector<float, 64> array;
-    if (!toVector(exec, exec->argument(2), array))
+    if (!toVector(exec, exec->uncheckedArgument(2), array))
         return throwTypeError(exec);
 
     switch (f) {
index e35b69d..c81bc14 100644 (file)
@@ -84,7 +84,7 @@ JSValue JSWorkerGlobalScope::importScripts(ExecState* exec)
 
     Vector<String> urls;
     for (unsigned i = 0; i < exec->argumentCount(); i++) {
-        urls.append(exec->argument(i).toString(exec)->value(exec));
+        urls.append(exec->uncheckedArgument(i).toString(exec)->value(exec));
         if (exec->hadException())
             return jsUndefined();
     }
index 2bd49c1..30fcf3e 100644 (file)
@@ -88,18 +88,17 @@ JSValue JSXMLHttpRequest::open(ExecState* exec)
     if (exec->argumentCount() < 2)
         return exec->vm().throwException(exec, createNotEnoughArgumentsError(exec));
 
-    const KURL& url = impl()->scriptExecutionContext()->completeURL(exec->argument(1).toString(exec)->value(exec));
-    String method = exec->argument(0).toString(exec)->value(exec);
+    const KURL& url = impl()->scriptExecutionContext()->completeURL(exec->uncheckedArgument(1).toString(exec)->value(exec));
+    String method = exec->uncheckedArgument(0).toString(exec)->value(exec);
 
     ExceptionCode ec = 0;
     if (exec->argumentCount() >= 3) {
-        bool async = exec->argument(2).toBoolean(exec);
+        bool async = exec->uncheckedArgument(2).toBoolean(exec);
+        if (!exec->argument(3).isUndefined()) {
+            String user = valueToStringWithNullCheck(exec, exec->uncheckedArgument(3));
 
-        if (exec->argumentCount() >= 4 && !exec->argument(3).isUndefined()) {
-            String user = valueToStringWithNullCheck(exec, exec->argument(3));
-
-            if (exec->argumentCount() >= 5 && !exec->argument(4).isUndefined()) {
-                String password = valueToStringWithNullCheck(exec, exec->argument(4));
+            if (!exec->argument(4).isUndefined()) {
+                String password = valueToStringWithNullCheck(exec, exec->uncheckedArgument(4));
                 impl()->open(method, url, async, user, password, ec);
             } else
                 impl()->open(method, url, async, user, ec);
@@ -149,26 +148,22 @@ JSValue JSXMLHttpRequest::send(ExecState* exec)
     InspectorInstrumentation::willSendXMLHttpRequest(impl()->scriptExecutionContext(), impl()->url());
 
     ExceptionCode ec = 0;
-    if (!exec->argumentCount())
+    JSValue val = exec->argument(0);
+    if (val.isUndefinedOrNull())
         impl()->send(ec);
-    else {
-        JSValue val = exec->argument(0);
-        if (val.isUndefinedOrNull())
-            impl()->send(ec);
-        else if (val.inherits(JSDocument::info()))
-            impl()->send(toDocument(val), ec);
-        else if (val.inherits(JSBlob::info()))
-            impl()->send(toBlob(val), ec);
-        else if (val.inherits(JSDOMFormData::info()))
-            impl()->send(toDOMFormData(val), ec);
-        else if (val.inherits(JSArrayBuffer::info()))
-            impl()->send(toArrayBuffer(val), ec);
-        else if (val.inherits(JSArrayBufferView::info())) {
-            RefPtr<ArrayBufferView> view = toArrayBufferView(val);
-            impl()->send(view.get(), ec);
-        } else
-            impl()->send(val.toString(exec)->value(exec), ec);
-    }
+    else if (val.inherits(JSDocument::info()))
+        impl()->send(toDocument(val), ec);
+    else if (val.inherits(JSBlob::info()))
+        impl()->send(toBlob(val), ec);
+    else if (val.inherits(JSDOMFormData::info()))
+        impl()->send(toDOMFormData(val), ec);
+    else if (val.inherits(JSArrayBuffer::info()))
+        impl()->send(toArrayBuffer(val), ec);
+    else if (val.inherits(JSArrayBufferView::info())) {
+        RefPtr<ArrayBufferView> view = toArrayBufferView(val);
+        impl()->send(view.get(), ec);
+    } else
+        impl()->send(val.toString(exec)->value(exec), ec);
 
     SendFunctor functor;
     exec->iterate(functor);
index 5436a6b..405fba0 100644 (file)
@@ -50,9 +50,9 @@ JSValue JSXSLTProcessor::setParameter(ExecState* exec)
 {
     if (exec->argument(1).isUndefinedOrNull() || exec->argument(2).isUndefinedOrNull())
         return jsUndefined(); // Throw exception?
-    String namespaceURI = exec->argument(0).toString(exec)->value(exec);
-    String localName = exec->argument(1).toString(exec)->value(exec);
-    String value = exec->argument(2).toString(exec)->value(exec);
+    String namespaceURI = exec->uncheckedArgument(0).toString(exec)->value(exec);
+    String localName = exec->uncheckedArgument(1).toString(exec)->value(exec);
+    String value = exec->uncheckedArgument(2).toString(exec)->value(exec);
     impl()->setParameter(namespaceURI, localName, value);
     return jsUndefined();
 }
@@ -61,8 +61,8 @@ JSValue JSXSLTProcessor::getParameter(ExecState* exec)
 {
     if (exec->argument(1).isUndefinedOrNull())
         return jsUndefined();
-    String namespaceURI = exec->argument(0).toString(exec)->value(exec);
-    String localName = exec->argument(1).toString(exec)->value(exec);
+    String namespaceURI = exec->uncheckedArgument(0).toString(exec)->value(exec);
+    String localName = exec->uncheckedArgument(1).toString(exec)->value(exec);
     String value = impl()->getParameter(namespaceURI, localName);
     return jsStringOrUndefined(exec, value);
 }
@@ -71,8 +71,8 @@ JSValue JSXSLTProcessor::removeParameter(ExecState* exec)
 {
     if (exec->argument(1).isUndefinedOrNull())
         return jsUndefined();
-    String namespaceURI = exec->argument(0).toString(exec)->value(exec);
-    String localName = exec->argument(1).toString(exec)->value(exec);
+    String namespaceURI = exec->uncheckedArgument(0).toString(exec)->value(exec);
+    String localName = exec->uncheckedArgument(1).toString(exec)->value(exec);
     impl()->removeParameter(namespaceURI, localName);
     return jsUndefined();
 }
index 7f2e5c5..789ebd8 100644 (file)
@@ -72,7 +72,7 @@ ScheduledAction::ScheduledAction(ExecState* exec, JSValue function, DOMWrapperWo
     // setTimeout(function, interval, arg0, arg1...).
     // Start at 2 to skip function and interval.
     for (size_t i = 2; i < exec->argumentCount(); ++i)
-        m_args.append(Strong<JSC::Unknown>(exec->vm(), exec->argument(i)));
+        m_args.append(Strong<JSC::Unknown>(exec->vm(), exec->uncheckedArgument(i)));
 }
 
 void ScheduledAction::execute(ScriptExecutionContext* context)
index b713e75..5d66c4d 100644 (file)
@@ -202,7 +202,7 @@ PassRefPtr<ScriptArguments> createScriptArguments(JSC::ExecState* exec, unsigned
     Vector<ScriptValue> arguments;
     size_t argumentCount = exec->argumentCount();
     for (size_t i = skipArgumentCount; i < argumentCount; ++i)
-        arguments.append(ScriptValue(exec->vm(), exec->argument(i)));
+        arguments.append(ScriptValue(exec->vm(), exec->uncheckedArgument(i)));
     return ScriptArguments::create(exec, arguments);
 }
 
index ded46bb..8e83e4a 100644 (file)
@@ -2844,24 +2844,24 @@ sub GenerateParametersCheck
             $implIncludes{"$callbackClassName.h"} = 1;
             if ($optional) {
                 push(@$outputArray, "    RefPtr<$argType> $name;\n");
-                push(@$outputArray, "    if (exec->argumentCount() > $argsIndex && !exec->argument($argsIndex).isUndefinedOrNull()) {\n");
-                push(@$outputArray, "        if (!exec->argument($argsIndex).isFunction())\n");
+                push(@$outputArray, "    if (!exec->argument($argsIndex).isUndefinedOrNull()) {\n");
+                push(@$outputArray, "        if (!exec->uncheckedArgument($argsIndex).isFunction())\n");
                 push(@$outputArray, "            return throwVMTypeError(exec);\n");
                 if ($function->isStatic) {
                     AddToImplIncludes("CallbackFunction.h");
-                    push(@$outputArray, "        $name = createFunctionOnlyCallback<${callbackClassName}>(exec, static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), exec->argument($argsIndex));\n");
+                    push(@$outputArray, "        $name = createFunctionOnlyCallback<${callbackClassName}>(exec, static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), exec->uncheckedArgument($argsIndex));\n");
                 } else {
-                    push(@$outputArray, "        $name = ${callbackClassName}::create(asObject(exec->argument($argsIndex)), castedThis->globalObject());\n");
+                    push(@$outputArray, "        $name = ${callbackClassName}::create(asObject(exec->uncheckedArgument($argsIndex)), castedThis->globalObject());\n");
                 }
                 push(@$outputArray, "    }\n");
             } else {
-                push(@$outputArray, "    if (exec->argumentCount() <= $argsIndex || !exec->argument($argsIndex).isFunction())\n");
+                push(@$outputArray, "    if (!exec->argument($argsIndex).isFunction())\n");
                 push(@$outputArray, "        return throwVMTypeError(exec);\n");
                 if ($function->isStatic) {
                     AddToImplIncludes("CallbackFunction.h");
-                    push(@$outputArray, "    RefPtr<$argType> $name = createFunctionOnlyCallback<${callbackClassName}>(exec, static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), exec->argument($argsIndex));\n");
+                    push(@$outputArray, "    RefPtr<$argType> $name = createFunctionOnlyCallback<${callbackClassName}>(exec, static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), exec->uncheckedArgument($argsIndex));\n");
                 } else {
-                    push(@$outputArray, "    RefPtr<$argType> $name = ${callbackClassName}::create(asObject(exec->argument($argsIndex)), castedThis->globalObject());\n");
+                    push(@$outputArray, "    RefPtr<$argType> $name = ${callbackClassName}::create(asObject(exec->uncheckedArgument($argsIndex)), castedThis->globalObject());\n");
                 }
             }
         } elsif ($parameter->extendedAttributes->{"Clamp"}) {
@@ -2886,9 +2886,9 @@ sub GenerateParametersCheck
             if (!IsNativeType($argType)) {
                 push(@$outputArray, "    Vector<$nativeElementType> $name;\n");
                 push(@$outputArray, "    for (unsigned i = $argsIndex; i < exec->argumentCount(); ++i) {\n");
-                push(@$outputArray, "        if (!exec->argument(i).inherits(JS${argType}::info()))\n");
+                push(@$outputArray, "        if (!exec->uncheckedArgument(i).inherits(JS${argType}::info()))\n");
                 push(@$outputArray, "            return throwVMTypeError(exec);\n");
-                push(@$outputArray, "        $name.append(to$argType(exec->argument(i)));\n");
+                push(@$outputArray, "        $name.append(to$argType(exec->uncheckedArgument(i)));\n");
                 push(@$outputArray, "    }\n")
             } else {
                 push(@$outputArray, "    Vector<$nativeElementType> $name = toNativeArguments<$nativeElementType>(exec, $argsIndex);\n");
index df4d672..cfc801a 100644 (file)
@@ -149,9 +149,9 @@ EncodedJSValue JSC_HOST_CALL jsTestMediaQueryListListenerPrototypeFunctionMethod
     TestMediaQueryListListener* impl = static_cast<TestMediaQueryListListener*>(castedThis->impl());
     if (exec->argumentCount() < 1)
         return throwVMError(exec, createNotEnoughArgumentsError(exec));
-    if (exec->argumentCount() <= 0 || !exec->argument(0).isFunction())
+    if (!exec->argument(0).isFunction())
         return throwVMTypeError(exec);
-    RefPtr<MediaQueryListListener> listener = JSMediaQueryListListener::create(asObject(exec->argument(0)), castedThis->globalObject());
+    RefPtr<MediaQueryListListener> listener = JSMediaQueryListListener::create(asObject(exec->uncheckedArgument(0)), castedThis->globalObject());
     impl->method(listener);
     return JSValue::encode(jsUndefined());
 }
index b9e43ce..5ccef93 100644 (file)
@@ -213,9 +213,9 @@ EncodedJSValue JSC_HOST_CALL JSTestObjConstructor::constructJSTestObj(ExecState*
     JSTestObjConstructor* castedThis = jsCast<JSTestObjConstructor*>(exec->callee());
     if (exec->argumentCount() < 1)
         return throwVMError(exec, createNotEnoughArgumentsError(exec));
-    if (exec->argumentCount() <= 0 || !exec->argument(0).isFunction())
+    if (!exec->argument(0).isFunction())
         return throwVMTypeError(exec);
-    RefPtr<TestCallback> testCallback = JSTestCallback::create(asObject(exec->argument(0)), castedThis->globalObject());
+    RefPtr<TestCallback> testCallback = JSTestCallback::create(asObject(exec->uncheckedArgument(0)), castedThis->globalObject());
     RefPtr<TestObj> object = TestObj::create(testCallback);
     return JSValue::encode(asObject(toJS(exec, castedThis->globalObject(), object.get())));
 }
@@ -2375,9 +2375,9 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackArg(Exe
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
     if (exec->argumentCount() < 1)
         return throwVMError(exec, createNotEnoughArgumentsError(exec));
-    if (exec->argumentCount() <= 0 || !exec->argument(0).isFunction())
+    if (!exec->argument(0).isFunction())
         return throwVMTypeError(exec);
-    RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->argument(0)), castedThis->globalObject());
+    RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->uncheckedArgument(0)), castedThis->globalObject());
     impl->methodWithCallbackArg(callback);
     return JSValue::encode(jsUndefined());
 }
@@ -2395,9 +2395,9 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonCallbackArgA
     int nonCallback(toInt32(exec, exec->argument(0), NormalConversion));
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
-    if (exec->argumentCount() <= 1 || !exec->argument(1).isFunction())
+    if (!exec->argument(1).isFunction())
         return throwVMTypeError(exec);
-    RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->argument(1)), castedThis->globalObject());
+    RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->uncheckedArgument(1)), castedThis->globalObject());
     impl->methodWithNonCallbackArgAndCallbackArg(nonCallback, callback);
     return JSValue::encode(jsUndefined());
 }
@@ -2411,10 +2411,10 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackAndOpti
     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
     RefPtr<TestCallback> callback;
-    if (exec->argumentCount() > 0 && !exec->argument(0).isUndefinedOrNull()) {
-        if (!exec->argument(0).isFunction())
+    if (!exec->argument(0).isUndefinedOrNull()) {
+        if (!exec->uncheckedArgument(0).isFunction())
             return throwVMTypeError(exec);
-        callback = JSTestCallback::create(asObject(exec->argument(0)), castedThis->globalObject());
+        callback = JSTestCallback::create(asObject(exec->uncheckedArgument(0)), castedThis->globalObject());
     }
     impl->methodWithCallbackAndOptionalArg(callback);
     return JSValue::encode(jsUndefined());
@@ -2423,10 +2423,10 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackAndOpti
 EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionStaticMethodWithCallbackAndOptionalArg(ExecState* exec)
 {
     RefPtr<TestCallback> callback;
-    if (exec->argumentCount() > 0 && !exec->argument(0).isUndefinedOrNull()) {
-        if (!exec->argument(0).isFunction())
+    if (!exec->argument(0).isUndefinedOrNull()) {
+        if (!exec->uncheckedArgument(0).isFunction())
             return throwVMTypeError(exec);
-        callback = createFunctionOnlyCallback<JSTestCallback>(exec, static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), exec->argument(0));
+        callback = createFunctionOnlyCallback<JSTestCallback>(exec, static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), exec->uncheckedArgument(0));
     }
     TestObj::staticMethodWithCallbackAndOptionalArg(callback);
     return JSValue::encode(jsUndefined());
@@ -2436,9 +2436,9 @@ EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionStaticMethodWithCallbac
 {
     if (exec->argumentCount() < 1)
         return throwVMError(exec, createNotEnoughArgumentsError(exec));
-    if (exec->argumentCount() <= 0 || !exec->argument(0).isFunction())
+    if (!exec->argument(0).isFunction())
         return throwVMTypeError(exec);
-    RefPtr<TestCallback> callback = createFunctionOnlyCallback<JSTestCallback>(exec, static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), exec->argument(0));
+    RefPtr<TestCallback> callback = createFunctionOnlyCallback<JSTestCallback>(exec, static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), exec->uncheckedArgument(0));
     TestObj::staticMethodWithCallbackArg(callback);
     return JSValue::encode(jsUndefined());
 }
@@ -2580,9 +2580,9 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod5(
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
     if (exec->argumentCount() < 1)
         return throwVMError(exec, createNotEnoughArgumentsError(exec));
-    if (exec->argumentCount() <= 0 || !exec->argument(0).isFunction())
+    if (!exec->argument(0).isFunction())
         return throwVMTypeError(exec);
-    RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->argument(0)), castedThis->globalObject());
+    RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->uncheckedArgument(0)), castedThis->globalObject());
     impl->overloadedMethod(callback);
     return JSValue::encode(jsUndefined());
 }
@@ -3134,9 +3134,9 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVariadicNodeMethod(ExecSt
         return JSValue::encode(jsUndefined());
     Vector<Node*> tail;
     for (unsigned i = 1; i < exec->argumentCount(); ++i) {
-        if (!exec->argument(i).inherits(JSNode::info()))
+        if (!exec->uncheckedArgument(i).inherits(JSNode::info()))
             return throwVMTypeError(exec);
-        tail.append(toNode(exec->argument(i)));
+        tail.append(toNode(exec->uncheckedArgument(i)));
     }
     impl->variadicNodeMethod(head, tail);
     return JSValue::encode(jsUndefined());
index 78ce98f..80e87fd 100644 (file)
@@ -75,9 +75,9 @@ EncodedJSValue JSC_HOST_CALL JSTestTypedefsConstructor::constructJSTestTypedefs(
     const String& hello(exec->argument(0).isEmpty() ? String() : exec->argument(0).toString(exec)->value(exec));
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
-    if (exec->argumentCount() <= 1 || !exec->argument(1).isFunction())
+    if (!exec->argument(1).isFunction())
         return throwVMTypeError(exec);
-    RefPtr<TestCallback> testCallback = JSTestCallback::create(asObject(exec->argument(1)), castedThis->globalObject());
+    RefPtr<TestCallback> testCallback = JSTestCallback::create(asObject(exec->uncheckedArgument(1)), castedThis->globalObject());
     RefPtr<TestTypedefs> object = TestTypedefs::create(hello, testCallback);
     return JSValue::encode(asObject(toJS(exec, castedThis->globalObject(), object.get())));
 }
index 985dd98..c4e9b14 100644 (file)
@@ -167,7 +167,7 @@ JSValue CInstance::invokeMethod(ExecState* exec, RuntimeMethod* runtimeMethod)
 
     unsigned i;
     for (i = 0; i < count; i++)
-        convertValueToNPVariant(exec, exec->argument(i), &cArgs[i]);
+        convertValueToNPVariant(exec, exec->uncheckedArgument(i), &cArgs[i]);
 
     // Invoke the 'C' method.
     bool retval = true;
@@ -203,7 +203,7 @@ JSValue CInstance::invokeDefaultMethod(ExecState* exec)
 
     unsigned i;
     for (i = 0; i < count; i++)
-        convertValueToNPVariant(exec, exec->argument(i), &cArgs[i]);
+        convertValueToNPVariant(exec, exec->uncheckedArgument(i), &cArgs[i]);
 
     // Invoke the 'C' method.
     bool retval = true;
index cbafc2d..549e716 100644 (file)
@@ -260,13 +260,13 @@ JSValue ObjcInstance::invokeObjcMethod(ExecState* exec, ObjcMethod* method)
         NSMutableArray* objcArgs = [NSMutableArray array];
         int count = exec->argumentCount();
         for (int i = 0; i < count; i++) {
-            ObjcValue value = convertValueToObjcValue(exec, exec->argument(i), ObjcObjectType);
+            ObjcValue value = convertValueToObjcValue(exec, exec->uncheckedArgument(i), ObjcObjectType);
             [objcArgs addObject:value.objectValue];
         }
         [invocation setArgument:&objcArgs atIndex:3];
     } else {
         unsigned count = [signature numberOfArguments];
-        for (unsigned i = 2; i < count ; i++) {
+        for (unsigned i = 2; i < count; ++i) {
             const char* type = [signature getArgumentTypeAtIndex:i];
             ObjcValueType objcValueType = objcValueTypeForType(type);
 
@@ -275,7 +275,7 @@ JSValue ObjcInstance::invokeObjcMethod(ExecState* exec, ObjcMethod* method)
             // types.
             ASSERT(objcValueType != ObjcInvalidType && objcValueType != ObjcVoidType);
 
-            ObjcValue value = convertValueToObjcValue(exec, exec->argument(i-2), objcValueType);
+            ObjcValue value = convertValueToObjcValue(exec, exec->argument(i - 2), objcValueType);
 
             switch (objcValueType) {
                 case ObjcObjectType:
@@ -374,7 +374,7 @@ JSValue ObjcInstance::invokeDefaultMethod(ExecState* exec)
     NSMutableArray* objcArgs = [NSMutableArray array];
     unsigned count = exec->argumentCount();
     for (unsigned i = 0; i < count; i++) {
-        ObjcValue value = convertValueToObjcValue(exec, exec->argument(i), ObjcObjectType);
+        ObjcValue value = convertValueToObjcValue(exec, exec->uncheckedArgument(i), ObjcObjectType);
         [objcArgs addObject:value.objectValue];
     }
     [invocation setArgument:&objcArgs atIndex:2];
index c980a81..46aff15 100644 (file)
@@ -1,3 +1,15 @@
+2013-09-21  Darin Adler  <darin@apple.com>
+
+        Add ExecState::uncheckedArgument and use where possible to shrink a bit
+        https://bugs.webkit.org/show_bug.cgi?id=121750
+
+        Reviewed by Andreas Kling.
+
+        * WebProcess/Plugins/Netscape/JSNPObject.cpp:
+        (WebKit::JSNPObject::callMethod): In a loop.
+        (WebKit::JSNPObject::callObject): Ditto.
+        (WebKit::JSNPObject::callConstructor): Ditto.
+
 2013-09-18  Anders Carlsson  <andersca@apple.com>
 
         Remove the ENABLE_PLUGIN_PROCESS #define
index c19e00c..4447ab0 100644 (file)
@@ -115,7 +115,7 @@ JSValue JSNPObject::callMethod(ExecState* exec, NPIdentifier methodName)
 
     // Convert all arguments to NPVariants.
     for (size_t i = 0; i < argumentCount; ++i)
-        m_objectMap->convertJSValueToNPVariant(exec, exec->argument(i), arguments[i]);
+        m_objectMap->convertJSValueToNPVariant(exec, exec->uncheckedArgument(i), arguments[i]);
 
     // Calling NPClass::invoke will call into plug-in code, and there's no telling what the plug-in can do.
     // (including destroying the plug-in). Because of this, we make sure to keep the plug-in alive until 
@@ -155,7 +155,7 @@ JSC::JSValue JSNPObject::callObject(JSC::ExecState* exec)
     
     // Convert all arguments to NPVariants.
     for (size_t i = 0; i < argumentCount; ++i)
-        m_objectMap->convertJSValueToNPVariant(exec, exec->argument(i), arguments[i]);
+        m_objectMap->convertJSValueToNPVariant(exec, exec->uncheckedArgument(i), arguments[i]);
 
     // Calling NPClass::invokeDefault will call into plug-in code, and there's no telling what the plug-in can do.
     // (including destroying the plug-in). Because of this, we make sure to keep the plug-in alive until 
@@ -195,7 +195,7 @@ JSValue JSNPObject::callConstructor(ExecState* exec)
 
     // Convert all arguments to NPVariants.
     for (size_t i = 0; i < argumentCount; ++i)
-        m_objectMap->convertJSValueToNPVariant(exec, exec->argument(i), arguments[i]);
+        m_objectMap->convertJSValueToNPVariant(exec, exec->uncheckedArgument(i), arguments[i]);
 
     // Calling NPClass::construct will call into plug-in code, and there's no telling what the plug-in can do.
     // (including destroying the plug-in). Because of this, we make sure to keep the plug-in alive until