Build with spidermonkey-tip by default. Remove codepaths for old SpiderMonkey.

This was SVN commit r7366.
This commit is contained in:
Ykkrosh 2010-03-19 20:54:44 +00:00
parent e7e8b8dbc3
commit ed69187450
8 changed files with 4 additions and 82 deletions

View File

@ -149,15 +149,6 @@ extern_lib_defs = {
end
end,
},
nspr = {
-- On windows, this is somehow baked into the js library (ask philip)
-- but on unix we need to explicitly include this (it's used by libjs).
add_func = function()
if OS ~= "windows" then
pkgconfig("nspr")
end
end,
},
openal = {
win_names = { "openal32" },
unix_names = { "openal" },
@ -178,9 +169,7 @@ extern_lib_defs = {
end
end
},
spidermonkey =
options["with-spidermonkey-tip"] and
{
spidermonkey = {
add_func = function()
if OS == "windows" then
include_dir = "include-win32"
@ -195,13 +184,6 @@ extern_lib_defs = {
tinsert(package.config["Testing"].links, "mozjs-ps-release")
tinsert(package.config["Release"].links, "mozjs-ps-release")
end,
}
or -- SpiderMonkey 1.6
{
win_names = { "js32" },
unix_names = { "js" },
depends = { "nspr" },
defines = { "JS_THREADSAFE" },
},
valgrind = {
},

View File

@ -7,7 +7,6 @@ addoption("outpath", "Location for generated project files")
addoption("without-tests", "Disable generation of test projects")
addoption("without-pch", "Disable generation and usage of precompiled headers")
addoption("with-valgrind", "Enable using valgrind for debugging functionality")
addoption("with-spidermonkey-tip", "Use SpiderMonkey from mozilla-central tip instead of the 1.6 release")
use_dcdt = false -- disable it since it's a non-Free library

View File

@ -11,7 +11,7 @@ cd "$(dirname $0)"
# Build/update bundled external libraries
(cd ../../libraries/fcollada/src && make) || die "FCollada build failed"
(cd ../../libraries/spidermonkey/src && ./build.sh) || die "SpiderMonkey build failed"
(cd ../../libraries/spidermonkey-tip && ./build.sh) || die "SpiderMonkey build failed"
# Make sure workspaces/gcc exists.
mkdir -p gcc

View File

@ -27,12 +27,6 @@
#include "js/jspubtd.h"
#if JS_VERSION <= 160
// 1.6 doesn't support the standards-conforming globals behaviour,
// so we can't use this flag there
# define JSCLASS_GLOBAL_FLAGS 0
#endif
class ScriptInterface;
class CScriptVal;

View File

@ -83,15 +83,9 @@ public:
roundtrip<i32>(1073741822, "1073741822"); // JSVAL_INT_MAX-1
roundtrip<i32>(1073741823, "1073741823"); // JSVAL_INT_MAX
roundtrip<i32>(1073741824, "1073741824"); // JSVAL_INT_MAX+1
#if JS_VERSION >= 180
roundtrip<i32>(-1073741823, "-1073741823"); // JSVAL_INT_MIN+1
roundtrip<i32>(-1073741824, "-1073741824"); // JSVAL_INT_MIN
roundtrip<i32>(-1073741825, "-1073741825"); // JSVAL_INT_MIN-1
#else
roundtrip<i32>(-1073741822, "-1073741822"); // JSVAL_INT_MIN+1
roundtrip<i32>(-1073741823, "-1073741823"); // JSVAL_INT_MIN
roundtrip<i32>(-1073741824, "-1073741824"); // JSVAL_INT_MIN-1
#endif
roundtrip<u32>(0, "0");
roundtrip<u32>(123, "123");
@ -107,20 +101,12 @@ public:
roundtrip<std::string>("", "\"\"");
roundtrip<std::string>("test", "\"test\"");
#if JS_VERSION >= 180
roundtrip<std::string>(s1, "\"t\\0st\"");
#else
roundtrip<std::string>(s1, "\"t\\x00st\"");
#endif
// TODO: should test non-ASCII strings
roundtrip<std::wstring>(L"", "\"\"");
roundtrip<std::wstring>(L"test", "\"test\"");
#if JS_VERSION >= 180
roundtrip<std::wstring>(w1, "\"t\\0st\"");
#else
roundtrip<std::wstring>(w1, "\"t\\x00st\"");
#endif
// TODO: should test non-ASCII strings
convert_to<const char*>("", "\"\"");
@ -143,15 +129,9 @@ public:
TS_ASSERT(JSVAL_IS_INT(ScriptInterface::ToJSVal<i32>(cx, 1073741822))); // JSVAL_INT_MAX-1
TS_ASSERT(JSVAL_IS_INT(ScriptInterface::ToJSVal<i32>(cx, 1073741823))); // JSVAL_INT_MAX
TS_ASSERT(JSVAL_IS_DOUBLE(ScriptInterface::ToJSVal<i32>(cx, 1073741824))); // JSVAL_INT_MAX+1
#if JS_VERSION >= 180
TS_ASSERT(JSVAL_IS_INT(ScriptInterface::ToJSVal<i32>(cx, -1073741823))); // JSVAL_INT_MIN+1
TS_ASSERT(JSVAL_IS_INT(ScriptInterface::ToJSVal<i32>(cx, -1073741824))); // JSVAL_INT_MIN
TS_ASSERT(JSVAL_IS_DOUBLE(ScriptInterface::ToJSVal<i32>(cx, -1073741825))); // JSVAL_INT_MIN-1
#else
TS_ASSERT(JSVAL_IS_INT(ScriptInterface::ToJSVal<i32>(cx, -1073741822))); // JSVAL_INT_MIN+1
TS_ASSERT(JSVAL_IS_INT(ScriptInterface::ToJSVal<i32>(cx, -1073741823))); // JSVAL_INT_MIN
TS_ASSERT(JSVAL_IS_DOUBLE(ScriptInterface::ToJSVal<i32>(cx, -1073741824))); // JSVAL_INT_MIN-1
#endif
TS_ASSERT(JSVAL_IS_INT(ScriptInterface::ToJSVal<u32>(cx, 0)));

View File

@ -312,14 +312,10 @@ public:
{
TestLogger log;
TS_ASSERT(man.LoadScript(L"simulation/components/error.js"));
#if JS_VERSION >= 180
// In SpiderMonkey 1.6, JS_ReportError calls the error reporter even if it's inside
// a try{} in the script; in recent versions (not sure when it changed) it doesn't
// so the error here won't get reported.
TS_ASSERT_WSTR_NOT_CONTAINS(log.GetOutput(), L"ERROR: JavaScript error: simulation/components/error.js line 4\nInvalid interface id");
#else
TS_ASSERT_WSTR_CONTAINS(log.GetOutput(), L"ERROR: JavaScript error: simulation/components/error.js line 4\nInvalid interface id");
#endif
}
}

View File

@ -245,17 +245,11 @@ public:
CScriptVal obj;
TS_ASSERT(script.Eval("({'x': 123, 'y': [1, 1.5, '2', 'test', undefined, null, true, false]})", obj));
#if JS_VERSION >= 180
#define STR_JS_UNDEFINED "(void 0)"
#else
#define STR_JS_UNDEFINED "undefined"
#endif
{
std::stringstream stream;
CDebugSerializer serialize(script, stream);
serialize.ScriptVal("script", obj);
TS_ASSERT_STR_EQUALS(stream.str(), "script: ({x:123, y:[1, 1.5, \"2\", \"test\", " STR_JS_UNDEFINED ", null, true, false]})\n");
TS_ASSERT_STR_EQUALS(stream.str(), "script: ({x:123, y:[1, 1.5, \"2\", \"test\", (void 0), null, true, false]})\n");
}
{
@ -300,7 +294,7 @@ public:
std::string source;
TS_ASSERT(script.CallFunction(newobj, "toSource", source));
TS_ASSERT_STR_EQUALS(source, "({x:123, y:[1, 1.5, \"2\", \"test\", " STR_JS_UNDEFINED ", null, true, false]})");
TS_ASSERT_STR_EQUALS(source, "({x:123, y:[1, 1.5, \"2\", \"test\", (void 0), null, true, false]})");
}
}
@ -367,28 +361,17 @@ public:
const char stream[] = "\x02" // SCRIPT_TYPE_ARRAY
"\x04\0\0\0" // num props
"\x01\0\0\0" "0" // "0"
#if JS_VERSION >= 180
"\x05" "\x00\0\0\xC0" // SCRIPT_TYPE_INT -1073741824 (JS_INT_MIN)
"\x01\0\0\0" "1" // "1"
"\x06" "\0\0\x40\0\0\0\xD0\xC1" // SCRIPT_TYPE_DOUBLE -1073741825 (JS_INT_MIN-1)
#else
"\x05" "\x01\0\0\xC0" // SCRIPT_TYPE_INT -1073741823 (JS_INT_MIN)
"\x01\0\0\0" "1" // "1"
"\x06" "\0\0\0\0\0\0\xD0\xC1" // SCRIPT_TYPE_DOUBLE -1073741824 (JS_INT_MIN-1)
#endif
"\x01\0\0\0" "2" // "2"
"\x05" "\xFF\xFF\xFF\x3F" // SCRIPT_TYPE_INT 1073741823
"\x01\0\0\0" "3" // "3"
"\x06" "\0\0\0\0\0\0\xD0\x41" // SCRIPT_TYPE_DOUBLE 1073741824
;
#if JS_VERSION >= 180
helper_script_roundtrip("numbers", "[-1073741824, -1073741825, 1.073741823e+9, 1073741824]",
"[-1073741824, -1073741825, 1073741823, 1073741824]", sizeof(stream) - 1, stream);
#else
helper_script_roundtrip("numbers", "[-1073741823, -1073741824, 1.073741823e+9, 1073741824]",
"[-1073741823, -1073741824, 1073741823, 1073741824]", sizeof(stream) - 1, stream);
#endif
}
void test_script_exceptions()

View File

@ -26,18 +26,6 @@
#include "js/jspubtd.h"
#ifndef JS_THREADSAFE
#error The editor requires a threadsafe version of SpiderMonkey. Something in the build system is broken if you see this error.
#endif
// (There are a few places where SM really needs to be told to be threadsafe, even
// though we're not actually sharing runtimes between threads.)
#if JS_VERSION <= 160
// 1.6 doesn't support the standards-conforming globals behaviour,
// so we can't use this flag there
# define JSCLASS_GLOBAL_FLAGS 0
#endif
class wxWindow;
class wxString;
class wxPanel;