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

Side by Side Diff: src/assembler.cc

Issue 1729833002: Add wasm internal opcodes for asm.js stdlib functions we're missing. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 4 years, 9 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
« no previous file with comments | « src/assembler.h ('k') | src/compiler/wasm-compiler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 static void f64_nearest_int_wrapper(double* param) { 1202 static void f64_nearest_int_wrapper(double* param) {
1203 *param = nearbyint(*param); 1203 *param = nearbyint(*param);
1204 } 1204 }
1205 1205
1206 ExternalReference ExternalReference::f64_nearest_int_wrapper_function( 1206 ExternalReference ExternalReference::f64_nearest_int_wrapper_function(
1207 Isolate* isolate) { 1207 Isolate* isolate) {
1208 return ExternalReference( 1208 return ExternalReference(
1209 Redirect(isolate, FUNCTION_ADDR(f64_nearest_int_wrapper))); 1209 Redirect(isolate, FUNCTION_ADDR(f64_nearest_int_wrapper)));
1210 } 1210 }
1211 1211
1212 static void f64_acos_wrapper(double* param) { *param = std::acos(*param); }
1213
1214 ExternalReference ExternalReference::f64_acos_wrapper_function(
1215 Isolate* isolate) {
1216 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f64_acos_wrapper)));
1217 }
1218
1219 static void f64_asin_wrapper(double* param) { *param = std::asin(*param); }
1220
1221 ExternalReference ExternalReference::f64_asin_wrapper_function(
1222 Isolate* isolate) {
1223 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f64_asin_wrapper)));
1224 }
1225
1226 static void f64_atan_wrapper(double* param) { *param = std::atan(*param); }
1227
1228 ExternalReference ExternalReference::f64_atan_wrapper_function(
1229 Isolate* isolate) {
1230 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f64_atan_wrapper)));
1231 }
1232
1233 static void f64_cos_wrapper(double* param) { *param = std::cos(*param); }
1234
1235 ExternalReference ExternalReference::f64_cos_wrapper_function(
1236 Isolate* isolate) {
1237 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f64_cos_wrapper)));
1238 }
1239
1240 static void f64_sin_wrapper(double* param) { *param = std::sin(*param); }
1241
1242 ExternalReference ExternalReference::f64_sin_wrapper_function(
1243 Isolate* isolate) {
1244 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f64_sin_wrapper)));
1245 }
1246
1247 static void f64_tan_wrapper(double* param) { *param = std::tan(*param); }
1248
1249 ExternalReference ExternalReference::f64_tan_wrapper_function(
1250 Isolate* isolate) {
1251 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f64_tan_wrapper)));
1252 }
1253
1254 static void f64_exp_wrapper(double* param) { *param = std::exp(*param); }
1255
1256 ExternalReference ExternalReference::f64_exp_wrapper_function(
1257 Isolate* isolate) {
1258 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f64_exp_wrapper)));
1259 }
1260
1261 static void f64_log_wrapper(double* param) { *param = std::log(*param); }
1262
1263 ExternalReference ExternalReference::f64_log_wrapper_function(
1264 Isolate* isolate) {
1265 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f64_log_wrapper)));
1266 }
1267
1268 static void f64_pow_wrapper(double* param0, double* param1) {
1269 *param0 = power_double_double(*param0, *param1);
1270 }
1271
1272 ExternalReference ExternalReference::f64_pow_wrapper_function(
1273 Isolate* isolate) {
1274 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f64_pow_wrapper)));
1275 }
1276
1277 static void f64_atan2_wrapper(double* param0, double* param1) {
1278 double x = *param0;
1279 double y = *param1;
1280 // TODO(bradnelson): Find a good place to put this to share
1281 // with the same code in src/runtime/runtime-math.cc
1282 static const double kPiDividedBy4 = 0.78539816339744830962;
1283 if (std::isinf(x) && std::isinf(y)) {
1284 // Make sure that the result in case of two infinite arguments
1285 // is a multiple of Pi / 4. The sign of the result is determined
1286 // by the first argument (x) and the sign of the second argument
1287 // determines the multiplier: one or three.
1288 int multiplier = (x < 0) ? -1 : 1;
1289 if (y < 0) multiplier *= 3;
1290 *param0 = multiplier * kPiDividedBy4;
1291 } else {
1292 *param0 = std::atan2(x, y);
1293 }
1294 }
1295
1296 ExternalReference ExternalReference::f64_atan2_wrapper_function(
1297 Isolate* isolate) {
1298 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f64_atan2_wrapper)));
1299 }
1300
1301 static void f64_mod_wrapper(double* param0, double* param1) {
1302 *param0 = modulo(*param0, *param1);
1303 }
1304
1305 ExternalReference ExternalReference::f64_mod_wrapper_function(
1306 Isolate* isolate) {
1307 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f64_mod_wrapper)));
1308 }
1309
1212 ExternalReference ExternalReference::log_enter_external_function( 1310 ExternalReference ExternalReference::log_enter_external_function(
1213 Isolate* isolate) { 1311 Isolate* isolate) {
1214 return ExternalReference( 1312 return ExternalReference(
1215 Redirect(isolate, FUNCTION_ADDR(Logger::EnterExternal))); 1313 Redirect(isolate, FUNCTION_ADDR(Logger::EnterExternal)));
1216 } 1314 }
1217 1315
1218 1316
1219 ExternalReference ExternalReference::log_leave_external_function( 1317 ExternalReference ExternalReference::log_leave_external_function(
1220 Isolate* isolate) { 1318 Isolate* isolate) {
1221 return ExternalReference( 1319 return ExternalReference(
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
1933 2031
1934 2032
1935 void Assembler::DataAlign(int m) { 2033 void Assembler::DataAlign(int m) {
1936 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m)); 2034 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m));
1937 while ((pc_offset() & (m - 1)) != 0) { 2035 while ((pc_offset() & (m - 1)) != 0) {
1938 db(0); 2036 db(0);
1939 } 2037 }
1940 } 2038 }
1941 } // namespace internal 2039 } // namespace internal
1942 } // namespace v8 2040 } // namespace v8
OLDNEW
« no previous file with comments | « src/assembler.h ('k') | src/compiler/wasm-compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698