Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 581 | 581 |
| 582 // --------------------------------------------------------------------------- | 582 // --------------------------------------------------------------------------- |
| 583 // Runtime calls | 583 // Runtime calls |
| 584 | 584 |
| 585 // Call a code stub. | 585 // Call a code stub. |
| 586 void CallStub(CodeStub* stub, Condition cond = al); | 586 void CallStub(CodeStub* stub, Condition cond = al); |
| 587 | 587 |
| 588 // Call a code stub. | 588 // Call a code stub. |
| 589 void TailCallStub(CodeStub* stub, Condition cond = al); | 589 void TailCallStub(CodeStub* stub, Condition cond = al); |
| 590 | 590 |
| 591 // Tail call a code stub (jump) and return the code object called. Try to | |
| 592 // generate the code if necessary. Do not perform a GC but instead return | |
| 593 // a retry after GC failure. | |
| 594 MUST_USE_RESULT MaybeObject* TryTailCallStub(CodeStub* stub, | |
| 595 Condition cond = al); | |
| 596 | |
| 591 // Call a runtime routine. | 597 // Call a runtime routine. |
| 592 void CallRuntime(Runtime::Function* f, int num_arguments); | 598 void CallRuntime(Runtime::Function* f, int num_arguments); |
| 593 void CallRuntimeSaveDoubles(Runtime::FunctionId id); | 599 void CallRuntimeSaveDoubles(Runtime::FunctionId id); |
| 594 | 600 |
| 595 // Convenience function: Same as above, but takes the fid instead. | 601 // Convenience function: Same as above, but takes the fid instead. |
| 596 void CallRuntime(Runtime::FunctionId fid, int num_arguments); | 602 void CallRuntime(Runtime::FunctionId fid, int num_arguments); |
| 597 | 603 |
| 598 // Convenience function: call an external reference. | 604 // Convenience function: call an external reference. |
| 599 void CallExternalReference(const ExternalReference& ext, | 605 void CallExternalReference(const ExternalReference& ext, |
| 600 int num_arguments); | 606 int num_arguments); |
| 601 | 607 |
| 602 // Tail call of a runtime routine (jump). | 608 // Tail call of a runtime routine (jump). |
| 603 // Like JumpToExternalReference, but also takes care of passing the number | 609 // Like JumpToExternalReference, but also takes care of passing the number |
| 604 // of parameters. | 610 // of parameters. |
| 605 void TailCallExternalReference(const ExternalReference& ext, | 611 void TailCallExternalReference(const ExternalReference& ext, |
| 606 int num_arguments, | 612 int num_arguments, |
| 607 int result_size); | 613 int result_size); |
| 608 | 614 |
| 615 // Tail call of a runtime routine (jump). Try to generate the code if | |
| 616 // necessary. Do not perform a GC but instead return a retry after GC | |
| 617 // failure. | |
| 618 MUST_USE_RESULT MaybeObject* TryTailCallExternalReference( | |
| 619 const ExternalReference& ext, int num_arguments, int result_size); | |
| 620 | |
| 609 // Convenience function: tail call a runtime routine (jump). | 621 // Convenience function: tail call a runtime routine (jump). |
| 610 void TailCallRuntime(Runtime::FunctionId fid, | 622 void TailCallRuntime(Runtime::FunctionId fid, |
| 611 int num_arguments, | 623 int num_arguments, |
| 612 int result_size); | 624 int result_size); |
| 613 | 625 |
| 614 // Before calling a C-function from generated code, align arguments on stack. | 626 // Before calling a C-function from generated code, align arguments on stack. |
| 615 // After aligning the frame, non-register arguments must be stored in | 627 // After aligning the frame, non-register arguments must be stored in |
| 616 // sp[0], sp[4], etc., not pushed. The argument count assumes all arguments | 628 // sp[0], sp[4], etc., not pushed. The argument count assumes all arguments |
| 617 // are word sized. | 629 // are word sized. |
| 618 // Some compilers/platforms require the stack to be aligned when calling | 630 // Some compilers/platforms require the stack to be aligned when calling |
| 619 // C++ code. | 631 // C++ code. |
| 620 // Needs a scratch register to do some arithmetic. This register will be | 632 // Needs a scratch register to do some arithmetic. This register will be |
| 621 // trashed. | 633 // trashed. |
| 622 void PrepareCallCFunction(int num_arguments, Register scratch); | 634 void PrepareCallCFunction(int num_arguments, Register scratch); |
| 623 | 635 |
| 624 // Calls a C function and cleans up the space for arguments allocated | 636 // Calls a C function and cleans up the space for arguments allocated |
| 625 // by PrepareCallCFunction. The called function is not allowed to trigger a | 637 // by PrepareCallCFunction. The called function is not allowed to trigger a |
| 626 // garbage collection, since that might move the code and invalidate the | 638 // garbage collection, since that might move the code and invalidate the |
| 627 // return address (unless this is somehow accounted for by the called | 639 // return address (unless this is somehow accounted for by the called |
| 628 // function). | 640 // function). |
| 629 void CallCFunction(ExternalReference function, int num_arguments); | 641 void CallCFunction(ExternalReference function, int num_arguments); |
| 630 void CallCFunction(Register function, int num_arguments); | 642 void CallCFunction(Register function, int num_arguments); |
| 631 | 643 |
| 644 // creates the Exit frame, pushes the arguments and aligns the stack | |
|
antonm
2011/01/11 14:11:33
nit: [C]reates. And you probably do not need [E]
Zaheer
2011/01/11 15:44:35
Done
| |
| 645 // for the C call. saves the fp and context in top | |
| 646 void PrepareCallApiFunction(int arg_stack_space, | |
| 647 int unwind_space, | |
| 648 Register scratch); | |
| 649 | |
| 650 // Calls an API function. Allocates HandleScope, extracts | |
| 651 // returned value from handle and propagates exceptions. | |
| 652 // Restores context. | |
| 653 MaybeObject* TryCallApiFunctionAndReturn(ApiFunction* function); | |
| 654 | |
| 632 // Jump to a runtime routine. | 655 // Jump to a runtime routine. |
| 633 void JumpToExternalReference(const ExternalReference& builtin); | 656 void JumpToExternalReference(const ExternalReference& builtin); |
| 634 | 657 |
| 658 MaybeObject* TryJumpToExternalReference(const ExternalReference& ext); | |
| 659 | |
| 635 // Invoke specified builtin JavaScript function. Adds an entry to | 660 // Invoke specified builtin JavaScript function. Adds an entry to |
| 636 // the unresolved list if the name does not resolve. | 661 // the unresolved list if the name does not resolve. |
| 637 void InvokeBuiltin(Builtins::JavaScript id, InvokeJSFlags flags); | 662 void InvokeBuiltin(Builtins::JavaScript id, InvokeJSFlags flags); |
| 638 | 663 |
| 639 // Store the code object for the given builtin in the target register and | 664 // Store the code object for the given builtin in the target register and |
| 640 // setup the function in r1. | 665 // setup the function in r1. |
| 641 void GetBuiltinEntry(Register target, Builtins::JavaScript id); | 666 void GetBuiltinEntry(Register target, Builtins::JavaScript id); |
| 642 | 667 |
| 643 // Store the function for the given builtin in the target register. | 668 // Store the function for the given builtin in the target register. |
| 644 void GetBuiltinFunction(Register target, Builtins::JavaScript id); | 669 void GetBuiltinFunction(Register target, Builtins::JavaScript id); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 820 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 845 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
| 821 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 846 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
| 822 #else | 847 #else |
| 823 #define ACCESS_MASM(masm) masm-> | 848 #define ACCESS_MASM(masm) masm-> |
| 824 #endif | 849 #endif |
| 825 | 850 |
| 826 | 851 |
| 827 } } // namespace v8::internal | 852 } } // namespace v8::internal |
| 828 | 853 |
| 829 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ | 854 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ |
| OLD | NEW |