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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 | 605 |
608 // --------------------------------------------------------------------------- | 606 // --------------------------------------------------------------------------- |
609 // Runtime calls | 607 // Runtime calls |
610 | 608 |
611 // Call a code stub. | 609 // Call a code stub. |
612 void CallStub(CodeStub* stub, Condition cond = al); | 610 void CallStub(CodeStub* stub, Condition cond = al); |
613 | 611 |
614 // Call a code stub. | 612 // Call a code stub. |
615 void TailCallStub(CodeStub* stub, Condition cond = al); | 613 void TailCallStub(CodeStub* stub, Condition cond = al); |
616 | 614 |
| 615 // Tail call a code stub (jump) and return the code object called. Try to |
| 616 // generate the code if necessary. Do not perform a GC but instead return |
| 617 // a retry after GC failure. |
| 618 MUST_USE_RESULT MaybeObject* TryTailCallStub(CodeStub* stub, |
| 619 Condition cond = al); |
| 620 |
617 // Call a runtime routine. | 621 // Call a runtime routine. |
618 void CallRuntime(Runtime::Function* f, int num_arguments); | 622 void CallRuntime(Runtime::Function* f, int num_arguments); |
619 void CallRuntimeSaveDoubles(Runtime::FunctionId id); | 623 void CallRuntimeSaveDoubles(Runtime::FunctionId id); |
620 | 624 |
621 // Convenience function: Same as above, but takes the fid instead. | 625 // Convenience function: Same as above, but takes the fid instead. |
622 void CallRuntime(Runtime::FunctionId fid, int num_arguments); | 626 void CallRuntime(Runtime::FunctionId fid, int num_arguments); |
623 | 627 |
624 // Convenience function: call an external reference. | 628 // Convenience function: call an external reference. |
625 void CallExternalReference(const ExternalReference& ext, | 629 void CallExternalReference(const ExternalReference& ext, |
626 int num_arguments); | 630 int num_arguments); |
627 | 631 |
628 // Tail call of a runtime routine (jump). | 632 // Tail call of a runtime routine (jump). |
629 // Like JumpToExternalReference, but also takes care of passing the number | 633 // Like JumpToExternalReference, but also takes care of passing the number |
630 // of parameters. | 634 // of parameters. |
631 void TailCallExternalReference(const ExternalReference& ext, | 635 void TailCallExternalReference(const ExternalReference& ext, |
632 int num_arguments, | 636 int num_arguments, |
633 int result_size); | 637 int result_size); |
634 | 638 |
| 639 // Tail call of a runtime routine (jump). Try to generate the code if |
| 640 // necessary. Do not perform a GC but instead return a retry after GC |
| 641 // failure. |
| 642 MUST_USE_RESULT MaybeObject* TryTailCallExternalReference( |
| 643 const ExternalReference& ext, int num_arguments, int result_size); |
| 644 |
635 // Convenience function: tail call a runtime routine (jump). | 645 // Convenience function: tail call a runtime routine (jump). |
636 void TailCallRuntime(Runtime::FunctionId fid, | 646 void TailCallRuntime(Runtime::FunctionId fid, |
637 int num_arguments, | 647 int num_arguments, |
638 int result_size); | 648 int result_size); |
639 | 649 |
640 // Before calling a C-function from generated code, align arguments on stack. | 650 // Before calling a C-function from generated code, align arguments on stack. |
641 // After aligning the frame, non-register arguments must be stored in | 651 // After aligning the frame, non-register arguments must be stored in |
642 // sp[0], sp[4], etc., not pushed. The argument count assumes all arguments | 652 // sp[0], sp[4], etc., not pushed. The argument count assumes all arguments |
643 // are word sized. | 653 // are word sized. |
644 // Some compilers/platforms require the stack to be aligned when calling | 654 // Some compilers/platforms require the stack to be aligned when calling |
645 // C++ code. | 655 // C++ code. |
646 // Needs a scratch register to do some arithmetic. This register will be | 656 // Needs a scratch register to do some arithmetic. This register will be |
647 // trashed. | 657 // trashed. |
648 void PrepareCallCFunction(int num_arguments, Register scratch); | 658 void PrepareCallCFunction(int num_arguments, Register scratch); |
649 | 659 |
650 // Calls a C function and cleans up the space for arguments allocated | 660 // Calls a C function and cleans up the space for arguments allocated |
651 // by PrepareCallCFunction. The called function is not allowed to trigger a | 661 // by PrepareCallCFunction. The called function is not allowed to trigger a |
652 // garbage collection, since that might move the code and invalidate the | 662 // garbage collection, since that might move the code and invalidate the |
653 // return address (unless this is somehow accounted for by the called | 663 // return address (unless this is somehow accounted for by the called |
654 // function). | 664 // function). |
655 void CallCFunction(ExternalReference function, int num_arguments); | 665 void CallCFunction(ExternalReference function, int num_arguments); |
656 void CallCFunction(Register function, int num_arguments); | 666 void CallCFunction(Register function, int num_arguments); |
657 | 667 |
| 668 // Calls an API function. Allocates HandleScope, extracts returned value |
| 669 // from handle and propagates exceptions. Restores context. |
| 670 // stack_space - space to be unwound on exit (includes the call js |
| 671 // arguments space and the additional space allocated for the fast call). |
| 672 MaybeObject* TryCallApiFunctionAndReturn(ApiFunction* function, |
| 673 int stack_space); |
| 674 |
658 // Jump to a runtime routine. | 675 // Jump to a runtime routine. |
659 void JumpToExternalReference(const ExternalReference& builtin); | 676 void JumpToExternalReference(const ExternalReference& builtin); |
660 | 677 |
| 678 MaybeObject* TryJumpToExternalReference(const ExternalReference& ext); |
| 679 |
661 // Invoke specified builtin JavaScript function. Adds an entry to | 680 // Invoke specified builtin JavaScript function. Adds an entry to |
662 // the unresolved list if the name does not resolve. | 681 // the unresolved list if the name does not resolve. |
663 void InvokeBuiltin(Builtins::JavaScript id, | 682 void InvokeBuiltin(Builtins::JavaScript id, |
664 InvokeJSFlags flags, | 683 InvokeJSFlags flags, |
665 PostCallGenerator* post_call_generator = NULL); | 684 PostCallGenerator* post_call_generator = NULL); |
666 | 685 |
667 // Store the code object for the given builtin in the target register and | 686 // Store the code object for the given builtin in the target register and |
668 // setup the function in r1. | 687 // setup the function in r1. |
669 void GetBuiltinEntry(Register target, Builtins::JavaScript id); | 688 void GetBuiltinEntry(Register target, Builtins::JavaScript id); |
670 | 689 |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 923 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
905 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 924 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
906 #else | 925 #else |
907 #define ACCESS_MASM(masm) masm-> | 926 #define ACCESS_MASM(masm) masm-> |
908 #endif | 927 #endif |
909 | 928 |
910 | 929 |
911 } } // namespace v8::internal | 930 } } // namespace v8::internal |
912 | 931 |
913 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ | 932 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ |
OLD | NEW |