Skip to content
This repository has been archived by the owner on Dec 1, 2020. It is now read-only.

Commit

Permalink
Vanilla SpiderMonkey v21
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardoquesada committed May 14, 2013
1 parent f6805fb commit 4d819bb
Show file tree
Hide file tree
Showing 1,405 changed files with 42,574 additions and 57,583 deletions.
13 changes: 4 additions & 9 deletions Android.mk
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
LOCAL_PATH := $(call my-dir)
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/.

include $(CLEAR_VARS)
LOCAL_MODULE := spidermonkey_static
LOCAL_MODULE_FILENAME := js_static
LOCAL_SRC_FILES := ./lib/$(TARGET_ARCH_ABI)/libjs_static.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_CPPFLAGS := -D__STDC_LIMIT_MACROS=1
LOCAL_EXPORT_CPPFLAGS := -D__STDC_LIMIT_MACROS=1
include $(PREBUILT_STATIC_LIBRARY)
# empty file to block B2G/Gonk from trying to build anything inside mozilla-central
2 changes: 0 additions & 2 deletions js/ipc/ObjectWrapperChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,6 @@ ObjectWrapperChild::jsval_to_JSVariant(JSContext* cx, jsval from, JSVariant* to)
case JSTYPE_BOOLEAN:
*to = !!JSVAL_TO_BOOLEAN(from);
return true;
case JSTYPE_XML:
// fall through
default:
return false;
}
Expand Down
37 changes: 2 additions & 35 deletions js/ipc/ObjectWrapperParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,7 @@ const js::Class ObjectWrapperParent::sCPOW_JSClass = {
ObjectWrapperParent::CPOW_Call,
ObjectWrapperParent::CPOW_HasInstance,
ObjectWrapperParent::CPOW_Construct,
nullptr, // trace
{
ObjectWrapperParent::CPOW_Equality,
nullptr, // outerObject
nullptr, // innerObject
nullptr, // iteratorObject
nullptr, // wrappedObject
}
nullptr // trace
};

void
Expand Down Expand Up @@ -244,8 +237,6 @@ ObjectWrapperParent::jsval_to_JSVariant(JSContext* cx, jsval from,
case JSTYPE_BOOLEAN:
*to = !!JSVAL_TO_BOOLEAN(from);
return true;
case JSTYPE_XML:
return with_error(cx, false, "CPOWs currently cannot handle JSTYPE_XML");
default:
return with_error(cx, false, "Bad jsval type");
}
Expand Down Expand Up @@ -700,28 +691,4 @@ ObjectWrapperParent::CPOW_HasInstance(JSContext *cx, JSHandleObject obj, JSMutab
self->CallHasInstance(in_v,
aco.StatusPtr(), bp) &&
aco.Ok());
}

/*static*/ JSBool
ObjectWrapperParent::CPOW_Equality(JSContext *cx, JSHandleObject obj, JSHandleValue v,
JSBool *bp)
{
CPOW_LOG(("Calling CPOW_Equality..."));

*bp = JS_FALSE;

ObjectWrapperParent* self = Unwrap(cx, obj);
if (!self)
return with_error(cx, JS_FALSE, "Unwrapping failed in CPOW_Equality");

if (JSVAL_IS_PRIMITIVE(v))
return JS_TRUE;

ObjectWrapperParent* other = Unwrap(cx, JSVAL_TO_OBJECT(v));
if (!other)
return JS_TRUE;

*bp = (self == other);

return JS_TRUE;
}
}
5 changes: 1 addition & 4 deletions js/ipc/ObjectWrapperParent.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,9 @@ class ObjectWrapperParent

static JSBool
CPOW_Construct(JSContext *cx, unsigned argc, jsval *vp);

static JSBool
CPOW_HasInstance(JSContext *cx, JSHandleObject obj, JSMutableHandleValue vp, JSBool *bp);

