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/JSString.cpp

    r95936 r96143  
    275275}
    276276
    277 bool JSString::getPrimitiveNumber(ExecState* exec, double& number, JSValue& result)
     277bool JSString::getPrimitiveNumber(ExecState* exec, double& number, JSValue& result) const
    278278{
    279279    result = this;
Note: See TracChangeset for help on using the changeset viewer.