OLD | NEW |
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1140 Redirect(isolate, FUNCTION_ADDR(Deoptimizer::New))); | 1140 Redirect(isolate, FUNCTION_ADDR(Deoptimizer::New))); |
1141 } | 1141 } |
1142 | 1142 |
1143 | 1143 |
1144 ExternalReference ExternalReference::compute_output_frames_function( | 1144 ExternalReference ExternalReference::compute_output_frames_function( |
1145 Isolate* isolate) { | 1145 Isolate* isolate) { |
1146 return ExternalReference( | 1146 return ExternalReference( |
1147 Redirect(isolate, FUNCTION_ADDR(Deoptimizer::ComputeOutputFrames))); | 1147 Redirect(isolate, FUNCTION_ADDR(Deoptimizer::ComputeOutputFrames))); |
1148 } | 1148 } |
1149 | 1149 |
1150 static void f32_trunc_wrapper(float* param) { *param = truncf(*param); } | 1150 static void wasm_f32_trunc_wrapper(float* param) { *param = truncf(*param); } |
1151 | 1151 |
1152 ExternalReference ExternalReference::f32_trunc_wrapper_function( | 1152 ExternalReference ExternalReference::wasm_f32_trunc(Isolate* isolate) { |
1153 Isolate* isolate) { | 1153 return ExternalReference( |
1154 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f32_trunc_wrapper))); | 1154 Redirect(isolate, FUNCTION_ADDR(wasm_f32_trunc_wrapper))); |
1155 } | 1155 } |
1156 | 1156 |
1157 static void f32_floor_wrapper(float* param) { *param = floorf(*param); } | 1157 static void wasm_f32_floor_wrapper(float* param) { *param = floorf(*param); } |
1158 | 1158 |
1159 ExternalReference ExternalReference::f32_floor_wrapper_function( | 1159 ExternalReference ExternalReference::wasm_f32_floor(Isolate* isolate) { |
1160 Isolate* isolate) { | 1160 return ExternalReference( |
1161 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f32_floor_wrapper))); | 1161 Redirect(isolate, FUNCTION_ADDR(wasm_f32_floor_wrapper))); |
1162 } | 1162 } |
1163 | 1163 |
1164 static void f32_ceil_wrapper(float* param) { *param = ceilf(*param); } | 1164 static void wasm_f32_ceil_wrapper(float* param) { *param = ceilf(*param); } |
1165 | 1165 |
1166 ExternalReference ExternalReference::f32_ceil_wrapper_function( | 1166 ExternalReference ExternalReference::wasm_f32_ceil(Isolate* isolate) { |
1167 Isolate* isolate) { | 1167 return ExternalReference( |
1168 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f32_ceil_wrapper))); | 1168 Redirect(isolate, FUNCTION_ADDR(wasm_f32_ceil_wrapper))); |
1169 } | 1169 } |
1170 | 1170 |
1171 static void f32_nearest_int_wrapper(float* param) { | 1171 static void wasm_f32_nearest_int_wrapper(float* param) { |
1172 *param = nearbyintf(*param); | 1172 *param = nearbyintf(*param); |
1173 } | 1173 } |
1174 | 1174 |
1175 ExternalReference ExternalReference::f32_nearest_int_wrapper_function( | 1175 ExternalReference ExternalReference::wasm_f32_nearest_int(Isolate* isolate) { |
1176 Isolate* isolate) { | |
1177 return ExternalReference( | 1176 return ExternalReference( |
1178 Redirect(isolate, FUNCTION_ADDR(f32_nearest_int_wrapper))); | 1177 Redirect(isolate, FUNCTION_ADDR(wasm_f32_nearest_int_wrapper))); |
1179 } | 1178 } |
1180 | 1179 |
1181 static void f64_trunc_wrapper(double* param) { *param = trunc(*param); } | 1180 static void wasm_f64_trunc_wrapper(double* param) { *param = trunc(*param); } |
1182 | 1181 |
1183 ExternalReference ExternalReference::f64_trunc_wrapper_function( | 1182 ExternalReference ExternalReference::wasm_f64_trunc(Isolate* isolate) { |
1184 Isolate* isolate) { | 1183 return ExternalReference( |
1185 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f64_trunc_wrapper))); | 1184 Redirect(isolate, FUNCTION_ADDR(wasm_f64_trunc_wrapper))); |
1186 } | 1185 } |
1187 | 1186 |
1188 static void f64_floor_wrapper(double* param) { *param = floor(*param); } | 1187 static void wasm_f64_floor_wrapper(double* param) { *param = floor(*param); } |
1189 | 1188 |
1190 ExternalReference ExternalReference::f64_floor_wrapper_function( | 1189 ExternalReference ExternalReference::wasm_f64_floor(Isolate* isolate) { |
1191 Isolate* isolate) { | 1190 return ExternalReference( |
1192 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f64_floor_wrapper))); | 1191 Redirect(isolate, FUNCTION_ADDR(wasm_f64_floor_wrapper))); |
1193 } | 1192 } |
1194 | 1193 |
1195 static void f64_ceil_wrapper(double* param) { *param = ceil(*param); } | 1194 static void wasm_f64_ceil_wrapper(double* param) { *param = ceil(*param); } |
1196 | 1195 |
1197 ExternalReference ExternalReference::f64_ceil_wrapper_function( | 1196 ExternalReference ExternalReference::wasm_f64_ceil(Isolate* isolate) { |
1198 Isolate* isolate) { | 1197 return ExternalReference( |
1199 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f64_ceil_wrapper))); | 1198 Redirect(isolate, FUNCTION_ADDR(wasm_f64_ceil_wrapper))); |
1200 } | 1199 } |
1201 | 1200 |
1202 static void f64_nearest_int_wrapper(double* param) { | 1201 static void wasm_f64_nearest_int_wrapper(double* param) { |
1203 *param = nearbyint(*param); | 1202 *param = nearbyint(*param); |
1204 } | 1203 } |
1205 | 1204 |
1206 ExternalReference ExternalReference::f64_nearest_int_wrapper_function( | 1205 ExternalReference ExternalReference::wasm_f64_nearest_int(Isolate* isolate) { |
1207 Isolate* isolate) { | |
1208 return ExternalReference( | 1206 return ExternalReference( |
1209 Redirect(isolate, FUNCTION_ADDR(f64_nearest_int_wrapper))); | 1207 Redirect(isolate, FUNCTION_ADDR(wasm_f64_nearest_int_wrapper))); |
| 1208 } |
| 1209 |
| 1210 static void wasm_int64_to_float32_wrapper(int64_t* input, float* output) { |
| 1211 *output = static_cast<float>(*input); |
| 1212 } |
| 1213 |
| 1214 ExternalReference ExternalReference::wasm_int64_to_float32(Isolate* isolate) { |
| 1215 return ExternalReference( |
| 1216 Redirect(isolate, FUNCTION_ADDR(wasm_int64_to_float32_wrapper))); |
| 1217 } |
| 1218 |
| 1219 static void wasm_uint64_to_float32_wrapper(uint64_t* input, float* output) { |
| 1220 uint64_t value = *input; |
| 1221 #if V8_CC_MSVC |
| 1222 // static_cast<float>(uint64_t input) is not defined in the C standard if the |
| 1223 // input value cannot be represented exactly as double. The clang and gcc |
| 1224 // implementations satisfy the IEEE 754-2008 standard. msvc violates the |
| 1225 // standard in some cases where the MSB and the LSB of the input is set. |
| 1226 // With the additional calculation below the standard is also satisfied with |
| 1227 // msvc in all cases. |
| 1228 if ((value & 0x8000000000000000) != 0) { |
| 1229 value |= ((value & 1) << 1); |
| 1230 } |
| 1231 #endif |
| 1232 *output = static_cast<float>(value); |
| 1233 } |
| 1234 |
| 1235 ExternalReference ExternalReference::wasm_uint64_to_float32(Isolate* isolate) { |
| 1236 return ExternalReference( |
| 1237 Redirect(isolate, FUNCTION_ADDR(wasm_uint64_to_float32_wrapper))); |
| 1238 } |
| 1239 |
| 1240 static void wasm_int64_to_float64_wrapper(int64_t* input, double* output) { |
| 1241 *output = static_cast<double>(*input); |
| 1242 } |
| 1243 |
| 1244 ExternalReference ExternalReference::wasm_int64_to_float64(Isolate* isolate) { |
| 1245 return ExternalReference( |
| 1246 Redirect(isolate, FUNCTION_ADDR(wasm_int64_to_float64_wrapper))); |
| 1247 } |
| 1248 |
| 1249 static void wasm_uint64_to_float64_wrapper(uint64_t* input, double* output) { |
| 1250 uint64_t value = *input; |
| 1251 #if V8_CC_MSVC |
| 1252 // static_cast<double>(uint64_t input) is not defined in the C standard if the |
| 1253 // input value cannot be represented exactly as double. The clang and gcc |
| 1254 // implementations satisfy the IEEE 754-2008 standard. msvc violates the |
| 1255 // standard in some cases where the MSB and the LSB of the input is set. |
| 1256 // With the additional calculation below the standard is also satisfied with |
| 1257 // msvc in all cases. |
| 1258 if ((value & 0x8000000000000000) != 0) { |
| 1259 value |= ((value & 1) << 1); |
| 1260 } |
| 1261 #endif |
| 1262 *output = static_cast<double>(value); |
| 1263 } |
| 1264 |
| 1265 ExternalReference ExternalReference::wasm_uint64_to_float64(Isolate* isolate) { |
| 1266 return ExternalReference( |
| 1267 Redirect(isolate, FUNCTION_ADDR(wasm_uint64_to_float64_wrapper))); |
1210 } | 1268 } |
1211 | 1269 |
1212 ExternalReference ExternalReference::log_enter_external_function( | 1270 ExternalReference ExternalReference::log_enter_external_function( |
1213 Isolate* isolate) { | 1271 Isolate* isolate) { |
1214 return ExternalReference( | 1272 return ExternalReference( |
1215 Redirect(isolate, FUNCTION_ADDR(Logger::EnterExternal))); | 1273 Redirect(isolate, FUNCTION_ADDR(Logger::EnterExternal))); |
1216 } | 1274 } |
1217 | 1275 |
1218 | 1276 |
1219 ExternalReference ExternalReference::log_leave_external_function( | 1277 ExternalReference ExternalReference::log_leave_external_function( |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1936 | 1994 |
1937 | 1995 |
1938 void Assembler::DataAlign(int m) { | 1996 void Assembler::DataAlign(int m) { |
1939 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m)); | 1997 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m)); |
1940 while ((pc_offset() & (m - 1)) != 0) { | 1998 while ((pc_offset() & (m - 1)) != 0) { |
1941 db(0); | 1999 db(0); |
1942 } | 2000 } |
1943 } | 2001 } |
1944 } // namespace internal | 2002 } // namespace internal |
1945 } // namespace v8 | 2003 } // namespace v8 |
OLD | NEW |