static JSBool
CPOW_Equality(JSContext *cx, JSHandleObject obj, JSHandleValue v, JSBool *bp);
CPOW_HasInstance(JSContext *cx, JSHandleObject obj, JSMutableHandleValue vp, JSBool *bp);

static bool jsval_to_JSVariant(JSContext* cx, jsval from, JSVariant* to);
static bool jsval_from_JSVariant(JSContext* cx, const JSVariant& from,
Expand Down
19 changes: 10 additions & 9 deletions js/jsd/jsd.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ struct JSDStackFrameInfo
JSDThreadState* jsdthreadstate;
JSDScript* jsdscript;
uintptr_t pc;
JSStackFrame* fp;
bool isConstructing;
JSAbstractFramePtr frame;
};

#define GOT_PROTO ((short) (1 << 0))
Expand Down Expand Up @@ -347,7 +348,7 @@ extern JSDScript*
jsd_FindOrCreateJSDScript(JSDContext *jsdc,
JSContext *cx,
JSScript *script,
JSStackFrame *fp);
JSAbstractFramePtr frame);

extern JSDProfileData*
jsd_GetScriptProfileData(JSDContext* jsdc, JSDScript *script);
Expand Down Expand Up @@ -697,15 +698,15 @@ jsd_EvaluateUCScriptInStackFrame(JSDContext* jsdc,
JSDStackFrameInfo* jsdframe,
const jschar *bytes, unsigned length,
const char *filename, unsigned lineno,
JSBool eatExceptions, jsval *rval);
JSBool eatExceptions, JS::MutableHandleValue rval);

extern JSBool
jsd_EvaluateScriptInStackFrame(JSDContext* jsdc,
JSDThreadState* jsdthreadstate,
JSDStackFrameInfo* jsdframe,
const char *bytes, unsigned length,
const char *filename, unsigned lineno,
JSBool eatExceptions, jsval *rval);
JSBool eatExceptions, JS::MutableHandleValue rval);

extern JSString*
jsd_ValToStringInStackFrame(JSDContext* jsdc,
Expand Down Expand Up @@ -978,12 +979,12 @@ jsd_GetPropertyFlags(JSDContext* jsdc, JSDProperty* jsdprop);
/* Stepping Functions */

extern void *
jsd_FunctionCallHook(JSContext *cx, JSStackFrame *fp, JSBool before,
JSBool *ok, void *closure);
jsd_FunctionCallHook(JSContext *cx, JSAbstractFramePtr frame, bool isConstructing,
JSBool before, JSBool *ok, void *closure);

extern void *
jsd_TopLevelCallHook(JSContext *cx, JSStackFrame *fp, JSBool before,
JSBool *ok, void *closure);
jsd_TopLevelCallHook(JSContext *cx, JSAbstractFramePtr frame, bool isConstructing,
JSBool before, JSBool *ok, void *closure);

/**************************************************/
/* Object Functions */
Expand All @@ -999,7 +1000,7 @@ jsd_DestroyObjects(JSDContext* jsdc);

extern void
jsd_Constructing(JSDContext* jsdc, JSContext *cx, JSObject *obj,
JSStackFrame *fp);
JSAbstractFramePtr frame);

extern JSDObject*
jsd_IterateObjects(JSDContext* jsdc, JSDObject** iterp);
Expand Down
6 changes: 3 additions & 3 deletions js/jsd/jsd_hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jsd_InterruptHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rva
return JSTRAP_CONTINUE;

