Changeset 155466 in webkit for trunk/Source/JavaScriptCore


Ignore:
Timestamp:
Sep 10, 2013, 12:33:22 PM (12 years ago)
Author:
[email protected]
Message:

SpecType should have SpecInt48AsDouble
https://bugs.webkit.org/show_bug.cgi?id=121065

Reviewed by Oliver Hunt.

  • bytecode/SpeculatedType.cpp:

(JSC::dumpSpeculation):
(JSC::speculationToAbbreviatedString):
(JSC::speculationFromValue):

  • bytecode/SpeculatedType.h:

(JSC::isInt48AsDoubleSpeculation):
(JSC::isIntegerSpeculation):
(JSC::isDoubleRealSpeculation):

Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r155457 r155466  
     12013-09-10  Filip Pizlo  <[email protected]>
     2
     3        SpecType should have SpecInt48AsDouble
     4        https://bugs.webkit.org/show_bug.cgi?id=121065
     5
     6        Reviewed by Oliver Hunt.
     7
     8        * bytecode/SpeculatedType.cpp:
     9        (JSC::dumpSpeculation):
     10        (JSC::speculationToAbbreviatedString):
     11        (JSC::speculationFromValue):
     12        * bytecode/SpeculatedType.h:
     13        (JSC::isInt48AsDoubleSpeculation):
     14        (JSC::isIntegerSpeculation):
     15        (JSC::isDoubleRealSpeculation):
     16
    1172013-09-10  Filip Pizlo  <[email protected]>
    218
  • trunk/Source/JavaScriptCore/bytecode/SpeculatedType.cpp

    r154403 r155466  
    162162        myOut.print("Double");
    163163    else {
    164         if (value & SpecDoubleReal)
    165             myOut.print("Doublereal");
     164        if (value & SpecInt48AsDouble)
     165            myOut.print("Int48asdouble");
     166        else
     167            isTop = false;
     168       
     169        if (value & SpecNonIntAsDouble)
     170            myOut.print("Nonintasdouble");
    166171        else
    167172            isTop = false;
     
    234239    if (isInt32Speculation(prediction))
    235240        return "<Int32>";
     241    if (isInt48AsDoubleSpeculation(prediction))
     242        return "<Int48AsDouble>";
    236243    if (isDoubleSpeculation(prediction))
    237244        return "<Double>";
     
    332339    if (value.isDouble()) {
    333340        double number = value.asNumber();
    334         if (number == number)
     341        if (number == number) {
     342            int64_t asInt64 = static_cast<int64_t>(number);
     343            if (asInt64 == number && (!asInt64 || std::signbit(number))
     344                && asInt64 < (static_cast<int64_t>(1) << 47)
     345                && asInt64 >= -(static_cast<int64_t>(1) << 47))
     346                return SpecInt48AsDouble;
    335347            return SpecDoubleReal;
     348        }
    336349        return SpecDoubleNaN;
    337350    }
  • trunk/Source/JavaScriptCore/bytecode/SpeculatedType.h

    r154403 r155466  
    6363static const SpeculatedType SpecCell              = 0x0007ffff; // It's definitely a JSCell.
    6464static const SpeculatedType SpecInt32             = 0x00800000; // It's definitely an Int32.
    65 static const SpeculatedType SpecDoubleReal        = 0x01000000; // It's definitely a non-NaN double.
    66 static const SpeculatedType SpecDoubleNaN         = 0x02000000; // It's definitely a NaN.
    67 static const SpeculatedType SpecDouble            = 0x03000000; // It's either a non-NaN or a NaN double.
    68 static const SpeculatedType SpecRealNumber        = 0x01800000; // It's either an Int32 or a DoubleReal.
    69 static const SpeculatedType SpecNumber            = 0x03800000; // It's either an Int32 or a Double.
    70 static const SpeculatedType SpecBoolean           = 0x04000000; // It's definitely a Boolean.
    71 static const SpeculatedType SpecOther             = 0x08000000; // It's definitely none of the above.
    72 static const SpeculatedType SpecTop               = 0x0fffffff; // It can be any of the above.
    73 static const SpeculatedType SpecEmpty             = 0x10000000; // It's definitely an empty value marker.
    74 static const SpeculatedType SpecEmptyOrTop        = 0x1fffffff; // It can be any of the above.
    75 static const SpeculatedType FixedIndexedStorageMask    = SpecInt8Array | SpecInt16Array | SpecInt32Array | SpecUint8Array | SpecUint8ClampedArray | SpecUint16Array | SpecUint32Array | SpecFloat32Array | SpecFloat64Array;
     65static const SpeculatedType SpecInt48AsDouble     = 0x01000000; // It's definitely an Int48 and it's inside a double.
     66static const SpeculatedType SpecInteger           = 0x01800000; // It's definitely some kind of integer.
     67static const SpeculatedType SpecNonIntAsDouble    = 0x02000000; // It's definitely not an Int48 but it's a real number and it's a double.
     68static const SpeculatedType SpecDoubleReal        = 0x03000000; // It's definitely a non-NaN double.
     69static const SpeculatedType SpecDoubleNaN         = 0x04000000; // It's definitely a NaN.
     70static const SpeculatedType SpecDouble            = 0x07000000; // It's either a non-NaN or a NaN double.
     71static const SpeculatedType SpecRealNumber        = 0x03800000; // It's either an Int32 or a DoubleReal.
     72static const SpeculatedType SpecNumber            = 0x07800000; // It's either an Int32 or a Double.
     73static const SpeculatedType SpecBoolean           = 0x08000000; // It's definitely a Boolean.
     74static const SpeculatedType SpecOther             = 0x10000000; // It's definitely none of the above.
     75static const SpeculatedType SpecTop               = 0x1fffffff; // It can be any of the above.
     76static const SpeculatedType SpecEmpty             = 0x20000000; // It's definitely an empty value marker.
     77static const SpeculatedType SpecEmptyOrTop        = 0x3fffffff; // It can be any of the above.
    7678
    7779typedef bool (*SpeculatedTypeChecker)(SpeculatedType);
     
    106108{
    107109    return !!(value & (SpecFinalObject | SpecOther)) && !(value & ~(SpecFinalObject | SpecOther));
    108 }
    109 
    110 inline bool isFixedIndexedStorageObjectSpeculation(SpeculatedType value)
    111 {
    112     return !!value && (value & FixedIndexedStorageMask) == value;
    113110}
    114111
     
    249246}
    250247
     248inline bool isInt48AsDoubleSpeculation(SpeculatedType value)
     249{
     250    return value == SpecInt48AsDouble;
     251}
     252
     253inline bool isIntegerSpeculation(SpeculatedType value)
     254{
     255    return !!value && (value & SpecInteger) == value;
     256}
     257
    251258inline bool isDoubleRealSpeculation(SpeculatedType value)
    252259{
    253     return value == SpecDoubleReal;
     260    return !!value && (value & SpecDoubleReal) == value;
    254261}
    255262
Note: See TracChangeset for help on using the changeset viewer.