Commit Graph

315 Commits

Author SHA1 Message Date
9e4f0cc543 Properly shut down SpiderMonkey using JS_ShutDown.
This also adds some validation to ensure the correct order of JS_Init,
JS_NewRuntime, JS_DestroyRuntime and JS_ShutDown calls.

Refs #3708

This was SVN commit r18584.
2016-08-06 15:41:59 +00:00
4e87fef3da The old debug API has been removed in SpiderMonkey 38, so remove profiler1 script profiling.
Patch by leper, refs #3708

See also https://bugzilla.mozilla.org/show_bug.cgi?id=1069694

This was SVN commit r18580.
2016-08-02 16:58:30 +00:00
72ca6c5f80 Style cleanup by leper, preparing the SpiderMonkey update. Refs #3708
This was SVN commit r18579.
2016-08-02 16:12:11 +00:00
a4a45e4dc4 Fix compiler warning, thanks to elexis. Refs #4056
This was SVN commit r18442.
2016-06-26 16:51:52 +00:00
898ab5229b Change profiling calls to get a better view of what is actually slow and what is not.
This was SVN commit r18438.
2016-06-25 13:12:35 +00:00
3cbe96d24c Revamp Profiler2 to make it more usable.
Features include new graphs to compare runtime of functions and runtimes
across reports, as well as new profiling functions that only profile
spikes.

This was SVN commit r18423.
2016-06-22 13:38:05 +00:00
7c21a0cf8e Header cleanup: profile.h is no longer unnecessarily included in scriptinterface.h but rather in the required .cpp files
This was SVN commit r18417.
2016-06-21 10:33:11 +00:00
2a830fdb6a Support building with mozjs 31.5 used in Ubuntu PPA.
Fixes #3039.

This was SVN commit r18153.
2016-05-10 09:02:58 +00:00
199d38dfec Work around clang bug to fix compiling.
This was SVN commit r17703.
2016-01-24 10:34:38 +00:00
1a66f510d0 Use const T& for parameters of some types in script-exposed native functions
Using references matches the C++ coding style better and should improve
performance a bit in theory. It avoids 2 copies of T in case of the
functions registered with RegisterFunction (mainy used in the GUI). It
should also avoid one or two copies in case of
DEFINE_INTERFACE_METHOD_X, which is used in the simulation, but I
haven't bothered to count it there exactly.
It is now predefined which types have to be passed by const reference
and which are passed by value. Note that references can't be used as
out-parameters (to return multiple values to JS). This hasn't worked
before either and probably never will.

This was SVN commit r17696.
2016-01-23 15:17:56 +00:00
5f86beea6f Replace HandleWrapper and avoid repoint function
JS::Handle<T>::repoint gets removed with SpiderMonkey 38, so the
existing solution has to be replaced. The new approach should also be a
bit clearer. Named Return Value Optimization (NRVO) should avoid a
superfluous temporary for the return value in the generic template
function implementation of AssignOrFromJSVal.

Refs #3708

This was SVN commit r17695.
2016-01-23 14:42:59 +00:00
cfb2216b8c Remove JSDebugger. Closes #2419, #2973. Refs #410, #2348, #3708.
https://bugzilla.mozilla.org/show_bug.cgi?id=1069694

This was SVN commit r17655.
2016-01-17 00:34:33 +00:00
2ec4d87abf Use .assign instead of operator=.
This was SVN commit r17634.
2016-01-11 20:57:03 +00:00
39eb7fb243 Fix JS_SetGCZeal call.
https://bugzilla.mozilla.org/show_bug.cgi?id=650978
https://bugzilla.mozilla.org/show_bug.cgi?id=742570

This was SVN commit r17632.
2016-01-11 20:03:31 +00:00
775f856421 Use .assign instead of operator=.
This was SVN commit r17631.
2016-01-11 20:03:28 +00:00
d08044c8ad JS_DumpHeap is removed in SpiderMonkey 38, since we have nothing using it remove it. Refs #3708.
https://bugzilla.mozilla.org/show_bug.cgi?id=1105069
https://bugzilla.mozilla.org/show_bug.cgi?id=1122842

This was SVN commit r17630.
2016-01-11 20:03:09 +00:00
785acdb1c6 Fix test failure on Windows.
This was SVN commit r17629.
2016-01-11 20:03:01 +00:00
b18cd3254c Test FixedVector{2,3}D script conversions, and test calling functions of the prototypes.
Also ENSURE that the given value identifier is actually present in the
cache instead of creating one if it is not.

