Ignore:
Timestamp:
Sep 27, 2011, 12:53:49 PM (14 years ago)
Author:
[email protected]
Message:

De-virtualize JSCell::getPrimitiveNumber
https://bugs.webkit.org/show_bug.cgi?id=68851

Reviewed by Darin Adler.

Changed JSCell::getPrimitiveNumber to manually handle the dispatch for
JSCells (JSObject and JSString in this case).

  • runtime/JSCell.cpp:

(JSC::JSCell::getPrimitiveNumber):

  • runtime/JSCell.h:

Removed JSNotAnObject::getPrimitiveNumber since its return value doesn't
matter and it already implements defaultValue, so JSObject::getPrimitiveNumber
can cover the case for JSNotAnObject.

  • runtime/JSNotAnObject.cpp:
  • runtime/JSNotAnObject.h:

De-virtualized JSObject::getPrimitiveNumber and JSString::getPrimitiveNumber
and changed them to be const. Also made JSString::getPrimitiveNumber public
because it needs to be called from JSCell::getPrimitiveNumber and also since it's
no longer virtual, we want people who have a more specific pointer (JSString*
instead of JSCell*) to not have to pay the cost of a virtual method call.

  • runtime/JSObject.cpp:

(JSC::JSObject::getPrimitiveNumber):

  • runtime/JSObject.h:
  • runtime/JSString.cpp:

(JSC::JSString::getPrimitiveNumber):

  • runtime/JSString.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSNotAnObject.h

    r96045 r96143  
    6565        // JSValue methods
    6666        virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const;
    67         virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue&);
    6867        virtual double toNumber(ExecState*) const;
    6968        virtual UString toString(ExecState*) const;
Note: See TracChangeset for help on using the changeset viewer.