OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 // r0: actual number of argument | 263 // r0: actual number of argument |
264 { Label done; | 264 { Label done; |
265 __ tst(r0, Operand(r0)); | 265 __ tst(r0, Operand(r0)); |
266 __ b(ne, &done); | 266 __ b(ne, &done); |
267 __ mov(r2, Operand(Factory::undefined_value())); | 267 __ mov(r2, Operand(Factory::undefined_value())); |
268 __ push(r2); | 268 __ push(r2); |
269 __ add(r0, r0, Operand(1)); | 269 __ add(r0, r0, Operand(1)); |
270 __ bind(&done); | 270 __ bind(&done); |
271 } | 271 } |
272 | 272 |
273 // 2. Get the function to call. Already in r1. | 273 // 2. Get the function to call from the stack. |
274 // r0: actual number of argument | 274 // r0: actual number of argument |
275 { Label done, non_function, function; | 275 { Label done, non_function, function; |
276 __ ldr(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); | 276 __ ldr(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); |
277 __ tst(r1, Operand(kSmiTagMask)); | 277 __ tst(r1, Operand(kSmiTagMask)); |
278 __ b(eq, &non_function); | 278 __ b(eq, &non_function); |
279 __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); | 279 __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); |
280 __ ldrb(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset)); | 280 __ ldrb(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset)); |
281 __ cmp(r2, Operand(JS_FUNCTION_TYPE)); | 281 __ cmp(r2, Operand(JS_FUNCTION_TYPE)); |
282 __ b(eq, &function); | 282 __ b(eq, &function); |
283 | 283 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 | 353 |
354 __ bind(&done); | 354 __ bind(&done); |
355 } | 355 } |
356 | 356 |
357 // 4. Shift stuff one slot down the stack | 357 // 4. Shift stuff one slot down the stack |
358 // r0: actual number of arguments (including call() receiver) | 358 // r0: actual number of arguments (including call() receiver) |
359 // r1: function | 359 // r1: function |
360 { Label loop; | 360 { Label loop; |
361 // Calculate the copy start address (destination). Copy end address is sp. | 361 // Calculate the copy start address (destination). Copy end address is sp. |
362 __ add(r2, sp, Operand(r0, LSL, kPointerSizeLog2)); | 362 __ add(r2, sp, Operand(r0, LSL, kPointerSizeLog2)); |
| 363 __ add(r2, r2, Operand(kPointerSize)); // copy receiver too |
363 | 364 |
364 __ bind(&loop); | 365 __ bind(&loop); |
365 __ ldr(ip, MemOperand(r2, -kPointerSize)); | 366 __ ldr(ip, MemOperand(r2, -kPointerSize)); |
366 __ str(ip, MemOperand(r2)); | 367 __ str(ip, MemOperand(r2)); |
367 __ sub(r2, r2, Operand(kPointerSize)); | 368 __ sub(r2, r2, Operand(kPointerSize)); |
368 __ cmp(r2, sp); | 369 __ cmp(r2, sp); |
369 __ b(ne, &loop); | 370 __ b(ne, &loop); |
370 } | 371 } |
371 | 372 |
372 // 5. Adjust the actual number of arguments and remove the top element. | 373 // 5. Adjust the actual number of arguments and remove the top element. |
373 // r0: actual number of arguments (including call() receiver) | 374 // r0: actual number of arguments (including call() receiver) |
374 // r1: function | 375 // r1: function |
375 __ sub(r0, r0, Operand(1)); | 376 __ sub(r0, r0, Operand(1)); |
376 __ add(sp, sp, Operand(kPointerSize)); | 377 __ add(sp, sp, Operand(kPointerSize)); |
377 | 378 |
378 // 6. Get the code for the function or the non-function builtin. | 379 // 6. Get the code for the function or the non-function builtin. |
379 // If number of expected arguments matches, then call. Otherwise restart | 380 // If number of expected arguments matches, then call. Otherwise restart |
380 // the arguments adaptor stub. | 381 // the arguments adaptor stub. |
381 // r0: actual number of arguments | 382 // r0: actual number of arguments |
382 // r1: function | 383 // r1: function |
383 { Label invoke; | 384 { Label invoke; |
384 __ tst(r1, r1); | 385 __ tst(r1, r1); |
385 __ b(ne, &invoke); | 386 __ b(ne, &invoke); |
386 // __ stop("Generate_ArgumentsAdaptorTrampoline - non-function call"); | |
387 __ mov(r2, Operand(0)); // expected arguments is 0 for CALL_NON_FUNCTION | 387 __ mov(r2, Operand(0)); // expected arguments is 0 for CALL_NON_FUNCTION |
388 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); | 388 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); |
389 __ Jump(Handle<Code>(builtin(ArgumentsAdaptorTrampoline)), code_target); | 389 __ Jump(Handle<Code>(builtin(ArgumentsAdaptorTrampoline)), code_target); |
390 | 390 |
391 __ bind(&invoke); | 391 __ bind(&invoke); |
392 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 392 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
393 __ ldr(r2, | 393 __ ldr(r2, |
394 FieldMemOperand(r3, | 394 FieldMemOperand(r3, |
395 SharedFunctionInfo::kFormalParameterCountOffset)); | 395 SharedFunctionInfo::kFormalParameterCountOffset)); |
396 __ ldr(r3, | 396 __ ldr(r3, |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 } | 828 } |
829 | 829 |
830 void Builtins::Generate_StubNoRegisters_DebugBreak(MacroAssembler* masm) { | 830 void Builtins::Generate_StubNoRegisters_DebugBreak(MacroAssembler* masm) { |
831 // Generate nothing as CodeStub CallFunction is not used on ARM. | 831 // Generate nothing as CodeStub CallFunction is not used on ARM. |
832 } | 832 } |
833 | 833 |
834 | 834 |
835 #undef __ | 835 #undef __ |
836 | 836 |
837 } } // namespace v8::internal | 837 } } // namespace v8::internal |
OLD | NEW |