Changeset 27483 in webkit for trunk/JavaScriptCore/kjs/nodes.cpp


Ignore:
Timestamp:
Nov 6, 2007, 11:34:41 AM (18 years ago)
Author:
oliver
Message:

Replace boolean comparisons in AddNode with mask comparisons for a 0.2% improvement in sunspider.

Reviewed by Darin

File:
1 edited

Legend:

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

    r27482 r27483  
    17081708    JSType t1 = v1->type();
    17091709    JSType t2 = v2->type();
    1710        
    1711     if (t1 == NumberType && t2 == NumberType)
     1710    const unsigned bothTypes = (t1 << 16) | t2;
     1711   
     1712    if (bothTypes == ((NumberType << 16) | NumberType))
    17121713        return jsNumber(v1->toNumber(exec) + v2->toNumber(exec));
    1713     else if (t1 == StringType && t2 == StringType) {
     1714    else if (bothTypes == ((StringType << 16) | StringType)) {
    17141715        UString value = static_cast<StringImp*>(v1)->value() + static_cast<StringImp*>(v2)->value();
    17151716        if (value.isNull())
Note: See TracChangeset for help on using the changeset viewer.