Ignore:
Timestamp:
Dec 15, 2011, 9:32:58 PM (13 years ago)
Author:
[email protected]
Message:

Value profiling should distinguished between NaN and non-NaN doubles
https://bugs.webkit.org/show_bug.cgi?id=74682

Reviewed by Gavin Barraclough.

Added PredictDoubleReal and PredictDoubleNaN. PredictDouble is now the union
of the two.

  • bytecode/PredictedType.cpp:

(JSC::predictionToString):
(JSC::predictionFromValue):

  • bytecode/PredictedType.h:

(JSC::isDoubleRealPrediction):
(JSC::isDoublePrediction):

Location:
trunk/Source/JavaScriptCore/bytecode
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/bytecode/PredictedType.cpp

    r101729 r103023  
    129129        isTop = false;
    130130   
    131     if (value & PredictDouble)
    132         ptr.strcat("Double");
     131    if (value & PredictDoubleReal)
     132        ptr.strcat("Doublereal");
     133    else
     134        isTop = false;
     135   
     136    if (value & PredictDoubleNaN)
     137        ptr.strcat("Doublenan");
    133138    else
    134139        isTop = false;
     
    213218    if (value.isInt32())
    214219        return PredictInt32;
    215     if (value.isDouble())
    216         return PredictDouble;
     220    if (value.isDouble()) {
     221        double number = value.asNumber();
     222        if (number == number)
     223            return PredictDoubleReal;
     224        return PredictDoubleNaN;
     225    }
    217226    if (value.isCell())
    218227        return predictionFromCell(value.asCell());
  • trunk/Source/JavaScriptCore/bytecode/PredictedType.h

    r102442 r103023  
    5656static const PredictedType PredictCell          = 0x00007fff; // It's definitely a JSCell.
    5757static const PredictedType PredictInt32         = 0x00008000; // It's definitely an Int32.
    58 static const PredictedType PredictDouble        = 0x00010000; // It's definitely a Double.
    59 static const PredictedType PredictNumber        = 0x00018000; // It's either an Int32 or a Double.
    60 static const PredictedType PredictBoolean       = 0x00020000; // It's definitely a Boolean.
     58static const PredictedType PredictDoubleReal    = 0x00010000; // It's definitely a non-NaN double.
     59static const PredictedType PredictDoubleNaN     = 0x00020000; // It's definitely a NaN.
     60static const PredictedType PredictDouble        = 0x00030000; // It's either a non-NaN or a NaN double.
     61static const PredictedType PredictNumber        = 0x00038000; // It's either an Int32 or a Double.
     62static const PredictedType PredictBoolean       = 0x00040000; // It's definitely a Boolean.
    6163static const PredictedType PredictOther         = 0x40000000; // It's definitely none of the above.
    6264static const PredictedType PredictTop           = 0x7fffffff; // It can be any of the above.
     
    160162}
    161163
     164inline bool isDoubleRealPrediction(PredictedType value)
     165{
     166    return value == PredictDoubleReal;
     167}
     168
    162169inline bool isDoublePrediction(PredictedType value)
    163170{
    164     return value == PredictDouble;
     171    return (value & PredictDouble) == value;
    165172}
    166173
Note: See TracChangeset for help on using the changeset viewer.