OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 "src/utils.h" | 5 #include "src/utils.h" |
6 | 6 |
7 #include <stdarg.h> | 7 #include <stdarg.h> |
8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
9 | 9 |
10 #include "src/base/functional.h" | 10 #include "src/base/functional.h" |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 CreateMemCopyUint16Uint8Function(isolate, &MemCopyUint16Uint8Wrapper); | 423 CreateMemCopyUint16Uint8Function(isolate, &MemCopyUint16Uint8Wrapper); |
424 #elif V8_OS_POSIX && V8_HOST_ARCH_MIPS | 424 #elif V8_OS_POSIX && V8_HOST_ARCH_MIPS |
425 memcopy_uint8_function = | 425 memcopy_uint8_function = |
426 CreateMemCopyUint8Function(isolate, &MemCopyUint8Wrapper); | 426 CreateMemCopyUint8Function(isolate, &MemCopyUint8Wrapper); |
427 #endif | 427 #endif |
428 } | 428 } |
429 | 429 |
430 | 430 |
431 bool DoubleToBoolean(double d) { | 431 bool DoubleToBoolean(double d) { |
432 // NaN, +0, and -0 should return the false object | 432 // NaN, +0, and -0 should return the false object |
433 #if V8_TARGET_LITTLE_ENDIAN | 433 IeeeDoubleArchType u; |
434 union IeeeDoubleLittleEndianArchType u; | 434 |
435 #else | |
436 union IeeeDoubleBigEndianArchType u; | |
437 #endif | |
438 u.d = d; | 435 u.d = d; |
439 if (u.bits.exp == 2047) { | 436 if (u.bits.exp == 2047) { |
440 // Detect NaN for IEEE double precision floating point. | 437 // Detect NaN for IEEE double precision floating point. |
441 if ((u.bits.man_low | u.bits.man_high) != 0) return false; | 438 if ((u.bits.man_low | u.bits.man_high) != 0) return false; |
442 } | 439 } |
443 if (u.bits.exp == 0) { | 440 if (u.bits.exp == 0) { |
444 // Detect +0, and -0 for IEEE double precision floating point. | 441 // Detect +0, and -0 for IEEE double precision floating point. |
445 if ((u.bits.man_low | u.bits.man_high) == 0) return false; | 442 if ((u.bits.man_low | u.bits.man_high) == 0) return false; |
446 } | 443 } |
447 return true; | 444 return true; |
448 } | 445 } |
449 | 446 |
450 | 447 |
451 } // namespace internal | 448 } // namespace internal |
452 } // namespace v8 | 449 } // namespace v8 |
OLD | NEW |