OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1086 const CallWrapper& call_wrapper); | 1086 const CallWrapper& call_wrapper); |
1087 void InvokeFunction(Handle<JSFunction> function, | 1087 void InvokeFunction(Handle<JSFunction> function, |
1088 const ParameterCount& expected, | 1088 const ParameterCount& expected, |
1089 const ParameterCount& actual, | 1089 const ParameterCount& actual, |
1090 InvokeFlag flag, | 1090 InvokeFlag flag, |
1091 const CallWrapper& call_wrapper); | 1091 const CallWrapper& call_wrapper); |
1092 | 1092 |
1093 | 1093 |
1094 // ---- Floating point helpers ---- | 1094 // ---- Floating point helpers ---- |
1095 | 1095 |
1096 enum ECMA262ToInt32Result { | |
1097 // Provide an untagged int32_t which can be read using result.W(). That is, | |
1098 // the upper 32 bits of result are undefined. | |
1099 INT32_IN_W, | |
1100 | 1096 |
1101 // Provide an untagged int32_t which can be read using the 64-bit result | 1097 // Performs a truncating conversion of a floating point number as used by |
1102 // register. The int32_t result is sign-extended. | 1098 // the JS bitwise operations. See ECMA-262 9.5: ToInt32. Goes to 'done' if it |
1103 INT32_IN_X, | 1099 // succeeds, otherwise falls through if result is saturated. On return |
| 1100 // 'result' either holds answer, or is clobbered on fall through. |
| 1101 // |
| 1102 // Only public for the test code in test-code-stubs-a64.cc. |
| 1103 void TryInlineTruncateDoubleToI(Register result, |
| 1104 DoubleRegister input, |
| 1105 Label* done); |
1104 | 1106 |
1105 // Tag the int32_t result as a smi. | 1107 // Performs a truncating conversion of a floating point number as used by |
1106 SMI | 1108 // the JS bitwise operations. See ECMA-262 9.5: ToInt32. |
1107 }; | 1109 // Exits with 'result' holding the answer. |
| 1110 void TruncateDoubleToI(Register result, DoubleRegister double_input); |
1108 | 1111 |
1109 // Applies ECMA-262 ToInt32 (see section 9.5) to a double value. | 1112 // Performs a truncating conversion of a heap number as used by |
1110 void ECMA262ToInt32(Register result, | 1113 // the JS bitwise operations. See ECMA-262 9.5: ToInt32. 'result' and 'input' |
1111 DoubleRegister input, | 1114 // must be different registers. Exits with 'result' holding the answer. |
1112 Register scratch1, | 1115 void TruncateHeapNumberToI(Register result, Register object); |
1113 Register scratch2, | |
1114 ECMA262ToInt32Result format = INT32_IN_X); | |
1115 | 1116 |
1116 // As ECMA262ToInt32, but operate on a HeapNumber. | 1117 // Converts the smi or heap number in object to an int32 using the rules |
1117 void HeapNumberECMA262ToInt32(Register result, | 1118 // for ToInt32 as described in ECMAScript 9.5.: the value is truncated |
1118 Register heap_number, | 1119 // and brought into the range -2^31 .. +2^31 - 1. 'result' and 'input' must be |
1119 Register scratch1, | 1120 // different registers. |
1120 Register scratch2, | 1121 void TruncateNumberToI(Register object, |
1121 DoubleRegister double_scratch, | 1122 Register result, |
1122 ECMA262ToInt32Result format = INT32_IN_X); | 1123 Register heap_number_map, |
| 1124 Label* not_int32); |
1123 | 1125 |
1124 // ---- Code generation helpers ---- | 1126 // ---- Code generation helpers ---- |
1125 | 1127 |
1126 void set_generating_stub(bool value) { generating_stub_ = value; } | 1128 void set_generating_stub(bool value) { generating_stub_ = value; } |
1127 bool generating_stub() const { return generating_stub_; } | 1129 bool generating_stub() const { return generating_stub_; } |
1128 #if DEBUG | 1130 #if DEBUG |
1129 void set_allow_macro_instructions(bool value) { | 1131 void set_allow_macro_instructions(bool value) { |
1130 allow_macro_instructions_ = value; | 1132 allow_macro_instructions_ = value; |
1131 } | 1133 } |
1132 bool allow_macro_instructions() const { return allow_macro_instructions_; } | 1134 bool allow_macro_instructions() const { return allow_macro_instructions_; } |
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2183 #error "Unsupported option" | 2185 #error "Unsupported option" |
2184 #define CODE_COVERAGE_STRINGIFY(x) #x | 2186 #define CODE_COVERAGE_STRINGIFY(x) #x |
2185 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) | 2187 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) |
2186 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 2188 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
2187 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 2189 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
2188 #else | 2190 #else |
2189 #define ACCESS_MASM(masm) masm-> | 2191 #define ACCESS_MASM(masm) masm-> |
2190 #endif | 2192 #endif |
2191 | 2193 |
2192 #endif // V8_A64_MACRO_ASSEMBLER_A64_H_ | 2194 #endif // V8_A64_MACRO_ASSEMBLER_A64_H_ |
OLD | NEW |