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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 } | 400 } |
401 | 401 |
402 | 402 |
403 void CallIC::Generate(MacroAssembler* masm, | 403 void CallIC::Generate(MacroAssembler* masm, |
404 int argc, | 404 int argc, |
405 const ExternalReference& f) { | 405 const ExternalReference& f) { |
406 // ----------- S t a t e ------------- | 406 // ----------- S t a t e ------------- |
407 // -- lr: return address | 407 // -- lr: return address |
408 // ----------------------------------- | 408 // ----------------------------------- |
409 | 409 |
410 // Setup number of arguments for EnterJSFrame. | 410 // Get the receiver of the function from the stack. |
411 __ mov(r0, Operand(argc)); | 411 __ ldr(r2, MemOperand(sp, argc * kPointerSize)); |
412 // Get the receiver of the function from the stack into r1. | 412 // Get the name of the function to call from the stack. |
413 __ ldr(r1, MemOperand(sp, argc * kPointerSize)); | 413 __ ldr(r1, MemOperand(sp, (argc + 1) * kPointerSize)); |
414 __ EnterJSFrame(0); | 414 |
415 __ pop(); // remove the code slot | 415 __ EnterInternalFrame(); |
416 | 416 |
417 // Push the receiver and the name of the function. | 417 // Push the receiver and the name of the function. |
418 __ ldr(r0, MemOperand(pp, 0)); | 418 __ stm(db_w, sp, r1.bit() | r2.bit()); |
419 __ mov(r2, Operand(0)); // code slot == 0 | |
420 __ stm(db_w, sp, r0.bit() | r1.bit() | r2.bit()); | |
421 | 419 |
422 // Call the entry. | 420 // Call the entry. |
423 __ mov(r0, Operand(2)); | 421 __ mov(r0, Operand(2)); |
424 __ mov(r1, Operand(f)); | 422 __ mov(r1, Operand(f)); |
425 | 423 |
426 CEntryStub stub; | 424 CEntryStub stub; |
427 __ CallStub(&stub); | 425 __ CallStub(&stub); |
428 | 426 |
429 // Move result to r1. | 427 // Move result to r1. |
430 __ mov(r1, Operand(r0)); | 428 __ mov(r1, Operand(r0)); |
431 | 429 |
432 __ ExitJSFrame(DO_NOT_RETURN); | 430 __ ExitInternalFrame(); |
433 | 431 |
434 // Patch the function on the stack; 1 ~ receiver. | 432 // Patch the function on the stack; 1 ~ receiver. |
435 __ str(r1, MemOperand(sp, (argc + 1) * kPointerSize)); | 433 __ str(r1, MemOperand(sp, (argc + 1) * kPointerSize)); |
436 | 434 |
437 // Invoke the function. | 435 // Invoke the function. |
438 ParameterCount actual(argc); | 436 ParameterCount actual(argc); |
439 __ InvokeFunction(r1, actual, JUMP_FUNCTION); | 437 __ InvokeFunction(r1, actual, JUMP_FUNCTION); |
440 } | 438 } |
441 | 439 |
442 | 440 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 | 573 |
576 // Perform tail call to the entry. | 574 // Perform tail call to the entry. |
577 __ TailCallRuntime(f, 3); | 575 __ TailCallRuntime(f, 3); |
578 } | 576 } |
579 | 577 |
580 | 578 |
581 #undef __ | 579 #undef __ |
582 | 580 |
583 | 581 |
584 } } // namespace v8::internal | 582 } } // namespace v8::internal |
OLD | NEW |