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

Commit

Permalink
Auto merge of #494 - servo:smup, r=asajeffrey
Browse files Browse the repository at this point in the history
Update SpiderMonkey
  • Loading branch information
bors-servo authored Mar 5, 2020
2 parents c1e5ad8 + a09ebb1 commit 98ebda0
Show file tree
Hide file tree
Showing 16 changed files with 407 additions and 418 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-xenial-8
packages:
- autoconf2.13
- clang
- clang-8
homebrew:
update: true
packages:
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "mozjs"
description = "Rust bindings to the Mozilla SpiderMonkey JavaScript engine."
repository = "https://github.com/servo/rust-mozjs"
version = "0.12.1"
version = "0.13.0"
authors = ["The Servo Project Developers"]
build = "build.rs"
license = "MPL-2.0"
Expand Down Expand Up @@ -58,4 +58,4 @@ lazy_static = "1"
libc = "0.2"
log = "0.4"
num-traits = "0.2"
mozjs_sys = { git = "https://github.com/servo/mozjs", rev = "bc4935b668171863e537d3fb0d911001a6742013" }
mozjs_sys = { git = "https://github.com/servo/mozjs", rev = "aabcc9ba889b2755f1e4e83f28323a60415a790f" }
11 changes: 8 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ matrix:
fast_finish: true

environment:
LINKER: "lld-link.exe"
PYTHON3: "C:\\Python37-x64\\python.exe"
# The appveyor image we use has a pretty huge set of things installed... we make the
# initial PATH something sane so we know what to expect
Expand All @@ -30,16 +31,18 @@ environment:
C:\\Program Files\\Git\\cmd;\
C:\\Program Files\\Git\\usr\\bin;\
C:\\Program Files\\AppVeyor\\BuildAgent;"

CC: "clang-cl.exe"
CXX: "clang-cl.exe"
LINKER: "lld-link.exe"

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

matrix:
- TARGET: i686-pc-windows-msvc
CROSS_COMPILE: 1
- TARGET: x86_64-pc-windows-msvc
- TARGET: x86_64-pc-windows-msvc
FEATURES: "--features debugmozjs"

