Ignore:
Timestamp:
Jun 4, 2010, 2:38:38 PM (15 years ago)
Author:
[email protected]
Message:

Bug 40187 - Change function signature of NativeConstructor to match NativeFunction

Reviewed by Oliver Hunt.

Mostly for consistency, but constructor & args arguments are redundant,
and this will help if we wish to be able to JIT calls to more constructors.

JavaScriptCore:

  • API/JSCallbackConstructor.cpp:

(JSC::constructJSCallback):

  • API/JSCallbackObject.h:
  • API/JSCallbackObjectFunctions.h:

(JSC::::construct):

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::executeConstruct):

  • interpreter/Interpreter.h:
  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • runtime/ArrayConstructor.cpp:

(JSC::constructWithArrayConstructor):

  • runtime/BooleanConstructor.cpp:

(JSC::constructWithBooleanConstructor):

  • runtime/ConstructData.cpp:

(JSC::construct):

  • runtime/ConstructData.h:
  • runtime/DateConstructor.cpp:

(JSC::constructWithDateConstructor):

  • runtime/Error.cpp:

(JSC::constructNativeError):
(JSC::Error::create):

  • runtime/ErrorConstructor.cpp:

(JSC::constructWithErrorConstructor):

  • runtime/FunctionConstructor.cpp:

(JSC::constructWithFunctionConstructor):

  • runtime/NativeErrorConstructor.cpp:

(JSC::constructWithNativeErrorConstructor):

  • runtime/NativeErrorConstructor.h:

(JSC::NativeErrorConstructor::errorStructure):

  • runtime/NumberConstructor.cpp:

(JSC::constructWithNumberConstructor):

  • runtime/ObjectConstructor.cpp:

(JSC::constructWithObjectConstructor):

  • runtime/RegExpConstructor.cpp:

(JSC::constructWithRegExpConstructor):

  • runtime/StringConstructor.cpp:

(JSC::constructWithStringConstructor):

WebCore:

  • bindings/js/JSArrayBufferConstructor.cpp:

(WebCore::constructCanvasArrayBuffer):

  • bindings/js/JSAudioConstructor.cpp:

(WebCore::constructAudio):

  • bindings/js/JSEventSourceConstructor.cpp:

(WebCore::constructEventSource):

  • bindings/js/JSFloatArrayConstructor.cpp:

(WebCore::constructCanvasFloatArray):

  • bindings/js/JSImageConstructor.cpp:

(WebCore::constructImage):

  • bindings/js/JSInt16ArrayConstructor.cpp:

(WebCore::constructCanvasShortArray):

  • bindings/js/JSInt32ArrayConstructor.cpp:

(WebCore::constructCanvasIntArray):

  • bindings/js/JSInt8ArrayConstructor.cpp:

(WebCore::constructCanvasByteArray):

  • bindings/js/JSMessageChannelConstructor.cpp:

(WebCore::JSMessageChannelConstructor::construct):

  • bindings/js/JSMessageChannelConstructor.h:
  • bindings/js/JSOptionConstructor.cpp:

(WebCore::constructHTMLOptionElement):

  • bindings/js/JSSharedWorkerConstructor.cpp:

(WebCore::constructSharedWorker):

  • bindings/js/JSUint16ArrayConstructor.cpp:

(WebCore::constructCanvasUnsignedShortArray):

  • bindings/js/JSUint32ArrayConstructor.cpp:

(WebCore::constructCanvasUnsignedIntArray):

  • bindings/js/JSUint8ArrayConstructor.cpp:

(WebCore::constructCanvasUnsignedByteArray):

  • bindings/js/JSWebKitCSSMatrixConstructor.cpp:

(WebCore::constructWebKitCSSMatrix):

  • bindings/js/JSWebKitPointConstructor.cpp:

(WebCore::constructWebKitPoint):

  • bindings/js/JSWebSocketConstructor.cpp:

(WebCore::constructWebSocket):

  • bindings/js/JSWorkerConstructor.cpp:

(WebCore::constructWorker):

  • bindings/js/JSXMLHttpRequestConstructor.cpp:

(WebCore::constructXMLHttpRequest):

  • bindings/js/JSXSLTProcessorConstructor.cpp:

(WebCore::constructXSLTProcessor):

  • bindings/scripts/CodeGeneratorJS.pm:
  • bridge/runtime_object.cpp:

(JSC::Bindings::callRuntimeConstructor):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/API/JSCallbackObjectFunctions.h

    r60631 r60708  
    309309
    310310template <class Base>
    311 JSObject* JSCallbackObject<Base>::construct(ExecState* exec, JSObject* constructor, const ArgList& args)
    312 {
     311EncodedJSValue JSCallbackObject<Base>::construct(ExecState* exec)
     312{
     313    JSObject* constructor = exec->callee();
    313314    JSContextRef execRef = toRef(exec);
    314315    JSObjectRef constructorRef = toRef(constructor);
     
    316317    for (JSClassRef jsClass = static_cast<JSCallbackObject<Base>*>(constructor)->classRef(); jsClass; jsClass = jsClass->parentClass) {
    317318        if (JSObjectCallAsConstructorCallback callAsConstructor = jsClass->callAsConstructor) {
    318             int argumentCount = static_cast<int>(args.size());
     319            int argumentCount = static_cast<int>(exec->argumentCount());
    319320            Vector<JSValueRef, 16> arguments(argumentCount);
    320321            for (int i = 0; i < argumentCount; i++)
    321                 arguments[i] = toRef(exec, args.at(i));
     322                arguments[i] = toRef(exec, exec->argument(i));
    322323            JSValueRef exception = 0;
    323324            JSObject* result;
     
    328329            if (exception)
    329330                exec->setException(toJS(exec, exception));
    330             return result;
     331            return JSValue::encode(result);
    331332        }
    332333    }
    333334   
    334335    ASSERT_NOT_REACHED(); // getConstructData should prevent us from reaching here
    335     return 0;
     336    return JSValue::encode(JSValue());
    336337}
    337338
Note: See TracChangeset for help on using the changeset viewer.