This was SVN commit r17603.
2016-01-04 21:41:40 +00:00
d5d60d53ed Replace JS_ASSERT (which is renamed to MOZ_ASSERT in SpiderMonkey 38) with TS_ASSERT, since the former was used for no apparent reason.
This was SVN commit r17588.
2016-01-01 21:28:25 +00:00
6970ebba16 Test non-ASCII string conversions.
This was SVN commit r17535.
2015-12-22 17:30:05 +00:00
848efb56b3 Make a method const.
This was SVN commit r17527.
2015-12-22 14:08:32 +00:00
509028d738 CompileOptions::setFileAndLine does not copy the string, so create a copy for it.
This was SVN commit r17512.
2015-12-19 02:55:30 +00:00
190f9176df SpiderMonkey 38 removes JS_NewPropertyIterator, use JS_Enumerate instead.
https://bugzilla.mozilla.org/show_bug.cgi?id=1081660

This was SVN commit r17510.
2015-12-19 02:21:22 +00:00
753936e7df SpiderMonkey 38 removes JS_Evaluate{,UC}Script, use JS::Evaluate.
https://bugzilla.mozilla.org/show_bug.cgi?id=1100579

This was SVN commit r17508.
2015-12-19 01:58:03 +00:00
2239fe338c The jschar typedef is removed in SpiderMonkey 38.
Since it already is char16_t in 31 replace it by that.
https://bugzilla.mozilla.org/show_bug.cgi?id=1063962

This was SVN commit r17506.
2015-12-19 01:29:55 +00:00
8bfe16cac8 Use in-place construction.
This was SVN commit r16894.
2015-07-29 23:44:17 +00:00
c5eb9b7bb7 Range-based for for VfsPath loops.
This was SVN commit r16893.
2015-07-29 23:44:12 +00:00
5a0b9b0e70 Fix some issues found by static analysis (clang-analyzer and cppcheck).
This was SVN commit r16801.
2015-06-21 18:46:31 +00:00
4af117434d Fixes clang unused parameter warning
This was SVN commit r16770.
2015-06-14 23:45:15 +00:00
c93c1c92eb Replace std::auto_ptr uses by std::unique_ptr since the former is deprecated.
This was SVN commit r16674.
2015-05-25 01:23:27 +00:00
1ac24adde2 Disables some SpiderMonkey-related build warnings with clang
This was SVN commit r16379.
2015-02-22 21:15:47 +00:00
bb9de80dd4 Convert CConsole to take UTF-8 strings.
This avoids vswprintf failures when printing non-ASCII char* strings
from CLogger into the console.

Also convert ScriptInterface::ToString to return UTF-8, to avoid some
utf8_from_wstring calls.

Also remove some unused and redundant CConsole functions.

