summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoan Touzet <wohali@apache.org>2021-04-07 18:36:26 -0400
committerJoan Touzet <wohali@apache.org>2021-04-07 19:42:01 -0400
commit15777e8e8a45adb0382eef11d6471f067a69b2ee (patch)
tree22e64acb923c27d10a88a7c81c73ba9c1410b97c
parentca86ae1e74840af0c3dd1b2f31f2cf2eca6eb4f3 (diff)
downloadcouchdb-SM78.tar.gz
Add support for Spidermonkey 78SM78
-rw-r--r--src/couch/rebar.config.script15
-rw-r--r--src/couch/test/eunit/couch_js_tests.erl3
-rw-r--r--support/build_js.escript14
3 files changed, 17 insertions, 15 deletions
diff --git a/src/couch/rebar.config.script b/src/couch/rebar.config.script
index 5c9e6335f..a6d700518 100644
--- a/src/couch/rebar.config.script
+++ b/src/couch/rebar.config.script
@@ -61,6 +61,8 @@ SMVsn = case lists:keyfind(spidermonkey_version, 1, CouchConfig) of
"60";
{_, "68"} ->
"68";
+ {_, "78"} ->
+ "78";
{_, "86"} ->
"86";
undefined ->
@@ -84,7 +86,12 @@ ConfigH = [
{"PACKAGE_VERSION", "\"" ++ Version ++ "\""}
].
-CouchJSConfig = "priv/couch_js/" ++ SMVsn ++ "/config.h".
+CouchJSConfig = case SMVsn of
+ "78" ->
+ "priv/couch_js/86/config.h";
+ _ ->
+ "priv/couch_js/" ++ SMVsn ++ "/config.h"
+end.
ConfigSrc = [["#define ", K, " ", V, $\n] || {K, V} <- ConfigH].
ConfigBin = iolist_to_binary(ConfigSrc).
ok = CopyIfDifferent(CouchJSConfig, ConfigBin).
@@ -132,6 +139,11 @@ end.
"-DXP_UNIX -I/usr/include/mozjs-68 -I/usr/local/include/mozjs-68 -std=c++14 -Wno-invalid-offsetof",
"-L/usr/local/lib -std=c++14 -lmozjs-68 -lm"
};
+ {unix, _} when SMVsn == "78" ->
+ {
+ "-DXP_UNIX -I/usr/include/mozjs-78 -I/usr/local/include/mozjs-78 -std=c++20 -Wno-invalid-offsetof",
+ "-L/usr/local/lib -std=c++20 -lmozjs-78 -lm"
+ };
{unix, _} when SMVsn == "86" ->
{
"-DXP_UNIX -I/usr/include/mozjs-86 -I/usr/local/include/mozjs-86 -I/opt/homebrew/include/mozjs-86/ -std=c++17 -Wno-invalid-offsetof",
@@ -143,6 +155,7 @@ CouchJSSrc = case SMVsn of
"1.8.5" -> ["priv/couch_js/1.8.5/*.c"];
"60" -> ["priv/couch_js/60/*.cpp"];
"68" -> ["priv/couch_js/68/*.cpp"];
+ "78" -> ["priv/couch_js/86/*.cpp"];
"86" -> ["priv/couch_js/86/*.cpp"]
end.
diff --git a/src/couch/test/eunit/couch_js_tests.erl b/src/couch/test/eunit/couch_js_tests.erl
index 693cd9772..c68d60125 100644
--- a/src/couch/test/eunit/couch_js_tests.erl
+++ b/src/couch/test/eunit/couch_js_tests.erl
@@ -150,8 +150,9 @@ should_exit_on_oom() ->
"var state = [];\n"
"function(doc) {\n"
" var val = \"0123456789ABCDEF\";\n"
- " for(var i = 0; i < 165535; i++) {\n"
+ " for(var i = 0; i < 665535; i++) {\n"
" state.push([val, val]);\n"
+ " emit(null, null);\n"
" }\n"
"}\n"
>>,
diff --git a/support/build_js.escript b/support/build_js.escript
index 03d45a7e5..5f1e92015 100644
--- a/support/build_js.escript
+++ b/support/build_js.escript
@@ -65,19 +65,7 @@ main([]) ->
[
"share/server/rewrite_fun.js"
];
- "60" ->
- [
- "share/server/60/esprima.js",
- "share/server/60/escodegen.js",
- "share/server/60/rewrite_fun.js"
- ];
- "68" ->
- [
- "share/server/60/esprima.js",
- "share/server/60/escodegen.js",
- "share/server/60/rewrite_fun.js"
- ];
- "86" ->
+ _ ->
[
"share/server/60/esprima.js",
"share/server/60/escodegen.js",