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

Side by Side Diff: src/assembler.cc

Issue 2062773002: [wasm] Use the new Float64Atan(2) TF operators in wasm. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 1315
1316 static void f64_asin_wrapper(double* param) { 1316 static void f64_asin_wrapper(double* param) {
1317 WriteDoubleValue(param, std::asin(ReadDoubleValue(param))); 1317 WriteDoubleValue(param, std::asin(ReadDoubleValue(param)));
1318 } 1318 }
1319 1319
1320 ExternalReference ExternalReference::f64_asin_wrapper_function( 1320 ExternalReference ExternalReference::f64_asin_wrapper_function(
1321 Isolate* isolate) { 1321 Isolate* isolate) {
1322 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f64_asin_wrapper))); 1322 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f64_asin_wrapper)));
1323 } 1323 }
1324 1324
1325 static void f64_atan_wrapper(double* param) {
1326 WriteDoubleValue(param, base::ieee754::atan(ReadDoubleValue(param)));
1327 }
1328
1329 ExternalReference ExternalReference::f64_atan_wrapper_function(
1330 Isolate* isolate) {
1331 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f64_atan_wrapper)));
1332 }
1333
1334 static void f64_cos_wrapper(double* param) { 1325 static void f64_cos_wrapper(double* param) {
1335 WriteDoubleValue(param, std::cos(ReadDoubleValue(param))); 1326 WriteDoubleValue(param, std::cos(ReadDoubleValue(param)));
1336 } 1327 }
1337 1328
1338 ExternalReference ExternalReference::f64_cos_wrapper_function( 1329 ExternalReference ExternalReference::f64_cos_wrapper_function(
1339 Isolate* isolate) { 1330 Isolate* isolate) {
1340 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f64_cos_wrapper))); 1331 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f64_cos_wrapper)));
1341 } 1332 }
1342 1333
1343 static void f64_sin_wrapper(double* param) { 1334 static void f64_sin_wrapper(double* param) {
(...skipping 26 matching lines...) Expand all
1370 static void f64_pow_wrapper(double* param0, double* param1) { 1361 static void f64_pow_wrapper(double* param0, double* param1) {
1371 WriteDoubleValue(param0, power_double_double(ReadDoubleValue(param0), 1362 WriteDoubleValue(param0, power_double_double(ReadDoubleValue(param0),
1372 ReadDoubleValue(param1))); 1363 ReadDoubleValue(param1)));
1373 } 1364 }
1374 1365
1375 ExternalReference ExternalReference::f64_pow_wrapper_function( 1366 ExternalReference ExternalReference::f64_pow_wrapper_function(
1376 Isolate* isolate) { 1367 Isolate* isolate) {
1377 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f64_pow_wrapper))); 1368 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f64_pow_wrapper)));
1378 } 1369 }
1379 1370
1380 static void f64_atan2_wrapper(double* param0, double* param1) {
1381 double x = ReadDoubleValue(param0);
1382 double y = ReadDoubleValue(param1);
1383 // TODO(bradnelson): Find a good place to put this to share
1384 // with the same code in src/runtime/runtime-math.cc
1385 static const double kPiDividedBy4 = 0.78539816339744830962;
1386 if (std::isinf(x) && std::isinf(y)) {
1387 // Make sure that the result in case of two infinite arguments
1388 // is a multiple of Pi / 4. The sign of the result is determined
1389 // by the first argument (x) and the sign of the second argument
1390 // determines the multiplier: one or three.
1391 int multiplier = (x < 0) ? -1 : 1;
1392 if (y < 0) multiplier *= 3;
1393 WriteDoubleValue(param0, multiplier * kPiDividedBy4);
1394 } else {
1395 WriteDoubleValue(param0, base::ieee754::atan2(x, y));
1396 }
1397 }
1398
1399 ExternalReference ExternalReference::f64_atan2_wrapper_function(
1400 Isolate* isolate) {
1401 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f64_atan2_wrapper)));
1402 }
1403
1404 static void f64_mod_wrapper(double* param0, double* param1) { 1371 static void f64_mod_wrapper(double* param0, double* param1) {
1405 WriteDoubleValue(param0, 1372 WriteDoubleValue(param0,
1406 modulo(ReadDoubleValue(param0), ReadDoubleValue(param1))); 1373 modulo(ReadDoubleValue(param0), ReadDoubleValue(param1)));
1407 } 1374 }
1408 1375
1409 ExternalReference ExternalReference::f64_mod_wrapper_function( 1376 ExternalReference ExternalReference::f64_mod_wrapper_function(
1410 Isolate* isolate) { 1377 Isolate* isolate) {
1411 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f64_mod_wrapper))); 1378 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f64_mod_wrapper)));
1412 } 1379 }
1413 1380
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
2127 2094
2128 2095
2129 void Assembler::DataAlign(int m) { 2096 void Assembler::DataAlign(int m) {
2130 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m)); 2097 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m));
2131 while ((pc_offset() & (m - 1)) != 0) { 2098 while ((pc_offset() & (m - 1)) != 0) {
2132 db(0); 2099 db(0);
2133 } 2100 }
2134 } 2101 }
2135 } // namespace internal 2102 } // namespace internal
2136 } // namespace v8 2103 } // 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