V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
instructions-arm64-constants.cc
1 // Copyright 2017 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include <cstdint>
6 #include "include/v8config.h"
7 
8 namespace v8 {
9 namespace internal {
10 
11 // ISA constants. --------------------------------------------------------------
12 
13 // The following code initializes float/double variables with bit patterns
14 // without using static initializers (which is surprisingly difficult in
15 // C++). These variables are used by client code as extern float16,
16 // extern float and extern double types, which works because (I think) the
17 // linker ignores the types. This is kept in a separate source file to
18 // avoid breaking jumbo builds.
19 //
20 // TODO(mostynb): replace these with std::numeric_limits constexpr's where
21 // possible, and figure out how to replace *DefaultNaN with something clean,
22 // then move this code back into instructions-arm64.cc with the same types
23 // that client code uses.
24 
25 #if defined(V8_OS_WIN)
26 extern "C" {
27 #endif
28 
29 extern const uint16_t kFP16PositiveInfinity = 0x7C00;
30 extern const uint16_t kFP16NegativeInfinity = 0xFC00;
31 extern const uint32_t kFP32PositiveInfinity = 0x7F800000;
32 extern const uint32_t kFP32NegativeInfinity = 0xFF800000;
33 extern const uint64_t kFP64PositiveInfinity = 0x7FF0000000000000UL;
34 extern const uint64_t kFP64NegativeInfinity = 0xFFF0000000000000UL;
35 
36 // This value is a signalling NaN as both a double and as a float (taking the
37 // least-significant word).
38 extern const uint64_t kFP64SignallingNaN = 0x7FF000007F800001;
39 extern const uint32_t kFP32SignallingNaN = 0x7F800001;
40 
41 // A similar value, but as a quiet NaN.
42 extern const uint64_t kFP64QuietNaN = 0x7FF800007FC00001;
43 extern const uint32_t kFP32QuietNaN = 0x7FC00001;
44 
45 // The default NaN values (for FPCR.DN=1).
46 extern const uint64_t kFP64DefaultNaN = 0x7FF8000000000000UL;
47 extern const uint32_t kFP32DefaultNaN = 0x7FC00000;
48 extern const uint16_t kFP16DefaultNaN = 0x7E00;
49 
50 #if defined(V8_OS_WIN)
51 } // end of extern "C"
52 #endif
53 
54 } // namespace internal
55 } // namespace v8
Definition: libplatform.h:13