Commit d9b22137 authored by darin@apple.com's avatar 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.

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: http://svn.webkit.org/repository/webkit/trunk@156240 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent fdd873bb
......@@ -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;
......
......@@ -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;
......
......@@ -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;
{
......
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
......@@ -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)
{
......
......@@ -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);
}
......
......@@ -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;
......
......@@ -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;
......
......@@ -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 {
......
......@@ -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
......
......@@ -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;
......
......@@ -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());
}
......
......@@ -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)"));
}
......
......@@ -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
......
......@@ -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();
......
......@@ -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);
}
......
......@@ -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;
......
......@@ -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)));
}
......
......@@ -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;