Ignore:
Timestamp:
May 2, 2008, 3:07:53 AM (17 years ago)
Author:
[email protected]
Message:

Reviewed by Geoffrey Garen.

https://bugs.webkit.org/show_bug.cgi?id=18826
Make JavaScript heap per-thread

File:
1 edited

Legend:

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

    r32652 r32807  
    5656    : NumberInstance(objectPrototype)
    5757{
    58     setInternalValue(jsNumber(0));
     58    setInternalValue(jsNumber(exec, 0));
    5959
    6060    // The constructor will be added later, after NumberObjectImp has been constructed
    6161
    62     putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().toString, numberProtoFuncToString), DontEnum);
    63     putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toLocaleString, numberProtoFuncToLocaleString), DontEnum);
    64     putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().valueOf, numberProtoFuncValueOf), DontEnum);
    65     putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().toFixed, numberProtoFuncToFixed), DontEnum);
    66     putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().toExponential, numberProtoFuncToExponential), DontEnum);
    67     putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().toPrecision, numberProtoFuncToPrecision), DontEnum);
     62    putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().toString, numberProtoFuncToString), DontEnum);
     63    putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toLocaleString, numberProtoFuncToLocaleString), DontEnum);
     64    putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().valueOf, numberProtoFuncValueOf), DontEnum);
     65    putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().toFixed, numberProtoFuncToFixed), DontEnum);
     66    putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().toExponential, numberProtoFuncToExponential), DontEnum);
     67    putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().toPrecision, numberProtoFuncToPrecision), DontEnum);
    6868}
    6969
     
    152152    double radixAsDouble = args[0]->toInteger(exec); // nan -> 0
    153153    if (radixAsDouble == 10 || args[0]->isUndefined())
    154         return jsString(v->toString(exec));
     154        return jsString(exec, v->toString(exec));
    155155
    156156    if (radixAsDouble < 2 || radixAsDouble > 36)
     
    166166    double x = v->toNumber(exec);
    167167    if (isnan(x) || isinf(x))
    168         return jsString(UString::from(x));
     168        return jsString(exec, UString::from(x));
    169169
    170170    bool isNegative = x < 0.0;
     
    205205    ASSERT(p < s + sizeof(s));
    206206
    207     return jsString(startOfResultString);
     207    return jsString(exec, startOfResultString);
    208208}
    209209
     
    214214
    215215    // TODO
    216     return jsString(static_cast<NumberInstance*>(thisObj)->internalValue()->toString(exec));
     216    return jsString(exec, static_cast<NumberInstance*>(thisObj)->internalValue()->toString(exec));
    217217}
    218218
     
    240240    double x = v->toNumber(exec);
    241241    if (isnan(x))
    242         return jsString("NaN");
     242        return jsString(exec, "NaN");
    243243
    244244    UString s;
     
    250250
    251251    if (x >= pow(10.0, 21.0))
    252         return jsString(s + UString::from(x));
     252        return jsString(exec, s + UString::from(x));
    253253
    254254    const double tenToTheF = pow(10.0, f);
     
    270270    int kMinusf = k - f;
    271271    if (kMinusf < m.size())
    272         return jsString(s + m.substr(0, kMinusf) + "." + m.substr(kMinusf));
    273     return jsString(s + m.substr(0, kMinusf));
     272        return jsString(exec, s + m.substr(0, kMinusf) + "." + m.substr(kMinusf));
     273    return jsString(exec, s + m.substr(0, kMinusf));
    274274}
    275275
     
    321321
    322322    if (isnan(x) || isinf(x))
    323         return jsString(UString::from(x));
     323        return jsString(exec, UString::from(x));
    324324
    325325    JSValue* fractionalDigitsValue = args[0];
     
    347347
    348348    if (isnan(x))
    349         return jsString("NaN");
     349        return jsString(exec, "NaN");
    350350
    351351    if (x == -0.0) // (-0.0).toExponential() should print as 0 instead of -0
     
    379379    freedtoa(result);
    380380
    381     return jsString(buf);
     381    return jsString(exec, buf);
    382382}
    383383
     
    392392    double x = v->toNumber(exec);
    393393    if (args[0]->isUndefined() || isnan(x) || isinf(x))
    394         return jsString(v->toString(exec));
     394        return jsString(exec, v->toString(exec));
    395395
    396396    UString s;
     
    431431                m = m.substr(0, 1) + "." + m.substr(1);
    432432            if (e >= 0)
    433                 return jsString(s + m + "e+" + UString::from(e));
    434             return jsString(s + m + "e-" + UString::from(-e));
     433                return jsString(exec, s + m + "e+" + UString::from(e));
     434            return jsString(exec, s + m + "e-" + UString::from(-e));
    435435        }
    436436    } else {
     
    440440
    441441    if (e == precision - 1)
    442         return jsString(s + m);
     442        return jsString(exec, s + m);
    443443    if (e >= 0) {
    444444        if (e + 1 < m.size())
    445             return jsString(s + m.substr(0, e + 1) + "." + m.substr(e + 1));
    446         return jsString(s + m);
    447     }
    448     return jsString(s + "0." + char_sequence('0', -(e + 1)) + m);
     445            return jsString(exec, s + m.substr(0, e + 1) + "." + m.substr(e + 1));
     446        return jsString(exec, s + m);
     447    }
     448    return jsString(exec, s + "0." + char_sequence('0', -(e + 1)) + m);
    449449}
    450450
     
    469469
    470470    // no. of arguments for constructor
    471     putDirect(exec->propertyNames().length, jsNumber(1), ReadOnly|DontDelete|DontEnum);
     471    putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly|DontDelete|DontEnum);
    472472}
    473473
     
    477477}
    478478
    479 JSValue* NumberObjectImp::getValueProperty(ExecState*, int token) const
     479JSValue* NumberObjectImp::getValueProperty(ExecState* exec, int token) const
    480480{
    481481    // ECMA 15.7.3
    482482    switch (token) {
    483483        case NaNValue:
    484             return jsNaN();
     484            return jsNaN(exec);
    485485        case NegInfinity:
    486             return jsNumberCell(-Inf);
     486            return jsNumberCell(exec, -Inf);
    487487        case PosInfinity:
    488             return jsNumberCell(Inf);
     488            return jsNumberCell(exec, Inf);
    489489        case MaxValue:
    490             return jsNumberCell(1.7976931348623157E+308);
     490            return jsNumberCell(exec, 1.7976931348623157E+308);
    491491        case MinValue:
    492             return jsNumberCell(5E-324);
     492            return jsNumberCell(exec, 5E-324);
    493493    }
    494494    ASSERT_NOT_REACHED();
     
    505505{
    506506    JSObject* proto = exec->lexicalGlobalObject()->numberPrototype();
    507     NumberInstance* obj = new NumberInstance(proto);
     507    NumberInstance* obj = new (exec) NumberInstance(proto);
    508508
    509509    // FIXME: Check args[0]->isUndefined() instead of args.isEmpty()?
    510510    double n = args.isEmpty() ? 0 : args[0]->toNumber(exec);
    511     obj->setInternalValue(jsNumber(n));
     511    obj->setInternalValue(jsNumber(exec, n));
    512512    return obj;
    513513}
     
    517517{
    518518    // FIXME: Check args[0]->isUndefined() instead of args.isEmpty()?
    519     return jsNumber(args.isEmpty() ? 0 : args[0]->toNumber(exec));
     519    return jsNumber(exec, args.isEmpty() ? 0 : args[0]->toNumber(exec));
    520520}
    521521
Note: See TracChangeset for help on using the changeset viewer.