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

Side by Side Diff: src/assembler.cc

Issue 553843002: Replace our home-grown BitCast with bit_cast from Chrome/Google3. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/assembler.h ('k') | src/base/macros.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 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 876
877 877
878 // ----------------------------------------------------------------------------- 878 // -----------------------------------------------------------------------------
879 // Implementation of ExternalReference 879 // Implementation of ExternalReference
880 880
881 void ExternalReference::SetUp() { 881 void ExternalReference::SetUp() {
882 double_constants.min_int = kMinInt; 882 double_constants.min_int = kMinInt;
883 double_constants.one_half = 0.5; 883 double_constants.one_half = 0.5;
884 double_constants.minus_one_half = -0.5; 884 double_constants.minus_one_half = -0.5;
885 double_constants.canonical_non_hole_nan = base::OS::nan_value(); 885 double_constants.canonical_non_hole_nan = base::OS::nan_value();
886 double_constants.the_hole_nan = BitCast<double>(kHoleNanInt64); 886 double_constants.the_hole_nan = bit_cast<double>(kHoleNanInt64);
887 double_constants.negative_infinity = -V8_INFINITY; 887 double_constants.negative_infinity = -V8_INFINITY;
888 double_constants.uint32_bias = 888 double_constants.uint32_bias =
889 static_cast<double>(static_cast<uint32_t>(0xFFFFFFFF)) + 1; 889 static_cast<double>(static_cast<uint32_t>(0xFFFFFFFF)) + 1;
890 890
891 math_exp_data_mutex = new base::Mutex(); 891 math_exp_data_mutex = new base::Mutex();
892 } 892 }
893 893
894 894
895 void ExternalReference::InitializeMathExpData() { 895 void ExternalReference::InitializeMathExpData() {
896 // Early return? 896 // Early return?
(...skipping 20 matching lines...) Expand all
917 math_exp_constants_array[4] = 917 math_exp_constants_array[4] =
918 static_cast<double>(static_cast<int64_t>(3) << 51); 918 static_cast<double>(static_cast<int64_t>(3) << 51);
919 math_exp_constants_array[5] = 1 / constant3; 919 math_exp_constants_array[5] = 1 / constant3;
920 math_exp_constants_array[6] = 3.0000000027955394; 920 math_exp_constants_array[6] = 3.0000000027955394;
921 math_exp_constants_array[7] = 0.16666666685227835; 921 math_exp_constants_array[7] = 0.16666666685227835;
922 math_exp_constants_array[8] = 1; 922 math_exp_constants_array[8] = 1;
923 923
924 math_exp_log_table_array = new double[kTableSize]; 924 math_exp_log_table_array = new double[kTableSize];
925 for (int i = 0; i < kTableSize; i++) { 925 for (int i = 0; i < kTableSize; i++) {
926 double value = std::pow(2, i / kTableSizeDouble); 926 double value = std::pow(2, i / kTableSizeDouble);
927 uint64_t bits = BitCast<uint64_t, double>(value); 927 uint64_t bits = bit_cast<uint64_t, double>(value);
928 bits &= (static_cast<uint64_t>(1) << 52) - 1; 928 bits &= (static_cast<uint64_t>(1) << 52) - 1;
929 double mantissa = BitCast<double, uint64_t>(bits); 929 double mantissa = bit_cast<double, uint64_t>(bits);
930 math_exp_log_table_array[i] = mantissa; 930 math_exp_log_table_array[i] = mantissa;
931 } 931 }
932 932
933 math_exp_data_initialized = true; 933 math_exp_data_initialized = true;
934 } 934 }
935 } 935 }
936 936
937 937
938 void ExternalReference::TearDownMathExpData() { 938 void ExternalReference::TearDownMathExpData() {
939 delete[] math_exp_constants_array; 939 delete[] math_exp_constants_array;
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); 1565 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position);
1566 state_.written_position = state_.current_position; 1566 state_.written_position = state_.current_position;
1567 written = true; 1567 written = true;
1568 } 1568 }
1569 1569
1570 // Return whether something was written. 1570 // Return whether something was written.
1571 return written; 1571 return written;
1572 } 1572 }
1573 1573
1574 } } // namespace v8::internal 1574 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/assembler.h ('k') | src/base/macros.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698