Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: src/a64/instructions-a64.h

Issue 143493006: A64: Eliminate static initializers (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: updates Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/a64/frames-a64.h ('k') | src/a64/instructions-a64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 22 matching lines...) Expand all
33 #include "a64/constants-a64.h" 33 #include "a64/constants-a64.h"
34 #include "a64/utils-a64.h" 34 #include "a64/utils-a64.h"
35 35
36 namespace v8 { 36 namespace v8 {
37 namespace internal { 37 namespace internal {
38 38
39 39
40 // ISA constants. -------------------------------------------------------------- 40 // ISA constants. --------------------------------------------------------------
41 41
42 typedef uint32_t Instr; 42 typedef uint32_t Instr;
43 const float kFP32PositiveInfinity = rawbits_to_float(0x7f800000); 43
44 const float kFP32NegativeInfinity = rawbits_to_float(0xff800000); 44 // The following macros initialize a float/double variable with a bit pattern
45 const double kFP64PositiveInfinity = rawbits_to_double(0x7ff0000000000000UL); 45 // without using static initializers: If A64_DEFINE_FP_STATICS is defined, the
46 const double kFP64NegativeInfinity = rawbits_to_double(0xfff0000000000000UL); 46 // symbol is defined as uint32_t/uint64_t initialized with the desired bit
47 // pattern. Otherwise, the same symbol is declared as an external float/double.
48 #if defined(A64_DEFINE_FP_STATICS)
49 #define DEFINE_FLOAT(name, value) extern const uint32_t name = value
50 #define DEFINE_DOUBLE(name, value) extern const uint64_t name = value
51 #else
52 #define DEFINE_FLOAT(name, value) extern const float name
53 #define DEFINE_DOUBLE(name, value) extern const double name
54 #endif // defined(A64_DEFINE_FP_STATICS)
55
56 DEFINE_FLOAT(kFP32PositiveInfinity, 0x7f800000);
57 DEFINE_FLOAT(kFP32NegativeInfinity, 0xff800000);
58 DEFINE_DOUBLE(kFP64PositiveInfinity, 0x7ff0000000000000UL);
59 DEFINE_DOUBLE(kFP64NegativeInfinity, 0xfff0000000000000UL);
47 60
48 // This value is a signalling NaN as both a double and as a float (taking the 61 // This value is a signalling NaN as both a double and as a float (taking the
49 // least-significant word). 62 // least-significant word).
50 static const double kFP64SignallingNaN = rawbits_to_double(0x7ff000007f800001); 63 DEFINE_DOUBLE(kFP64SignallingNaN, 0x7ff000007f800001);
51 static const float kFP32SignallingNaN = rawbits_to_float(0x7f800001); 64 DEFINE_FLOAT(kFP32SignallingNaN, 0x7f800001);
52 65
53 // A similar value, but as a quiet NaN. 66 // A similar value, but as a quiet NaN.
54 static const double kFP64QuietNaN = rawbits_to_double(0x7ff800007fc00001); 67 DEFINE_DOUBLE(kFP64QuietNaN, 0x7ff800007fc00001);
55 static const float kFP32QuietNaN = rawbits_to_float(0x7fc00001); 68 DEFINE_FLOAT(kFP32QuietNaN, 0x7fc00001);
69
70 #undef DEFINE_FLOAT
71 #undef DEFINE_DOUBLE
56 72
57 73
58 enum LSDataSize { 74 enum LSDataSize {
59 LSByte = 0, 75 LSByte = 0,
60 LSHalfword = 1, 76 LSHalfword = 1,
61 LSWord = 2, 77 LSWord = 2,
62 LSDoubleWord = 3 78 LSDoubleWord = 3
63 }; 79 };
64 80
65 LSDataSize CalcLSPairDataSize(LoadStorePairOp op); 81 LSDataSize CalcLSPairDataSize(LoadStorePairOp op);
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 TRACE_ENABLE = 1 << 6, 476 TRACE_ENABLE = 1 << 6,
461 TRACE_DISABLE = 2 << 6, 477 TRACE_DISABLE = 2 << 6,
462 TRACE_OVERRIDE = 3 << 6 478 TRACE_OVERRIDE = 3 << 6
463 }; 479 };
464 480
465 481
466 } } // namespace v8::internal 482 } } // namespace v8::internal
467 483
468 484
469 #endif // V8_A64_INSTRUCTIONS_A64_H_ 485 #endif // V8_A64_INSTRUCTIONS_A64_H_
OLDNEW
« no previous file with comments | « src/a64/frames-a64.h ('k') | src/a64/instructions-a64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698