Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SpiderMonkey #260

Merged
merged 4 commits into from Apr 27, 2016
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -3,14 +3,17 @@ sudo: 9000
dist: trusty
rust:
- nightly
os:
- linux
- osx

env:
- FEATURES=""
- FEATURES="debugmozjs"
- FEATURES="--features debugmozjs"

script:
- cargo build --verbose --features "$FEATURES"
- cargo test --verbose --features "$FEATURES"
- travis_wait cargo build --verbose $FEATURES
- cargo test --verbose $FEATURES

branches:
except:
@@ -15,6 +15,9 @@ name = "stack_limit"
[[test]]
name = "vec_conversion"

[lib]
doctest = false

[features]
debugmozjs = ['mozjs_sys/debugmozjs']

@@ -0,0 +1,79 @@
cd "$(dirname "$0")"

../../rust-bindgen/target/debug/bindgen \
-no-type-renaming \
-dtor-attr unsafe_no_drop_flag \
-blacklist-type DefaultHasher \
-blacklist-type Heap \
-blacklist-type AutoHashMapRooter \
-blacklist-type AutoHashSetRooter \
-blacklist-type TypeIsGCThing \
-blacklist-type HashMap \
-blacklist-type HashSet \
-blacklist-type HashTable \
-blacklist-type HashTableEntry \
-opaque-type RuntimeStats \
-opaque-type EnumeratedArray \
-opaque-type HashMap \
-opaque-type AutoAssertGCCallback \
-opaque-type CompileOptions \
-opaque-type OwningCompileOptions \
-opaque-type ReadOnlyCompileOptions \
-allow-unknown-types -x c++ --std=c++11 \
-I ../target/debug/build/mozjs_sys-*/out/dist/include \
wrapper.h \
-DRUST_BINDGEN=1 \
-o ../out.rs \
-match wrapper.h \
-match jsapi.h \
-match jsfriendapi.h \
-match jsalloc.h \
-match jsbytecode.h \
-match jspubtd.h \
-match AllocPolicy.h \
-match CallArgs.h \
-match CallNonGenericMethod.h \
-match CharacterEncoding.h \
-match Class.h \
-match Conversions.h \
-match Date.h \
-match Debug.h \
-match EnumeratedArray.h \
-match GCAPI.h \
-match GCAnnotations.h \
-match GCPolicyAPI.h \
-match GCVariant.h \
-match GCVector.h \
-match HashTable.h \
-match HeapAPI.h \
-match Id.h \
-match Initialization.h \
-match LinkedList.h \
-match LegacyIntTypes.h \
-match MemoryMetrics.h \
-match MemoryReporting.h \
-match Opaque.h \
-match Principals.h \
-match ProfilingFrameIterator.h \
-match ProfilingStack.h \
-match Promise.h \
-match Proxy.h \
-match Range.h \
-match RangedPtr.h \
-match RequiredDefines.h \
-match RootingAPI.h \
-match SliceBudget.h \
-match StructuredClone.h \
-match TraceKind.h \
-match TracingAPI.h \
-match TrackedOptimizationInfo.h \
-match TypeDecls.h \
-match UbiNode.h \
-match UbiNodeBreadthFirst.h \
-match UbiNodeCensus.h \
-match UbiNodeDominatorTree.h \
-match UbiNodePostOrder.h \
-match UbiNodeShortestPaths.h \
-match Value.h \
-match Vector.h \
-match WeakMapPtr.h
@@ -0,0 +1,9 @@
#include <stdint.h>
#include <unistd.h>

typedef uint32_t HashNumber;

#include "jsfriendapi.h"
#include "js/Conversions.h"
#include "js/Initialization.h"
#include "js/MemoryMetrics.h"
@@ -2,54 +2,27 @@
* 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::JSProtoKey;
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 default_stacksize: usize = 8192;

pub const JSID_TYPE_STRING: i64 = 0;
pub const JSID_TYPE_INT: i64 = 1;
pub const JSID_TYPE_VOID: i64 = 2;
pub const JSID_TYPE_OBJECT: i64 = 4;
pub const JSID_TYPE_DEFAULT_XML_NAMESPACE: i64 = 6;
pub const JSID_TYPE_MASK: i64 = 7;
pub const JSCLASS_IS_DOMJSCLASS: c_uint = 1 << 4;
pub const JSCLASS_USERBIT1: c_uint = 1 << 7;

pub const JSFUN_CONSTRUCTOR: u32 = 0x400; /* native that can be called as a ctor */

pub const JSPROP_ENUMERATE: c_uint = 0x01;
pub const JSPROP_READONLY: c_uint = 0x02;
pub const JSPROP_PERMANENT: c_uint = 0x04;
pub const JSPROP_GETTER: c_uint = 0x10;
pub const JSPROP_SETTER: c_uint = 0x20;
pub const JSPROP_SHARED: c_uint = 0x40;
pub const JSPROP_NATIVE_ACCESSORS: c_uint = 0x08;

