summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2017-10-18 09:27:07 -0700
committerMichaël Zasso <targos@protonmail.com>2017-10-18 17:04:24 -0700
commit2780f01392a43a0714d7f5c871eb73c04f4551e8 (patch)
treec6b19a5eb8cec0243a46298508d54b9b718ade42
parent33b2b10b687aff47f689f7bd9a92bd1816de8650 (diff)
downloadandroid-node-v8-2780f01392a43a0714d7f5c871eb73c04f4551e8.tar.gz
android-node-v8-2780f01392a43a0714d7f5c871eb73c04f4551e8.tar.bz2
android-node-v8-2780f01392a43a0714d7f5c871eb73c04f4551e8.zip
deps: backport b096c44 from upstream V8
Original commit message: [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 at 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 "6.0.287.53-emb.1", the embedder must set V8_EMBEDDER_STRING to "-emb.1". Related Node.js issue: https://github.com/nodejs/node/pull/9754 BUG=v8:5740 R=machenbach@chromium.org Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng Change-Id: Ifa2d9bd213795e6d54886436f8c3787ac6162823 Reviewed-on: https://chromium-review.googlesource.com/690475 Reviewed-by: Michael Achenbach <machenbach@chromium.org> Reviewed-by: Yang Guo <yangguo@chromium.org> Commit-Queue: Michaël Zasso <mic.besace@gmail.com> Cr-Commit-Position: refs/heads/master@{#48301} Refs: https://github.com/v8/v8/commit/b096c44ffc32d84979bd2ea64ddfd08d643581ff PR-URL: https://github.com/nodejs/node/pull/15785 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
-rw-r--r--deps/v8/BUILD.gn6
-rw-r--r--deps/v8/gypfiles/features.gypi6
-rw-r--r--deps/v8/include/v8-version-string.h6
-rw-r--r--deps/v8/src/log-utils.cc13
-rw-r--r--deps/v8/src/version.cc19
-rw-r--r--deps/v8/src/version.h5
-rw-r--r--deps/v8/test/cctest/test-version.cc51
7 files changed, 75 insertions, 31 deletions
diff --git a/deps/v8/BUILD.gn b/deps/v8/BUILD.gn
index deedf82d11..17759e1fbd 100644
--- a/deps/v8/BUILD.gn
+++ b/deps/v8/BUILD.gn
@@ -40,6 +40,9 @@ declare_args() {
# Embeds the given script into the snapshot.
v8_embed_script = ""
+ # Allows the embedder to add a custom suffix to the version string.
+ v8_embedder_string = ""
+
# Sets -dENABLE_DISASSEMBLER.
v8_enable_disassembler = ""
@@ -224,6 +227,9 @@ config("features") {
defines = []
+ if (v8_embedder_string != "") {
+ defines += [ "V8_EMBEDDER_STRING=\"$v8_embedder_string\"" ]
+ }
if (v8_enable_disassembler) {
defines += [ "ENABLE_DISASSEMBLER" ]
}
diff --git a/deps/v8/gypfiles/features.gypi b/deps/v8/gypfiles/features.gypi
index 55b250ddc1..6b0b293db6 100644
--- a/deps/v8/gypfiles/features.gypi
+++ b/deps/v8/gypfiles/features.gypi
@@ -33,6 +33,9 @@
'v8_target_arch%': '<(target_arch)',
},
+ # Allows the embedder to add a custom suffix to the version string.
+ 'v8_embedder_string%': '',
+
'v8_enable_disassembler%': 0,
'v8_promise_internal_field_count%': 0,
@@ -86,6 +89,9 @@
},
'target_defaults': {
'conditions': [
+ ['v8_embedder_string!=""', {
+ 'defines': ['V8_EMBEDDER_STRING="<(v8_embedder_string)"',],
+ }],
['v8_enable_disassembler==1', {
'defines': ['ENABLE_DISASSEMBLER',],
}],
diff --git a/deps/v8/include/v8-version-string.h b/deps/v8/include/v8-version-string.h
index 075282de4c..eab0934804 100644
--- a/deps/v8/include/v8-version-string.h
+++ b/deps/v8/include/v8-version-string.h
@@ -16,6 +16,10 @@
#define V8_CANDIDATE_STRING ""
#endif
+#ifndef V8_EMBEDDER_STRING
+#define V8_EMBEDDER_STRING ""
+#endif
+
#define V8_SX(x) #x
#define V8_S(x) V8_SX(x)
@@ -23,7 +27,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_CANDIDATE_STRING
+ V8_PATCH_LEVEL) V8_EMBEDDER_STRING V8_CANDIDATE_STRING
#else
#define V8_VERSION_STRING \
V8_S(V8_MAJOR_VERSION) \
diff --git a/deps/v8/src/log-utils.cc b/deps/v8/src/log-utils.cc
index bb2a82f17b..82d24a111e 100644
--- a/deps/v8/src/log-utils.cc
+++ b/deps/v8/src/log-utils.cc
@@ -52,9 +52,16 @@ void Log::Initialize(const char* log_file_name) {
if (output_handle_ != nullptr) {
Log::MessageBuilder msg(this);
- msg.Append("v8-version,%d,%d,%d,%d,%d", Version::GetMajor(),
- Version::GetMinor(), Version::GetBuild(), Version::GetPatch(),
- Version::IsCandidate());
+ 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.WriteToLogFile();
}
}
diff --git a/deps/v8/src/version.cc b/deps/v8/src/version.cc
index 3252d55035..b050fc9ab5 100644
--- a/deps/v8/src/version.cc
+++ b/deps/v8/src/version.cc
@@ -20,6 +20,7 @@ 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;
@@ -33,12 +34,12 @@ void Version::GetString(Vector<char> str) {
const char* is_simulator = "";
#endif // USE_SIMULATOR
if (GetPatch() > 0) {
- SNPrintF(str, "%d.%d.%d.%d%s%s",
- GetMajor(), GetMinor(), GetBuild(), GetPatch(), candidate,
- is_simulator);
+ SNPrintF(str, "%d.%d.%d.%d%s%s%s",
+ GetMajor(), GetMinor(), GetBuild(), GetPatch(), GetEmbedder(),
+ candidate, is_simulator);
} else {
- SNPrintF(str, "%d.%d.%d%s%s",
- GetMajor(), GetMinor(), GetBuild(), candidate,
+ SNPrintF(str, "%d.%d.%d%s%s%s",
+ GetMajor(), GetMinor(), GetBuild(), GetEmbedder(), candidate,
is_simulator);
}
}
@@ -50,11 +51,11 @@ void Version::GetSONAME(Vector<char> 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.so",
- GetMajor(), GetMinor(), GetBuild(), GetPatch(), candidate);
+ SNPrintF(str, "libv8-%d.%d.%d.%d%s%s.so", GetMajor(), GetMinor(),
+ GetBuild(), GetPatch(), GetEmbedder(), candidate);
} else {
- SNPrintF(str, "libv8-%d.%d.%d%s.so",
- GetMajor(), GetMinor(), GetBuild(), candidate);
+ SNPrintF(str, "libv8-%d.%d.%d%s%s.so", GetMajor(), GetMinor(), GetBuild(),
+ GetEmbedder(), candidate);
}
} else {
// Use specific SONAME.
diff --git a/deps/v8/src/version.h b/deps/v8/src/version.h
index 3395d7f4fe..20d9c71fe7 100644
--- a/deps/v8/src/version.h
+++ b/deps/v8/src/version.h
@@ -18,6 +18,7 @@ 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<uint32_t>(
@@ -38,13 +39,15 @@ 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,
- bool candidate, const char* soname);
+ const char* embedder, bool candidate,
+ const char* soname);
};
} // namespace internal
diff --git a/deps/v8/test/cctest/test-version.cc b/deps/v8/test/cctest/test-version.cc
index 2c51af0ae6..78bc81a7e8 100644
--- a/deps/v8/test/cctest/test-version.cc
+++ b/deps/v8/test/cctest/test-version.cc
@@ -35,24 +35,25 @@ namespace v8 {
namespace internal {
void SetVersion(int major, int minor, int build, int patch,
- bool candidate, const char* soname) {
+ const char* embedder, 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;
}
-static void CheckVersion(int major, int minor, int build,
- int patch, bool candidate,
+static void CheckVersion(int major, int minor, int build, int patch,
+ const char* embedder, bool candidate,
const char* expected_version_string,
const char* expected_generic_soname) {
static v8::internal::EmbeddedVector<char, 128> version_str;
static v8::internal::EmbeddedVector<char, 128> soname_str;
// Test version without specific SONAME.
- SetVersion(major, minor, build, patch, candidate, "");
+ SetVersion(major, minor, build, patch, embedder, candidate, "");
Version::GetString(version_str);
CHECK_EQ(0, strcmp(expected_version_string, version_str.start()));
Version::GetSONAME(soname_str);
@@ -60,7 +61,7 @@ static void CheckVersion(int major, int minor, int build,
// Test version with specific SONAME.
const char* soname = "libv8.so.1";
- SetVersion(major, minor, build, patch, candidate, soname);
+ SetVersion(major, minor, build, patch, embedder, candidate, soname);
Version::GetString(version_str);
CHECK_EQ(0, strcmp(expected_version_string, version_str.start()));
Version::GetSONAME(soname_str);
@@ -82,19 +83,35 @@ TEST(VersionString) {
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(6, 0, 287, 0, "-emb.1", false, "6.0.287-emb.1 SIMULATOR",
+ "libv8-6.0.287-emb.1.so");
+ CheckVersion(6, 0, 287, 0, "-emb.1", true, "6.0.287-emb.1 (candidate) SIMULATOR",
+ "libv8-6.0.287-emb.1-candidate.so");
+ CheckVersion(6, 0, 287, 53, "-emb.1", false, "6.0.287.53-emb.1 SIMULATOR",
+ "libv8-6.0.287.53-emb.1.so");
+ CheckVersion(6, 0, 287, 53, "-emb.1", true, "6.0.287.53-emb.1 (candidate) SIMULATOR",
+ "libv8-6.0.287.53-emb.1-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(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(6, 0, 287, 0, "-emb.1", false, "6.0.287-emb.1",
+ "libv8-6.0.287-emb.1.so");
+ CheckVersion(6, 0, 287, 0, "-emb.1", true, "6.0.287-emb.1 (candidate)",
+ "libv8-6.0.287-emb.1-candidate.so");
+ CheckVersion(6, 0, 287, 53, "-emb.1", false, "6.0.287.53-emb.1",
+ "libv8-6.0.287.53-emb.1.so");
+ CheckVersion(6, 0, 287, 53, "-emb.1", true, "6.0.287.53-emb.1 (candidate)",
+ "libv8-6.0.287.53-emb.1-candidate.so");
#endif
}