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

Upgrade SpiderMonkey #2455

Closed
wants to merge 7 commits into from
Closed
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Next

Build with upgraded SpiderMonkey.

  • Loading branch information
jdm committed May 13, 2014
commit e2cd11f17c1fee9877a6257d4ef585076534c6b3
@@ -137,6 +137,7 @@ endif
# their name already, while others don't.
DONE_$(1) = $$(B)src/$$(PATH_$(1))/lib*.dummy
DEPS_SUBMODULES += $$(PATH_$(1))
DEPS_SUBMODULES += $$(PATH_$(1))/dist/lib
DEPS_SUBMODULES += $$(PATH_$(1))/.libs
DEPS_SUBMODULES += $$(PATH_$(1))/src/.libs
endef
@@ -156,7 +157,7 @@ include $(S)mk/sub.mk
# Define how to compute approximate submodule dependencies.
# TODO: this may be a bit brutish, but is there a better way?
define DEF_SUBMODULE_DEPS
ROUGH_DEPS_$(1)=$$(call rwildcard,$$(S)src/$$(PATH_$(1)),*h *c *cpp *rs *rc)
ROUGH_DEPS_$(1)=$$(call rwildcard,$$(S)src/$$(PATH_$(1)),*.h *.c *.cpp *.rs *.rc)
DONE_DEPS_$(1)=$$(foreach dep,$$(DEPS_$(1)),$$(DONE_$$(dep)))
# the main target for a submodule
endef
@@ -165,7 +166,7 @@ endef
define DEF_SUBMODULE_RULES

ENV_RLDFLAGS_$(1) = -L $$(CFG_BUILD_HOME)workspace/lib/$$(CFG_TARGET)
ENV_RLDFLAGS_$(1) += $$(foreach dep,$$(DEPS_$(1)),-L $$(B)src/$$(PATH_$$(dep)) -L $$(B)src/$$(PATH_$$(dep))/.libs -L $$(B)src/$$(PATH_$$(dep))/src/.libs)
ENV_RLDFLAGS_$(1) += $$(foreach dep,$$(DEPS_$(1)),-L $$(B)src/$$(PATH_$$(dep)) -L $$(B)src/$$(PATH_$$(dep))/.libs -L $$(B)src/$$(PATH_$$(dep))/src/.libs -L $$(B)src/$$(PATH_$$(dep))/dist/lib)

# variables that depend on dependency definitions from sub.mk!
ENV_CFLAGS_$(1) = CFLAGS="$$(CFLAGS_$(1))"
@@ -246,7 +247,7 @@ DONE_gfx = $(B)src/components/gfx/libgfx.dummy

DEPS_gfx = $(CRATE_gfx) $(SRC_gfx) $(DONE_SUBMODULES) $(DONE_util) $(DONE_style) $(DONE_net) $(DONE_msg) $(DONE_macros)

RFLAGS_script = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/components/util -L $(B)src/components/style -L $(B)src/components/net -L $(B)src/components/msg -L$(B)src/components/macros
RFLAGS_script = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/supprt/spidermonkey/mozjs/dist/lib -L $(B)src/components/util -L $(B)src/components/style -L $(B)src/components/net -L $(B)src/components/msg -L$(B)src/components/macros

BINDINGS_SRC = $(S)src/components/script/dom/bindings/codegen
WEBIDLS_SRC = $(S)src/components/script/dom/webidls
@@ -697,7 +697,7 @@ do
CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-android-ndk=${CFG_ANDROID_NDK_PATH}"
CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-android-toolchain=${CFG_ANDROID_CROSS_PATH}"
fi
CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-gczeal"
CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-gczeal --without-intl-api"
;;
support/skia/skia)
# Right now the skia configure script actually ignores --enable-debug and the
@@ -25,6 +25,7 @@ extern crate layers;
extern crate opengles;
extern crate png;
extern crate rustuv;
#[link_args = "-ljs_static"]
extern crate script;
#[phase(syntax)]
extern crate servo_macros = "macros";
@@ -164,6 +165,10 @@ fn run(opts: opts::Opts) {
pool_config.event_loop_factory = rustuv::event_loop;
let mut pool = green::SchedPool::new(pool_config);

unsafe {
js::jsapi::JS_Init();
}

let (compositor_port, compositor_chan) = CompositorChan::new();
let profiler_chan = Profiler::create(opts.profiler_period);

@@ -217,5 +222,9 @@ fn run(opts: opts::Opts) {
profiler_chan);

pool.shutdown();

unsafe {
js::jsapi::JS_ShutDown();
}
}

