Ignore:
Timestamp:
Nov 23, 2009, 6:30:04 PM (16 years ago)
Author:
[email protected]
Message:

Streamlined some Math functions where we expect or know the result not
to be representable as an int.

Reviewed by Oliver Hunt.

SunSpider says 0.6% faster.

  • runtime/JSNumberCell.h:

(JSC::JSValue::JSValue):

  • runtime/JSValue.h:

(JSC::JSValue::):
(JSC::jsDoubleNumber):
(JSC::JSValue::JSValue): Added a function for making a numeric JSValue
and skipping the "can I encode this as an int?" check, avoiding the
overhead of int <-> double roundtripping and double <-> double comparison
and branching.

  • runtime/MathObject.cpp:

(JSC::mathProtoFuncACos):
(JSC::mathProtoFuncASin):
(JSC::mathProtoFuncATan):
(JSC::mathProtoFuncATan2):
(JSC::mathProtoFuncCos):
(JSC::mathProtoFuncExp):
(JSC::mathProtoFuncLog):
(JSC::mathProtoFuncRandom):
(JSC::mathProtoFuncSin):
(JSC::mathProtoFuncSqrt):
(JSC::mathProtoFuncTan): For these functions, which we expect or know
to produce results not representable as ints, call jsDoubleNumber instead
of jsNumber.

File:
1 edited

Legend:

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

    r49649 r51334  
    110110    }
    111111
     112    ALWAYS_INLINE JSValue::JSValue(EncodeAsDoubleTag, ExecState* exec, double d)
     113    {
     114        *this = jsNumberCell(exec, d);
     115    }
     116
    112117    inline JSValue::JSValue(ExecState* exec, double d)
    113118    {
     
    194199
    195200#if USE(JSVALUE64)
     201    ALWAYS_INLINE JSValue::JSValue(EncodeAsDoubleTag, ExecState*, double d)
     202    {
     203        *this = JSImmediate::fromNumberOutsideIntegerRange(d);
     204    }
     205
    196206    inline JSValue::JSValue(ExecState*, double d)
    197207    {
Note: See TracChangeset for help on using the changeset viewer.