pub const JSCLASS_RESERVED_SLOTS_SHIFT: c_uint = 8;
pub const JSCLASS_RESERVED_SLOTS_WIDTH: c_uint = 8;
pub const JSCLASS_RESERVED_SLOTS_MASK: c_uint = ((1 << JSCLASS_RESERVED_SLOTS_WIDTH) - 1) as c_uint;
pub const JSCLASS_RESERVED_SLOTS_MASK: c_uint =
(1 << JSCLASS_RESERVED_SLOTS_WIDTH) - 1;

pub const JSCLASS_HIGH_FLAGS_SHIFT: c_uint =
JSCLASS_RESERVED_SLOTS_SHIFT + JSCLASS_RESERVED_SLOTS_WIDTH;
pub const JSCLASS_IS_GLOBAL: c_uint = 1 << (JSCLASS_HIGH_FLAGS_SHIFT + 1);
pub const JSCLASS_GLOBAL_APPLICATION_SLOTS: c_uint = 4;
pub const JSCLASS_GLOBAL_SLOT_COUNT: c_uint = JSCLASS_GLOBAL_APPLICATION_SLOTS + JSProtoKey::JSProto_LIMIT as u32 * 3 + 31;

pub const JSCLASS_IS_DOMJSCLASS: u32 = 1 << 4;
pub const JSCLASS_IMPLEMENTS_BARRIERS: u32 = 1 << 5;
pub const JSCLASS_USERBIT1: u32 = 1 << 7;

pub const JSCLASS_IS_PROXY: u32 = 1 << (JSCLASS_HIGH_FLAGS_SHIFT+4);

pub const JSSLOT_PROXY_PRIVATE: u32 = 1;

pub const JS_DEFAULT_ZEAL_FREQ: u32 = 100;
pub const JSCLASS_IS_GLOBAL: c_uint =
1 << (JSCLASS_HIGH_FLAGS_SHIFT + 1);

pub const JSITER_ENUMERATE: c_uint = 0x1;
pub const JSITER_FOREACH: c_uint = 0x2;
pub const JSITER_KEYVALUE: c_uint = 0x4;
pub const JSITER_OWNONLY: c_uint = 0x8;
pub const JSITER_HIDDEN: c_uint = 0x10;
pub const JSITER_SYMBOLS: c_uint = 0x20;
pub const JSITER_SYMBOLSONLY: c_uint = 0x40;
pub const JSCLASS_IS_PROXY: c_uint =
1 << (JSCLASS_HIGH_FLAGS_SHIFT + 4);

pub const JSCLASS_GLOBAL_SLOT_COUNT: c_uint =
JSCLASS_GLOBAL_APPLICATION_SLOTS + JSProtoKey::JSProto_LIMIT as c_uint * 3 + 36;
@@ -27,9 +27,9 @@

#![deny(missing_docs)]

use JSPROP_ENUMERATE;
use error::throw_type_error;
use glue::RUST_JS_NumberValue;
use jsapi::JSPROP_ENUMERATE;
use jsapi::{JSContext, JSObject, JSString, HandleValue, MutableHandleValue};
use jsapi::{JS_NewUCStringCopyN, JS_StringHasLatin1Chars, JS_WrapValue};
use jsapi::{JS_GetLatin1StringCharsAndLength, JS_GetTwoByteStringCharsAndLength};
@@ -9,7 +9,7 @@
use jsapi::{JSContext, JSErrorFormatString, JSExnType, JS_ReportErrorNumber};
use libc;
use std::ffi::CString;
use std::{mem, ptr};
use std::{mem, os, ptr};