@@ -3,12 +3,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use dom::bindings::utils::Reflectable;
use js::jsapi::{JSContext, JSObject, JS_WrapObject, JS_ObjectIsCallable};
use js::jsapi::{JS_GetProperty, JSTracer, JS_CallTracer};
use js::jsapi::{JSContext, JSObject, JS_WrapObject, JS_ObjectIsCallable, JSHandleObject};
use js::jsapi::{JS_GetProperty, JSTracer, JS_CallObjectTracer, JSMutableHandleObject};
use js::jsapi::JSMutableHandleValue;
use js::jsval::{JSVal, UndefinedValue};
use js::JSTRACE_OBJECT;

use libc;
use std::cast;
use std::ptr;

@@ -27,45 +26,50 @@ pub enum ExceptionHandling {

#[deriving(Clone,Eq)]
pub struct CallbackInterface {
pub callback: *JSObject
pub callback: *mut JSObject
}

impl<S: Encoder<E>, E> Encodable<S, E> for CallbackInterface {
fn encode(&self, s: &mut S) -> Result<(), E> {
unsafe {
let tracer: *mut JSTracer = cast::transmute(s);
"callback".to_c_str().with_ref(|name| {
(*tracer).debugPrinter = ptr::null();
(*tracer).debugPrintIndex = -1;
(*tracer).debugPrintArg = name as *libc::c_void;
JS_CallTracer(tracer as *JSTracer, self.callback, JSTRACE_OBJECT as u32);
//XXXjdm the arg can be moved
let mut cb = self.callback;
JS_CallObjectTracer(tracer, &mut cb, name);
});
};
Ok(())
}
}

pub trait CallbackContainer {
fn callback(&self) -> *JSObject;
fn callback(&self) -> *mut JSObject;
}

impl CallbackContainer for CallbackInterface {
fn callback(&self) -> *JSObject {
fn callback(&self) -> *mut JSObject {
self.callback
}
}

impl CallbackInterface {
pub fn new(callback: *JSObject) -> CallbackInterface {
pub fn new(callback: *mut JSObject) -> CallbackInterface {
CallbackInterface {
callback: callback
}
}

pub fn GetCallableProperty(&self, cx: *JSContext, name: &str) -> Result<JSVal, ()> {
pub fn GetCallableProperty(&self, cx: *mut JSContext, name: &str) -> Result<JSVal, ()> {
let mut callable = UndefinedValue();
unsafe {
if name.to_c_str().with_ref(|name| JS_GetProperty(cx, self.callback, name, &mut callable as *mut JSVal as *JSVal)) == 0 {
let callback = JSHandleObject {
unnamed_field1: &self.callback,
};
let callablehandle = JSMutableHandleValue {
unnamed_field1: &mut callable,
};
if name.to_c_str().with_ref(|name| JS_GetProperty(cx, callback, name, callablehandle)) == 0 {
return Err(());
}

@@ -79,39 +83,41 @@ impl CallbackInterface {
}
}

pub fn GetJSObjectFromCallback<T: CallbackContainer>(callback: &T) -> *JSObject {
pub fn GetJSObjectFromCallback<T: CallbackContainer>(callback: &T) -> *mut JSObject {
callback.callback()
}

pub fn WrapCallThisObject<T: 'static + CallbackContainer + Reflectable>(cx: *JSContext,
_scope: *JSObject,
p: ~T) -> *JSObject {
let obj = GetJSObjectFromCallback(p);
pub fn WrapCallThisObject<T: 'static + CallbackContainer + Reflectable>(cx: *mut JSContext,
_scope: *mut JSObject,
p: ~T) -> *mut JSObject {
let mut obj = GetJSObjectFromCallback(p);
assert!(obj.is_not_null());

let obj = JSMutableHandleObject {
unnamed_field1: &mut obj,
};
unsafe {
if JS_WrapObject(cx, &obj) == 0 {
return ptr::null();
if JS_WrapObject(cx, obj) == 0 {
return ptr::mut_null();
}
return *obj.unnamed_field1;
}

return obj;
}

pub struct CallSetup {
pub cx: *JSContext,
pub cx: *mut JSContext,
pub handling: ExceptionHandling
}

impl CallSetup {
pub fn new(cx: *JSContext, handling: ExceptionHandling) -> CallSetup {
pub fn new(cx: *mut JSContext, handling: ExceptionHandling) -> CallSetup {
CallSetup {
cx: cx,
handling: handling
}
}

pub fn GetContext(&self) -> *JSContext {
pub fn GetContext(&self) -> *mut JSContext {
self.cx
}
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.