From d840ed11d9fa9f38676e6edcee93ed749afb284d Mon Sep 17 00:00:00 2001 From: hablich Date: Sat, 21 Jan 2017 14:36:54 -0800 Subject: [PATCH] Revert of [build] Introduce an embedder version string (patchset #3 id:40001 of https://codereview.chromium.org/2619213002/ ) Reason for revert: Blocks roll https://codereview.chromium.org/2647183002/ Original issue's description: > [build] Introduce an embedder version string > > Sometimes, the embedder might want to merge a fix to an abandoned branch > or to a supported branch but the fix is not relevant to Chromium. > This adds a new version string that the embedder can set on compile time > and that will be appended to the official V8 version. > The separator must be provided in the string. For instance, to have a > full version string like "5.5.372.37.custom.1", the embedder must set > V8_EMBEDDER_STRING to ".custom.1". > > Related Node.js issue: https://github.com/nodejs/node/pull/9754 > > BUG=v8:5740 > R=machenbach@chromium.org,hablich@chromium.com,ofrobots@google.com > > CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_chromium_rel_ng > > Review-Url: https://codereview.chromium.org/2619213002 > Cr-Original-Commit-Position: refs/heads/master@{#42175} > Committed: https://chromium.googlesource.com/v8/v8/+/fc86d4329b253bf21c1dd85469f1ef4b6e5ba01a > Review-Url: https://codereview.chromium.org/2619213002 > Cr-Commit-Position: refs/heads/master@{#42582} > Committed: https://chromium.googlesource.com/v8/v8/+/2c1d1e60883882011ed50310a9b09e95dc61234a TBR=hablich@chromium.com,machenbach@chromium.org,ofrobots@google.com,mic.besace@gmail.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=v8:5740 Review-Url: https://codereview.chromium.org/2643393004 Cr-Commit-Position: refs/heads/master@{#42583} --- BUILD.gn | 7 ---- gypfiles/features.gypi | 6 ---- include/v8-version-string.h | 2 +- include/v8-version.h | 4 --- src/log-utils.cc | 13 ++----- src/version.cc | 10 +++--- src/version.h | 5 +-- test/cctest/test-version.cc | 71 ++++++++++++++++--------------------- 8 files changed, 41 insertions(+), 77 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 7197da08e02d..2f065a0504bc 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -29,9 +29,6 @@ declare_args() { # Enable compiler warnings when using V8_DEPRECATED apis. v8_deprecation_warnings = false - # Allow the embedder to add a custom suffix to the version string. - v8_embedder_string = "" - # Enable compiler warnings when using V8_DEPRECATE_SOON apis. v8_imminent_deprecation_warnings = "" @@ -192,10 +189,6 @@ config("features") { defines = [] - if (v8_embedder_string != "") { - defines += [ "V8_EMBEDDER_STRING=\"$v8_embedder_string\"" ] - } - if (v8_enable_disassembler) { defines += [ "ENABLE_DISASSEMBLER" ] } diff --git a/gypfiles/features.gypi b/gypfiles/features.gypi index 4669fcf8bad8..f82a59f0f82f 100644 --- a/gypfiles/features.gypi +++ b/gypfiles/features.gypi @@ -64,9 +64,6 @@ # Enable compiler warnings when using V8_DEPRECATE_SOON apis. 'v8_imminent_deprecation_warnings%': 0, - # Allow the embedder to add a custom suffix to the version string. - 'v8_embedder_string%': '', - # Set to 1 to enable DCHECKs in release builds. 'dcheck_always_on%': 0, @@ -108,9 +105,6 @@ ['v8_use_snapshot=="true" and v8_use_external_startup_data==1', { 'defines': ['V8_USE_EXTERNAL_STARTUP_DATA',], }], - ['v8_embedder_string!=""', { - 'defines': ['V8_EMBEDDER_STRING="<(v8_embedder_string)"',], - }], ['dcheck_always_on!=0', { 'defines': ['DEBUG',], }], diff --git a/include/v8-version-string.h b/include/v8-version-string.h index 55aff06dcd51..075282de4ca0 100644 --- a/include/v8-version-string.h +++ b/include/v8-version-string.h @@ -23,7 +23,7 @@ #define V8_VERSION_STRING \ V8_S(V8_MAJOR_VERSION) \ "." V8_S(V8_MINOR_VERSION) "." V8_S(V8_BUILD_NUMBER) "." V8_S( \ - V8_PATCH_LEVEL) V8_EMBEDDER_STRING V8_CANDIDATE_STRING + V8_PATCH_LEVEL) V8_CANDIDATE_STRING #else #define V8_VERSION_STRING \ V8_S(V8_MAJOR_VERSION) \ diff --git a/include/v8-version.h b/include/v8-version.h index 5a42674a2e97..86611251330f 100644 --- a/include/v8-version.h +++ b/include/v8-version.h @@ -13,10 +13,6 @@ #define V8_BUILD_NUMBER 0 #define V8_PATCH_LEVEL 0 -#ifndef V8_EMBEDDER_STRING -#define V8_EMBEDDER_STRING "" -#endif // V8_EMBEDDER_STRING - // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) #define V8_IS_CANDIDATE_VERSION 1 diff --git a/src/log-utils.cc b/src/log-utils.cc index 970e7965f097..462f83f53453 100644 --- a/src/log-utils.cc +++ b/src/log-utils.cc @@ -55,16 +55,9 @@ void Log::Initialize(const char* log_file_name) { if (output_handle_ != nullptr) { Log::MessageBuilder msg(this); - if (strlen(Version::GetEmbedder()) == 0) { - msg.Append("v8-version,%d,%d,%d,%d,%d", Version::GetMajor(), - Version::GetMinor(), Version::GetBuild(), - Version::GetPatch(), Version::IsCandidate()); - } else { - msg.Append("v8-version,%d,%d,%d,%d,%s,%d", Version::GetMajor(), - Version::GetMinor(), Version::GetBuild(), - Version::GetPatch(), Version::GetEmbedder(), - Version::IsCandidate()); - } + msg.Append("v8-version,%d,%d,%d,%d,%d", Version::GetMajor(), + Version::GetMinor(), Version::GetBuild(), Version::GetPatch(), + Version::IsCandidate()); msg.WriteToLogFile(); } } diff --git a/src/version.cc b/src/version.cc index 18497bc48d78..3252d550354e 100644 --- a/src/version.cc +++ b/src/version.cc @@ -20,7 +20,6 @@ int Version::major_ = V8_MAJOR_VERSION; int Version::minor_ = V8_MINOR_VERSION; int Version::build_ = V8_BUILD_NUMBER; int Version::patch_ = V8_PATCH_LEVEL; -const char* Version::embedder_ = V8_EMBEDDER_STRING; bool Version::candidate_ = (V8_IS_CANDIDATE_VERSION != 0); const char* Version::soname_ = SONAME; const char* Version::version_string_ = V8_VERSION_STRING; @@ -34,8 +33,9 @@ void Version::GetString(Vector str) { const char* is_simulator = ""; #endif // USE_SIMULATOR if (GetPatch() > 0) { - SNPrintF(str, "%d.%d.%d.%d%s%s%s", GetMajor(), GetMinor(), GetBuild(), - GetPatch(), GetEmbedder(), candidate, is_simulator); + SNPrintF(str, "%d.%d.%d.%d%s%s", + GetMajor(), GetMinor(), GetBuild(), GetPatch(), candidate, + is_simulator); } else { SNPrintF(str, "%d.%d.%d%s%s", GetMajor(), GetMinor(), GetBuild(), candidate, @@ -50,8 +50,8 @@ void Version::GetSONAME(Vector str) { // Generate generic SONAME if no specific SONAME is defined. const char* candidate = IsCandidate() ? "-candidate" : ""; if (GetPatch() > 0) { - SNPrintF(str, "libv8-%d.%d.%d.%d%s%s.so", GetMajor(), GetMinor(), - GetBuild(), GetPatch(), GetEmbedder(), candidate); + SNPrintF(str, "libv8-%d.%d.%d.%d%s.so", + GetMajor(), GetMinor(), GetBuild(), GetPatch(), candidate); } else { SNPrintF(str, "libv8-%d.%d.%d%s.so", GetMajor(), GetMinor(), GetBuild(), candidate); diff --git a/src/version.h b/src/version.h index 20d9c71fe766..3395d7f4fe55 100644 --- a/src/version.h +++ b/src/version.h @@ -18,7 +18,6 @@ class Version { static int GetMinor() { return minor_; } static int GetBuild() { return build_; } static int GetPatch() { return patch_; } - static const char* GetEmbedder() { return embedder_; } static bool IsCandidate() { return candidate_; } static uint32_t Hash() { return static_cast( @@ -39,15 +38,13 @@ class Version { static int minor_; static int build_; static int patch_; - static const char* embedder_; static bool candidate_; static const char* soname_; static const char* version_string_; // In test-version.cc. friend void SetVersion(int major, int minor, int build, int patch, - const char* embedder, bool candidate, - const char* soname); + bool candidate, const char* soname); }; } // namespace internal diff --git a/test/cctest/test-version.cc b/test/cctest/test-version.cc index 464505e5c957..50fca16871a3 100644 --- a/test/cctest/test-version.cc +++ b/test/cctest/test-version.cc @@ -37,12 +37,11 @@ namespace v8 { namespace internal { void SetVersion(int major, int minor, int build, int patch, - const char* embedder, bool candidate, const char* soname) { + bool candidate, const char* soname) { Version::major_ = major; Version::minor_ = minor; Version::build_ = build; Version::patch_ = patch; - Version::embedder_ = embedder; Version::candidate_ = candidate; Version::soname_ = soname; } @@ -50,14 +49,16 @@ void SetVersion(int major, int minor, int build, int patch, } // namespace internal } // namespace v8 -static void CheckVersion(int major, int minor, int build, int patch, - const char* embedder, bool candidate, + +static void CheckVersion(int major, int minor, int build, + int patch, bool candidate, const char* expected_version_string, const char* expected_generic_soname) { static v8::internal::EmbeddedVector version_str; static v8::internal::EmbeddedVector soname_str; + // Test version without specific SONAME. - SetVersion(major, minor, build, patch, embedder, candidate, ""); + SetVersion(major, minor, build, patch, candidate, ""); Version::GetString(version_str); CHECK_EQ(0, strcmp(expected_version_string, version_str.start())); Version::GetSONAME(soname_str); @@ -65,7 +66,7 @@ static void CheckVersion(int major, int minor, int build, int patch, // Test version with specific SONAME. const char* soname = "libv8.so.1"; - SetVersion(major, minor, build, patch, embedder, candidate, soname); + SetVersion(major, minor, build, patch, candidate, soname); Version::GetString(version_str); CHECK_EQ(0, strcmp(expected_version_string, version_str.start())); Version::GetSONAME(soname_str); @@ -75,40 +76,30 @@ static void CheckVersion(int major, int minor, int build, int patch, TEST(VersionString) { #ifdef USE_SIMULATOR - CheckVersion(0, 0, 0, 0, "", false, "0.0.0 SIMULATOR", "libv8-0.0.0.so"); - CheckVersion(0, 0, 0, 0, "", true, "0.0.0 (candidate) SIMULATOR", - "libv8-0.0.0-candidate.so"); - CheckVersion(1, 0, 0, 0, "", false, "1.0.0 SIMULATOR", "libv8-1.0.0.so"); - CheckVersion(1, 0, 0, 0, "", true, "1.0.0 (candidate) SIMULATOR", - "libv8-1.0.0-candidate.so"); - CheckVersion(1, 0, 0, 1, "", false, "1.0.0.1 SIMULATOR", "libv8-1.0.0.1.so"); - CheckVersion(1, 0, 0, 1, "", true, "1.0.0.1 (candidate) SIMULATOR", - "libv8-1.0.0.1-candidate.so"); - CheckVersion(2, 5, 10, 7, "", false, "2.5.10.7 SIMULATOR", - "libv8-2.5.10.7.so"); - CheckVersion(2, 5, 10, 7, "", true, "2.5.10.7 (candidate) SIMULATOR", - "libv8-2.5.10.7-candidate.so"); - CheckVersion(2, 5, 10, 7, ".emb.1", false, "2.5.10.7.emb.1 SIMULATOR", - "libv8-2.5.10.7.emb.1.so"); - CheckVersion(2, 5, 10, 7, ".emb.1", true, - "2.5.10.7.emb.1 (candidate) SIMULATOR", - "libv8-2.5.10.7.emb.1-candidate.so"); + CheckVersion(0, 0, 0, 0, false, "0.0.0 SIMULATOR", "libv8-0.0.0.so"); + CheckVersion(0, 0, 0, 0, true, + "0.0.0 (candidate) SIMULATOR", "libv8-0.0.0-candidate.so"); + CheckVersion(1, 0, 0, 0, false, "1.0.0 SIMULATOR", "libv8-1.0.0.so"); + CheckVersion(1, 0, 0, 0, true, + "1.0.0 (candidate) SIMULATOR", "libv8-1.0.0-candidate.so"); + CheckVersion(1, 0, 0, 1, false, "1.0.0.1 SIMULATOR", "libv8-1.0.0.1.so"); + CheckVersion(1, 0, 0, 1, true, + "1.0.0.1 (candidate) SIMULATOR", "libv8-1.0.0.1-candidate.so"); + CheckVersion(2, 5, 10, 7, false, "2.5.10.7 SIMULATOR", "libv8-2.5.10.7.so"); + CheckVersion(2, 5, 10, 7, true, + "2.5.10.7 (candidate) SIMULATOR", "libv8-2.5.10.7-candidate.so"); #else - CheckVersion(0, 0, 0, 0, "", false, "0.0.0", "libv8-0.0.0.so"); - CheckVersion(0, 0, 0, 0, "", true, "0.0.0 (candidate)", - "libv8-0.0.0-candidate.so"); - CheckVersion(1, 0, 0, 0, "", false, "1.0.0", "libv8-1.0.0.so"); - CheckVersion(1, 0, 0, 0, "", true, "1.0.0 (candidate)", - "libv8-1.0.0-candidate.so"); - CheckVersion(1, 0, 0, 1, "", false, "1.0.0.1", "libv8-1.0.0.1.so"); - CheckVersion(1, 0, 0, 1, "", true, "1.0.0.1 (candidate)", - "libv8-1.0.0.1-candidate.so"); - CheckVersion(2, 5, 10, 7, "", false, "2.5.10.7", "libv8-2.5.10.7.so"); - CheckVersion(2, 5, 10, 7, "", true, "2.5.10.7 (candidate)", - "libv8-2.5.10.7-candidate.so"); - CheckVersion(2, 5, 10, 7, ".emb.1", false, "2.5.10.7.emb.1", - "libv8-2.5.10.7.emb.1.so"); - CheckVersion(2, 5, 10, 7, ".emb.1", true, "2.5.10.7.emb.1 (candidate)", - "libv8-2.5.10.7.emb.1-candidate.so"); + CheckVersion(0, 0, 0, 0, false, "0.0.0", "libv8-0.0.0.so"); + CheckVersion(0, 0, 0, 0, true, + "0.0.0 (candidate)", "libv8-0.0.0-candidate.so"); + CheckVersion(1, 0, 0, 0, false, "1.0.0", "libv8-1.0.0.so"); + CheckVersion(1, 0, 0, 0, true, + "1.0.0 (candidate)", "libv8-1.0.0-candidate.so"); + CheckVersion(1, 0, 0, 1, false, "1.0.0.1", "libv8-1.0.0.1.so"); + CheckVersion(1, 0, 0, 1, true, + "1.0.0.1 (candidate)", "libv8-1.0.0.1-candidate.so"); + CheckVersion(2, 5, 10, 7, false, "2.5.10.7", "libv8-2.5.10.7.so"); + CheckVersion(2, 5, 10, 7, true, + "2.5.10.7 (candidate)", "libv8-2.5.10.7-candidate.so"); #endif }