/// Format string used to throw javascript errors.
static ERROR_FORMAT_STRING_STRING: [libc::c_char; 4] = [
@@ -21,21 +21,23 @@ static ERROR_FORMAT_STRING_STRING: [libc::c_char; 4] = [

/// Format string struct used to throw `TypeError`s.
static mut TYPE_ERROR_FORMAT_STRING: JSErrorFormatString = JSErrorFormatString {
name: b"TYPE_ERROR" as *const _ as *const libc::c_char,
format: &ERROR_FORMAT_STRING_STRING as *const libc::c_char,
argCount: 1,
exnType: JSExnType::JSEXN_TYPEERR as i16,
};

/// Format string struct used to throw `RangeError`s.
static mut RANGE_ERROR_FORMAT_STRING: JSErrorFormatString = JSErrorFormatString {
name: b"RANGE_ERROR" as *const _ as *const libc::c_char,
format: &ERROR_FORMAT_STRING_STRING as *const libc::c_char,
argCount: 1,
exnType: JSExnType::JSEXN_RANGEERR as i16,
};

/// Callback used to throw javascript errors.
/// See throw_js_error for info about error_number.
unsafe extern "C" fn get_error_message(_user_ref: *mut libc::c_void,
unsafe extern "C" fn get_error_message(_user_ref: *mut os::raw::c_void,
error_number: libc::c_uint)
-> *const JSErrorFormatString {
let num: JSExnType = mem::transmute(error_number);
@@ -1,7 +1,5 @@
use jsapi::*;

pub const JS_STRUCTURED_CLONE_VERSION: u32 = 5;

pub enum Action { }
unsafe impl Sync for ProxyTraps { }
/* automatically generated by rust-bindgen */
@@ -20,14 +18,14 @@ pub struct ProxyTraps {
HandleObject,
id: HandleId,
desc:
MutableHandle<JSPropertyDescriptor>)
MutableHandle<PropertyDescriptor>)
-> bool>,
pub defineProperty: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
proxy: HandleObject,
id: HandleId,
desc:
Handle<JSPropertyDescriptor>,
Handle<PropertyDescriptor>,
result:
*mut ObjectOpResult)
-> bool>,
@@ -63,13 +61,13 @@ pub struct ProxyTraps {
pub get: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
proxy: HandleObject,
receiver: HandleObject, id: HandleId,
receiver: HandleValue, id: HandleId,
vp: MutableHandleValue) -> bool>,
pub set: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
proxy: HandleObject,
receiver: HandleObject, id: HandleId,
vp: MutableHandleValue,
id: HandleId, v: HandleValue,
receiver: HandleValue,
result: *mut ObjectOpResult) -> bool>,
pub call: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
@@ -84,7 +82,7 @@ pub struct ProxyTraps {
proxy: HandleObject,
id: HandleId,
desc:
MutableHandle<JSPropertyDescriptor>)
MutableHandle<PropertyDescriptor>)
-> bool>,
pub hasOwn: ::std::option::Option<unsafe extern "C" fn
(cx: *mut JSContext,
@@ -171,13 +169,14 @@ extern "C" {
cx: *mut JSContext,
proxy: HandleObject, id: HandleId,
desc:
MutableHandle<JSPropertyDescriptor>)
MutableHandle<PropertyDescriptor>)
-> bool;
pub fn InvokeHasOwn(handler: *const ::libc::c_void,
cx: *mut JSContext, proxy: HandleObject,
id: HandleId, bp: *mut bool) -> bool;
pub fn RUST_JS_NumberValue(d: f64) -> Value;
pub fn RUST_FUNCTION_VALUE_TO_JITINFO(v: Value) -> *const JSJitInfo;
pub fn CreateCallArgsFromVp(argc: u32, v: *mut Value) -> CallArgs;
pub fn CallJitGetterOp(info: *const JSJitInfo, cx: *mut JSContext,
thisObj: HandleObject,
specializedThis: *mut ::libc::c_void, argc: u32,
@@ -211,9 +210,10 @@ extern "C" {
pub fn NewWindowProxy(aCx: *mut JSContext, aObj: HandleObject,
aHandler: *const ::libc::c_void)
-> *mut JSObject;
pub fn GetWindowProxyClass() -> *const Class;
pub fn GetProxyExtra(obj: *mut JSObject, slot: u32) -> Value;
pub fn GetProxyPrivate(obj: *mut JSObject) -> Value;
pub fn SetProxyExtra(obj: *mut JSObject, slot: u32, val: Value);
pub fn SetProxyExtra(obj: *mut JSObject, slot: u32, val: *const Value);
pub fn RUST_JSID_IS_INT(id: HandleId) -> bool;
pub fn RUST_JSID_TO_INT(id: HandleId) -> i32;
pub fn int_to_jsid(i: i32) -> jsid;
@@ -239,4 +239,23 @@ extern "C" {
obj: *mut JSObject) -> bool;
pub fn DeleteAutoObjectVector(v: *mut AutoObjectVector);
pub fn CollectServoSizes(rt: *mut JSRuntime, sizes: *mut ServoSizes) -> bool;
pub fn CallIdTracer(trc: *mut JSTracer, idp: *mut Heap<jsid>,
name: *const ::libc::c_char);
pub fn CallValueTracer(trc: *mut JSTracer, valuep: *mut Heap<Value>,
name: *const ::libc::c_char);
pub fn CallObjectTracer(trc: *mut JSTracer,
objp: *mut Heap<*mut JSObject>,
name: *const ::libc::c_char);
pub fn CallStringTracer(trc: *mut JSTracer,
strp: *mut Heap<*mut JSString>,
name: *const ::libc::c_char);
pub fn CallScriptTracer(trc: *mut JSTracer,
scriptp: *mut Heap<*mut JSScript>,
name: *const ::libc::c_char);
pub fn CallFunctionTracer(trc: *mut JSTracer,
funp: *mut Heap<*mut JSFunction>,
name: *const ::libc::c_char);
pub fn CallUnbarrieredObjectTracer(trc: *mut JSTracer,
objp: *mut *mut JSObject,
name: *const ::libc::c_char);
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.