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

Side by Side Diff: src/assembler.cc

Issue 121303005: Use std:: on symbols declared in C++-style C headers. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Including <cstdlib> in cctest/test-time.cc is no longer necessary. Created 6 years, 11 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 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 931
932 math_exp_constants_array = new double[9]; 932 math_exp_constants_array = new double[9];
933 // Input values smaller than this always return 0. 933 // Input values smaller than this always return 0.
934 math_exp_constants_array[0] = -708.39641853226408; 934 math_exp_constants_array[0] = -708.39641853226408;
935 // Input values larger than this always return +Infinity. 935 // Input values larger than this always return +Infinity.
936 math_exp_constants_array[1] = 709.78271289338397; 936 math_exp_constants_array[1] = 709.78271289338397;
937 math_exp_constants_array[2] = V8_INFINITY; 937 math_exp_constants_array[2] = V8_INFINITY;
938 // The rest is black magic. Do not attempt to understand it. It is 938 // The rest is black magic. Do not attempt to understand it. It is
939 // loosely based on the "expd" function published at: 939 // loosely based on the "expd" function published at:
940 // http://herumi.blogspot.com/2011/08/fast-double-precision-exponential.html 940 // http://herumi.blogspot.com/2011/08/fast-double-precision-exponential.html
941 const double constant3 = (1 << kTableSizeBits) / log(2.0); 941 const double constant3 = (1 << kTableSizeBits) / std::log(2.0);
942 math_exp_constants_array[3] = constant3; 942 math_exp_constants_array[3] = constant3;
943 math_exp_constants_array[4] = 943 math_exp_constants_array[4] =
944 static_cast<double>(static_cast<int64_t>(3) << 51); 944 static_cast<double>(static_cast<int64_t>(3) << 51);
945 math_exp_constants_array[5] = 1 / constant3; 945 math_exp_constants_array[5] = 1 / constant3;
946 math_exp_constants_array[6] = 3.0000000027955394; 946 math_exp_constants_array[6] = 3.0000000027955394;
947 math_exp_constants_array[7] = 0.16666666685227835; 947 math_exp_constants_array[7] = 0.16666666685227835;
948 math_exp_constants_array[8] = 1; 948 math_exp_constants_array[8] = 1;
949 949
950 math_exp_log_table_array = new double[kTableSize]; 950 math_exp_log_table_array = new double[kTableSize];
951 for (int i = 0; i < kTableSize; i++) { 951 for (int i = 0; i < kTableSize; i++) {
952 double value = pow(2, i / kTableSizeDouble); 952 double value = std::pow(2, i / kTableSizeDouble);
953 uint64_t bits = BitCast<uint64_t, double>(value); 953 uint64_t bits = BitCast<uint64_t, double>(value);
954 bits &= (static_cast<uint64_t>(1) << 52) - 1; 954 bits &= (static_cast<uint64_t>(1) << 52) - 1;
955 double mantissa = BitCast<double, uint64_t>(bits); 955 double mantissa = BitCast<double, uint64_t>(bits);
956 math_exp_log_table_array[i] = mantissa; 956 math_exp_log_table_array[i] = mantissa;
957 } 957 }
958 958
959 math_exp_data_initialized = true; 959 math_exp_data_initialized = true;
960 } 960 }
961 } 961 }
962 962
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 return ExternalReference(isolate->regexp_stack()->memory_size_address()); 1385 return ExternalReference(isolate->regexp_stack()->memory_size_address());
1386 } 1386 }
1387 1387
1388 #endif // V8_INTERPRETED_REGEXP 1388 #endif // V8_INTERPRETED_REGEXP
1389 1389
1390 1390
1391 ExternalReference ExternalReference::math_log_double_function( 1391 ExternalReference ExternalReference::math_log_double_function(
1392 Isolate* isolate) { 1392 Isolate* isolate) {
1393 typedef double (*d2d)(double x); 1393 typedef double (*d2d)(double x);
1394 return ExternalReference(Redirect(isolate, 1394 return ExternalReference(Redirect(isolate,
1395 FUNCTION_ADDR(static_cast<d2d>(log)), 1395 FUNCTION_ADDR(static_cast<d2d>(std::log)),
1396 BUILTIN_FP_CALL)); 1396 BUILTIN_FP_CALL));
1397 } 1397 }
1398 1398
1399 1399
1400 ExternalReference ExternalReference::math_exp_constants(int constant_index) { 1400 ExternalReference ExternalReference::math_exp_constants(int constant_index) {
1401 ASSERT(math_exp_data_initialized); 1401 ASSERT(math_exp_data_initialized);
1402 return ExternalReference( 1402 return ExternalReference(
1403 reinterpret_cast<void*>(math_exp_constants_array + constant_index)); 1403 reinterpret_cast<void*>(math_exp_constants_array + constant_index));
1404 } 1404 }
1405 1405
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 } 1456 }
1457 1457
1458 1458
1459 double power_double_double(double x, double y) { 1459 double power_double_double(double x, double y) {
1460 #if defined(__MINGW64_VERSION_MAJOR) && \ 1460 #if defined(__MINGW64_VERSION_MAJOR) && \
1461 (!defined(__MINGW64_VERSION_RC) || __MINGW64_VERSION_RC < 1) 1461 (!defined(__MINGW64_VERSION_RC) || __MINGW64_VERSION_RC < 1)
1462 // MinGW64 has a custom implementation for pow. This handles certain 1462 // MinGW64 has a custom implementation for pow. This handles certain
1463 // special cases that are different. 1463 // special cases that are different.
1464 if ((x == 0.0 || std::isinf(x)) && std::isfinite(y)) { 1464 if ((x == 0.0 || std::isinf(x)) && std::isfinite(y)) {
1465 double f; 1465 double f;
1466 if (modf(y, &f) != 0.0) return ((x == 0.0) ^ (y > 0)) ? V8_INFINITY : 0; 1466 if (modf(y, &f) != 0.0) return ((x == 0.0) ^ (y > 0)) ? V8_INFINITY : 0;
Benedikt Meurer 2014/01/07 08:20:27 std::modf
1467 } 1467 }
1468 1468
1469 if (x == 2.0) { 1469 if (x == 2.0) {
1470 int y_int = static_cast<int>(y); 1470 int y_int = static_cast<int>(y);
1471 if (y == y_int) return ldexp(1.0, y_int); 1471 if (y == y_int) return ldexp(1.0, y_int);
Benedikt Meurer 2014/01/07 08:20:27 std::ldexp
1472 } 1472 }
1473 #endif 1473 #endif
1474 1474
1475 // The checks for special cases can be dropped in ia32 because it has already 1475 // The checks for special cases can be dropped in ia32 because it has already
1476 // been done in generated code before bailing out here. 1476 // been done in generated code before bailing out here.
1477 if (std::isnan(y) || ((x == 1 || x == -1) && std::isinf(y))) { 1477 if (std::isnan(y) || ((x == 1 || x == -1) && std::isinf(y))) {
1478 return OS::nan_value(); 1478 return OS::nan_value();
1479 } 1479 }
1480 return pow(x, y); 1480 return std::pow(x, y);
1481 } 1481 }
1482 1482
1483 1483
1484 ExternalReference ExternalReference::power_double_double_function( 1484 ExternalReference ExternalReference::power_double_double_function(
1485 Isolate* isolate) { 1485 Isolate* isolate) {
1486 return ExternalReference(Redirect(isolate, 1486 return ExternalReference(Redirect(isolate,
1487 FUNCTION_ADDR(power_double_double), 1487 FUNCTION_ADDR(power_double_double),
1488 BUILTIN_FP_FP_CALL)); 1488 BUILTIN_FP_FP_CALL));
1489 } 1489 }
1490 1490
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1589 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); 1589 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position);
1590 state_.written_position = state_.current_position; 1590 state_.written_position = state_.current_position;
1591 written = true; 1591 written = true;
1592 } 1592 }
1593 1593
1594 // Return whether something was written. 1594 // Return whether something was written.
1595 return written; 1595 return written;
1596 } 1596 }
1597 1597
1598 } } // namespace v8::internal 1598 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/simulator-arm.cc ('k') | src/bignum-dtoa.cc » ('j') | src/cpu.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698