OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 {V8_2PART_UINT64_C(0xac2820d9, 623bf429), 880, 284}, | 126 {V8_2PART_UINT64_C(0xac2820d9, 623bf429), 880, 284}, |
127 {V8_2PART_UINT64_C(0x80444b5e, 7aa7cf85), 907, 292}, | 127 {V8_2PART_UINT64_C(0x80444b5e, 7aa7cf85), 907, 292}, |
128 {V8_2PART_UINT64_C(0xbf21e440, 03acdd2d), 933, 300}, | 128 {V8_2PART_UINT64_C(0xbf21e440, 03acdd2d), 933, 300}, |
129 {V8_2PART_UINT64_C(0x8e679c2f, 5e44ff8f), 960, 308}, | 129 {V8_2PART_UINT64_C(0x8e679c2f, 5e44ff8f), 960, 308}, |
130 {V8_2PART_UINT64_C(0xd433179d, 9c8cb841), 986, 316}, | 130 {V8_2PART_UINT64_C(0xd433179d, 9c8cb841), 986, 316}, |
131 {V8_2PART_UINT64_C(0x9e19db92, b4e31ba9), 1013, 324}, | 131 {V8_2PART_UINT64_C(0x9e19db92, b4e31ba9), 1013, 324}, |
132 {V8_2PART_UINT64_C(0xeb96bf6e, badf77d9), 1039, 332}, | 132 {V8_2PART_UINT64_C(0xeb96bf6e, badf77d9), 1039, 332}, |
133 {V8_2PART_UINT64_C(0xaf87023b, 9bf0ee6b), 1066, 340}, | 133 {V8_2PART_UINT64_C(0xaf87023b, 9bf0ee6b), 1066, 340}, |
134 }; | 134 }; |
135 | 135 |
| 136 #ifdef DEBUG |
136 static const int kCachedPowersLength = ARRAY_SIZE(kCachedPowers); | 137 static const int kCachedPowersLength = ARRAY_SIZE(kCachedPowers); |
| 138 #endif |
| 139 |
137 static const int kCachedPowersOffset = 348; // -1 * the first decimal_exponent. | 140 static const int kCachedPowersOffset = 348; // -1 * the first decimal_exponent. |
138 static const double kD_1_LOG2_10 = 0.30102999566398114; // 1 / lg(10) | 141 static const double kD_1_LOG2_10 = 0.30102999566398114; // 1 / lg(10) |
139 // Difference between the decimal exponents in the table above. | 142 // Difference between the decimal exponents in the table above. |
140 const int PowersOfTenCache::kDecimalExponentDistance = 8; | 143 const int PowersOfTenCache::kDecimalExponentDistance = 8; |
141 const int PowersOfTenCache::kMinDecimalExponent = -348; | 144 const int PowersOfTenCache::kMinDecimalExponent = -348; |
142 const int PowersOfTenCache::kMaxDecimalExponent = 340; | 145 const int PowersOfTenCache::kMaxDecimalExponent = 340; |
143 | 146 |
144 void PowersOfTenCache::GetCachedPowerForBinaryExponentRange( | 147 void PowersOfTenCache::GetCachedPowerForBinaryExponentRange( |
145 int min_exponent, | 148 int min_exponent, |
146 int max_exponent, | 149 int max_exponent, |
(...skipping 23 matching lines...) Expand all Loading... |
170 int index = | 173 int index = |
171 (requested_exponent + kCachedPowersOffset) / kDecimalExponentDistance; | 174 (requested_exponent + kCachedPowersOffset) / kDecimalExponentDistance; |
172 CachedPower cached_power = kCachedPowers[index]; | 175 CachedPower cached_power = kCachedPowers[index]; |
173 *power = DiyFp(cached_power.significand, cached_power.binary_exponent); | 176 *power = DiyFp(cached_power.significand, cached_power.binary_exponent); |
174 *found_exponent = cached_power.decimal_exponent; | 177 *found_exponent = cached_power.decimal_exponent; |
175 ASSERT(*found_exponent <= requested_exponent); | 178 ASSERT(*found_exponent <= requested_exponent); |
176 ASSERT(requested_exponent < *found_exponent + kDecimalExponentDistance); | 179 ASSERT(requested_exponent < *found_exponent + kDecimalExponentDistance); |
177 } | 180 } |
178 | 181 |
179 } } // namespace v8::internal | 182 } } // namespace v8::internal |
OLD | NEW |