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 <stdarg.h> | 5 #include <stdarg.h> |
6 #include <sys/stat.h> | 6 #include <sys/stat.h> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/base/logging.h" | 10 #include "src/base/logging.h" |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 memcopy_uint16_uint8_function = | 389 memcopy_uint16_uint8_function = |
390 CreateMemCopyUint16Uint8Function(&MemCopyUint16Uint8Wrapper); | 390 CreateMemCopyUint16Uint8Function(&MemCopyUint16Uint8Wrapper); |
391 #elif V8_OS_POSIX && V8_HOST_ARCH_MIPS | 391 #elif V8_OS_POSIX && V8_HOST_ARCH_MIPS |
392 memcopy_uint8_function = CreateMemCopyUint8Function(&MemCopyUint8Wrapper); | 392 memcopy_uint8_function = CreateMemCopyUint8Function(&MemCopyUint8Wrapper); |
393 #endif | 393 #endif |
394 } | 394 } |
395 | 395 |
396 | 396 |
397 bool DoubleToBoolean(double d) { | 397 bool DoubleToBoolean(double d) { |
398 // NaN, +0, and -0 should return the false object | 398 // NaN, +0, and -0 should return the false object |
399 #if __BYTE_ORDER == __LITTLE_ENDIAN | 399 #if V8_TARGET_LITTLE_ENDIAN |
400 union IeeeDoubleLittleEndianArchType u; | 400 union IeeeDoubleLittleEndianArchType u; |
401 #elif __BYTE_ORDER == __BIG_ENDIAN | 401 #else |
402 union IeeeDoubleBigEndianArchType u; | 402 union IeeeDoubleBigEndianArchType u; |
403 #endif | 403 #endif |
404 u.d = d; | 404 u.d = d; |
405 if (u.bits.exp == 2047) { | 405 if (u.bits.exp == 2047) { |
406 // Detect NaN for IEEE double precision floating point. | 406 // Detect NaN for IEEE double precision floating point. |
407 if ((u.bits.man_low | u.bits.man_high) != 0) return false; | 407 if ((u.bits.man_low | u.bits.man_high) != 0) return false; |
408 } | 408 } |
409 if (u.bits.exp == 0) { | 409 if (u.bits.exp == 0) { |
410 // Detect +0, and -0 for IEEE double precision floating point. | 410 // Detect +0, and -0 for IEEE double precision floating point. |
411 if ((u.bits.man_low | u.bits.man_high) == 0) return false; | 411 if ((u.bits.man_low | u.bits.man_high) == 0) return false; |
412 } | 412 } |
413 return true; | 413 return true; |
414 } | 414 } |
415 | 415 |
416 | 416 |
417 } } // namespace v8::internal | 417 } } // namespace v8::internal |
OLD | NEW |