OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 Register src, | 135 Register src, |
136 Register scratch, | 136 Register scratch, |
137 int lsb, | 137 int lsb, |
138 int width, | 138 int width, |
139 Condition cond = al); | 139 Condition cond = al); |
140 void Bfc(Register dst, int lsb, int width, Condition cond = al); | 140 void Bfc(Register dst, int lsb, int width, Condition cond = al); |
141 void Usat(Register dst, int satpos, const Operand& src, | 141 void Usat(Register dst, int satpos, const Operand& src, |
142 Condition cond = al); | 142 Condition cond = al); |
143 | 143 |
144 void Call(Label* target); | 144 void Call(Label* target); |
| 145 |
| 146 // Register move. May do nothing if the registers are identical. |
145 void Move(Register dst, Handle<Object> value); | 147 void Move(Register dst, Handle<Object> value); |
146 // May do nothing if the registers are identical. | |
147 void Move(Register dst, Register src); | 148 void Move(Register dst, Register src); |
| 149 void Move(DoubleRegister dst, DoubleRegister src); |
| 150 |
148 // Jumps to the label at the index given by the Smi in "index". | 151 // Jumps to the label at the index given by the Smi in "index". |
149 void SmiJumpTable(Register index, Vector<Label*> targets); | 152 void SmiJumpTable(Register index, Vector<Label*> targets); |
150 // Load an object from the root table. | 153 // Load an object from the root table. |
151 void LoadRoot(Register destination, | 154 void LoadRoot(Register destination, |
152 Heap::RootListIndex index, | 155 Heap::RootListIndex index, |
153 Condition cond = al); | 156 Condition cond = al); |
154 // Store an object to the root table. | 157 // Store an object to the root table. |
155 void StoreRoot(Register source, | 158 void StoreRoot(Register source, |
156 Heap::RootListIndex index, | 159 Heap::RootListIndex index, |
157 Condition cond = al); | 160 Condition cond = al); |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 // necessary. Do not perform a GC but instead return a retry after GC | 736 // necessary. Do not perform a GC but instead return a retry after GC |
734 // failure. | 737 // failure. |
735 MUST_USE_RESULT MaybeObject* TryTailCallExternalReference( | 738 MUST_USE_RESULT MaybeObject* TryTailCallExternalReference( |
736 const ExternalReference& ext, int num_arguments, int result_size); | 739 const ExternalReference& ext, int num_arguments, int result_size); |
737 | 740 |
738 // Convenience function: tail call a runtime routine (jump). | 741 // Convenience function: tail call a runtime routine (jump). |
739 void TailCallRuntime(Runtime::FunctionId fid, | 742 void TailCallRuntime(Runtime::FunctionId fid, |
740 int num_arguments, | 743 int num_arguments, |
741 int result_size); | 744 int result_size); |
742 | 745 |
| 746 int CalculateStackPassedWords(int num_reg_arguments, |
| 747 int num_double_arguments); |
| 748 |
743 // Before calling a C-function from generated code, align arguments on stack. | 749 // Before calling a C-function from generated code, align arguments on stack. |
744 // After aligning the frame, non-register arguments must be stored in | 750 // After aligning the frame, non-register arguments must be stored in |
745 // sp[0], sp[4], etc., not pushed. The argument count assumes all arguments | 751 // sp[0], sp[4], etc., not pushed. The argument count assumes all arguments |
746 // are word sized. | 752 // are word sized. If double arguments are used, this function assumes that |
| 753 // all double arguments are stored before core registers; otherwise the |
| 754 // correct alignment of the double values is not guaranteed. |
747 // Some compilers/platforms require the stack to be aligned when calling | 755 // Some compilers/platforms require the stack to be aligned when calling |
748 // C++ code. | 756 // C++ code. |
749 // Needs a scratch register to do some arithmetic. This register will be | 757 // Needs a scratch register to do some arithmetic. This register will be |
750 // trashed. | 758 // trashed. |
751 void PrepareCallCFunction(int num_arguments, Register scratch); | 759 void PrepareCallCFunction(int num_reg_arguments, |
| 760 int num_double_registers, |
| 761 Register scratch); |
| 762 void PrepareCallCFunction(int num_reg_arguments, |
| 763 Register scratch); |
| 764 |
| 765 // There are two ways of passing double arguments on ARM, depending on |
| 766 // whether soft or hard floating point ABI is used. These functions |
| 767 // abstract parameter passing for the three different ways we call |
| 768 // C functions from generated code. |
| 769 void SetCallCDoubleArguments(DoubleRegister dreg); |
| 770 void SetCallCDoubleArguments(DoubleRegister dreg1, DoubleRegister dreg2); |
| 771 void SetCallCDoubleArguments(DoubleRegister dreg, Register reg); |
752 | 772 |
753 // Calls a C function and cleans up the space for arguments allocated | 773 // Calls a C function and cleans up the space for arguments allocated |
754 // by PrepareCallCFunction. The called function is not allowed to trigger a | 774 // by PrepareCallCFunction. The called function is not allowed to trigger a |
755 // garbage collection, since that might move the code and invalidate the | 775 // garbage collection, since that might move the code and invalidate the |
756 // return address (unless this is somehow accounted for by the called | 776 // return address (unless this is somehow accounted for by the called |
757 // function). | 777 // function). |
758 void CallCFunction(ExternalReference function, int num_arguments); | 778 void CallCFunction(ExternalReference function, int num_arguments); |
759 void CallCFunction(Register function, Register scratch, int num_arguments); | 779 void CallCFunction(Register function, Register scratch, int num_arguments); |
| 780 void CallCFunction(ExternalReference function, |
| 781 int num_reg_arguments, |
| 782 int num_double_arguments); |
| 783 void CallCFunction(Register function, Register scratch, |
| 784 int num_reg_arguments, |
| 785 int num_double_arguments); |
760 | 786 |
761 void GetCFunctionDoubleResult(const DoubleRegister dst); | 787 void GetCFunctionDoubleResult(const DoubleRegister dst); |
762 | 788 |
763 // Calls an API function. Allocates HandleScope, extracts returned value | 789 // Calls an API function. Allocates HandleScope, extracts returned value |
764 // from handle and propagates exceptions. Restores context. | 790 // from handle and propagates exceptions. Restores context. |
765 // stack_space - space to be unwound on exit (includes the call js | 791 // stack_space - space to be unwound on exit (includes the call js |
766 // arguments space and the additional space allocated for the fast call). | 792 // arguments space and the additional space allocated for the fast call). |
767 MaybeObject* TryCallApiFunctionAndReturn(ExternalReference function, | 793 MaybeObject* TryCallApiFunctionAndReturn(ExternalReference function, |
768 int stack_space); | 794 int stack_space); |
769 | 795 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 // Get the location of a relocated constant (its address in the constant pool) | 973 // Get the location of a relocated constant (its address in the constant pool) |
948 // from its load site. | 974 // from its load site. |
949 void GetRelocatedValueLocation(Register ldr_location, | 975 void GetRelocatedValueLocation(Register ldr_location, |
950 Register result); | 976 Register result); |
951 | 977 |
952 | 978 |
953 private: | 979 private: |
954 void CallCFunctionHelper(Register function, | 980 void CallCFunctionHelper(Register function, |
955 ExternalReference function_reference, | 981 ExternalReference function_reference, |
956 Register scratch, | 982 Register scratch, |
957 int num_arguments); | 983 int num_reg_arguments, |
| 984 int num_double_arguments); |
958 | 985 |
959 void Jump(intptr_t target, RelocInfo::Mode rmode, Condition cond = al); | 986 void Jump(intptr_t target, RelocInfo::Mode rmode, Condition cond = al); |
960 int CallSize(intptr_t target, RelocInfo::Mode rmode, Condition cond = al); | 987 int CallSize(intptr_t target, RelocInfo::Mode rmode, Condition cond = al); |
961 void Call(intptr_t target, RelocInfo::Mode rmode, Condition cond = al); | 988 void Call(intptr_t target, RelocInfo::Mode rmode, Condition cond = al); |
962 | 989 |
963 // Helper functions for generating invokes. | 990 // Helper functions for generating invokes. |
964 void InvokePrologue(const ParameterCount& expected, | 991 void InvokePrologue(const ParameterCount& expected, |
965 const ParameterCount& actual, | 992 const ParameterCount& actual, |
966 Handle<Code> code_constant, | 993 Handle<Code> code_constant, |
967 Register code_reg, | 994 Register code_reg, |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1062 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 1089 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
1063 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 1090 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
1064 #else | 1091 #else |
1065 #define ACCESS_MASM(masm) masm-> | 1092 #define ACCESS_MASM(masm) masm-> |
1066 #endif | 1093 #endif |
1067 | 1094 |
1068 | 1095 |
1069 } } // namespace v8::internal | 1096 } } // namespace v8::internal |
1070 | 1097 |
1071 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ | 1098 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ |
OLD | NEW |