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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 // --------------------------------------------------------------------------- | 280 // --------------------------------------------------------------------------- |
281 // Activation frames | 281 // Activation frames |
282 | 282 |
283 void EnterInternalFrame() { EnterFrame(StackFrame::INTERNAL); } | 283 void EnterInternalFrame() { EnterFrame(StackFrame::INTERNAL); } |
284 void LeaveInternalFrame() { LeaveFrame(StackFrame::INTERNAL); } | 284 void LeaveInternalFrame() { LeaveFrame(StackFrame::INTERNAL); } |
285 | 285 |
286 void EnterConstructFrame() { EnterFrame(StackFrame::CONSTRUCT); } | 286 void EnterConstructFrame() { EnterFrame(StackFrame::CONSTRUCT); } |
287 void LeaveConstructFrame() { LeaveFrame(StackFrame::CONSTRUCT); } | 287 void LeaveConstructFrame() { LeaveFrame(StackFrame::CONSTRUCT); } |
288 | 288 |
289 // Enter exit frame. | 289 // Enter exit frame. |
290 // Expects the number of arguments in register r0 and | 290 // stack_space - extra stack space, used for alignment before call to C. |
291 // the builtin function to call in register r1. Exits with argc in | 291 void EnterExitFrame(bool save_doubles, int stack_space = 0); |
292 // r4, argv in r6, and and the builtin function to call in r5. | |
293 void EnterExitFrame(bool save_doubles); | |
294 | 292 |
295 // Leave the current exit frame. Expects the return value in r0. | 293 // Leave the current exit frame. Expects the return value in r0. |
296 void LeaveExitFrame(bool save_doubles); | 294 void LeaveExitFrame(bool save_doubles); |
297 | 295 |
298 // Get the actual activation frame alignment for target environment. | 296 // Get the actual activation frame alignment for target environment. |
299 static int ActivationFrameAlignment(); | 297 static int ActivationFrameAlignment(); |
300 | 298 |
301 void LoadContext(Register dst, int context_chain_length); | 299 void LoadContext(Register dst, int context_chain_length); |
302 | 300 |
303 void LoadGlobalFunction(int index, Register function); | 301 void LoadGlobalFunction(int index, Register function); |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 | 607 |
610 // --------------------------------------------------------------------------- | 608 // --------------------------------------------------------------------------- |
611 // Runtime calls | 609 // Runtime calls |
612 | 610 |
613 // Call a code stub. | 611 // Call a code stub. |
614 void CallStub(CodeStub* stub, Condition cond = al); | 612 void CallStub(CodeStub* stub, Condition cond = al); |
615 | 613 |
616 // Call a code stub. | 614 // Call a code stub. |
617 void TailCallStub(CodeStub* stub, Condition cond = al); | 615 void TailCallStub(CodeStub* stub, Condition cond = al); |
618 | 616 |
| 617 // Tail call a code stub (jump) and return the code object called. Try to |
| 618 // generate the code if necessary. Do not perform a GC but instead return |
| 619 // a retry after GC failure. |
| 620 MUST_USE_RESULT MaybeObject* TryTailCallStub(CodeStub* stub, |
| 621 Condition cond = al); |
| 622 |
619 // Call a runtime routine. | 623 // Call a runtime routine. |
620 void CallRuntime(Runtime::Function* f, int num_arguments); | 624 void CallRuntime(Runtime::Function* f, int num_arguments); |
621 void CallRuntimeSaveDoubles(Runtime::FunctionId id); | 625 void CallRuntimeSaveDoubles(Runtime::FunctionId id); |
622 | 626 |
623 // Convenience function: Same as above, but takes the fid instead. | 627 // Convenience function: Same as above, but takes the fid instead. |
624 void CallRuntime(Runtime::FunctionId fid, int num_arguments); | 628 void CallRuntime(Runtime::FunctionId fid, int num_arguments); |
625 | 629 |
626 // Convenience function: call an external reference. | 630 // Convenience function: call an external reference. |
627 void CallExternalReference(const ExternalReference& ext, | 631 void CallExternalReference(const ExternalReference& ext, |
628 int num_arguments); | 632 int num_arguments); |
629 | 633 |
630 // Tail call of a runtime routine (jump). | 634 // Tail call of a runtime routine (jump). |
631 // Like JumpToExternalReference, but also takes care of passing the number | 635 // Like JumpToExternalReference, but also takes care of passing the number |
632 // of parameters. | 636 // of parameters. |
633 void TailCallExternalReference(const ExternalReference& ext, | 637 void TailCallExternalReference(const ExternalReference& ext, |
634 int num_arguments, | 638 int num_arguments, |
635 int result_size); | 639 int result_size); |
636 | 640 |
| 641 // Tail call of a runtime routine (jump). Try to generate the code if |
| 642 // necessary. Do not perform a GC but instead return a retry after GC |
| 643 // failure. |
| 644 MUST_USE_RESULT MaybeObject* TryTailCallExternalReference( |
| 645 const ExternalReference& ext, int num_arguments, int result_size); |
| 646 |
637 // Convenience function: tail call a runtime routine (jump). | 647 // Convenience function: tail call a runtime routine (jump). |
638 void TailCallRuntime(Runtime::FunctionId fid, | 648 void TailCallRuntime(Runtime::FunctionId fid, |
639 int num_arguments, | 649 int num_arguments, |
640 int result_size); | 650 int result_size); |
641 | 651 |
642 // Before calling a C-function from generated code, align arguments on stack. | 652 // Before calling a C-function from generated code, align arguments on stack. |
643 // After aligning the frame, non-register arguments must be stored in | 653 // After aligning the frame, non-register arguments must be stored in |
644 // sp[0], sp[4], etc., not pushed. The argument count assumes all arguments | 654 // sp[0], sp[4], etc., not pushed. The argument count assumes all arguments |
645 // are word sized. | 655 // are word sized. |
646 // Some compilers/platforms require the stack to be aligned when calling | 656 // Some compilers/platforms require the stack to be aligned when calling |
647 // C++ code. | 657 // C++ code. |
648 // Needs a scratch register to do some arithmetic. This register will be | 658 // Needs a scratch register to do some arithmetic. This register will be |
649 // trashed. | 659 // trashed. |
650 void PrepareCallCFunction(int num_arguments, Register scratch); | 660 void PrepareCallCFunction(int num_arguments, Register scratch); |
651 | 661 |
652 // Calls a C function and cleans up the space for arguments allocated | 662 // Calls a C function and cleans up the space for arguments allocated |
653 // by PrepareCallCFunction. The called function is not allowed to trigger a | 663 // by PrepareCallCFunction. The called function is not allowed to trigger a |
654 // garbage collection, since that might move the code and invalidate the | 664 // garbage collection, since that might move the code and invalidate the |
655 // return address (unless this is somehow accounted for by the called | 665 // return address (unless this is somehow accounted for by the called |
656 // function). | 666 // function). |
657 void CallCFunction(ExternalReference function, int num_arguments); | 667 void CallCFunction(ExternalReference function, int num_arguments); |
658 void CallCFunction(Register function, int num_arguments); | 668 void CallCFunction(Register function, int num_arguments); |
659 | 669 |
| 670 // Calls an API function. Allocates HandleScope, extracts returned value |
| 671 // from handle and propagates exceptions. Restores context. |
| 672 // stack_space - space to be unwound on exit (includes the call js |
| 673 // arguments space and the additional space allocated for the fast call). |
| 674 MaybeObject* TryCallApiFunctionAndReturn(ApiFunction* function, |
| 675 int stack_space); |
| 676 |
660 // Jump to a runtime routine. | 677 // Jump to a runtime routine. |
661 void JumpToExternalReference(const ExternalReference& builtin); | 678 void JumpToExternalReference(const ExternalReference& builtin); |
662 | 679 |
| 680 MaybeObject* TryJumpToExternalReference(const ExternalReference& ext); |
| 681 |
663 // Invoke specified builtin JavaScript function. Adds an entry to | 682 // Invoke specified builtin JavaScript function. Adds an entry to |
664 // the unresolved list if the name does not resolve. | 683 // the unresolved list if the name does not resolve. |
665 void InvokeBuiltin(Builtins::JavaScript id, | 684 void InvokeBuiltin(Builtins::JavaScript id, |
666 InvokeJSFlags flags, | 685 InvokeJSFlags flags, |
667 PostCallGenerator* post_call_generator = NULL); | 686 PostCallGenerator* post_call_generator = NULL); |
668 | 687 |
669 // Store the code object for the given builtin in the target register and | 688 // Store the code object for the given builtin in the target register and |
670 // setup the function in r1. | 689 // setup the function in r1. |
671 void GetBuiltinEntry(Register target, Builtins::JavaScript id); | 690 void GetBuiltinEntry(Register target, Builtins::JavaScript id); |
672 | 691 |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 930 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
912 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 931 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
913 #else | 932 #else |
914 #define ACCESS_MASM(masm) masm-> | 933 #define ACCESS_MASM(masm) masm-> |
915 #endif | 934 #endif |
916 | 935 |
917 | 936 |
918 } } // namespace v8::internal | 937 } } // namespace v8::internal |
919 | 938 |
920 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ | 939 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ |
OLD | NEW |