Ignore:
Timestamp:
Oct 29, 2007, 2:14:08 AM (18 years ago)
Author:
eseidel
Message:

2007-10-29 Eric Seidel <[email protected]>

Reviewed by Maciej.


SunSpider claims this was a 0.7% speedup.

  • kjs/string_object.cpp: (KJS::StringProtoFunc::callAsFunction): avoid mallocing a jsString in the common case
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/string_object.cpp

    r27218 r27222  
    444444  // toString and valueOf are no generic function.
    445445  if (id == ToString || id == ValueOf) {
    446     if (!thisObj || !thisObj->inherits(&StringInstance::info))
     446    if (!thisObj->inherits(&StringInstance::info))
    447447      return throwError(exec, TypeError);
    448448
     
    455455  double d = 0.0;
    456456
    457   UString s = thisObj->toString(exec);
     457  // This optimizes the common case that thisObj is a StringInstance
     458  UString s = thisObj->inherits(&StringInstance::info) ? static_cast<StringInstance*>(thisObj)->internalValue()->value() : thisObj->toString(exec);
    458459
    459460  int len = s.size();
Note: See TracChangeset for help on using the changeset viewer.