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/checks.h" | 10 #include "src/checks.h" |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 #elif V8_OS_POSIX && V8_HOST_ARCH_ARM | 368 #elif V8_OS_POSIX && V8_HOST_ARCH_ARM |
369 memcopy_uint8_function = CreateMemCopyUint8Function(&MemCopyUint8Wrapper); | 369 memcopy_uint8_function = CreateMemCopyUint8Function(&MemCopyUint8Wrapper); |
370 memcopy_uint16_uint8_function = | 370 memcopy_uint16_uint8_function = |
371 CreateMemCopyUint16Uint8Function(&MemCopyUint16Uint8Wrapper); | 371 CreateMemCopyUint16Uint8Function(&MemCopyUint16Uint8Wrapper); |
372 #elif V8_OS_POSIX && V8_HOST_ARCH_MIPS | 372 #elif V8_OS_POSIX && V8_HOST_ARCH_MIPS |
373 memcopy_uint8_function = CreateMemCopyUint8Function(&MemCopyUint8Wrapper); | 373 memcopy_uint8_function = CreateMemCopyUint8Function(&MemCopyUint8Wrapper); |
374 #endif | 374 #endif |
375 } | 375 } |
376 | 376 |
377 | 377 |
| 378 bool DoubleToBoolean(double d) { |
| 379 // NaN, +0, and -0 should return the false object |
| 380 #if __BYTE_ORDER == __LITTLE_ENDIAN |
| 381 union IeeeDoubleLittleEndianArchType u; |
| 382 #elif __BYTE_ORDER == __BIG_ENDIAN |
| 383 union IeeeDoubleBigEndianArchType u; |
| 384 #endif |
| 385 u.d = d; |
| 386 if (u.bits.exp == 2047) { |
| 387 // Detect NaN for IEEE double precision floating point. |
| 388 if ((u.bits.man_low | u.bits.man_high) != 0) return false; |
| 389 } |
| 390 if (u.bits.exp == 0) { |
| 391 // Detect +0, and -0 for IEEE double precision floating point. |
| 392 if ((u.bits.man_low | u.bits.man_high) == 0) return false; |
| 393 } |
| 394 return true; |
| 395 } |
| 396 |
| 397 |
378 } } // namespace v8::internal | 398 } } // namespace v8::internal |
OLD | NEW |