Skip to content
This repository was archived by the owner on Nov 12, 2022. It is now read-only.

Commit 98ebda0

Browse files
author
bors-servo
authored
Auto merge of #494 - servo:smup, r=asajeffrey
Update SpiderMonkey
2 parents c1e5ad8 + a09ebb1 commit 98ebda0

16 files changed

+407
-418
lines changed

.travis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ addons:
1414
apt:
1515
sources:
1616
- ubuntu-toolchain-r-test
17+
- llvm-toolchain-xenial-8
1718
packages:
1819
- autoconf2.13
19-
- clang
20+
- clang-8
2021
homebrew:
2122
update: true
2223
packages:

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "mozjs"
33
description = "Rust bindings to the Mozilla SpiderMonkey JavaScript engine."
44
repository = "https://github.com/servo/rust-mozjs"
5-
version = "0.12.1"
5+
version = "0.13.0"
66
authors = ["The Servo Project Developers"]
77
build = "build.rs"
88
license = "MPL-2.0"
@@ -58,4 +58,4 @@ lazy_static = "1"
5858
libc = "0.2"
5959
log = "0.4"
6060
num-traits = "0.2"
61-
mozjs_sys = { git = "https://github.com/servo/mozjs", rev = "bc4935b668171863e537d3fb0d911001a6742013" }
61+
mozjs_sys = { git = "https://github.com/servo/mozjs", rev = "aabcc9ba889b2755f1e4e83f28323a60415a790f" }

appveyor.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ matrix:
55
fast_finish: true
66

77
environment:
8+
LINKER: "lld-link.exe"
89
PYTHON3: "C:\\Python37-x64\\python.exe"
910
# The appveyor image we use has a pretty huge set of things installed... we make the
1011
# initial PATH something sane so we know what to expect
@@ -30,16 +31,18 @@ environment:
3031
C:\\Program Files\\Git\\cmd;\
3132
C:\\Program Files\\Git\\usr\\bin;\
3233
C:\\Program Files\\AppVeyor\\BuildAgent;"
34+
3335
CC: "clang-cl.exe"
3436
CXX: "clang-cl.exe"
35-
LINKER: "lld-link.exe"
3637

3738
VCVARSALL_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
3839

3940
matrix:
4041
- TARGET: i686-pc-windows-msvc
4142
CROSS_COMPILE: 1
4243
- TARGET: x86_64-pc-windows-msvc
44+
- TARGET: x86_64-pc-windows-msvc
45+
FEATURES: "--features debugmozjs"
4346

4447
# Uncomment to enable RDP & wait for exit. Connection info will be printed in the log.
4548
#init:
@@ -52,6 +55,7 @@ install:
5255
- set BUILD_ENV=msvc
5356
- ps: Start-FileDownload "http://servo-rust.s3.amazonaws.com/build/MozillaBuildSetup-2.2.0.exe"
5457
- ps: .\MozillaBuildSetup-2.2.0.exe /S | Out-Null
58+
- appveyor-retry choco install llvm --version=8.0.1
5559
- appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
5660
- rustup-init.exe -y --default-host=x86_64-pc-windows-msvc
5761
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
@@ -66,5 +70,6 @@ build_script:
6670
- echo PATH %PATH%
6771
- echo MOZTOOLS_PATH %MOZTOOLS_PATH%
6872
- cd %APPVEYOR_BUILD_FOLDER%
69-
- cargo build --verbose --verbose --target %TARGET%
70-
- if "%CROSS_COMPILE%" == "" cargo test --verbose --verbose --target %TARGET%
73+
- set MOZJS_FORCE_RERUN=1
74+
- cargo build --verbose --verbose --target %TARGET% %FEATURES%
75+
- if "%CROSS_COMPILE%" == "" cargo test --verbose --verbose --target %TARGET% %FEATURES%

