Ignore:
Timestamp:
Apr 2, 2010, 1:15:53 PM (15 years ago)
Author:
[email protected]
Message:

Inlined toThisString and toThisJSString to avoid virtual function call overhead
https://bugs.webkit.org/show_bug.cgi?id=37039

Reviewed by Oliver Hunt.

Maybe a 1% speedup on iBench JS.

  • runtime/JSCell.cpp:
  • runtime/JSCell.h:
  • runtime/JSNumberCell.cpp:
  • runtime/JSNumberCell.h:
  • runtime/JSString.cpp:
  • runtime/JSString.h:
  • runtime/JSValue.h:
  • runtime/JSZombie.h:

(JSC::JSZombie::toThisObject): Nixed the old virtual-type implementation.

  • runtime/JSObject.h:

(JSC::JSValue::toThisString):
(JSC::JSValue::toThisJSString): Added the inlined implementation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/JSObject.h

    r55521 r57019  
    3636#include "Structure.h"
    3737#include "JSGlobalData.h"
     38#include "JSString.h"
    3839#include <wtf/StdLibExtras.h>
    3940
     
    710711}
    711712
     713// --- JSValue inlines ----------------------------
     714
     715ALWAYS_INLINE UString JSValue::toThisString(ExecState* exec) const
     716{
     717    return isString() ? static_cast<JSString*>(asCell())->value(exec) : toThisObject(exec)->toString(exec);
     718}
     719
     720inline JSString* JSValue::toThisJSString(ExecState* exec) const
     721{
     722    return isString() ? static_cast<JSString*>(asCell()) : jsString(exec, toThisObject(exec)->toString(exec));
     723}
     724
    712725} // namespace JSC
    713726
Note: See TracChangeset for help on using the changeset viewer.