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

Side by Side Diff: src/strtod.cc

Issue 293743005: Introduce x87 port (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: rebase Created 6 years, 7 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/simulator.h ('k') | src/x87/assembler-x87.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdarg.h> 5 #include <stdarg.h>
6 #include <cmath> 6 #include <cmath>
7 7
8 #include "globals.h" 8 #include "globals.h"
9 #include "utils.h" 9 #include "utils.h"
10 #include "strtod.h" 10 #include "strtod.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 int exponent = 0; 146 int exponent = 0;
147 *result = DiyFp(significand, exponent); 147 *result = DiyFp(significand, exponent);
148 *remaining_decimals = buffer.length() - read_digits; 148 *remaining_decimals = buffer.length() - read_digits;
149 } 149 }
150 } 150 }
151 151
152 152
153 static bool DoubleStrtod(Vector<const char> trimmed, 153 static bool DoubleStrtod(Vector<const char> trimmed,
154 int exponent, 154 int exponent,
155 double* result) { 155 double* result) {
156 #if (V8_TARGET_ARCH_IA32 || defined(USE_SIMULATOR)) && !defined(_MSC_VER) 156 #if (V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87 || defined(USE_SIMULATOR)) && \
157 !defined(_MSC_VER)
157 // On x86 the floating-point stack can be 64 or 80 bits wide. If it is 158 // On x86 the floating-point stack can be 64 or 80 bits wide. If it is
158 // 80 bits wide (as is the case on Linux) then double-rounding occurs and the 159 // 80 bits wide (as is the case on Linux) then double-rounding occurs and the
159 // result is not accurate. 160 // result is not accurate.
160 // We know that Windows32 with MSVC, unlike with MinGW32, uses 64 bits and is 161 // We know that Windows32 with MSVC, unlike with MinGW32, uses 64 bits and is
161 // therefore accurate. 162 // therefore accurate.
162 // Note that the ARM and MIPS simulators are compiled for 32bits. They 163 // Note that the ARM and MIPS simulators are compiled for 32bits. They
163 // therefore exhibit the same problem. 164 // therefore exhibit the same problem.
164 return false; 165 return false;
165 #endif 166 #endif
166 if (trimmed.length() <= kMaxExactDoubleIntegerDecimalDigits) { 167 if (trimmed.length() <= kMaxExactDoubleIntegerDecimalDigits) {
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 411
411 double guess; 412 double guess;
412 if (DoubleStrtod(trimmed, exponent, &guess) || 413 if (DoubleStrtod(trimmed, exponent, &guess) ||
413 DiyFpStrtod(trimmed, exponent, &guess)) { 414 DiyFpStrtod(trimmed, exponent, &guess)) {
414 return guess; 415 return guess;
415 } 416 }
416 return BignumStrtod(trimmed, exponent, guess); 417 return BignumStrtod(trimmed, exponent, guess);
417 } 418 }
418 419
419 } } // namespace v8::internal 420 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/simulator.h ('k') | src/x87/assembler-x87.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698