# Uncomment to enable RDP & wait for exit. Connection info will be printed in the log.
#init:
Expand All @@ -52,6 +55,7 @@ install:
- set BUILD_ENV=msvc
- ps: Start-FileDownload "http://servo-rust.s3.amazonaws.com/build/MozillaBuildSetup-2.2.0.exe"
- ps: .\MozillaBuildSetup-2.2.0.exe /S | Out-Null
- appveyor-retry choco install llvm --version=8.0.1
- appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
- rustup-init.exe -y --default-host=x86_64-pc-windows-msvc
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
Expand All @@ -66,5 +70,6 @@ build_script:
- echo PATH %PATH%
- echo MOZTOOLS_PATH %MOZTOOLS_PATH%
- cd %APPVEYOR_BUILD_FOLDER%
- cargo build --verbose --verbose --target %TARGET%
- if "%CROSS_COMPILE%" == "" cargo test --verbose --verbose --target %TARGET%
- set MOZJS_FORCE_RERUN=1
- cargo build --verbose --verbose --target %TARGET% %FEATURES%
- if "%CROSS_COMPILE%" == "" cargo test --verbose --verbose --target %TARGET% %FEATURES%
5 changes: 1 addition & 4 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,17 @@ fn main() {

build.cpp(true)
.file("src/jsglue.cpp")
.flag("-DSTATIC_JS_API")
.include(include_path);
if env::var("CARGO_FEATURE_DEBUGMOZJS").is_ok() {
build.define("DEBUG", "");
build.define("_DEBUG", "");

if cfg!(target_os = "windows") {
build.flag("-MDd");
build.flag("-Od");
} else {
build.flag("-g");
build.flag("-O0");
}
} else if cfg!(target_os = "windows") {
build.flag("-MD");
}

if env::var("CARGO_FEATURE_PROFILEMOZJS").is_ok() {
Expand Down
23 changes: 7 additions & 16 deletions src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use jsapi::{JSCLASS_GLOBAL_APPLICATION_SLOTS, JSCLASS_RESERVED_SLOTS_SHIFT};
use jsapi::{JSCLASS_RESERVED_SLOTS_WIDTH, JSProtoKey};
use libc::c_uint;

pub const default_heapsize: u32 = 32_u32 * 1024_u32 * 1024_u32;

pub const JSCLASS_IS_DOMJSCLASS: c_uint = 1 << 4;
pub const JSCLASS_USERBIT1: c_uint = 1 << 7;
pub use jsapi::JSCLASS_IS_DOMJSCLASS;
pub use jsapi::JSCLASS_USERBIT1;

pub const JSCLASS_RESERVED_SLOTS_MASK: c_uint =
(1 << JSCLASS_RESERVED_SLOTS_WIDTH) - 1;
pub use jsapi::JSCLASS_RESERVED_SLOTS_MASK;

pub const JSCLASS_HIGH_FLAGS_SHIFT: c_uint =
(JSCLASS_RESERVED_SLOTS_SHIFT as c_uint) + JSCLASS_RESERVED_SLOTS_WIDTH;
pub use jsapi::JSCLASS_HIGH_FLAGS_SHIFT;

pub const JSCLASS_IS_GLOBAL: c_uint =
1 << (JSCLASS_HIGH_FLAGS_SHIFT + 1);
pub use jsapi::JSCLASS_IS_GLOBAL;

pub const JSCLASS_IS_PROXY: c_uint =
1 << (JSCLASS_HIGH_FLAGS_SHIFT + 4);
pub use jsapi::JSCLASS_IS_PROXY;

pub const JSCLASS_GLOBAL_SLOT_COUNT: c_uint =
JSCLASS_GLOBAL_APPLICATION_SLOTS + JSProtoKey::JSProto_LIMIT as c_uint * 2 + 38;
pub use jsapi::JSCLASS_GLOBAL_SLOT_COUNT;
1 change: 0 additions & 1 deletion src/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ impl_as!(u64, u64);
/// A trait to convert Rust types to `JSVal`s.
pub trait ToJSValConvertible {
/// Convert `self` to a `JSVal`. JSAPI failure causes a panic.
#[inline]
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue);
}

Expand Down
2 changes: 1 addition & 1 deletion src/generate_wrappers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ grep_heur() {
sed 's/Handle<\*mut JSObject>/HandleObject/g'
}

grep_heur ../target/debug/build/mozjs_sys-*/out/jsapi.rs | sed 's/\(.*\)/wrap!(jsapi: \1);/g' > jsapi_wrappers.in
grep_heur ../target/debug/build/mozjs_sys-*/out/build/jsapi.rs | sed 's/\(.*\)/wrap!(jsapi: \1);/g' > jsapi_wrappers.in
grep_heur glue.rs | sed 's/\(.*\)/wrap!(glue: \1);/g' > glue_wrappers.in
36 changes: 14 additions & 22 deletions src/glue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub struct ProxyTraps {
pub ownPropertyKeys: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
proxy: HandleObject,
props: *mut AutoIdVector)
props: MutableHandleIdVector)
-> bool>,
pub delete_: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
Expand All @@ -58,7 +58,7 @@ pub struct ProxyTraps {
pub enumerate: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
proxy: HandleObject,
props: *mut AutoIdVector)
props: MutableHandleIdVector)
-> bool>,
pub getPrototypeIfOrdinary: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
Expand Down Expand Up @@ -109,7 +109,7 @@ pub struct ProxyTraps {
proxy:
HandleObject,
props:
*mut AutoIdVector)
MutableHandleIdVector)
-> bool>,
pub nativeCall: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
Expand Down Expand Up @@ -211,16 +211,6 @@ extern "C" {
-> *const ::libc::c_void;
pub fn CreateWrapperProxyHandler(aTraps: *const ProxyTraps)
-> *const ::libc::c_void;
pub fn CreateRustJSPrincipal(origin: *const ::libc::c_void,
destroy: Option<unsafe extern "C" fn
(principal: *mut JSPrincipals)>,
write: Option<unsafe extern "C" fn
(cx: *mut JSContext,
writer: *mut JSStructuredCloneWriter)
-> bool>)
-> *mut JSPrincipals;
pub fn GetPrincipalOrigin(principal: *const JSPrincipals)
-> *const ::libc::c_void;
pub fn GetCrossCompartmentWrapper() -> *const ::libc::c_void;
pub fn GetSecurityWrapper() -> *const ::libc::c_void;
pub fn NewCompileOptions(aCx: *mut JSContext, aFile: *const ::libc::c_char,
Expand All @@ -240,7 +230,7 @@ extern "C" {
pub fn NewWindowProxy(aCx: *mut JSContext, aObj: HandleObject,
aHandler: *const ::libc::c_void)
-> *mut JSObject;
pub fn GetWindowProxyClass() -> *const Class;
pub fn GetWindowProxyClass() -> *const JSClass;
pub fn GetProxyReservedSlot(obj: *mut JSObject, slot: u32, dest: *mut JS::Value);
pub fn GetProxyPrivate(obj: *mut JSObject, dest: *mut JS::Value);
pub fn SetProxyReservedSlot(obj: *mut JSObject, slot: u32, val: *const JS::Value);
Expand Down Expand Up @@ -269,15 +259,17 @@ extern "C" {
pub fn UnwrapObjectStatic(obj: *mut JSObject) -> *mut JSObject;
pub fn UnwrapObjectDynamic(obj: *mut JSObject, cx: *mut JSContext, stopAtOuter: u8) -> *mut JSObject;
pub fn UncheckedUnwrapObject(obj: *mut JSObject, stopAtOuter: u8) -> *mut JSObject;
pub fn CreateAutoIdVector(cx: *mut JSContext) -> *mut AutoIdVector;
pub fn AppendToAutoIdVector(v: *mut AutoIdVector, id: HandleId) -> bool;
pub fn SliceAutoIdVector(v: *const AutoIdVector, length: *mut usize) -> *const jsid;
pub fn DestroyAutoIdVector(v: *mut AutoIdVector);
pub fn CreateAutoObjectVector(aCx: *mut JSContext)
-> *mut AutoObjectVector;
pub fn AppendToAutoObjectVector(v: *mut AutoObjectVector,
pub fn CreateRootedIdVector(cx: *mut JSContext) -> *mut PersistentRootedIdVector;
pub fn GetIdVectorAddress(v: *mut PersistentRootedIdVector) -> *mut ::libc::c_void;
pub fn SliceRootedIdVector(v: *const PersistentRootedIdVector, length: *mut usize) -> *const jsid;
pub fn AppendToIdVector(v: MutableHandleIdVector, id: HandleId) -> bool;
pub fn DestroyRootedIdVector(v: *mut PersistentRootedIdVector);
pub fn CreateRootedObjectVector(aCx: *mut JSContext)
-> *mut PersistentRootedObjectVector;
pub fn AppendToRootedObjectVector(v: *mut PersistentRootedObjectVector,
obj: *mut JSObject) -> bool;
pub fn DeleteAutoObjectVector(v: *mut AutoObjectVector);
pub fn GetObjectVectorAddress(v: *mut PersistentRootedObjectVector) -> *mut ::libc::c_void;
pub fn DeleteRootedObjectVector(v: *mut PersistentRootedObjectVector);
pub fn CollectServoSizes(cx: *mut JSContext, sizes: *mut ServoSizes, get_size: Option<unsafe extern "C" fn (obj: *mut JSObject) -> usize>) -> bool;
pub fn InitializeMemoryReporter(want_to_measure: Option<unsafe extern "C" fn (obj: *mut JSObject) -> bool>);
pub fn CallIdTracer(trc: *mut JSTracer, idp: *mut Heap<jsid>,
Expand Down
6 changes: 4 additions & 2 deletions src/glue_wrappers.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ wrap!(glue: pub fn WrapperNew(aCx: *mut JSContext, aObj: HandleObject, aHandler:
wrap!(glue: pub fn NewWindowProxy(aCx: *mut JSContext, aObj: HandleObject, aHandler: *const ::libc::c_void) -> *mut JSObject);
wrap!(glue: pub fn RUST_JSID_IS_INT(id: HandleId) -> bool);
wrap!(glue: pub fn RUST_JSID_TO_INT(id: HandleId) -> i32);
wrap!(glue: pub fn int_to_jsid(i: i32, id: MutableHandleId));
wrap!(glue: pub fn RUST_JSID_IS_STRING(id: HandleId) -> bool);
wrap!(glue: pub fn RUST_JSID_TO_STRING(id: HandleId) -> *mut JSString);
wrap!(glue: pub fn RUST_SYMBOL_TO_JSID(sym: *mut Symbol, id: MutableHandleId));
wrap!(glue: pub fn int_to_jsid(i: i32, id: MutableHandleId));
wrap!(glue: pub fn RUST_JSID_IS_VOID(id: HandleId) -> bool);
wrap!(glue: pub fn RUST_INTERNED_STRING_TO_JSID(cx: *mut JSContext, str: *mut JSString, id: MutableHandleId));
wrap!(glue: pub fn AppendToAutoIdVector(v: *mut AutoIdVector, id: HandleId) -> bool);
wrap!(glue: pub fn GetIdVectorAddress(v: *mut PersistentRootedIdVector) -> *mut ::libc::c_void);
wrap!(glue: pub fn AppendToIdVector(v: MutableHandleIdVector, id: HandleId) -> bool);
wrap!(glue: pub fn JS_GetPromiseResult (promise: HandleObject, dest: MutableHandleValue));
wrap!(glue: pub fn EncodeStringToUTF8(cx: *mut JSContext, str: HandleString, cb: fn(*const c_char)));
Loading

0 comments on commit 98ebda0

Please sign in to comment.