JSD_LOCK_SCRIPTS(jsdc);
jsdscript = jsd_FindOrCreateJSDScript(jsdc, cx, script, NULL);
jsdscript = jsd_FindOrCreateJSDScript(jsdc, cx, script, JSNullFramePtr());
JSD_UNLOCK_SCRIPTS(jsdc);
if( ! jsdscript )
return JSTRAP_CONTINUE;
Expand Down Expand Up @@ -72,7 +72,7 @@ jsd_DebuggerHandler(JSContext *cx, JSScript *script, jsbytecode *pc,
return JSTRAP_CONTINUE;

JSD_LOCK_SCRIPTS(jsdc);
jsdscript = jsd_FindOrCreateJSDScript(jsdc, cx, script, NULL);
jsdscript = jsd_FindOrCreateJSDScript(jsdc, cx, script, JSNullFramePtr());
JSD_UNLOCK_SCRIPTS(jsdc);
if( ! jsdscript )
return JSTRAP_CONTINUE;
Expand Down Expand Up @@ -106,7 +106,7 @@ jsd_ThrowHandler(JSContext *cx, JSScript *script, jsbytecode *pc,
return JSTRAP_CONTINUE;

JSD_LOCK_SCRIPTS(jsdc);
jsdscript = jsd_FindOrCreateJSDScript(jsdc, cx, script, NULL);
jsdscript = jsd_FindOrCreateJSDScript(jsdc, cx, script, JSNullFramePtr());
JSD_UNLOCK_SCRIPTS(jsdc);
if( ! jsdscript )
return JSTRAP_CONTINUE;
Expand Down
6 changes: 3 additions & 3 deletions js/jsd/jsd_obj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ _destroyJSDObject(JSDContext* jsdc, JSDObject* jsdobj)

void
jsd_Constructing(JSDContext* jsdc, JSContext *cx, JSObject *obj,
JSStackFrame *fp)
JSAbstractFramePtr frame)
{
JSDObject* jsdobj;
JSScript* script;
Expand All @@ -93,15 +93,15 @@ jsd_Constructing(JSDContext* jsdc, JSContext *cx, JSObject *obj,
jsdobj = jsd_GetJSDObjectForJSObject(jsdc, obj);
if( jsdobj && !jsdobj->ctorURL )
{
script = JS_GetFrameScript(cx, fp);
script = frame.script();
if( script )
{
ctorURL = JS_GetScriptFilename(cx, script);
if( ctorURL )
jsdobj->ctorURL = jsd_AddAtom(jsdc, ctorURL);

JSD_LOCK_SCRIPTS(jsdc);
jsdscript = jsd_FindOrCreateJSDScript(jsdc, cx, script, fp);
jsdscript = jsd_FindOrCreateJSDScript(jsdc, cx, script, frame);
JSD_UNLOCK_SCRIPTS(jsdc);
if( jsdscript && (ctorNameStr = jsd_GetScriptFunctionId(jsdc, jsdscript)) ) {
if( (ctorName = JS_EncodeString(cx, ctorNameStr)) ) {
Expand Down
14 changes: 10 additions & 4 deletions js/jsd/jsd_scpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ _newJSDScript(JSDContext* jsdc,
JSContext *cx,
JSScript *script)
{
if ( JS_GetScriptIsSelfHosted(script) )
return NULL;

JSDScript* jsdscript;
unsigned lineno;
const char* raw_filename;
Expand Down Expand Up @@ -278,7 +281,7 @@ JSDScript *
jsd_FindOrCreateJSDScript(JSDContext *jsdc,
JSContext *cx,
JSScript *script,
JSStackFrame *fp)
JSAbstractFramePtr frame)
{
JSDScript *jsdscript;
JS_ASSERT(JSD_SCRIPTS_LOCKED(jsdc));
Expand All @@ -288,9 +291,12 @@ jsd_FindOrCreateJSDScript(JSDContext *jsdc,
return jsdscript;

/* Fallback for unknown scripts: create a new script. */
if (!fp)
JS_BrokenFrameIterator(cx, &fp);
if (fp)
if (!frame) {
JSBrokenFrameIterator iter(cx);
if (!iter.done())
frame = iter.abstractFramePtr();
}
if (frame)
jsdscript = _newJSDScript(jsdc, cx, script);

return jsdscript;
Expand Down

0 comments on commit 4d819bb

Please sign in to comment.