build.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,17 @@ fn main() {
1414

1515
build.cpp(true)
1616
.file("src/jsglue.cpp")
17+
.flag("-DSTATIC_JS_API")
1718
.include(include_path);
1819
if env::var("CARGO_FEATURE_DEBUGMOZJS").is_ok() {
1920
build.define("DEBUG", "");
20-
build.define("_DEBUG", "");
2121

2222
if cfg!(target_os = "windows") {
23-
build.flag("-MDd");
2423
build.flag("-Od");
2524
} else {
2625
build.flag("-g");
2726
build.flag("-O0");
2827
}
29-
} else if cfg!(target_os = "windows") {
30-
build.flag("-MD");
3128
}
3229

3330
if env::var("CARGO_FEATURE_PROFILEMOZJS").is_ok() {

src/consts.rs

+7-16
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,17 @@
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

5-
use jsapi::{JSCLASS_GLOBAL_APPLICATION_SLOTS, JSCLASS_RESERVED_SLOTS_SHIFT};
6-
use jsapi::{JSCLASS_RESERVED_SLOTS_WIDTH, JSProtoKey};
7-
use libc::c_uint;
8-
95
pub const default_heapsize: u32 = 32_u32 * 1024_u32 * 1024_u32;
106

11-
pub const JSCLASS_IS_DOMJSCLASS: c_uint = 1 << 4;
12-
pub const JSCLASS_USERBIT1: c_uint = 1 << 7;
7+
pub use jsapi::JSCLASS_IS_DOMJSCLASS;
8+
pub use jsapi::JSCLASS_USERBIT1;
139

14-
pub const JSCLASS_RESERVED_SLOTS_MASK: c_uint =
15-
(1 << JSCLASS_RESERVED_SLOTS_WIDTH) - 1;
10+
pub use jsapi::JSCLASS_RESERVED_SLOTS_MASK;
1611

17-
pub const JSCLASS_HIGH_FLAGS_SHIFT: c_uint =
18-
(JSCLASS_RESERVED_SLOTS_SHIFT as c_uint) + JSCLASS_RESERVED_SLOTS_WIDTH;
12+
pub use jsapi::JSCLASS_HIGH_FLAGS_SHIFT;
1913

20-
pub const JSCLASS_IS_GLOBAL: c_uint =
21-
1 << (JSCLASS_HIGH_FLAGS_SHIFT + 1);
14+
pub use jsapi::JSCLASS_IS_GLOBAL;
2215

23-
pub const JSCLASS_IS_PROXY: c_uint =
24-
1 << (JSCLASS_HIGH_FLAGS_SHIFT + 4);
16+
pub use jsapi::JSCLASS_IS_PROXY;
2517

26-
pub const JSCLASS_GLOBAL_SLOT_COUNT: c_uint =
27-
JSCLASS_GLOBAL_APPLICATION_SLOTS + JSProtoKey::JSProto_LIMIT as c_uint * 2 + 38;
18+
pub use jsapi::JSCLASS_GLOBAL_SLOT_COUNT;

src/conversions.rs

-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ impl_as!(u64, u64);
9292
/// A trait to convert Rust types to `JSVal`s.
9393
pub trait ToJSValConvertible {
9494
/// Convert `self` to a `JSVal`. JSAPI failure causes a panic.
95-
#[inline]
9695
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue);
9796
}
9897

src/generate_wrappers.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ grep_heur() {
2323
sed 's/Handle<\*mut JSObject>/HandleObject/g'
2424
}
2525

26-
grep_heur ../target/debug/build/mozjs_sys-*/out/jsapi.rs | sed 's/\(.*\)/wrap!(jsapi: \1);/g' > jsapi_wrappers.in
26+
grep_heur ../target/debug/build/mozjs_sys-*/out/build/jsapi.rs | sed 's/\(.*\)/wrap!(jsapi: \1);/g' > jsapi_wrappers.in
2727
grep_heur glue.rs | sed 's/\(.*\)/wrap!(glue: \1);/g' > glue_wrappers.in

src/glue.rs

+14-22
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub struct ProxyTraps {
4848
pub ownPropertyKeys: ::std::option::Option<unsafe extern "C" fn
4949
(cx: *mut JSContext,
5050
proxy: HandleObject,
51-
props: *mut AutoIdVector)
51+
props: MutableHandleIdVector)
5252
-> bool>,
5353
pub delete_: ::std::option::Option<unsafe extern "C" fn
5454
(cx: *mut JSContext,
@@ -58,7 +58,7 @@ pub struct ProxyTraps {
5858
pub enumerate: ::std::option::Option<unsafe extern "C" fn
5959
(cx: *mut JSContext,
6060
proxy: HandleObject,
61-
props: *mut AutoIdVector)
61+
props: MutableHandleIdVector)
6262
-> bool>,
6363
pub getPrototypeIfOrdinary: ::std::option::Option<unsafe extern "C" fn
6464
(cx: *mut JSContext,
@@ -109,7 +109,7 @@ pub struct ProxyTraps {
109109
proxy:
110110
HandleObject,
111111
props:
112-
*mut AutoIdVector)
112+
MutableHandleIdVector)
113113
-> bool>,
114114
pub nativeCall: ::std::option::Option<unsafe extern "C" fn
115115
(cx: *mut JSContext,
@@ -211,16 +211,6 @@ extern "C" {
211211
-> *const ::libc::c_void;
212212
pub fn CreateWrapperProxyHandler(aTraps: *const ProxyTraps)
213213
-> *const ::libc::c_void;
214-
pub fn CreateRustJSPrincipal(origin: *const ::libc::c_void,
215-
destroy: Option<unsafe extern "C" fn
216-
(principal: *mut JSPrincipals)>,
217-
write: Option<unsafe extern "C" fn
218-
(cx: *mut JSContext,
219-
writer: *mut JSStructuredCloneWriter)
220-
-> bool>)
221-
-> *mut JSPrincipals;
222-
pub fn GetPrincipalOrigin(principal: *const JSPrincipals)
223-
-> *const ::libc::c_void;
224214
pub fn GetCrossCompartmentWrapper() -> *const ::libc::c_void;
225215
pub fn GetSecurityWrapper() -> *const ::libc::c_void;
226216
pub fn NewCompileOptions(aCx: *mut JSContext, aFile: *const ::libc::c_char,
@@ -240,7 +230,7 @@ extern "C" {
240230
pub fn NewWindowProxy(aCx: *mut JSContext, aObj: HandleObject,
241231
aHandler: *const ::libc::c_void)
242232
-> *mut JSObject;
243-
pub fn GetWindowProxyClass() -> *const Class;
233+
pub fn GetWindowProxyClass() -> *const JSClass;
244234
pub fn GetProxyReservedSlot(obj: *mut JSObject, slot: u32, dest: *mut JS::Value);
245235
pub fn GetProxyPrivate(obj: *mut JSObject, dest: *mut JS::Value);
246236
pub fn SetProxyReservedSlot(obj: *mut JSObject, slot: u32, val: *const JS::Value);
@@ -269,15 +259,17 @@ extern "C" {
269259
pub fn UnwrapObjectStatic(obj: *mut JSObject) -> *mut JSObject;
270260
pub fn UnwrapObjectDynamic(obj: *mut JSObject, cx: *mut JSContext, stopAtOuter: u8) -> *mut JSObject;
271261
pub fn UncheckedUnwrapObject(obj: *mut JSObject, stopAtOuter: u8) -> *mut JSObject;
272-
pub fn CreateAutoIdVector(cx: *mut JSContext) -> *mut AutoIdVector;
273-
pub fn AppendToAutoIdVector(v: *mut AutoIdVector, id: HandleId) -> bool;
274-
pub fn SliceAutoIdVector(v: *const AutoIdVector, length: *mut usize) -> *const jsid;
275-
pub fn DestroyAutoIdVector(v: *mut AutoIdVector);
276-
pub fn CreateAutoObjectVector(aCx: *mut JSContext)
277-
-> *mut AutoObjectVector;
278-
pub fn AppendToAutoObjectVector(v: *mut AutoObjectVector,
262+
pub fn CreateRootedIdVector(cx: *mut JSContext) -> *mut PersistentRootedIdVector;
263+
pub fn GetIdVectorAddress(v: *mut PersistentRootedIdVector) -> *mut ::libc::c_void;
264+
pub fn SliceRootedIdVector(v: *const PersistentRootedIdVector, length: *mut usize) -> *const jsid;
265+
pub fn AppendToIdVector(v: MutableHandleIdVector, id: HandleId) -> bool;
266+
pub fn DestroyRootedIdVector(v: *mut PersistentRootedIdVector);
267+
pub fn CreateRootedObjectVector(aCx: *mut JSContext)
268+
-> *mut PersistentRootedObjectVector;
269+
pub fn AppendToRootedObjectVector(v: *mut PersistentRootedObjectVector,
279270
obj: *mut JSObject) -> bool;
280-
pub fn DeleteAutoObjectVector(v: *mut AutoObjectVector);
271+
pub fn GetObjectVectorAddress(v: *mut PersistentRootedObjectVector) -> *mut ::libc::c_void;
272+
pub fn DeleteRootedObjectVector(v: *mut PersistentRootedObjectVector);
281273
pub fn CollectServoSizes(cx: *mut JSContext, sizes: *mut ServoSizes, get_size: Option<unsafe extern "C" fn (obj: *mut JSObject) -> usize>) -> bool;
282274
pub fn InitializeMemoryReporter(want_to_measure: Option<unsafe extern "C" fn (obj: *mut JSObject) -> bool>);
283275
pub fn CallIdTracer(trc: *mut JSTracer, idp: *mut Heap<jsid>,

src/glue_wrappers.in

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ wrap!(glue: pub fn WrapperNew(aCx: *mut JSContext, aObj: HandleObject, aHandler:
88
wrap!(glue: pub fn NewWindowProxy(aCx: *mut JSContext, aObj: HandleObject, aHandler: *const ::libc::c_void) -> *mut JSObject);
99
wrap!(glue: pub fn RUST_JSID_IS_INT(id: HandleId) -> bool);
1010
wrap!(glue: pub fn RUST_JSID_TO_INT(id: HandleId) -> i32);
11+
wrap!(glue: pub fn int_to_jsid(i: i32, id: MutableHandleId));
1112
wrap!(glue: pub fn RUST_JSID_IS_STRING(id: HandleId) -> bool);
1213
wrap!(glue: pub fn RUST_JSID_TO_STRING(id: HandleId) -> *mut JSString);
1314
wrap!(glue: pub fn RUST_SYMBOL_TO_JSID(sym: *mut Symbol, id: MutableHandleId));
14-
wrap!(glue: pub fn int_to_jsid(i: i32, id: MutableHandleId));
15+
wrap!(glue: pub fn RUST_JSID_IS_VOID(id: HandleId) -> bool);
1516
wrap!(glue: pub fn RUST_INTERNED_STRING_TO_JSID(cx: *mut JSContext, str: *mut JSString, id: MutableHandleId));
16-
wrap!(glue: pub fn AppendToAutoIdVector(v: *mut AutoIdVector, id: HandleId) -> bool);
17+
wrap!(glue: pub fn GetIdVectorAddress(v: *mut PersistentRootedIdVector) -> *mut ::libc::c_void);
18+
wrap!(glue: pub fn AppendToIdVector(v: MutableHandleIdVector, id: HandleId) -> bool);
1719
wrap!(glue: pub fn JS_GetPromiseResult (promise: HandleObject, dest: MutableHandleValue));
1820
wrap!(glue: pub fn EncodeStringToUTF8(cx: *mut JSContext, str: HandleString, cb: fn(*const c_char)));

0 commit comments

Comments
 (0)