Changeset 11527 in webkit for trunk/JavaScriptCore/kjs/value.cpp


Ignore:
Timestamp:
Dec 10, 2005, 6:06:17 PM (19 years ago)
Author:
darin
Message:

JavaScriptCore:

Rubber stamped by Maciej.

  • did long-promised KJS renaming:

ValueImp -> JSValue
ObjectImp -> JSObject
AllocatedValueImp -> JSCell

A renaming to get a class out of the way

KJS::Bindings::JSObject -> JavaJSObject

and some other "imp-reduction" renaming

*InstanceImp -> *Instance
*ProtoFuncImp -> *ProtoFunc
*PrototypeImp -> *Prototype
ArgumentsImp -> Arguments
RuntimeArrayImp -> RuntimeArray
RuntimeMethodImp -> RuntimeMethod

  • most files and functions

WebCore:

Rubber stamped by Maciej.

  • updated for KJS class renaming
  • many files and functions
File:
1 edited

Legend:

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

    r11213 r11527  
    4141namespace KJS {
    4242
    43 AllocatedValueImp *ConstantValues::undefined = NULL;
    44 AllocatedValueImp *ConstantValues::null = NULL;
    45 AllocatedValueImp *ConstantValues::jsTrue = NULL;
    46 AllocatedValueImp *ConstantValues::jsFalse = NULL;
     43JSCell *ConstantValues::undefined = NULL;
     44JSCell *ConstantValues::null = NULL;
     45JSCell *ConstantValues::jsTrue = NULL;
     46JSCell *ConstantValues::jsFalse = NULL;
    4747
    4848static const double D16 = 65536.0;
    4949static const double D32 = 4294967296.0;
    5050
    51 void *AllocatedValueImp::operator new(size_t size)
     51void *JSCell::operator new(size_t size)
    5252{
    5353    return Collector::allocate(size);
    5454}
    5555
    56 bool AllocatedValueImp::getUInt32(unsigned&) const
     56bool JSCell::getUInt32(unsigned&) const
    5757{
    5858    return false;
     
    6060
    6161// ECMA 9.4
    62 double ValueImp::toInteger(ExecState *exec) const
    63 {
    64     uint32_t i;
    65     if (getUInt32(i))
    66         return i;
    67     return roundValue(exec, const_cast<ValueImp*>(this));
    68 }
    69 
    70 int32_t ValueImp::toInt32(ExecState *exec) const
    71 {
    72     uint32_t i;
    73     if (getUInt32(i))
    74         return i;
    75 
    76     double d = roundValue(exec, const_cast<ValueImp*>(this));
     62double JSValue::toInteger(ExecState *exec) const
     63{
     64    uint32_t i;
     65    if (getUInt32(i))
     66        return i;
     67    return roundValue(exec, const_cast<JSValue*>(this));
     68}
     69
     70int32_t JSValue::toInt32(ExecState *exec) const
     71{
     72    uint32_t i;
     73    if (getUInt32(i))
     74        return i;
     75
     76    double d = roundValue(exec, const_cast<JSValue*>(this));
    7777    if (isNaN(d) || isInf(d))
    7878        return 0;
     
    8787}
    8888
    89 uint32_t ValueImp::toUInt32(ExecState *exec) const
    90 {
    91     uint32_t i;
    92     if (getUInt32(i))
    93         return i;
    94 
    95     double d = roundValue(exec, const_cast<ValueImp*>(this));
     89uint32_t JSValue::toUInt32(ExecState *exec) const
     90{
     91    uint32_t i;
     92    if (getUInt32(i))
     93        return i;
     94
     95    double d = roundValue(exec, const_cast<JSValue*>(this));
    9696    if (isNaN(d) || isInf(d))
    9797        return 0;
     
    104104}
    105105
    106 uint16_t ValueImp::toUInt16(ExecState *exec) const
    107 {
    108     uint32_t i;
    109     if (getUInt32(i))
    110         return i;
    111 
    112     double d = roundValue(exec, const_cast<ValueImp*>(this));
     106uint16_t JSValue::toUInt16(ExecState *exec) const
     107{
     108    uint32_t i;
     109    if (getUInt32(i))
     110        return i;
     111
     112    double d = roundValue(exec, const_cast<JSValue*>(this));
    113113    if (isNaN(d) || isInf(d))
    114114        return 0;
     
    121121}
    122122
    123 ObjectImp *ValueImp::toObject(ExecState *exec) const
     123JSObject *JSValue::toObject(ExecState *exec) const
    124124{
    125125    if (SimpleNumber::is(this))
     
    128128}
    129129
    130 bool AllocatedValueImp::getBoolean(bool &booleanValue) const
     130bool JSCell::getBoolean(bool &booleanValue) const
    131131{
    132132    if (!isBoolean())
     
    136136}
    137137
    138 bool AllocatedValueImp::getNumber(double &numericValue) const
     138bool JSCell::getNumber(double &numericValue) const
    139139{
    140140    if (!isNumber())
     
    144144}
    145145
    146 double AllocatedValueImp::getNumber() const
     146double JSCell::getNumber() const
    147147{
    148148    return isNumber() ? static_cast<const NumberImp *>(this)->value() : NaN;
    149149}
    150150
    151 bool AllocatedValueImp::getString(UString &stringValue) const
     151bool JSCell::getString(UString &stringValue) const
    152152{
    153153    if (!isString())
     
    157157}
    158158
    159 UString AllocatedValueImp::getString() const
     159UString JSCell::getString() const
    160160{
    161161    return isString() ? static_cast<const StringImp *>(this)->value() : UString();
    162162}
    163163
    164 ObjectImp *AllocatedValueImp::getObject()
    165 {
    166     return isObject() ? static_cast<ObjectImp *>(this) : 0;
    167 }
    168 
    169 const ObjectImp *AllocatedValueImp::getObject() const
    170 {
    171     return isObject() ? static_cast<const ObjectImp *>(this) : 0;
    172 }
    173 
    174 AllocatedValueImp *jsString(const char *s)
     164JSObject *JSCell::getObject()
     165{
     166    return isObject() ? static_cast<JSObject *>(this) : 0;
     167}
     168
     169const JSObject *JSCell::getObject() const
     170{
     171    return isObject() ? static_cast<const JSObject *>(this) : 0;
     172}
     173
     174JSCell *jsString(const char *s)
    175175{
    176176    return new StringImp(s ? s : "");
    177177}
    178178
    179 AllocatedValueImp *jsString(const UString &s)
     179JSCell *jsString(const UString &s)
    180180{
    181181    return s.isNull() ? new StringImp("") : new StringImp(s);
    182182}
    183183
    184 ValueImp *jsNumber(double d)
    185 {
    186   ValueImp *v = SimpleNumber::make(d);
     184JSValue *jsNumber(double d)
     185{
     186  JSValue *v = SimpleNumber::make(d);
    187187  return v ? v : new NumberImp(d);
    188188}
     
    201201void ConstantValues::mark()
    202202{
    203     if (AllocatedValueImp *v = undefined)
    204         if (!v->marked())
    205             v->mark();
    206     if (AllocatedValueImp *v = null)
    207         if (!v->marked())
    208             v->mark();
    209     if (AllocatedValueImp *v = jsTrue)
    210         if (!v->marked())
    211             v->mark();
    212     if (AllocatedValueImp *v = jsFalse)
    213         if (!v->marked())
    214             v->mark();
    215 }
    216 
    217 }
     203    if (JSCell *v = undefined)
     204        if (!v->marked())
     205            v->mark();
     206    if (JSCell *v = null)
     207        if (!v->marked())
     208            v->mark();
     209    if (JSCell *v = jsTrue)
     210        if (!v->marked())
     211            v->mark();
     212    if (JSCell *v = jsFalse)
     213        if (!v->marked())
     214            v->mark();
     215}
     216
     217}
Note: See TracChangeset for help on using the changeset viewer.