Changeset 1823 in webkit for trunk/JavaScriptCore/kjs/array_object.cpp
- Timestamp:
- Aug 14, 2002, 9:32:46 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/array_object.cpp
r1822 r1823 52 52 , length(list.size()) 53 53 , capacity(length) 54 , storage(length ? new (ValueImp *)[length]: 0)54 , storage(length ? (ValueImp **)malloc(sizeof(ValueImp *) * length) : 0) 55 55 { 56 56 ListIterator it = list.begin(); 57 constunsigned l = length;57 unsigned l = length; 58 58 for (unsigned i = 0; i < l; ++i) { 59 59 storage[i] = (it++).imp(); … … 63 63 ArrayInstanceImp::~ArrayInstanceImp() 64 64 { 65 free 65 free(storage); 66 66 } 67 67 … … 74 74 unsigned index = propertyName.toULong(&ok); 75 75 if (ok) { 76 if (index >= length || storage[index] == NULL)76 if (index >= length) 77 77 return Undefined(); 78 return Value(storage[index]); 78 ValueImp *v = storage[index]; 79 return v ? Value(v) : Undefined(); 79 80 } 80 81 … … 84 85 Value ArrayInstanceImp::get(ExecState *exec, unsigned index) const 85 86 { 86 if (index >= length || storage[index] == NULL)87 if (index >= length) 87 88 return Undefined(); 88 return Value(storage[index]); 89 ValueImp *v = storage[index]; 90 return v ? Value(v) : Undefined(); 89 91 } 90 92 … … 124 126 if (index >= length) 125 127 return false; 126 return storage[index] != NULL && storage[index]->type() != UndefinedType; 128 ValueImp *v = storage[index]; 129 return v && v != UndefinedImp::staticUndefined; 127 130 } 128 131 … … 134 137 if (index >= length) 135 138 return false; 136 return storage[index] != NULL && storage[index]->type() != UndefinedType; 139 ValueImp *v = storage[index]; 140 return v && v != UndefinedImp::staticUndefined; 137 141 } 138 142 … … 147 151 if (index >= length) 148 152 return true; 149 storage[index] = NULL;153 storage[index] = 0; 150 154 return true; 151 155 } … … 158 162 if (index >= length) 159 163 return true; 160 storage[index] = NULL;164 storage[index] = 0; 161 165 return true; 162 166 } … … 179 183 { 180 184 ObjectImp::mark(); 181 constunsigned l = length;185 unsigned l = length; 182 186 for (unsigned i = 0; i < l; ++i) { 183 187 ValueImp *imp = storage[i]; 184 if (imp != NULL&& !imp->marked())188 if (imp && !imp->marked()) 185 189 imp->mark(); 186 190 }
Note:
See TracChangeset
for help on using the changeset viewer.