Changeset 36804 in webkit for trunk/JavaScriptCore/kjs/Arguments.cpp
- Timestamp:
- Sep 23, 2008, 3:59:42 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/Arguments.cpp
r36793 r36804 39 39 40 40 struct ArgumentsData : Noncopyable { 41 ArgumentsData(JSActivation* activation, unsigned numParameters, unsigned firstArgumentIndex, unsigned numArguments )41 ArgumentsData(JSActivation* activation, unsigned numParameters, unsigned firstArgumentIndex, unsigned numArguments, JSFunction* callee) 42 42 : activation(activation) 43 43 , numParameters(numParameters) … … 45 45 , numArguments(numArguments) 46 46 , extraArguments(0) 47 , callee(callee) 48 , overrodeLength(false) 49 , overrodeCallee(false) 47 50 { 48 51 } 49 52 50 53 JSActivation* activation; 54 51 55 unsigned numParameters; 52 56 unsigned firstArgumentIndex; … … 55 59 OwnArrayPtr<bool> deletedArguments; 56 60 Register extraArgumentsFixedBuffer[4]; 61 62 JSFunction* callee; 63 bool overrodeLength : 1; 64 bool overrodeCallee : 1; 57 65 }; 58 66 … … 60 68 Arguments::Arguments(ExecState* exec, JSFunction* function, JSActivation* activation, int firstArgumentIndex, Register* argv, int argc) 61 69 : JSObject(exec->lexicalGlobalObject()->argumentsStructure()) 62 , d(new ArgumentsData(activation, function->numParameters(), firstArgumentIndex, argc ))70 , d(new ArgumentsData(activation, function->numParameters(), firstArgumentIndex, argc, function)) 63 71 { 64 72 ASSERT(activation); 65 66 putDirect(exec->propertyNames().callee, function, DontEnum);67 putDirect(exec->propertyNames().length, jsNumber(exec, argc), DontEnum);68 73 69 74 if (d->numArguments > d->numParameters) { … … 98 103 } 99 104 105 if (!d->callee->marked()) 106 d->callee->mark(); 107 100 108 if (!d->activation->marked()) 101 109 d->activation->mark(); … … 165 173 } 166 174 175 if (propertyName == exec->propertyNames().length && LIKELY(!d->overrodeLength)) { 176 slot.setValue(jsNumber(exec, d->numArguments)); 177 return true; 178 } 179 180 if (propertyName == exec->propertyNames().callee && LIKELY(!d->overrodeCallee)) { 181 slot.setValue(d->callee); 182 return true; 183 } 184 167 185 return JSObject::getOwnPropertySlot(exec, propertyName, slot); 168 186 } … … 190 208 else 191 209 d->extraArguments[i - d->numParameters] = value; 210 return; 211 } 212 213 if (propertyName == exec->propertyNames().length && !d->overrodeLength) { 214 d->overrodeLength = true; 215 putDirect(propertyName, value, DontEnum); 216 return; 217 } 218 219 if (propertyName == exec->propertyNames().callee && !d->overrodeCallee) { 220 d->overrodeCallee = true; 221 putDirect(propertyName, value, DontEnum); 192 222 return; 193 223 } … … 227 257 } 228 258 259 if (propertyName == exec->propertyNames().length && !d->overrodeLength) { 260 d->overrodeLength = true; 261 return true; 262 } 263 264 if (propertyName == exec->propertyNames().callee && !d->overrodeCallee) { 265 d->overrodeCallee = true; 266 return true; 267 } 268 229 269 return JSObject::deleteProperty(exec, propertyName); 230 270 }
Note:
See TracChangeset
for help on using the changeset viewer.