This was SVN commit r16333.
2015-02-14 01:49:34 +00:00
e06a7b37d8 Convert debug_printf to take UTF-8 strings instead of wchar_t.
This fixes the problem where passing a non-ASCII string to
debug_printf(L"%hs", s) caused vswprintf_s to fail on Linux (because it
doesn't know what encoding the char* is meant to have). Now debug
messages will remain as UTF-8 until they reach the OS.

Fixes #3021.

This was SVN commit r16332.
2015-02-14 01:45:13 +00:00
5e7b55996c Fixes build with libmozjs-31-dev package from Ubuntu PPA. Fixes #3039.
This was SVN commit r16283.
2015-02-07 18:28:44 +00:00
0a34e6106d Improve readability printing a single error message.
This was SVN commit r16237.
2015-01-27 09:14:30 +00:00
4c1903500b Switch to std::shared_ptr and std::weak_ptr.
This was SVN commit r16227.
2015-01-25 03:10:58 +00:00
fc902df07c Remove checks for unsupported GCC versions (<4.6).
This was SVN commit r16224.
2015-01-24 20:37:07 +00:00
15e8637b67 Fix build with Visual Studio
I've reverted this workaround before the SM31 commit because I thought
it's only a problem with VS2010. Actually VS2013 still doesn't support
C++11 well enough and still requires the workaround.

Refs #2669, #2462

This was SVN commit r16215.
2015-01-24 16:33:27 +00:00
c02a7e1a7b SpiderMonkey 31 upgrade
This upgrade also introduces exact stack rooting (see to the wiki:
JSRootingGuide) and fixes problems with moving GC. This allows us to
enable generational garbage collection (GGC).
Measurements a few months ago have shown a performance improvement of a
non-visual replay of around 13.5%. This probably varies quite a bit, but
it should be somewhere between 5-20%. Memory usage has also been
improved. Check the forum thread for details.

Thanks to everyone from the team who helped with this directly or
indirectly (review, finding and fixing issues, the required C++11
upgrade, the new autobuilder etc.)! Also thanks to the SpiderMonkey
developers who helped on the #jsapi channel or elsewhere!

Fixes #2462, #2415, #2428, #2684, #1374
Refs #2973, #2669

This was SVN commit r16214.
2015-01-24 14:46:52 +00:00
f350a24c73 Disable "assignment operator could not be generated" warning globally on Windows, since it's never useful.
This was SVN commit r16192.
2015-01-22 21:09:33 +00:00
568c415d0a Convert wchar_t*/wstring arguments to UTF-8 strings in CLogger messages.
This was SVN commit r16188.
2015-01-22 20:37:38 +00:00
e02d7ad949 Automatically replace %hs/%ls with %s in CLogger format strings.
Everything is char* now, so we don't need to mess around with different
string types.

Done with:

  ag -ls 'LOG(MESSAGE|MESSAGERENDER|WARNING|ERROR)' source | xargs perl
-pi -e'1 while
s/(LOG(MESSAGE|MESSAGERENDER|WARNING|ERROR).*)%[hl]s/$1%s/g'

This was SVN commit r16187.
2015-01-22 20:36:24 +00:00
38a8e2e0d6 Automatically convert most path.string().c_str() to path.string8()
Done with:

  ag -l 'LOG.*string\(\).c_str\(\)' source | xargs perl -pi -e'1 while
s/(LOG.*string)\(\)\.c_str\(\)/${1}8()/g'

This was SVN commit r16186.
2015-01-22 20:35:17 +00:00
49e2ecea63 Automatically convert all CLogger format strings from wchar_t* to char*.
Done with:

  ag -ls 'LOG(MESSAGE|MESSAGERENDER|WARNING|ERROR)' source | xargs sed
-i 's/LOG\(MESSAGE\|MESSAGERENDER\|WARNING\|ERROR\)(L/LOG\1(/g'

This was SVN commit r16183.
2015-01-22 20:31:30 +00:00
dcf5a2667f CLogger: Use cppformat instead of sys_vswprintf.
sys_vswprintf relies on platform-specific printf implementations, which
vary widely between platforms (in handling of truncation, return values,
use of %s/%S/%hs/%ls for mixing char and wchar_t strings, etc) and are
therefore a pain.

Use cppformat's fmt::sprintf instead, which has very similar syntax to
sprintf but is more C++ish and is portable.

Also, wchar_t is stupid, so use char* strings (which are expected to be
UTF-8) in CLogger. This creates a bit of a pain with changing all
callers to convert to char* strings, but that's their fault for not
using UTF-8 already.

Refs #3011.

This was SVN commit r16182.
2015-01-22 20:30:05 +00:00
913674a202 Remove useless call.
This was SVN commit r16090.
2014-12-31 00:21:41 +00:00
4d89820f1c Fixes build errors on Windows introduced in c813a11427 and 1a0f9b086e.
This was SVN commit r15964.
2014-11-13 22:37:43 +00:00
c813a11427 Split ScriptRuntime and ScriptInterface code to separate files.
The runtime is becoming more and more important in the JSAPI. As a
result, we also have more functionality on the runtime level and having
the whole ScriptRuntime class hidden in ScriptInterface.cpp doesn't make
sense anymore. ScriptInterface.cpp also has become quite a large file
and pulling out the runtime part makes it a bit smaller.

Refs #2462

This was SVN commit r15961.
2014-11-13 11:19:28 +00:00
6e788fb15e Clean up JSON parsing code. Refs #1374.
Fix Engine.ReadJSONFile() which did throw a JS exception that was not
caught. Discovered by s0600204.
Expose Engine.ReadJSONFile() to the gui scripts.

This was SVN commit r15959.
2014-11-13 01:26:22 +00:00
5a985e18f4 Modify GC scheduling and reduce VFS cache size.
It seems like there is a memory leak if we haven't finished with the
marking phase of an incremental GC and SpiderMonkey has to trigger a
full GC because it runs out of memory. With this patch we stop trying to
make incremental GCs if we are above 1/2 of the runtime size and do Full
GCs instead. This should make such low memory conditions even less
likely than they were already after the previous patch. Also reduce the
maximum VFS cache size to 400 MB.
Refs #2808

This was SVN commit r15831.
2014-10-04 00:43:04 +00:00
3b49576fa6 Tunes GC scheduling a bit to reduce memory usage.
The main problem was that GC was only called from the simulation before
this patch. This means when you were waiting in the multiplayer lobby or
just had the GUI open, it only called GC when getting close to the JS
runtime size limit (I assume). Another problem was the Net Server
runtime which didn't GC either. Here the runtime size limit is 16 MB
though, so it's not too terrible. These issues have both been addressed
and GC has been given a bit more time per incremental slice to make sure
it gets done in time. It's still far from perfect, but there are too
many changes in SpiderMonkey related to GC, so I don't want to spend too
much time on this yet.

Refs #2808

This was SVN commit r15787.
2014-09-22 20:13:04 +00:00
3d1cd08a4c Suppresses noisy clang/libc++ warnings from SpiderMonkey headers on OS X
This was SVN commit r15716.
2014-09-07 23:58:22 +00:00
523d220ac5 Add engine support to load mods from config and restart into mods.
Restructure mod mounting code a bit to make it reusable, and use it for
replays. Fixes #2703.

This was SVN commit r15676.
2014-08-25 16:02:40 +00:00
8593825eee Modifies 23c708f72a to use the NONCOPYABLE macro as suggested by leper.
This was SVN commit r15626.
2014-08-09 21:16:25 +00:00
23c708f72a Prevent copying of ScriptInterface objects.
Copying a ScriptInterface is not allowed. The destructor destroys the
JSContext and if there's a copy around that still uses it, that causes
crashes which can be quite hard to debug. This change prevents copying
by of ScriptInterface objects by making the copy constructor private,
which will reveal such errors at compile time.

This was SVN commit r15625.
2014-08-09 20:20:32 +00:00
9872f5741f Exact stack rooting for ScriptInterface::FreezeObject.
Refs #2415

This was SVN commit r15622.
2014-08-08 11:59:49 +00:00
efb889b79a Exact stack rooting for WriteStructuredClone and functions that use it.
Refs #2415

This was SVN commit r15607.
2014-08-03 19:32:39 +00:00
f4d62152e7 Exact stack rooting for GetClass and GetPrivate.
Refs #2415

This was SVN commit r15606.
2014-08-03 17:53:21 +00:00
169174824f Exact stack rooting for ScriptInterface::ToString.
I had to change a few other functions to take JS::MutableHandleValue
because JS::Stringify takes a JS::MutableHandleValue as input parameter.
That seems a bit strange because it should not change that value.
I assume it has historical reasons.

Refs #2415
Refs #2462

This was SVN commit r15605.
2014-08-03 17:29:49 +00:00
a2bd44b23a Exact stack rooting for JSON related ScriptInterface functions.
Refs #2415
Refs #2462

This was SVN commit r15603.
2014-08-02 22:21:50 +00:00
c818b8e475 Exact rooting for CallConstructor.
Refs #2415
Refs #2462

This was SVN commit r15601.
2014-08-02 16:30:15 +00:00
736d934107 Removes an unused codepath for AI deserialization and related ScriptInterface code.
It might actually be needed again in the future, but I think even then
it would be easier to rewrite it than having to update the code in the
meantime.

Refs #2462

This was SVN commit r15600.
2014-08-02 13:22:02 +00:00
608c27fe10 Exact stack rooting for structured cloning functions.
Refs #2415
Refs #2462

This was SVN commit r15597.
2014-08-01 20:55:16 +00:00
5c07a25ddc More exact stack rooting (CallFunction object).
Changes CallFunction and CallFunctionVoid to use a HandleValue as object
parameter. Also changes some JS serialization/deserialization functions
to only support the JSAPI rooted types (drop support for CScriptVal and
CScriptValRooted there). Some other functions got changed too because
they were closely related.

Refs #2415
Refs #2462

This was SVN commit r15592.
2014-07-31 19:18:40 +00:00
d677a30c39 Adds support for passing JS::HandleValue and JS::RootedValue& to CallFunction.
Also adds tests for these cases.

Refs #2415

This was SVN commit r15591.
2014-07-31 16:34:15 +00:00
28bdd8540f Quite a lot of stack rooting related changes.
Changes GetProperty, SetProperty and HasProperty and a few other
functions to take handles. The conversions to CScriptVal or
CScriptValRooted at some places should be removed in the future. I've
done that to avoid an even larger patch.

Refs #2415
Refs #2462

This was SVN commit r15568.
2014-07-26 22:33:16 +00:00
e818b08344 Better support for SpiderMonkey rooted types in the ScriptInterface.
* Adds additional overloads/specializations which are required when
passing JS::Handle<T>/JS::MutableHandle<T> types to different functions.
* Replaces GetPropertyJS with a GetProperty specialization.
* Allows us to avoid the implementation of ToJSVal specializations for
JS::Value and JS::HandleValue. Such conversions should only happen if
there's no way around it and if you are aware of it.
* Adds test to make sure that all potentially required specializations
with custom implementations are instantiated. This should help prevent
introducing bugs in temporarily unused code.

Refs #2415

This was SVN commit r15567.
2014-07-26 20:31:29 +00:00
e3888448c4 Removes rooting test.
Rooting works different now and the CScriptVal types are going to be
removed. We will need rooting tests again, but they will have to work
completely different than this test implementation.

Refs #2415

This was SVN commit r15562.
2014-07-26 14:07:56 +00:00
a9048fa43d Adds support for passing JS::HandleValue to SetProperty and CallFunctionVoid without using ugly casing.
Also includes one little "demo-usecase", but additional code will be
changed to use that in future commits.

Refs #2415
Refs #2462

This was SVN commit r15542.
2014-07-20 19:45:18 +00:00
31f9ca9ebf Implements CallFunction with JS::MutableHandle<T> return type.
Changes the CallFunction implementation to use macros because otherwise
we'd have to write twice as many functions manually.
Adapts GetSavedGameData to use the new function template. Additional
callers will be changed in future commits.

Refs #2415
Refs #2462

This was SVN commit r15541.
2014-07-20 15:08:28 +00:00
52f4cda439 Changes ToJSVal to take JS::MutableHandleValue instead of JS::Value&.
JS::MutableHandleValue is similar to JS::HandleValue, but the whole
JS::Value it points to can be replaced.
This change is needed for support of exact stack rooting and moving GC.
Contains a few other trivial API adjustments and style improvements too.

Refs #2462
Refs #2415

This was SVN commit r15534.
2014-07-14 19:52:35 +00:00
09e04cb741 Adds missing request (fixes tests in debug mode).
This was SVN commit r15530.
2014-07-13 22:08:29 +00:00
1b5ab8142e Makes custom JS objects compatible with SpiderMonkey ESR31.
In v24 you called JS_InitClass and passed in a definition of JSNative
functions. Later you could call JS_NewObject with this class and the
object would get a prototype with the specified JSNative functions.
In ESR31 you now have to explicitly store the prototype object returned
by JS_InitClass and pass it as prototype argument to JS_NewObject to
achieve the same.
This change modifies our existing ScriptInterface implementation for
custom object types a bit and uses it at places where the JSAPI was used
directly before.

Refs #2462

This was SVN commit r15524.
2014-07-13 15:31:48 +00:00
5a3f07b3d9 Forgot to use excnObj in db9c20e0a9. Also roots an additional jsval.
This was SVN commit r15518.
2014-07-12 19:46:12 +00:00
db9c20e0a9 Changes FromJSVal to take a JS::HandleValue instead of JS::Value.
JS::HandleValue is basically a wrapper around a JS::Value that is safe
for exact stack rooting and moving GC.
I've tried to keep this changeset rather small and isolated and
therefore create additional JS::Rooted<T> values at some places where
the function should eventually directly take a JS::Handle<T>.
The functions "CallFunction" and "CallFunctionVoid" put their arguments
inside a JS::AutoValueVector because this will be passed directly to
"CallFunction_" with ESR31.

Refs #2462
Refs #2415

This was SVN commit r15517.
2014-07-12 19:08:39 +00:00
cfa59fc4e1 Changes our JSNative functions to use JS::CallReceiver/JS::CallArgs.
This is the new way for working with arguments in JSNative functions.
JS_THIS_VALUE, JS_ARGV, JS_SET_RVAL and direct access to vp or argc are
deprecated and will probably be removed in future versions of
SpiderMonkey.
CallArgs also takes care of proper rooting and you can get the values as
Handles or MutableHandles. The interface changes a little bit for ESR
31, but commiting this now still makes it easier and the changes shout
be straigtforward (search and replace more or less).

Refs #2462
Refs #2415

This was SVN commit r15516.
2014-07-12 16:55:09 +00:00
ae93c02ba8 Fixes a bug that caused script filenames to be defined as properties of the global object.
This was SVN commit r15450.
2014-06-26 17:08:46 +00:00
2b05a8d233 Reenable JS warnings that were disabled in db0376fdc2.
This was SVN commit r15156.
2014-05-18 13:25:08 +00:00
8cec641156 Replace strictness test by a different one, as the old test wasn't considered non-strict anymore.
This was SVN commit r15134.
2014-05-08 13:26:21 +00:00
db0376fdc2 Temporarily disable the Spidermonkey warnings for release
This was SVN commit r15127.
2014-05-07 19:42:12 +00:00
7acdde5c86 Changes tests to use global g_ScriptRuntime instead of creating a new JSRuntime for each test.
The tests crashed on my Debian systems but not on my Ubuntu system.
The crash happened in line 142 of SpiderMonkey's ThreadLocal.h.

I know that I had to use a workarounnd for contexts to avoid destroying
the context that was created first. I also had in mind that in newer
versions a JS_Init function got introduced which presumably solves this
kind of issues.
Based on this experience I assumed runtimes could have a similar problem
and this patch indeed fixes the issues.
Unfortunately the correct usage of JSRuntimes in that regard is not
documented.
There's only a rater misterious comment in JSAPI.h which hasn't been
cleared up so far and is most likely completely outdated
(https://bugzilla.mozilla.org/show_bug.cgi?id=992641).

This was SVN commit r14995.
2014-04-25 21:19:51 +00:00
92f2a16a88 Suppresses MSVC warning C4005 'macro redefinition' from SpiderMonkey upgrade
This was SVN commit r14975.
2014-04-23 21:12:28 +00:00
e9e05f4efc Second (main) commit for the SpiderMonkey upgrade.
This commit contains all the required changes to our source files and
build scripts (hopefully).
A next commit will remove the old stuff of SpiderMonkey 1.8.5.

Spcial thanks to:
 - H4writer who helped a lot mainly with the performance issues we
had/have, but also with other problems or questions.
 - Leper for the review.
 - Historic_bruno for implementing the build scripts on Mac OS X and
testing on the Mac.
 - The people from the #jsapi channel and from
mozilla.dev.tech.js-engine who answered a lot of questions and helped
solving problems.
 - All the other people who helped

Refs #1886
Fixes #2442
Fixes #2416

This was SVN commit r14877.
2014-03-28 20:26:32 +00:00
31e98e5c03 Reverts f25edfd8f1. Structured clones don't support cyclic references in SpiderMonkey v1.8.5.
SpiderMonkey v24 supports it and I'll add this change to #1886 instead.

Refs #2416
Refs #2415
Refs #1886

This was SVN commit r14733.
2014-02-06 13:32:09 +00:00
f25edfd8f1 Removes ValueCloner.
Fixes #2416
Refs #2415
Refs #1886

This was SVN commit r14724.
2014-02-01 20:37:33 +00:00
bab3a08643 Fixes a crash introduced in fd187f466f by ensuring that the CScriptValRooted values are destroyed before calling JS_DestroyContext.
I've tested the performance on Combat Demo (Huge) again with the code
from #2394.
It's very close but probably a little bit lower (hard to tell because
it's so close).

Closes #2408
Refs #2394

This was SVN commit r14705.
2014-01-30 13:21:36 +00:00
fd187f466f Add vector prototype to vector-like return values from C++ to JS. Fixes #2394.
This was SVN commit r14645.
2014-01-23 11:32:08 +00:00
cbc0650a79 Removes some unused files
This was SVN commit r14561.
2014-01-10 19:38:34 +00:00
7193e29961 Adds precompiled.h include because Visual Studio checks for that even though the file only contains comments.
Thanks to boeseRaupe for reporting.

Refs #2348

This was SVN commit r14512.
2014-01-05 13:58:38 +00:00
b20955436b I completely missed the header files when disabling the JS debugger.
Refs #2348

This was SVN commit r14511.
2014-01-05 10:26:27 +00:00
7d516e7e7a Disables the JS debugger.
It's completely broken since 4b1297b328 and will have to be updated for
the new SpiderMonkey API.
I only uncomment it at the moment because I plan to fix/reimplement it
soon after the upgrade.

Closes #2348
Refs #2241
Refs #1886

This was SVN commit r14506.
2014-01-04 20:47:56 +00:00
4b1297b328 Removes g_ScriptingHost and implements global to compartment 1 to 1 relation.
Each GUI Page gets its own compartment and all ScriptInterfaces in the
same thread should now use the same JS Runtime.
This is required for the SpiderMonkey upgrade.
Check the ticket for details.

Closes #2241
Refs #1886
Refs #1966

This was SVN commit r14496.
2014-01-04 10:14:53 +00:00
5ce8de1f0a Removes unused var from JS debugger, from patch by Markus. Fixes #1852
This was SVN commit r14211.
2013-11-17 23:41:19 +00:00
d178f32698 Fix Unicode in JS print() on Linux
This was SVN commit r14129.
2013-11-10 16:13:40 +00:00
d7ec8c47a6 Fix Unicode support in lobby.
Fix EncryptPassword being called with the wrong argument order, and
encrypting username instead of password. (This will break all existing
lobby accounts.)

Fix EncryptPassword not using all of salt_base.

This was SVN commit r14123.
2013-11-09 23:26:17 +00:00
72e11a2dea Fix VS2013 build errors, warnings
This was SVN commit r14073.
2013-11-03 12:46:07 +00:00
20ed5b118c Unify script conversions and remove JSInterface_Vector3D.
Because it was historically grown, we have some duplicated code for
converting script types to native types.
This patch removes the file JSConversions.cpp and moves some code to
ScriptConversions.cpp.
The places using JSConversions.cpp are changed to use the
ScriptInterface's conversion functions in ScriptConversions.cpp.
I also removed JSInterface_Vector3D because it had additional
requirements to the conversion code that no other code has and because
it's currently not used. I think it doesn't make sense to maintain code
just because it could possibly be used again later.

Closes #2213
Refs #1886

This was SVN commit r14036.
2013-10-20 17:13:53 +00:00
f3d088dd5c Fixes JS debugger, fixes VS 2013 build error, re-fixes #2127, #2175
This was SVN commit r13973.
2013-10-07 22:55:30 +00:00
5d9b2b95b0 Ticket #2127 - Performance and style improvements in scriptinterface.
No real behavior changes, only code maintenance.

Fixed signed/unsigned mismatch in EntityMap.h

This was SVN commit r13865.
2013-09-16 19:10:06 +00:00
b1bd61938e add file notification to Mac ticket 514, also change name of class FileInfo to CFileInfo to ease Mac development
This was SVN commit r13821.
2013-09-10 14:17:04 +00:00
0ca841b92b Suppress unused local typedef warnings when including SpiderMonkey headers.
This was SVN commit r13713.
2013-08-19 18:26:44 +00:00
8c74df2acd Give an elevation advantage to ranged units. Patch by sanderd17. Fix #1960.
This was SVN commit r13626.
2013-08-03 19:20:20 +00:00
94c57085e9 Makes some classes NONCOPYABLE, based on patch by Markus, refs #1852
This was SVN commit r13419.
2013-05-22 21:40:56 +00:00
d7dcd3b26c Use prefix increment operator for iterators (for consistency), refs #1852, #1064
This was SVN commit r13418.
2013-05-22 18:41:13 +00:00
3f00d4d997 Change some size() > 0 to Based on patches by kuranes and Markus. Refs #1852, #1923.
This was SVN commit r13413.
2013-05-21 22:11:47 +00:00
74df28f952 Fix --without-pch build
This was SVN commit r13333.
2013-04-02 15:44:42 +00:00
0d7e6b7880 Use pimpl idiom for ThreadDebugger.
This was SVN commit r13253.
2013-03-10 23:08:01 +00:00
8c756b507a Fix non-pch build. Maybe use pimpl idiom instead.
This was SVN commit r13245.
2013-03-08 23:46:32 +00:00
73951b75fc Adds the server-side part of the javascript debugger. Refs #410
This was SVN commit r13238.
2013-03-07 13:49:49 +00:00
1fdaca5cec Attempts to fix StringifyJSON by clearing pending exceptions from JS API
This was SVN commit r13125.
2013-01-27 01:38:43 +00:00
75a23856cf Fix some static analysis warnings
This was SVN commit r13101.
2013-01-21 20:33:25 +00:00
99d04e93bb Implements global tech modification function. Fixes #1358, refs #1520.
Applies tech modifications to template data returned by GuiInterface.
Extends engine to load arbitrary global scripts, separates this from RNG
replacement. Refs #1193.
Loads global scripts for most script contexts for consistency.
Adds simulation tests for global scripts.

This was SVN commit r12056.
2012-07-03 02:16:45 +00:00
2ee9981d99 Replace boost::uniform_real to avoid OOS caused by changes in behaviour between Boost versions
This was SVN commit r11857.
2012-05-13 23:40:06 +00:00
32d2927449 Adds UTF-8 support for JavaScript files.
This was SVN commit r11750.
2012-05-04 21:48:46 +00:00
da4c1c8f2b Fixes handling of UTF-8 encoded JSON files (stripping BOM if necessary). Fixes #1375.
This was SVN commit r11739.
2012-05-04 03:46:05 +00:00
edc62a240a Try to avoid some type warnings
This was SVN commit r11558.
2012-04-18 21:02:11 +00:00
c56f96040e Implement healing. Fixes #999.
This was SVN commit r11536.
2012-04-17 20:22:13 +00:00
f1e73807a8 Fix formatting
This was SVN commit r11377.
2012-03-20 18:13:27 +00:00
0b0f2e9e30 Fixed broken tests by silently failing if Math.js is not found. This is not ideal but seems better than everything else.
This was SVN commit r11253.
2012-03-05 21:20:39 +00:00
e2e5c81272 Added safe (identical across platforms) replacement sin and cos functions for scripts. This is part of #1193.
This was SVN commit r11226.
2012-03-03 00:06:16 +00:00
7fa6afac37 Corrects some Doxygen comments and adds a few others of interest.
This was SVN commit r11209.
2012-03-01 03:55:05 +00:00
182bf2b4af Vague start at hypothetical Android support
This was SVN commit r10923.
2012-01-17 22:05:43 +00:00
1e4b950ed1 This was SVN commit r10870. 2012-01-05 03:38:54 +00:00
dbf27dbc5e Fix #1065 (incorrect printf format string), based on patch by Echelon9
This was SVN commit r10823.
2011-12-29 01:40:24 +00:00
vts
db864f10c3 Rendering marker lines between buildings and rally points
Added command button to focus on rally point
(implements #524)

This was SVN commit r10704.
2011-12-10 07:07:04 +00:00
8492426a14 Rough support for profiling replay mode and scripts
This was SVN commit r10634.
2011-11-29 20:32:43 +00:00
5bd7b74ec7 Fix ABI incompatibility with --with-system-mozjs185 in debug mode (see #990).
This was SVN commit r10535.
2011-11-14 18:18:04 +00:00
85e16f95b1 Use debug_printf for script print() function, so it's more visible on Windows
This was SVN commit r10435.
2011-10-27 14:19:37 +00:00
0e39511b3a Attempts to fix random map OOS errors by avoiding parsing data to floats (uses CFixedVector3D instead). See #977.
Changes to rmgen API for consistency and support of 3D
position/rotation.

This was SVN commit r10326.
2011-09-26 21:36:33 +00:00
78fd3a2ba2 Fix compatibility with Boost 1.47
This was SVN commit r9905.
2011-07-24 11:41:06 +00:00
ea7f65818a Avoid release-mode-only warning
This was SVN commit r9857.
2011-07-17 01:26:04 +00:00
2f0bd8d8b0 Upgrade to SpiderMonkey 1.8.5 (fixes #734)
This was SVN commit r9852.
2011-07-16 23:24:14 +00:00
8eb7af4ac9 Be a bit more robust to build environment changes.
Reduce some module dependencies.
Clean up some unused instantiations.

This was SVN commit r9827.
2011-07-15 13:22:48 +00:00
a8fdcfde59 Fixes broken autostart for random maps with AI
This was SVN commit r9699.
2011-06-27 23:27:25 +00:00
5bc125a91f Changes terrain data returned by CMapGenerator to typed arrays, instead of an array of objects (this greatly reduces the size of the serialized data)
This was SVN commit r9664.
2011-06-26 02:56:54 +00:00
34186dd017 refactor file interface. requires workspace update
- separate file_system_util into vfs functions (-> vfs/vfs_util) and
file_system (avoids ugly fs_util namespace prefix)
- get rid of non-portable O_BINARY_NP etc. flags
- use standard O_WRONLY etc. flags instead of LIO_WRITE; but avoid the
need for specifying O_CREAT|O_TRUNC
- only open files for aio when O_DIRECT is specified (which 0ad does
not) - avoids wasting time and security issues
- return file descriptor directly instead of via output param
- waio: safer FCB mechanism that avoids mixing descriptors between lowio
and aio

This was SVN commit r9550.
2011-05-25 10:39:13 +00:00
b741feafb1 Add global deepcopy() function in scripts, to do a structured clone of objects.
Remove an unused include.

This was SVN commit r9506.
2011-05-12 23:50:42 +00:00
fffcdbbf21 Balances random map resources.
Attempts to avoid "invalid argument" errors in typed arrays by forcing
them to integer (see #658).
Removes script preloading from map generator (VFS is thread-safe now)
Removes thread checking from ScriptInterface file loading functions.
Adjusts starting entities in civ data.

This was SVN commit r9435.
2011-05-04 21:24:25 +00:00
cccd6849a7 cleanup (requires update-workspaces)
lib_errors.cpp: replace with status.cpp, adapt to needs at work
wutil: fix runtime warning reported via feedback box
config: merge CONFIG_PARANOIA and !CONFIG_FINAL into
CONFIG_ENABLE_CHECKS
add openmp, pointer_typedefs.h

This was SVN commit r9410.
2011-05-03 12:38:42 +00:00
4663ac0fe7 split debug_assert into ENSURE and ASSERT as discussed in a previous meeting.
the old debug_assert always ran and tested the expression, which slows
down release builds. wrapping them in #ifndef NDEBUG is clumsy. the new
ASSERT behaves like assert and ENSURE like the old debug_assert. Let's
change any time-critical but not-super-important ENSURE to ASSERT to
speed up release builds. (already done in bits.h and unique_range.h)

This was SVN commit r9362.
2011-04-30 13:01:45 +00:00
b4503bb61e Simplifies random map output, see #782.
Changes random maps to XZ coordinates, matching the engine.
More documentation for rmgen library.

This was SVN commit r9271.
2011-04-16 04:04:06 +00:00
481f570a0e CMapGeneratorWorker thread safety issue. Fixes #783.
VFS access moved to main thread, where random map scripts are preloaded
and stored prior to use by the worker thread.
Adds LoadGlobalScript to ScriptInterface, for evaluating script content
in the global scope.

This was SVN commit r9261.
2011-04-15 05:23:51 +00:00
f072b47dc1 Warn earlier about some non-thread-safe calls.
This was SVN commit r9252.
2011-04-14 14:28:24 +00:00
bd0063607a Fix build in Clang
This was SVN commit r9213.
2011-04-09 00:05:37 +00:00
e5e9e38532 Fix GCC 4.6 "set but not used" warnings
This was SVN commit r9194.
2011-04-07 16:34:51 +00:00
9193ba56f9 Build fixes and whatnot
This was SVN commit r9115.
2011-03-23 21:15:22 +00:00
588bfa11bf remove unnecessary utf8 includes
This was SVN commit r9110.
2011-03-23 16:32:44 +00:00
dcd192cb60 refactor path interface:
- use wrapper class instead of std::wstring (reduces mixing of
strings/paths; allows safe+easy join via operator/ and convenient
case-insensitive comparison via operator==, avoids NativePathFromString,
similar to boost::filesystem)
- NativePath -> OsPath
- add hash and To/FromJSVal for Path
- add TS_ASSERT_PATH_EQUALS
- replace _wfopen_s with sys_OpenFile
- remove obsolete SortFiles/Directories

This was SVN commit r9107.
2011-03-23 13:36:20 +00:00
f618605477 Changes default random map sizes.
Tweaks random map resources.
Adds support for circular maps to rmgen library.
Various fixes in map generator.
On Miletus map, change player 2 civ, as Romans are not fully implemented
(fixes #758)

This was SVN commit r9104.
2011-03-23 08:12:04 +00:00
575e3b0a69 Don't enable JITs when they can interfere with profiling.
Fix dangerous trailing slashes.

This was SVN commit r9103.
2011-03-23 00:36:34 +00:00