Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: src/assembler.cc

Issue 1738623003: [wasm] Int64Lowering of FXXXConvertI64 instructions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Another try on windows. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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); }
titzer 2016/02/28 15:26:03 Can we extract these wrappers to a header/cc file
ahaas 2016/03/02 14:02:56 Done. I only extracted the static functions, the o
titzer 2016/03/02 14:06:20 The goal there is to introduce an interface betwee
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
1222 #if V8_CC_MSVC
1223 // static_cast<float> is compiled to static_cast<float>(static_cast<double>)
1224 // by MSVC. Since static_cast<double> can loose information which may be
1225 // required for correct rounding, we take the OR of the 11 LSB and store them
1226 // the resulting value in a bit which is representable in float64 but not
1227 // representable in float32 (I picked 30 because it sounded good).
1228 if (value & 0x8000000000000000) {
1229 value |= (((value & 0x7ff) != 0 ? 1 : 0) << 30);
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 *output = static_cast<double>(*input);
1251 }
1252
1253 ExternalReference ExternalReference::wasm_uint64_to_float64(Isolate* isolate) {
1254 return ExternalReference(
1255 Redirect(isolate, FUNCTION_ADDR(wasm_uint64_to_float64_wrapper)));
1210 } 1256 }
1211 1257
1212 ExternalReference ExternalReference::log_enter_external_function( 1258 ExternalReference ExternalReference::log_enter_external_function(
1213 Isolate* isolate) { 1259 Isolate* isolate) {
1214 return ExternalReference( 1260 return ExternalReference(
1215 Redirect(isolate, FUNCTION_ADDR(Logger::EnterExternal))); 1261 Redirect(isolate, FUNCTION_ADDR(Logger::EnterExternal)));
1216 } 1262 }
1217 1263
1218 1264
1219 ExternalReference ExternalReference::log_leave_external_function( 1265 ExternalReference ExternalReference::log_leave_external_function(
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
1936 1982
1937 1983
1938 void Assembler::DataAlign(int m) { 1984 void Assembler::DataAlign(int m) {
1939 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m)); 1985 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m));
1940 while ((pc_offset() & (m - 1)) != 0) { 1986 while ((pc_offset() & (m - 1)) != 0) {
1941 db(0); 1987 db(0);
1942 } 1988 }
1943 } 1989 }
1944 } // namespace internal 1990 } // namespace internal
1945 } // namespace v8 1991 } // namespace v8
OLDNEW
« no previous file with comments | « src/assembler.h ('k') | src/compiler/wasm-compiler.h » ('j') | src/compiler/wasm-compiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698