Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#5859 closed task (fixed)

Upgrade 0 A.D. to Spidermonkey ESR 60

Reported by: wraitii Owned by: wraitii
Priority: Release Blocker Milestone: Alpha 24
Component: Core engine Keywords: javascript
Cc: Patch:

Description

See #4893 for the starting point and #5694 for why this is a RB.

Change History (6)

comment:1 by wraitii, 3 years ago

In 24229:

Make JS GUI Objects Proxy objects.

The JS-side counterparts of C++ objects are now Proxy objects, in anticipation of SM60 changes that remove the get/set hooks entirely.
This makes semantic sense too as they are essentially phantom wrappers around the C++ objects, with no proper JS representation.

By using different proxy handlers for different GUI object types, we can further fix issues encountered in D2136 by defining the relevant functions only on objects that should have them.

The main complexity with proxy handlers is that Spidermonkey assumes in several places that they are static and data-less, so they cannot be used directly to hold data. This diff works around that issue by storing per-script-interface data in the CGui directly.

Further API changes in SM60 make this slightly cleaner.

Comments by: Itms

Refs #5859

Differential Revision: https://code.wildfiregames.com/D2768

comment:2 by wraitii, 3 years ago

In 24235:

Enable C++14

Spidermonkey 60 can only be compiled with C++14. This conflicts with building 0 A.D. with C++11, so upgrade to C++14 first.
This in itself should not drop compiler support on any platform.

Tested on Windows by: Stan
Tested on Linux by: Freagarach

Refs #5859
Refs #5862

Differential Revision: https://code.wildfiregames.com/D3124

comment:3 by wraitii, 3 years ago

In 24242:

[SM60 1/2] Upgrade Spidermonkey build system and binaries to 60.9.1

This changes VS to use the same library name as other platforms, since the toolsets are binary-compatible going forward. This makes the build script slightly more streamlined on windows.
Also enable building NSPR on windows as part of the spidermonkey build, instead of compiling it separately.

Tested by: SubitaNeo, Stan

Refs #5859

Differential Revision: https://code.wildfiregames.com/D3115

comment:4 by wraitii, 3 years ago

Resolution: fixed
Status: assignedclosed

In 24243:

[SM60 2/2] Update to Spidermonkey 60 APIs

Two noteworthy changes:

  • Proxies are update to the SM60 API, having an explicit reserved slot and a private slot, in which the 'proxy data' and the C++ object are stored. This fixes a debug assertion failure of SM52 (See bugs 1237504 and 1339411)
  • The GC callback behaviour has changed slightly, and we should now only look for GC_SLICE_BEGIN and GC_SLICE_END calls (Bug 1364547)

Other updates are minor:

  • Bug 1339036: JSTYPE_VOID beomes JSTYPE_UNDEFINED
  • Bug 1308236 - avoid ambiguous comparison by changing NULL to nullptr
  • Bug 1421358, GC::reason::REFRESH_FRAME was removed. API is indicated in jsapi.h so use that.
  • Compartment behaviours update
  • ClassOps changes (Bug 1389510 removed the getter/setter - rP24229 - and bug 1370608 added one more before that so net minus one)
  • Minor tests touchups again.

Tested by: SubitaNeo, Stan

Thanks to bellaz89 for the Shared Array fix

Closes #5859

Differential Revision: https://code.wildfiregames.com/D3116

comment:5 by wraitii, 3 years ago

In 24265:

Fix SM compilation on Mac with SYSROOT specified

Refs #5859

comment:6 by wraitii, 3 years ago

In 24455:

Fix off-by-one line number in JS error reporting.

Post SM60 upgrade, CompileFunction started actually adding a line in front of the source buffer, shifting the error reporting in the simulation and other callers of LoadScript.
The GUI isn't affected as it uses LoadGlobalScript, which uses Evaluate directly.

Refs #5859
Fixes #5895

Differential Revision: https://code.wildfiregames.com/D3257

Note: See TracTickets for help on using tickets.