OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 #ifndef V8_VERSION_H_ | 5 #ifndef V8_VERSION_H_ |
6 #define V8_VERSION_H_ | 6 #define V8_VERSION_H_ |
7 | 7 |
| 8 #include "src/base/functional.h" |
| 9 |
8 namespace v8 { | 10 namespace v8 { |
9 namespace internal { | 11 namespace internal { |
10 | 12 |
11 class Version { | 13 class Version { |
12 public: | 14 public: |
13 // Return the various version components. | 15 // Return the various version components. |
14 static int GetMajor() { return major_; } | 16 static int GetMajor() { return major_; } |
15 static int GetMinor() { return minor_; } | 17 static int GetMinor() { return minor_; } |
16 static int GetBuild() { return build_; } | 18 static int GetBuild() { return build_; } |
17 static int GetPatch() { return patch_; } | 19 static int GetPatch() { return patch_; } |
18 static bool IsCandidate() { return candidate_; } | 20 static bool IsCandidate() { return candidate_; } |
19 static int Hash() { return (major_ << 20) ^ (minor_ << 10) ^ patch_; } | 21 static int Hash() { |
| 22 return static_cast<int>(base::hash_combine(major_, minor_, build_, patch_)); |
| 23 } |
20 | 24 |
21 // Calculate the V8 version string. | 25 // Calculate the V8 version string. |
22 static void GetString(Vector<char> str); | 26 static void GetString(Vector<char> str); |
23 | 27 |
24 // Calculate the SONAME for the V8 shared library. | 28 // Calculate the SONAME for the V8 shared library. |
25 static void GetSONAME(Vector<char> str); | 29 static void GetSONAME(Vector<char> str); |
26 | 30 |
27 static const char* GetVersion() { return version_string_; } | 31 static const char* GetVersion() { return version_string_; } |
28 | 32 |
29 private: | 33 private: |
30 // NOTE: can't make these really const because of test-version.cc. | 34 // NOTE: can't make these really const because of test-version.cc. |
31 static int major_; | 35 static int major_; |
32 static int minor_; | 36 static int minor_; |
33 static int build_; | 37 static int build_; |
34 static int patch_; | 38 static int patch_; |
35 static bool candidate_; | 39 static bool candidate_; |
36 static const char* soname_; | 40 static const char* soname_; |
37 static const char* version_string_; | 41 static const char* version_string_; |
38 | 42 |
39 // In test-version.cc. | 43 // In test-version.cc. |
40 friend void SetVersion(int major, int minor, int build, int patch, | 44 friend void SetVersion(int major, int minor, int build, int patch, |
41 bool candidate, const char* soname); | 45 bool candidate, const char* soname); |
42 }; | 46 }; |
43 | 47 |
44 } } // namespace v8::internal | 48 } } // namespace v8::internal |
45 | 49 |
46 #endif // V8_VERSION_H_ | 50 #endif // V8_VERSION_H_ |
OLD | NEW |