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 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 math_exp_constants_array[4] = | 920 math_exp_constants_array[4] = |
921 static_cast<double>(static_cast<int64_t>(3) << 51); | 921 static_cast<double>(static_cast<int64_t>(3) << 51); |
922 math_exp_constants_array[5] = 1 / constant3; | 922 math_exp_constants_array[5] = 1 / constant3; |
923 math_exp_constants_array[6] = 3.0000000027955394; | 923 math_exp_constants_array[6] = 3.0000000027955394; |
924 math_exp_constants_array[7] = 0.16666666685227835; | 924 math_exp_constants_array[7] = 0.16666666685227835; |
925 math_exp_constants_array[8] = 1; | 925 math_exp_constants_array[8] = 1; |
926 | 926 |
927 math_exp_log_table_array = new double[kTableSize]; | 927 math_exp_log_table_array = new double[kTableSize]; |
928 for (int i = 0; i < kTableSize; i++) { | 928 for (int i = 0; i < kTableSize; i++) { |
929 double value = pow(2, i / kTableSizeDouble); | 929 double value = pow(2, i / kTableSizeDouble); |
930 | |
931 uint64_t bits = BitCast<uint64_t, double>(value); | 930 uint64_t bits = BitCast<uint64_t, double>(value); |
932 bits &= (static_cast<uint64_t>(1) << 52) - 1; | 931 bits &= (static_cast<uint64_t>(1) << 52) - 1; |
933 double mantissa = BitCast<double, uint64_t>(bits); | 932 double mantissa = BitCast<double, uint64_t>(bits); |
934 | |
935 // <just testing> | |
936 uint64_t doublebits; | |
937 memcpy(&doublebits, &value, sizeof doublebits); | |
938 doublebits &= (static_cast<uint64_t>(1) << 52) - 1; | |
939 double mantissa2; | |
940 memcpy(&mantissa2, &doublebits, sizeof mantissa2); | |
941 CHECK_EQ(mantissa, mantissa2); | |
942 // </just testing> | |
943 | |
944 math_exp_log_table_array[i] = mantissa; | 933 math_exp_log_table_array[i] = mantissa; |
945 } | 934 } |
946 | 935 |
947 math_exp_data_initialized = true; | 936 math_exp_data_initialized = true; |
948 } | 937 } |
949 math_exp_data_mutex->Unlock(); | 938 math_exp_data_mutex->Unlock(); |
950 } | 939 } |
951 | 940 |
952 | 941 |
953 void ExternalReference::TearDownMathExpData() { | 942 void ExternalReference::TearDownMathExpData() { |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1651 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); | 1640 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); |
1652 state_.written_position = state_.current_position; | 1641 state_.written_position = state_.current_position; |
1653 written = true; | 1642 written = true; |
1654 } | 1643 } |
1655 | 1644 |
1656 // Return whether something was written. | 1645 // Return whether something was written. |
1657 return written; | 1646 return written; |
1658 } | 1647 } |
1659 | 1648 |
1660 } } // namespace v8::internal | 1649 } } // namespace v8::internal |
OLD | NEW |