| 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 IeeeDoubleArchType u; | 433 #if V8_TARGET_LITTLE_ENDIAN |
| 434 | 434 union IeeeDoubleLittleEndianArchType u; |
| 435 #else |
| 436 union IeeeDoubleBigEndianArchType u; |
| 437 #endif |
| 435 u.d = d; | 438 u.d = d; |
| 436 if (u.bits.exp == 2047) { | 439 if (u.bits.exp == 2047) { |
| 437 // Detect NaN for IEEE double precision floating point. | 440 // Detect NaN for IEEE double precision floating point. |
| 438 if ((u.bits.man_low | u.bits.man_high) != 0) return false; | 441 if ((u.bits.man_low | u.bits.man_high) != 0) return false; |
| 439 } | 442 } |
| 440 if (u.bits.exp == 0) { | 443 if (u.bits.exp == 0) { |
| 441 // Detect +0, and -0 for IEEE double precision floating point. | 444 // Detect +0, and -0 for IEEE double precision floating point. |
| 442 if ((u.bits.man_low | u.bits.man_high) == 0) return false; | 445 if ((u.bits.man_low | u.bits.man_high) == 0) return false; |
| 443 } | 446 } |
| 444 return true; | 447 return true; |
| 445 } | 448 } |
| 446 | 449 |
| 447 | 450 |
| 448 } // namespace internal | 451 } // namespace internal |
| 449 } // namespace v8 | 452 } // namespace v8 |
| OLD | NEW |