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/array_object.cpp

    r11525 r11527  
    4141using namespace KJS;
    4242
    43 // ------------------------------ ArrayInstanceImp -----------------------------
     43// ------------------------------ ArrayInstance -----------------------------
    4444
    4545const unsigned sparseArrayCutoff = 10000;
    4646
    47 const ClassInfo ArrayInstanceImp::info = {"Array", 0, 0, 0};
    48 
    49 ArrayInstanceImp::ArrayInstanceImp(ObjectImp *proto, unsigned initialLength)
    50   : ObjectImp(proto)
     47const ClassInfo ArrayInstance::info = {"Array", 0, 0, 0};
     48
     49ArrayInstance::ArrayInstance(JSObject *proto, unsigned initialLength)
     50  : JSObject(proto)
    5151  , length(initialLength)
    5252  , storageLength(initialLength < sparseArrayCutoff ? initialLength : 0)
    5353  , capacity(storageLength)
    54   , storage(capacity ? (ValueImp **)fastCalloc(capacity, sizeof(ValueImp *)) : 0)
    55 {
    56 }
    57 
    58 ArrayInstanceImp::ArrayInstanceImp(ObjectImp *proto, const List &list)
    59   : ObjectImp(proto)
     54  , storage(capacity ? (JSValue **)fastCalloc(capacity, sizeof(JSValue *)) : 0)
     55{
     56}
     57
     58ArrayInstance::ArrayInstance(JSObject *proto, const List &list)
     59  : JSObject(proto)
    6060  , length(list.size())
    6161  , storageLength(length)
    6262  , capacity(storageLength)
    63   , storage(capacity ? (ValueImp **)fastMalloc(sizeof(ValueImp *) * capacity) : 0)
     63  , storage(capacity ? (JSValue **)fastMalloc(sizeof(JSValue *) * capacity) : 0)
    6464{
    6565  ListIterator it = list.begin();
     
    7070}
    7171
    72 ArrayInstanceImp::~ArrayInstanceImp()
     72ArrayInstance::~ArrayInstance()
    7373{
    7474  fastFree(storage);
    7575}
    7676
    77 ValueImp *ArrayInstanceImp::lengthGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
    78 {
    79   return jsNumber(static_cast<ArrayInstanceImp *>(slot.slotBase())->length);
    80 }
    81 
    82 bool ArrayInstanceImp::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
     77JSValue *ArrayInstance::lengthGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
     78{
     79  return jsNumber(static_cast<ArrayInstance *>(slot.slotBase())->length);
     80}
     81
     82bool ArrayInstance::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
    8383{
    8484  if (propertyName == lengthPropertyName) {
     
    9393      return false;
    9494    if (index < storageLength) {
    95       ValueImp *v = storage[index];
     95      JSValue *v = storage[index];
    9696      if (!v || v->isUndefined())
    9797        return false;     
     
    101101  }
    102102
    103   return ObjectImp::getOwnPropertySlot(exec, propertyName, slot);
    104 }
    105 
    106 bool ArrayInstanceImp::getOwnPropertySlot(ExecState *exec, unsigned index, PropertySlot& slot)
     103  return JSObject::getOwnPropertySlot(exec, propertyName, slot);
     104}
     105
     106bool ArrayInstance::getOwnPropertySlot(ExecState *exec, unsigned index, PropertySlot& slot)
    107107{
    108108  if (index >= length)
    109109    return false;
    110110  if (index < storageLength) {
    111     ValueImp *v = storage[index];
     111    JSValue *v = storage[index];
    112112    if (!v || v->isUndefined())
    113113      return false;
     
    116116  }
    117117
    118   return ObjectImp::getOwnPropertySlot(exec, index, slot);
     118  return JSObject::getOwnPropertySlot(exec, index, slot);
    119119}
    120120
    121121// Special implementation of [[Put]] - see ECMA 15.4.5.1
    122 void ArrayInstanceImp::put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr)
     122void ArrayInstance::put(ExecState *exec, const Identifier &propertyName, JSValue *value, int attr)
    123123{
    124124  if (propertyName == lengthPropertyName) {
     
    134134  }
    135135 
    136   ObjectImp::put(exec, propertyName, value, attr);
    137 }
    138 
    139 void ArrayInstanceImp::put(ExecState *exec, unsigned index, ValueImp *value, int attr)
     136  JSObject::put(exec, propertyName, value, attr);
     137}
     138
     139void ArrayInstance::put(ExecState *exec, unsigned index, JSValue *value, int attr)
    140140{
    141141  if (index < sparseArrayCutoff && index >= storageLength) {
     
    153153 
    154154  assert(index >= sparseArrayCutoff);
    155   ObjectImp::put(exec, Identifier::from(index), value, attr);
    156 }
    157 
    158 bool ArrayInstanceImp::deleteProperty(ExecState *exec, const Identifier &propertyName)
     155  JSObject::put(exec, Identifier::from(index), value, attr);
     156}
     157
     158bool ArrayInstance::deleteProperty(ExecState *exec, const Identifier &propertyName)
    159159{
    160160  if (propertyName == lengthPropertyName)
     
    172172  }
    173173 
    174   return ObjectImp::deleteProperty(exec, propertyName);
    175 }
    176 
    177 bool ArrayInstanceImp::deleteProperty(ExecState *exec, unsigned index)
     174  return JSObject::deleteProperty(exec, propertyName);
     175}
     176
     177bool ArrayInstance::deleteProperty(ExecState *exec, unsigned index)
    178178{
    179179  if (index >= length)
     
    184184  }
    185185 
    186   return ObjectImp::deleteProperty(exec, Identifier::from(index));
    187 }
    188 
    189 ReferenceList ArrayInstanceImp::propList(ExecState *exec, bool recursive)
    190 {
    191   ReferenceList properties = ObjectImp::propList(exec,recursive);
     186  return JSObject::deleteProperty(exec, Identifier::from(index));
     187}
     188
     189ReferenceList ArrayInstance::propList(ExecState *exec, bool recursive)
     190{
     191  ReferenceList properties = JSObject::propList(exec,recursive);
    192192
    193193  // avoid fetching this every time through the loop
    194   ValueImp *undefined = jsUndefined();
     194  JSValue *undefined = jsUndefined();
    195195
    196196  for (unsigned i = 0; i < storageLength; ++i) {
    197     ValueImp *imp = storage[i];
     197    JSValue *imp = storage[i];
    198198    if (imp && imp != undefined) {
    199199      properties.append(Reference(this, i));
     
    203203}
    204204
    205 void ArrayInstanceImp::resizeStorage(unsigned newLength)
     205void ArrayInstance::resizeStorage(unsigned newLength)
    206206{
    207207    if (newLength < storageLength) {
    208       memset(storage + newLength, 0, sizeof(ValueImp *) * (storageLength - newLength));
     208      memset(storage + newLength, 0, sizeof(JSValue *) * (storageLength - newLength));
    209209    }
    210210    if (newLength > capacity) {
     
    218218        }
    219219      }
    220       storage = (ValueImp **)fastRealloc(storage, newCapacity * sizeof (ValueImp *));
    221       memset(storage + capacity, 0, sizeof(ValueImp *) * (newCapacity - capacity));
     220      storage = (JSValue **)fastRealloc(storage, newCapacity * sizeof (JSValue *));
     221      memset(storage + capacity, 0, sizeof(JSValue *) * (newCapacity - capacity));
    222222      capacity = newCapacity;
    223223    }
     
    225225}
    226226
    227 void ArrayInstanceImp::setLength(unsigned newLength, ExecState *exec)
     227void ArrayInstance::setLength(unsigned newLength, ExecState *exec)
    228228{
    229229  if (newLength <= storageLength) {
     
    250250}
    251251
    252 void ArrayInstanceImp::mark()
    253 {
    254   ObjectImp::mark();
     252void ArrayInstance::mark()
     253{
     254  JSObject::mark();
    255255  unsigned l = storageLength;
    256256  for (unsigned i = 0; i < l; ++i) {
    257     ValueImp *imp = storage[i];
     257    JSValue *imp = storage[i];
    258258    if (imp && !imp->marked())
    259259      imp->mark();
     
    266266{
    267267    ExecState *exec = execForCompareByStringForQSort;
    268     ValueImp *va = *(ValueImp **)a;
    269     ValueImp *vb = *(ValueImp **)b;
     268    JSValue *va = *(JSValue **)a;
     269    JSValue *vb = *(JSValue **)b;
    270270    if (va->isUndefined()) {
    271271        return vb->isUndefined() ? 0 : 1;
     
    277277}
    278278
    279 void ArrayInstanceImp::sort(ExecState *exec)
     279void ArrayInstance::sort(ExecState *exec)
    280280{
    281281    int lengthNotIncludingUndefined = pushUndefinedObjectsToEnd(exec);
    282282   
    283283    execForCompareByStringForQSort = exec;
    284     qsort(storage, lengthNotIncludingUndefined, sizeof(ValueImp *), compareByStringForQSort);
     284    qsort(storage, lengthNotIncludingUndefined, sizeof(JSValue *), compareByStringForQSort);
    285285    execForCompareByStringForQSort = 0;
    286286}
    287287
    288288struct CompareWithCompareFunctionArguments {
    289     CompareWithCompareFunctionArguments(ExecState *e, ObjectImp *cf)
     289    CompareWithCompareFunctionArguments(ExecState *e, JSObject *cf)
    290290        : exec(e)
    291291        , compareFunction(cf)
     
    297297
    298298    ExecState *exec;
    299     ObjectImp *compareFunction;
     299    JSObject *compareFunction;
    300300    List arguments;
    301     ObjectImp *globalObject;
     301    JSObject *globalObject;
    302302};
    303303
     
    308308    CompareWithCompareFunctionArguments *args = compareWithCompareFunctionArguments;
    309309
    310     ValueImp *va = *(ValueImp **)a;
    311     ValueImp *vb = *(ValueImp **)b;
     310    JSValue *va = *(JSValue **)a;
     311    JSValue *vb = *(JSValue **)b;
    312312    if (va->isUndefined()) {
    313313        return vb->isUndefined() ? 0 : 1;
     
    325325}
    326326
    327 void ArrayInstanceImp::sort(ExecState *exec, ObjectImp *compareFunction)
     327void ArrayInstance::sort(ExecState *exec, JSObject *compareFunction)
    328328{
    329329    int lengthNotIncludingUndefined = pushUndefinedObjectsToEnd(exec);
     
    331331    CompareWithCompareFunctionArguments args(exec, compareFunction);
    332332    compareWithCompareFunctionArguments = &args;
    333     qsort(storage, lengthNotIncludingUndefined, sizeof(ValueImp *), compareWithCompareFunctionForQSort);
     333    qsort(storage, lengthNotIncludingUndefined, sizeof(JSValue *), compareWithCompareFunctionForQSort);
    334334    compareWithCompareFunctionArguments = 0;
    335335}
    336336
    337 unsigned ArrayInstanceImp::pushUndefinedObjectsToEnd(ExecState *exec)
    338 {
    339     ValueImp *undefined = jsUndefined();
     337unsigned ArrayInstance::pushUndefinedObjectsToEnd(ExecState *exec)
     338{
     339    JSValue *undefined = jsUndefined();
    340340
    341341    unsigned o = 0;
    342342   
    343343    for (unsigned i = 0; i != storageLength; ++i) {
    344         ValueImp *v = storage[i];
     344        JSValue *v = storage[i];
    345345        if (v && v != undefined) {
    346346            if (o != i)
     
    362362      Reference ref = it++;
    363363      storage[o] = ref.getValue(exec);
    364       ObjectImp::deleteProperty(exec, ref.getPropertyName(exec));
     364      JSObject::deleteProperty(exec, ref.getPropertyName(exec));
    365365      o++;
    366366    }
    367367   
    368368    if (newLength != storageLength)
    369         memset(storage + o, 0, sizeof(ValueImp *) * (storageLength - o));
     369        memset(storage + o, 0, sizeof(JSValue *) * (storageLength - o));
    370370   
    371371    return o;
    372372}
    373373
    374 // ------------------------------ ArrayPrototypeImp ----------------------------
    375 
    376 const ClassInfo ArrayPrototypeImp::info = {"Array", &ArrayInstanceImp::info, &arrayTable, 0};
     374// ------------------------------ ArrayPrototype ----------------------------
     375
     376const ClassInfo ArrayPrototype::info = {"Array", &ArrayInstance::info, &arrayTable, 0};
    377377
    378378/* Source for array_object.lut.h
    379379@begin arrayTable 16
    380   toString       ArrayProtoFuncImp::ToString       DontEnum|Function 0
    381   toLocaleString ArrayProtoFuncImp::ToLocaleString DontEnum|Function 0
    382   concat         ArrayProtoFuncImp::Concat         DontEnum|Function 1
    383   join           ArrayProtoFuncImp::Join           DontEnum|Function 1
    384   pop            ArrayProtoFuncImp::Pop            DontEnum|Function 0
    385   push           ArrayProtoFuncImp::Push           DontEnum|Function 1
    386   reverse        ArrayProtoFuncImp::Reverse        DontEnum|Function 0
    387   shift          ArrayProtoFuncImp::Shift          DontEnum|Function 0
    388   slice          ArrayProtoFuncImp::Slice          DontEnum|Function 2
    389   sort           ArrayProtoFuncImp::Sort           DontEnum|Function 1
    390   splice         ArrayProtoFuncImp::Splice         DontEnum|Function 2
    391   unshift        ArrayProtoFuncImp::UnShift        DontEnum|Function 1
    392   every          ArrayProtoFuncImp::Every          DontEnum|Function 5
    393   forEach        ArrayProtoFuncImp::ForEach        DontEnum|Function 5
    394   some           ArrayProtoFuncImp::Some           DontEnum|Function 5
     380  toString       ArrayProtoFunc::ToString       DontEnum|Function 0
     381  toLocaleString ArrayProtoFunc::ToLocaleString DontEnum|Function 0
     382  concat         ArrayProtoFunc::Concat         DontEnum|Function 1
     383  join           ArrayProtoFunc::Join           DontEnum|Function 1
     384  pop            ArrayProtoFunc::Pop            DontEnum|Function 0
     385  push           ArrayProtoFunc::Push           DontEnum|Function 1
     386  reverse        ArrayProtoFunc::Reverse        DontEnum|Function 0
     387  shift          ArrayProtoFunc::Shift          DontEnum|Function 0
     388  slice          ArrayProtoFunc::Slice          DontEnum|Function 2
     389  sort           ArrayProtoFunc::Sort           DontEnum|Function 1
     390  splice         ArrayProtoFunc::Splice         DontEnum|Function 2
     391  unshift        ArrayProtoFunc::UnShift        DontEnum|Function 1
     392  every          ArrayProtoFunc::Every          DontEnum|Function 5
     393  forEach        ArrayProtoFunc::ForEach        DontEnum|Function 5
     394  some           ArrayProtoFunc::Some           DontEnum|Function 5
    395395@end
    396396*/
    397397
    398398// ECMA 15.4.4
    399 ArrayPrototypeImp::ArrayPrototypeImp(ExecState *exec,
    400                                      ObjectPrototypeImp *objProto)
    401   : ArrayInstanceImp(objProto, 0)
     399ArrayPrototype::ArrayPrototype(ExecState *exec,
     400                                     ObjectPrototype *objProto)
     401  : ArrayInstance(objProto, 0)
    402402{
    403403  setInternalValue(jsNull());
    404404}
    405405
    406 bool ArrayPrototypeImp::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
    407 {
    408   return getStaticFunctionSlot<ArrayProtoFuncImp, ArrayInstanceImp>(exec, &arrayTable, this, propertyName, slot);
    409 }
    410 
    411 // ------------------------------ ArrayProtoFuncImp ----------------------------
    412 
    413 ArrayProtoFuncImp::ArrayProtoFuncImp(ExecState *exec, int i, int len)
     406bool ArrayPrototype::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
     407{
     408  return getStaticFunctionSlot<ArrayProtoFunc, ArrayInstance>(exec, &arrayTable, this, propertyName, slot);
     409}
     410
     411// ------------------------------ ArrayProtoFunc ----------------------------
     412
     413ArrayProtoFunc::ArrayProtoFunc(ExecState *exec, int i, int len)
    414414  : InternalFunctionImp(
    415     static_cast<FunctionPrototypeImp*>(exec->lexicalInterpreter()->builtinFunctionPrototype())
     415    static_cast<FunctionPrototype*>(exec->lexicalInterpreter()->builtinFunctionPrototype())
    416416    ), id(i)
    417417{
     
    419419}
    420420
    421 bool ArrayProtoFuncImp::implementsCall() const
     421bool ArrayProtoFunc::implementsCall() const
    422422{
    423423  return true;
    424424}
    425425
    426 static ValueImp *getProperty(ExecState *exec, ObjectImp *obj, unsigned index)
     426static JSValue *getProperty(ExecState *exec, JSObject *obj, unsigned index)
    427427{
    428428    PropertySlot slot;
     
    433433
    434434// ECMA 15.4.4
    435 ValueImp *ArrayProtoFuncImp::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
     435JSValue *ArrayProtoFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const List &args)
    436436{
    437437  unsigned length = thisObj->get(exec,lengthPropertyName)->toUInt32(exec);
    438438
    439   ValueImp *result = 0; // work around gcc 4.0 bug in uninitialized variable warning
     439  JSValue *result = 0; // work around gcc 4.0 bug in uninitialized variable warning
    440440 
    441441  switch (id) {
     
    443443  case ToString:
    444444
    445     if (!thisObj->inherits(&ArrayInstanceImp::info))
     445    if (!thisObj->inherits(&ArrayInstance::info))
    446446      return throwError(exec, TypeError);
    447447
    448448    // fall through
    449449  case Join: {
    450     static HashSet< ObjectImp*, PointerHash<ObjectImp*> > visitedElems;
     450    static HashSet< JSObject*, PointerHash<JSObject*> > visitedElems;
    451451    if (visitedElems.contains(thisObj))
    452452      return jsString("");
     
    461461        str += separator;
    462462     
    463       ValueImp *element = thisObj->get(exec, k);
     463      JSValue *element = thisObj->get(exec, k);
    464464      if (element->isUndefinedOrNull())
    465465        continue;
     
    467467      bool fallback = false;
    468468      if (id == ToLocaleString) {
    469         ObjectImp *o = element->toObject(exec);
    470         ValueImp *conversionFunction = o->get(exec, toLocaleStringPropertyName);
    471         if (conversionFunction->isObject() && static_cast<ObjectImp *>(conversionFunction)->implementsCall()) {
    472           str += static_cast<ObjectImp *>(conversionFunction)->call(exec, o, List())->toString(exec);
     469        JSObject *o = element->toObject(exec);
     470        JSValue *conversionFunction = o->get(exec, toLocaleStringPropertyName);
     471        if (conversionFunction->isObject() && static_cast<JSObject *>(conversionFunction)->implementsCall()) {
     472          str += static_cast<JSObject *>(conversionFunction)->call(exec, o, List())->toString(exec);
    473473        } else {
    474474          // try toString() fallback
     
    479479      if (id == ToString || id == Join || fallback) {
    480480        if (element->isObject()) {
    481           ObjectImp *o = static_cast<ObjectImp *>(element);
    482           ValueImp *conversionFunction = o->get(exec, toStringPropertyName);
    483           if (conversionFunction->isObject() && static_cast<ObjectImp *>(conversionFunction)->implementsCall()) {
    484             str += static_cast<ObjectImp *>(conversionFunction)->call(exec, o, List())->toString(exec);
     481          JSObject *o = static_cast<JSObject *>(element);
     482          JSValue *conversionFunction = o->get(exec, toStringPropertyName);
     483          if (conversionFunction->isObject() && static_cast<JSObject *>(conversionFunction)->implementsCall()) {
     484            str += static_cast<JSObject *>(conversionFunction)->call(exec, o, List())->toString(exec);
    485485          } else {
    486486            return throwError(exec, RangeError, "Can't convert " + o->className() + " object to string");
     
    499499  }
    500500  case Concat: {
    501     ObjectImp *arr = static_cast<ObjectImp *>(exec->lexicalInterpreter()->builtinArray()->construct(exec,List::empty()));
     501    JSObject *arr = static_cast<JSObject *>(exec->lexicalInterpreter()->builtinArray()->construct(exec,List::empty()));
    502502    int n = 0;
    503     ValueImp *curArg = thisObj;
    504     ObjectImp *curObj = static_cast<ObjectImp *>(thisObj);
     503    JSValue *curArg = thisObj;
     504    JSObject *curObj = static_cast<JSObject *>(thisObj);
    505505    ListIterator it = args.begin();
    506506    for (;;) {
    507507      if (curArg->isObject() &&
    508           curObj->inherits(&ArrayInstanceImp::info)) {
     508          curObj->inherits(&ArrayInstance::info)) {
    509509        unsigned int k = 0;
    510510        // Older versions tried to optimize out getting the length of thisObj
     
    512512        length = curObj->get(exec,lengthPropertyName)->toUInt32(exec);
    513513        while (k < length) {
    514           if (ValueImp *v = getProperty(exec, curObj, k))
     514          if (JSValue *v = getProperty(exec, curObj, k))
    515515            arr->put(exec, n, v);
    516516          n++;
     
    524524        break;
    525525      curArg = *it;
    526       curObj = static_cast<ObjectImp *>(it++); // may be 0
     526      curObj = static_cast<JSObject *>(it++); // may be 0
    527527    }
    528528    arr->put(exec,lengthPropertyName, jsNumber(n), DontEnum | DontDelete);
     
    555555    for (unsigned int k = 0; k < middle; k++) {
    556556      unsigned lk1 = length - k - 1;
    557       ValueImp *obj2 = getProperty(exec, thisObj, lk1);
    558       ValueImp *obj = getProperty(exec, thisObj, k);
     557      JSValue *obj2 = getProperty(exec, thisObj, lk1);
     558      JSValue *obj = getProperty(exec, thisObj, k);
    559559
    560560      if (obj2)
     
    578578      result = thisObj->get(exec, 0);
    579579      for(unsigned int k = 1; k < length; k++) {
    580         if (ValueImp *obj = getProperty(exec, thisObj, k))
     580        if (JSValue *obj = getProperty(exec, thisObj, k))
    581581          thisObj->put(exec, k-1, obj);
    582582        else
     
    592592
    593593    // We return a new array
    594     ObjectImp *resObj = static_cast<ObjectImp *>(exec->lexicalInterpreter()->builtinArray()->construct(exec,List::empty()));
     594    JSObject *resObj = static_cast<JSObject *>(exec->lexicalInterpreter()->builtinArray()->construct(exec,List::empty()));
    595595    result = resObj;
    596596    double begin = 0;
     
    624624    int e = static_cast<int>(end);
    625625    for(int k = b; k < e; k++, n++) {
    626       if (ValueImp *v = getProperty(exec, thisObj, k))
     626      if (JSValue *v = getProperty(exec, thisObj, k))
    627627        resObj->put(exec, n, v);
    628628    }
     
    636636      printf("KJS Array::Sort: %d: %s\n", i, thisObj->get(exec, i)->toString(exec).ascii() );
    637637#endif
    638     ObjectImp *sortFunction = NULL;
     638    JSObject *sortFunction = NULL;
    639639    if (!args[0]->isUndefined())
    640640      {
     
    644644      }
    645645   
    646     if (thisObj->classInfo() == &ArrayInstanceImp::info) {
     646    if (thisObj->classInfo() == &ArrayInstance::info) {
    647647      if (sortFunction)
    648         ((ArrayInstanceImp *)thisObj)->sort(exec, sortFunction);
     648        ((ArrayInstance *)thisObj)->sort(exec, sortFunction);
    649649      else
    650         ((ArrayInstanceImp *)thisObj)->sort(exec);
     650        ((ArrayInstance *)thisObj)->sort(exec);
    651651      result = thisObj;
    652652      break;
     
    663663    for ( unsigned int i = 0 ; i<length-1 ; ++i )
    664664      {
    665         ValueImp *iObj = thisObj->get(exec,i);
     665        JSValue *iObj = thisObj->get(exec,i);
    666666        unsigned int themin = i;
    667         ValueImp *minObj = iObj;
     667        JSValue *minObj = iObj;
    668668        for ( unsigned int j = i+1 ; j<length ; ++j )
    669669          {
    670             ValueImp *jObj = thisObj->get(exec,j);
     670            JSValue *jObj = thisObj->get(exec,j);
    671671            double cmp;
    672672            if (jObj->isUndefined()) {
     
    706706  case Splice: {
    707707    // 15.4.4.12 - oh boy this is huge
    708     ObjectImp *resObj = static_cast<ObjectImp *>(exec->lexicalInterpreter()->builtinArray()->construct(exec,List::empty()));
     708    JSObject *resObj = static_cast<JSObject *>(exec->lexicalInterpreter()->builtinArray()->construct(exec,List::empty()));
    709709    result = resObj;
    710710    int begin = args[0]->toUInt32(exec);
     
    717717    //printf( "Splicing from %d, deleteCount=%d \n", begin, deleteCount );
    718718    for(unsigned int k = 0; k < deleteCount; k++) {
    719       if (ValueImp *v = getProperty(exec, thisObj, k+begin))
     719      if (JSValue *v = getProperty(exec, thisObj, k+begin))
    720720        resObj->put(exec, k, v);
    721721    }
     
    729729        for ( unsigned int k = begin; k < length - deleteCount; ++k )
    730730        {
    731           if (ValueImp *v = getProperty(exec, thisObj, k+deleteCount))
     731          if (JSValue *v = getProperty(exec, thisObj, k+deleteCount))
    732732            thisObj->put(exec, k+additionalArgs, v);
    733733          else
     
    741741        for ( unsigned int k = length - deleteCount; (int)k > begin; --k )
    742742        {
    743           if (ValueImp *obj = getProperty(exec, thisObj, k + deleteCount - 1))
     743          if (JSValue *obj = getProperty(exec, thisObj, k + deleteCount - 1))
    744744            thisObj->put(exec, k + additionalArgs - 1, obj);
    745745          else
     
    759759    for ( unsigned int k = length; k > 0; --k )
    760760    {
    761       if (ValueImp *v = getProperty(exec, thisObj, k - 1))
     761      if (JSValue *v = getProperty(exec, thisObj, k - 1))
    762762        thisObj->put(exec, k+nrArgs-1, v);
    763763      else
     
    778778    //http://developer-test.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Array:some
    779779   
    780     ObjectImp *eachFunction = args[0]->toObject(exec);
     780    JSObject *eachFunction = args[0]->toObject(exec);
    781781   
    782782    if (!eachFunction->implementsCall())
    783783      return throwError(exec, TypeError);
    784784   
    785     ObjectImp *applyThis = args[1]->isUndefinedOrNull() ? exec->dynamicInterpreter()->globalObject() :  args[1]->toObject(exec);
     785    JSObject *applyThis = args[1]->isUndefinedOrNull() ? exec->dynamicInterpreter()->globalObject() :  args[1]->toObject(exec);
    786786   
    787787    if (id == Some || id == Every)
     
    823823
    824824ArrayObjectImp::ArrayObjectImp(ExecState *exec,
    825                                FunctionPrototypeImp *funcProto,
    826                                ArrayPrototypeImp *arrayProto)
     825                               FunctionPrototype *funcProto,
     826                               ArrayPrototype *arrayProto)
    827827  : InternalFunctionImp(funcProto)
    828828{
     
    840840
    841841// ECMA 15.4.2
    842 ObjectImp *ArrayObjectImp::construct(ExecState *exec, const List &args)
     842JSObject *ArrayObjectImp::construct(ExecState *exec, const List &args)
    843843{
    844844  // a single numeric argument denotes the array size (!)
     
    847847    if (n != args[0]->toNumber(exec))
    848848      return throwError(exec, RangeError, "Array size is not a small enough positive integer.");
    849     return new ArrayInstanceImp(exec->lexicalInterpreter()->builtinArrayPrototype(), n);
     849    return new ArrayInstance(exec->lexicalInterpreter()->builtinArrayPrototype(), n);
    850850  }
    851851
    852852  // otherwise the array is constructed with the arguments in it
    853   return new ArrayInstanceImp(exec->lexicalInterpreter()->builtinArrayPrototype(), args);
     853  return new ArrayInstance(exec->lexicalInterpreter()->builtinArrayPrototype(), args);
    854854}
    855855
     
    860860
    861861// ECMA 15.6.1
    862 ValueImp *ArrayObjectImp::callAsFunction(ExecState *exec, ObjectImp */*thisObj*/, const List &args)
     862JSValue *ArrayObjectImp::callAsFunction(ExecState *exec, JSObject */*thisObj*/, const List &args)
    863863{
    864864  // equivalent to 'new Array(....)'
Note: See TracChangeset for help on using the changeset viewer.