Changeset 160244 in webkit for trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
- Timestamp:
- Dec 6, 2013, 1:38:26 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r160186 r160244 153 153 } 154 154 155 CallFrame* loadVarargs(CallFrame* callFrame, JSStack* stack, JSValue thisValue, JSValue arguments, int firstFreeRegister)155 CallFrame* sizeAndAllocFrameForVarargs(CallFrame* callFrame, JSStack* stack, JSValue arguments, int firstFreeRegister) 156 156 { 157 157 if (!arguments) { // f.apply(x, arguments), with arguments unmodified. … … 162 162 return 0; 163 163 } 164 165 newCallFrame->setArgumentCountIncludingThis(argumentCountIncludingThis);166 newCallFrame->setThisValue(thisValue);167 for (size_t i = 0; i < callFrame->argumentCount(); ++i)168 newCallFrame->setArgument(i, callFrame->argumentAfterCapture(i));169 164 return newCallFrame; 170 165 } … … 176 171 return 0; 177 172 } 178 newCallFrame->setArgumentCountIncludingThis(1);179 newCallFrame->setThisValue(thisValue);180 173 return newCallFrame; 181 174 } … … 194 187 return 0; 195 188 } 196 newCallFrame->setArgumentCountIncludingThis(argCount + 1);197 newCallFrame->setThisValue(thisValue);198 argsObject->copyToArguments(callFrame, newCallFrame, argCount);199 189 return newCallFrame; 200 190 } … … 208 198 return 0; 209 199 } 210 newCallFrame->setArgumentCountIncludingThis(argCount + 1);211 newCallFrame->setThisValue(thisValue);212 array->copyToArguments(callFrame, newCallFrame, argCount);213 200 return newCallFrame; 214 201 } … … 221 208 return 0; 222 209 } 210 return newCallFrame; 211 } 212 213 void loadVarargs(CallFrame* callFrame, CallFrame* newCallFrame, JSValue thisValue, JSValue arguments) 214 { 215 if (!arguments) { // f.apply(x, arguments), with arguments unmodified. 216 unsigned argumentCountIncludingThis = callFrame->argumentCountIncludingThis(); 217 218 newCallFrame->setArgumentCountIncludingThis(argumentCountIncludingThis); 219 newCallFrame->setThisValue(thisValue); 220 for (size_t i = 0; i < callFrame->argumentCount(); ++i) 221 newCallFrame->setArgument(i, callFrame->argumentAfterCapture(i)); 222 return; 223 } 224 225 if (arguments.isUndefinedOrNull()) { 226 newCallFrame->setArgumentCountIncludingThis(1); 227 newCallFrame->setThisValue(thisValue); 228 return; 229 } 230 231 if (asObject(arguments)->classInfo() == Arguments::info()) { 232 Arguments* argsObject = asArguments(arguments); 233 unsigned argCount = argsObject->length(callFrame); 234 newCallFrame->setArgumentCountIncludingThis(argCount + 1); 235 newCallFrame->setThisValue(thisValue); 236 argsObject->copyToArguments(callFrame, newCallFrame, argCount); 237 return; 238 } 239 240 if (isJSArray(arguments)) { 241 JSArray* array = asArray(arguments); 242 unsigned argCount = array->length(); 243 newCallFrame->setArgumentCountIncludingThis(argCount + 1); 244 newCallFrame->setThisValue(thisValue); 245 array->copyToArguments(callFrame, newCallFrame, argCount); 246 return; 247 } 248 249 JSObject* argObject = asObject(arguments); 250 unsigned argCount = argObject->get(callFrame, callFrame->propertyNames().length).toUInt32(callFrame); 223 251 newCallFrame->setArgumentCountIncludingThis(argCount + 1); 224 252 newCallFrame->setThisValue(thisValue); … … 226 254 newCallFrame->setArgument(i, asObject(arguments)->get(callFrame, i)); 227 255 if (UNLIKELY(callFrame->vm().exception())) 228 return 0; 229 } 230 return newCallFrame; 256 return; 257 } 231 258 } 232 259
Note:
See TracChangeset
for help on using the changeset viewer.