зеркало из https://github.com/mozilla/gecko-dev.git
Add 64-bit tracing support
This commit is contained in:
Родитель
a19cb9b2f1
Коммит
4d713f4749
|
@ -340,7 +340,7 @@ public:
|
|||
|
||||
// Blah. We can't name this DefineProperty also because PRBool is the same as PRInt32
|
||||
PRBool DefineBoolProperty(const char *name, PRBool val) {
|
||||
if (!JS_DefineProperty(mCtx->ctx, mObject, name, val ? JS_TRUE : JS_FALSE, NULL, NULL, JSPROP_ENUMERATE))
|
||||
if (!JS_DefineProperty(mCtx->ctx, mObject, name, val ? JSVAL_TRUE : JSVAL_FALSE, NULL, NULL, JSPROP_ENUMERATE))
|
||||
return PR_FALSE;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
|
|
@ -1,91 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* vim: set ts=8 sw=4 et tw=0 ft=C:
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla SpiderMonkey JavaScript 1.9 code, released
|
||||
* June 22, 2008.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Andreas Gal <gal@uci.edu>
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* This file declares builtin functions that can be called from JITted code.
|
||||
* Each line starts with "BUILTIN" and an integer, the number of arguments the
|
||||
* builtin takes. Builtins with no arguments are not supported.
|
||||
*
|
||||
* The macro arguments are:
|
||||
*
|
||||
* - 'extern' to indicate extern linkage for these functions and the associated
|
||||
* CallInfo.
|
||||
*
|
||||
* - The return type. This identifier must name one of the _JS_TYPEINFO_*
|
||||
* macros defined in jsbuiltins.h.
|
||||
*
|
||||
* - The builtin name. Prefixed with "js_" this gives the native function name.
|
||||
*
|
||||
* - The parameter types.
|
||||
*
|
||||
* - The cse flag. 1 if the builtin call can be optimized away by common
|
||||
* subexpression elimination; otherwise 0. This should be 1 only if the
|
||||
* function is idempotent and the return value is determined solely by the
|
||||
* arguments.
|
||||
*
|
||||
* - The fold flag. Reserved. The same as cse for now.
|
||||
*/
|
||||
|
||||
/*
|
||||
* NB: bool FASTCALL is not compatible with Nanojit's calling convention usage.
|
||||
* Do not use bool FASTCALL, use JSBool only!
|
||||
*/
|
||||
|
||||
BUILTIN2(extern, JSVAL, js_BoxDouble, CONTEXT, DOUBLE, 1, 1)
|
||||
BUILTIN2(extern, JSVAL, js_BoxInt32, CONTEXT, INT32, 1, 1)
|
||||
BUILTIN1(extern, DOUBLE, js_UnboxDouble, JSVAL, 1, 1)
|
||||
BUILTIN1(extern, INT32, js_UnboxInt32, JSVAL, 1, 1)
|
||||
BUILTIN2(extern, DOUBLE, js_dmod, DOUBLE, DOUBLE, 1, 1)
|
||||
BUILTIN2(extern, INT32, js_imod, INT32, INT32, 1, 1)
|
||||
BUILTIN1(extern, INT32, js_DoubleToInt32, DOUBLE, 1, 1)
|
||||
BUILTIN1(extern, UINT32, js_DoubleToUint32, DOUBLE, 1, 1)
|
||||
|
||||
BUILTIN2(extern, DOUBLE, js_StringToNumber, CONTEXT, STRING, 1, 1)
|
||||
BUILTIN2(extern, INT32, js_StringToInt32, CONTEXT, STRING, 1, 1)
|
||||
BUILTIN2(FRIEND, BOOL, js_CloseIterator, CONTEXT, JSVAL, 0, 0)
|
||||
BUILTIN2(extern, SIDEEXIT, js_CallTree, INTERPSTATE, FRAGMENT, 0, 0)
|
||||
BUILTIN3(extern, BOOL, js_AddProperty, CONTEXT, OBJECT, SCOPEPROP, 0, 0)
|
||||
BUILTIN3(extern, BOOL, js_HasNamedProperty, CONTEXT, OBJECT, STRING, 0, 0)
|
||||
BUILTIN3(extern, BOOL, js_HasNamedPropertyInt32, CONTEXT, OBJECT, INT32, 0, 0)
|
||||
BUILTIN3(extern, JSVAL, js_CallGetter, CONTEXT, OBJECT, SCOPEPROP, 0, 0)
|
||||
BUILTIN2(extern, STRING, js_TypeOfObject, CONTEXT, OBJECT, 1, 1)
|
||||
BUILTIN2(extern, STRING, js_TypeOfBoolean, CONTEXT, INT32, 1, 1)
|
||||
BUILTIN2(extern, DOUBLE, js_BooleanOrUndefinedToNumber, CONTEXT, INT32, 1, 1)
|
||||
BUILTIN2(extern, STRING, js_BooleanOrUndefinedToString, CONTEXT, INT32, 1, 1)
|
||||
BUILTIN2(extern, OBJECT, js_Arguments, CONTEXT, OBJECT 0, 0)
|
||||
BUILTIN4(extern, OBJECT, js_NewNullClosure, CONTEXT, OBJECT, OBJECT, OBJECT, 0, 0)
|
|
@ -111,6 +111,15 @@ using namespace js;
|
|||
JS_PUBLIC_DATA(jsid) JSID_VOID = { (size_t)JSID_VOID_TYPE };
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
JS_PUBLIC_DATA(jsval) JSVAL_NULL = { BUILD_JSVAL(JSVAL_TAG_NULL, 0) };
|
||||
JS_PUBLIC_DATA(jsval) JSVAL_ZERO = { BUILD_JSVAL(JSVAL_TAG_INT32, 0) };
|
||||
JS_PUBLIC_DATA(jsval) JSVAL_ONE = { BUILD_JSVAL(JSVAL_TAG_INT32, 1) };
|
||||
JS_PUBLIC_DATA(jsval) JSVAL_FALSE = { BUILD_JSVAL(JSVAL_TAG_BOOLEAN, JS_FALSE) };
|
||||
JS_PUBLIC_DATA(jsval) JSVAL_TRUE = { BUILD_JSVAL(JSVAL_TAG_BOOLEAN, JS_TRUE) };
|
||||
JS_PUBLIC_DATA(jsval) JSVAL_VOID = { BUILD_JSVAL(JSVAL_TAG_UNDEFINED, 0) };
|
||||
#endif
|
||||
|
||||
JS_PUBLIC_API(int64)
|
||||
JS_Now()
|
||||
{
|
||||
|
@ -536,11 +545,6 @@ JSRuntime::init(uint32 maxbytes)
|
|||
if (!js_InitGC(this, maxbytes) || !js_InitAtomState(this))
|
||||
return false;
|
||||
|
||||
#ifdef JS_64BIT
|
||||
if (!JSString::initStringTables())
|
||||
return false;
|
||||
#endif
|
||||
|
||||
deflatedStringCache = new js::DeflatedStringCache();
|
||||
if (!deflatedStringCache || !deflatedStringCache->init())
|
||||
return false;
|
||||
|
|
172
js/src/jsapi.h
172
js/src/jsapi.h
|
@ -52,18 +52,27 @@
|
|||
JS_BEGIN_EXTERN_C
|
||||
|
||||
/* Well-known JS values, initialized on startup. */
|
||||
#define JSVAL_NULL BUILD_JSVAL(JSVAL_TAG_NULL, 0)
|
||||
#define JSVAL_ZERO BUILD_JSVAL(JSVAL_TAG_INT32, 0)
|
||||
#define JSVAL_ONE BUILD_JSVAL(JSVAL_TAG_INT32, 1)
|
||||
#define JSVAL_FALSE BUILD_JSVAL(JSVAL_TAG_BOOLEAN, JS_FALSE)
|
||||
#define JSVAL_TRUE BUILD_JSVAL(JSVAL_TAG_BOOLEAN, JS_TRUE)
|
||||
#define JSVAL_VOID BUILD_JSVAL(JSVAL_TAG_UNDEFINED, 0)
|
||||
#ifdef DEBUG
|
||||
extern JS_PUBLIC_DATA(jsval) JSVAL_NULL;
|
||||
extern JS_PUBLIC_DATA(jsval) JSVAL_ZERO;
|
||||
extern JS_PUBLIC_DATA(jsval) JSVAL_ONE;
|
||||
extern JS_PUBLIC_DATA(jsval) JSVAL_FALSE;
|
||||
extern JS_PUBLIC_DATA(jsval) JSVAL_TRUE;
|
||||
extern JS_PUBLIC_DATA(jsval) JSVAL_VOID;
|
||||
#else
|
||||
# define JSVAL_NULL BUILD_JSVAL(JSVAL_TAG_NULL, 0)
|
||||
# define JSVAL_ZERO BUILD_JSVAL(JSVAL_TAG_INT32, 0)
|
||||
# define JSVAL_ONE BUILD_JSVAL(JSVAL_TAG_INT32, 1)
|
||||
# define JSVAL_FALSE BUILD_JSVAL(JSVAL_TAG_BOOLEAN, JS_FALSE)
|
||||
# define JSVAL_TRUE BUILD_JSVAL(JSVAL_TAG_BOOLEAN, JS_TRUE)
|
||||
# define JSVAL_VOID BUILD_JSVAL(JSVAL_TAG_UNDEFINED, 0)
|
||||
#endif
|
||||
|
||||
static JS_ALWAYS_INLINE JSBool
|
||||
JSVAL_IS_NULL(jsval v)
|
||||
{
|
||||
jsval_layout l;
|
||||
l.asBits = v;
|
||||
l.asBits = JSVAL_BITS(v);
|
||||
return JSVAL_IS_NULL_IMPL(l);
|
||||
}
|
||||
|
||||
|
@ -71,7 +80,7 @@ static JS_ALWAYS_INLINE JSBool
|
|||
JSVAL_IS_VOID(jsval v)
|
||||
{
|
||||
jsval_layout l;
|
||||
l.asBits = v;
|
||||
l.asBits = JSVAL_BITS(v);
|
||||
return JSVAL_IS_UNDEFINED_IMPL(l);
|
||||
}
|
||||
|
||||
|
@ -79,7 +88,7 @@ static JS_ALWAYS_INLINE JSBool
|
|||
JSVAL_IS_INT(jsval v)
|
||||
{
|
||||
jsval_layout l;
|
||||
l.asBits = v;
|
||||
l.asBits = JSVAL_BITS(v);
|
||||
return JSVAL_IS_INT32_IMPL(l);
|
||||
}
|
||||
|
||||
|
@ -88,7 +97,7 @@ JSVAL_TO_INT(jsval v)
|
|||
{
|
||||
jsval_layout l;
|
||||
JS_ASSERT(JSVAL_IS_INT(v));
|
||||
l.asBits = v;
|
||||
l.asBits = JSVAL_BITS(v);
|
||||
return JSVAL_TO_INT32_IMPL(l);
|
||||
}
|
||||
|
||||
|
@ -99,14 +108,14 @@ JSVAL_TO_INT(jsval v)
|
|||
static JS_ALWAYS_INLINE jsval
|
||||
INT_TO_JSVAL(int32 i)
|
||||
{
|
||||
return INT32_TO_JSVAL_IMPL(i).asBits;
|
||||
return IMPL_TO_JSVAL(INT32_TO_JSVAL_IMPL(i));
|
||||
}
|
||||
|
||||
static JS_ALWAYS_INLINE JSBool
|
||||
JSVAL_IS_DOUBLE(jsval v)
|
||||
{
|
||||
jsval_layout l;
|
||||
l.asBits = v;
|
||||
l.asBits = JSVAL_BITS(v);
|
||||
return JSVAL_IS_DOUBLE_IMPL(l);
|
||||
}
|
||||
|
||||
|
@ -115,14 +124,14 @@ JSVAL_TO_DOUBLE(jsval v)
|
|||
{
|
||||
jsval_layout l;
|
||||
JS_ASSERT(JSVAL_IS_DOUBLE(v));
|
||||
l.asBits = v;
|
||||
l.asBits = JSVAL_BITS(v);
|
||||
return l.asDouble;
|
||||
}
|
||||
|
||||
static JS_ALWAYS_INLINE jsval
|
||||
DOUBLE_TO_JSVAL(jsdouble d)
|
||||
{
|
||||
return DOUBLE_TO_JSVAL_IMPL(d).asBits;
|
||||
return IMPL_TO_JSVAL(DOUBLE_TO_JSVAL_IMPL(d));
|
||||
}
|
||||
|
||||
static JS_ALWAYS_INLINE jsval
|
||||
|
@ -137,7 +146,7 @@ static JS_ALWAYS_INLINE JSBool
|
|||
JSVAL_IS_NUMBER(jsval v)
|
||||
{
|
||||
jsval_layout l;
|
||||
l.asBits = v;
|
||||
l.asBits = JSVAL_BITS(v);
|
||||
return JSVAL_IS_NUMBER_IMPL(l);
|
||||
}
|
||||
|
||||
|
@ -145,7 +154,7 @@ static JS_ALWAYS_INLINE JSBool
|
|||
JSVAL_IS_STRING(jsval v)
|
||||
{
|
||||
jsval_layout l;
|
||||
l.asBits = v;
|
||||
l.asBits = JSVAL_BITS(v);
|
||||
return JSVAL_IS_STRING_IMPL(l);
|
||||
}
|
||||
|
||||
|
@ -154,21 +163,21 @@ JSVAL_TO_STRING(jsval v)
|
|||
{
|
||||
jsval_layout l;
|
||||
JS_ASSERT(JSVAL_IS_STRING(v));
|
||||
l.asBits = v;
|
||||
l.asBits = JSVAL_BITS(v);
|
||||
return JSVAL_TO_STRING_IMPL(l);
|
||||
}
|
||||
|
||||
static JS_ALWAYS_INLINE jsval
|
||||
STRING_TO_JSVAL(JSString *str)
|
||||
{
|
||||
return STRING_TO_JSVAL_IMPL(str).asBits;
|
||||
return IMPL_TO_JSVAL(STRING_TO_JSVAL_IMPL(str));
|
||||
}
|
||||
|
||||
static JS_ALWAYS_INLINE JSBool
|
||||
JSVAL_IS_OBJECT(jsval v)
|
||||
{
|
||||
jsval_layout l;
|
||||
l.asBits = v;
|
||||
l.asBits = JSVAL_BITS(v);
|
||||
return JSVAL_IS_OBJECT_OR_NULL_IMPL(l);
|
||||
}
|
||||
|
||||
|
@ -177,7 +186,7 @@ JSVAL_TO_OBJECT(jsval v)
|
|||
{
|
||||
jsval_layout l;
|
||||
JS_ASSERT(JSVAL_IS_OBJECT(v));
|
||||
l.asBits = v;
|
||||
l.asBits = JSVAL_BITS(v);
|
||||
return JSVAL_TO_OBJECT_IMPL(l);
|
||||
}
|
||||
|
||||
|
@ -188,14 +197,14 @@ OBJECT_TO_JSVAL(JSObject *obj)
|
|||
if (!obj)
|
||||
return JSVAL_NULL;
|
||||
type = JS_OBJ_IS_FUN_IMPL(obj) ? JSVAL_TYPE_FUNOBJ : JSVAL_TYPE_NONFUNOBJ;
|
||||
return OBJECT_TO_JSVAL_IMPL(type, obj).asBits;
|
||||
return IMPL_TO_JSVAL(OBJECT_TO_JSVAL_IMPL(type, obj));
|
||||
}
|
||||
|
||||
static JS_ALWAYS_INLINE JSBool
|
||||
JSVAL_IS_BOOLEAN(jsval v)
|
||||
{
|
||||
jsval_layout l;
|
||||
l.asBits = v;
|
||||
l.asBits = JSVAL_BITS(v);
|
||||
return JSVAL_IS_BOOLEAN_IMPL(l);
|
||||
}
|
||||
|
||||
|
@ -204,21 +213,21 @@ JSVAL_TO_BOOLEAN(jsval v)
|
|||
{
|
||||
jsval_layout l;
|
||||
JS_ASSERT(JSVAL_IS_BOOLEAN(v));
|
||||
l.asBits = v;
|
||||
l.asBits = JSVAL_BITS(v);
|
||||
return JSVAL_TO_BOOLEAN_IMPL(l);
|
||||
}
|
||||
|
||||
static JS_ALWAYS_INLINE jsval
|
||||
BOOLEAN_TO_JSVAL(JSBool b)
|
||||
{
|
||||
return BOOLEAN_TO_JSVAL_IMPL(b).asBits;
|
||||
return IMPL_TO_JSVAL(BOOLEAN_TO_JSVAL_IMPL(b));
|
||||
}
|
||||
|
||||
static JS_ALWAYS_INLINE JSBool
|
||||
JSVAL_IS_PRIMITIVE(jsval v)
|
||||
{
|
||||
jsval_layout l;
|
||||
l.asBits = v;
|
||||
l.asBits = JSVAL_BITS(v);
|
||||
return JSVAL_IS_PRIMITIVE_IMPL(l);
|
||||
}
|
||||
|
||||
|
@ -226,7 +235,7 @@ static JS_ALWAYS_INLINE JSBool
|
|||
JSVAL_IS_GCTHING(jsval v)
|
||||
{
|
||||
jsval_layout l;
|
||||
l.asBits = v;
|
||||
l.asBits = JSVAL_BITS(v);
|
||||
return JSVAL_IS_GCTHING_IMPL(l);
|
||||
}
|
||||
|
||||
|
@ -235,7 +244,7 @@ JSVAL_TO_GCTHING(jsval v)
|
|||
{
|
||||
jsval_layout l;
|
||||
JS_ASSERT(JSVAL_IS_GCTHING(v));
|
||||
l.asBits = v;
|
||||
l.asBits = JSVAL_BITS(v);
|
||||
return JSVAL_TO_GCTHING_IMPL(l);
|
||||
}
|
||||
|
||||
|
@ -244,7 +253,7 @@ JSVAL_TO_GCTHING(jsval v)
|
|||
static JS_ALWAYS_INLINE jsval
|
||||
PRIVATE_TO_JSVAL(void *ptr)
|
||||
{
|
||||
return PRIVATE_PTR_TO_JSVAL_IMPL(ptr).asBits;
|
||||
return IMPL_TO_JSVAL(PRIVATE_PTR_TO_JSVAL_IMPL(ptr));
|
||||
}
|
||||
|
||||
static JS_ALWAYS_INLINE void *
|
||||
|
@ -252,7 +261,7 @@ JSVAL_TO_PRIVATE(jsval v)
|
|||
{
|
||||
jsval_layout l;
|
||||
JS_ASSERT(JSVAL_IS_DOUBLE(v));
|
||||
l.asBits = v;
|
||||
l.asBits = JSVAL_BITS(v);
|
||||
return JSVAL_TO_PRIVATE_PTR_IMPL(l);
|
||||
}
|
||||
|
||||
|
@ -260,7 +269,7 @@ static JS_ALWAYS_INLINE JSBool
|
|||
JSVAL_IS_UNDERLYING_TYPE_OF_PRIVATE(jsval v)
|
||||
{
|
||||
jsval_layout l;
|
||||
l.asBits = v;
|
||||
l.asBits = JSVAL_BITS(v);
|
||||
return JSVAL_IS_UNDERLYING_TYPE_OF_PRIVATE_IMPL(l);
|
||||
}
|
||||
|
||||
|
@ -423,26 +432,6 @@ extern JS_PUBLIC_DATA(jsid) JSID_VOID;
|
|||
# define JSID_VOID ((jsid)JSID_VOID_TYPE)
|
||||
#endif
|
||||
|
||||
#if defined(DEBUG) && defined(__cplusplus)
|
||||
extern "C++" {
|
||||
/*
|
||||
* Internally we can use C++ to allow jsids, which are structs in debug builds,
|
||||
* to be compared with ==.
|
||||
*/
|
||||
static JS_ALWAYS_INLINE bool
|
||||
operator==(jsid lhs, jsid rhs)
|
||||
{
|
||||
return JSID_BITS(lhs) == JSID_BITS(rhs);
|
||||
}
|
||||
|
||||
static JS_ALWAYS_INLINE bool
|
||||
operator!=(jsid lhs, jsid rhs)
|
||||
{
|
||||
return JSID_BITS(lhs) != JSID_BITS(rhs);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
/* Lock and unlock the GC thing held by a jsval. */
|
||||
|
@ -1373,7 +1362,7 @@ JSVAL_TRACE_KIND(jsval v)
|
|||
{
|
||||
jsval_layout l;
|
||||
JS_ASSERT(JSVAL_IS_GCTHING(v));
|
||||
l.asBits = v;
|
||||
l.asBits = JSVAL_BITS(v);
|
||||
return JSVAL_TRACE_KIND_IMPL(l);
|
||||
}
|
||||
|
||||
|
@ -3192,23 +3181,6 @@ struct PrivateTag {
|
|||
*/
|
||||
class Value
|
||||
{
|
||||
/*
|
||||
* Generally, we'd like to keep the exact representation encapsulated so
|
||||
* that it may be tweaked in the future. Engine internals that need to
|
||||
* break this encapsulation should be listed as friends below. Also see
|
||||
* uses of public jsval members in jsapi.h/jspubtd.h.
|
||||
*/
|
||||
#ifdef JS_TRACER
|
||||
friend jsdouble UnboxDoubleHelper(uint32 mask, uint32 payload);
|
||||
friend void NonDoubleNativeToValue(JSValueType type, double *slot, Value *vp);
|
||||
friend void NonNumberValueToSlot(const Value &v, JSValueType type, double *slot);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
/* Type masks */
|
||||
|
||||
template <int I> class T {};
|
||||
|
||||
void staticAssertions() {
|
||||
JS_STATIC_ASSERT(sizeof(JSValueType) == 1);
|
||||
JS_STATIC_ASSERT(sizeof(JSValueTag) == 4);
|
||||
|
@ -3249,11 +3221,11 @@ class Value
|
|||
/* Change to a Value of a single type */
|
||||
|
||||
void setNull() {
|
||||
data.asBits = JSVAL_NULL;
|
||||
data.asBits = JSVAL_BITS(JSVAL_NULL);
|
||||
}
|
||||
|
||||
void setUndefined() {
|
||||
data.asBits = JSVAL_VOID;
|
||||
data.asBits = JSVAL_BITS(JSVAL_VOID);
|
||||
}
|
||||
|
||||
void setInt32(int32 i) {
|
||||
|
@ -3509,11 +3481,17 @@ class Value
|
|||
return JSVAL_EXTRACT_NON_DOUBLE_TYPE_IMPL(data);
|
||||
}
|
||||
|
||||
#if JS_BITS_PER_WORD == 32
|
||||
JSValueTag extractNonDoubleTag() const {
|
||||
return JSVAL_EXTRACT_NON_DOUBLE_TAG_IMPL(data);
|
||||
}
|
||||
#endif
|
||||
|
||||
void unboxNonDoubleTo(uint64 *out) const {
|
||||
UNBOX_NON_DOUBLE_JSVAL(data, out);
|
||||
}
|
||||
|
||||
void boxNonDoubleFrom(JSValueType type, uint64 *out) {
|
||||
data = BOX_NON_DOUBLE_JSVAL(type, out);
|
||||
}
|
||||
|
||||
/* Swap two Values */
|
||||
|
||||
|
@ -3563,21 +3541,10 @@ class Value
|
|||
return data.s.payload.u32;
|
||||
}
|
||||
|
||||
/* Tracing support API.
|
||||
* Use these functions to check if a Value needs to be passed
|
||||
* to JS_CallTracer. */
|
||||
bool isTraceable() const {
|
||||
return isGCThing();
|
||||
}
|
||||
|
||||
void *toTraceable() {
|
||||
return asGCThing();
|
||||
}
|
||||
|
||||
} VALUE_ALIGNMENT;
|
||||
|
||||
/*
|
||||
* As asserted above, js::Value and jsval are layout equivalent. To provide
|
||||
* As asserted above, js::Value and jsval are layout equivalent. To prevent
|
||||
* widespread casting, the following safe casts are provided.
|
||||
*/
|
||||
static inline jsval * Jsvalify(Value *v) { return (jsval *)v; }
|
||||
|
@ -3595,7 +3562,8 @@ static inline Value undefinedValue() { return UndefinedTag(); }
|
|||
static inline Value nullValue() { return NullTag(); }
|
||||
|
||||
/*
|
||||
* js::Class is layout compatible and thus
|
||||
* js::Class is layout compatible with JSCalss and thus may be safely converted back
|
||||
* and forth at no cost using Jsvalify and Valueify.
|
||||
*/
|
||||
struct Class {
|
||||
const char *name;
|
||||
|
@ -3624,6 +3592,10 @@ struct Class {
|
|||
|
||||
JS_STATIC_ASSERT(sizeof(JSClass) == sizeof(Class));
|
||||
|
||||
/*
|
||||
* js::ExtendedClass is layout compatible with JSExtendedClass and thus may be
|
||||
* safely converted back and forth at no cost using Jsvalify and Valueify.
|
||||
*/
|
||||
struct ExtendedClass {
|
||||
Class base;
|
||||
EqualityOp equality;
|
||||
|
@ -3640,6 +3612,11 @@ struct ExtendedClass {
|
|||
|
||||
JS_STATIC_ASSERT(sizeof(JSExtendedClass) == sizeof(ExtendedClass));
|
||||
|
||||
/*
|
||||
* js::PropertyDescriptor is layout compatible with JSPropertyDescriptor and
|
||||
* thus may be safely converted back and forth at no cost using Jsvalify and
|
||||
* Valueify.
|
||||
*/
|
||||
struct PropertyDescriptor {
|
||||
JSObject *obj;
|
||||
uintN attrs;
|
||||
|
@ -3658,6 +3635,31 @@ static JS_ALWAYS_INLINE ExtendedClass * Valueify(JSExtendedClass *c)
|
|||
static JS_ALWAYS_INLINE JSPropertyDescriptor * Jsvalify(PropertyDescriptor *p) { return (JSPropertyDescriptor *) p; }
|
||||
static JS_ALWAYS_INLINE PropertyDescriptor * Valueify(JSPropertyDescriptor *p) { return (PropertyDescriptor *) p; }
|
||||
|
||||
/*
|
||||
* In some cases (quickstubs) we want to take a value in whatever manner is
|
||||
* appropriate for the architecture and normalize to a const js::Value &. On
|
||||
* x64, passing a js::Value may cause the to unnecessarily be passed through
|
||||
* memory instead of registers, so jsval, which is a builtin uint64 is used.
|
||||
*/
|
||||
#if JS_BITS_PER_WORD == 32
|
||||
typedef const js::Value *ValueArgType;
|
||||
|
||||
static JS_ALWAYS_INLINE const js::Value &
|
||||
ValueArgToConstRef(const js::Value *arg)
|
||||
{
|
||||
return *arg;
|
||||
}
|
||||
|
||||
#elif JS_BITS_PER_WORD == 64
|
||||
typedef js::Value ValueArgType;
|
||||
|
||||
static JS_ALWAYS_INLINE const Value &
|
||||
ValueArgToConstRef(const Value &v)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
#endif
|
||||
|
||||
} /* namespace js */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
|
|
@ -879,9 +879,11 @@ js_PrototypeHasIndexedProperties(JSContext *cx, JSObject *obj)
|
|||
|
||||
#ifdef JS_TRACER
|
||||
|
||||
static JS_ALWAYS_INLINE JSBool FASTCALL
|
||||
static JS_ALWAYS_INLINE JSBool
|
||||
dense_grow(JSContext* cx, JSObject* obj, jsint i, const Value &v)
|
||||
{
|
||||
JS_ASSERT(obj->isDenseArray());
|
||||
|
||||
/*
|
||||
* Let the interpreter worry about negative array indexes.
|
||||
*/
|
||||
|
@ -916,21 +918,18 @@ dense_grow(JSContext* cx, JSObject* obj, jsint i, const Value &v)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
JSBool FASTCALL
|
||||
js_Array_dense_setelem(JSContext* cx, JSObject* obj, jsint i, Value *v)
|
||||
js_Array_dense_setelem(JSContext* cx, JSObject* obj, jsint i, ValueArgType v)
|
||||
{
|
||||
JS_ASSERT(obj->isDenseArray());
|
||||
return dense_grow(cx, obj, i, *v);
|
||||
return dense_grow(cx, obj, i, ValueArgToConstRef(v));
|
||||
}
|
||||
JS_DEFINE_CALLINFO_4(extern, BOOL, js_Array_dense_setelem, CONTEXT, OBJECT, INT32, VALUEPTR, 0,
|
||||
JS_DEFINE_CALLINFO_4(extern, BOOL, js_Array_dense_setelem, CONTEXT, OBJECT, INT32, VALUE, 0,
|
||||
nanojit::ACC_STORE_ANY)
|
||||
|
||||
JSBool FASTCALL
|
||||
js_Array_dense_setelem_int(JSContext* cx, JSObject* obj, jsint i, int32 j)
|
||||
{
|
||||
JS_ASSERT(obj->isDenseArray());
|
||||
return dense_grow(cx, obj, i, Value(Int32Tag(j)));
|
||||
return dense_grow(cx, obj, i, Int32Tag(j));
|
||||
}
|
||||
JS_DEFINE_CALLINFO_4(extern, BOOL, js_Array_dense_setelem_int, CONTEXT, OBJECT, INT32, INT32, 0,
|
||||
nanojit::ACC_STORE_ANY)
|
||||
|
@ -938,8 +937,7 @@ JS_DEFINE_CALLINFO_4(extern, BOOL, js_Array_dense_setelem_int, CONTEXT, OBJECT,
|
|||
JSBool FASTCALL
|
||||
js_Array_dense_setelem_double(JSContext* cx, JSObject* obj, jsint i, jsdouble d)
|
||||
{
|
||||
JS_ASSERT(obj->isDenseArray());
|
||||
return dense_grow(cx, obj, i, Value(NumberTag(d)));
|
||||
return dense_grow(cx, obj, i, NumberTag(d));
|
||||
}
|
||||
JS_DEFINE_CALLINFO_4(extern, BOOL, js_Array_dense_setelem_double, CONTEXT, OBJECT, INT32, DOUBLE,
|
||||
0, nanojit::ACC_STORE_ANY)
|
||||
|
@ -2127,8 +2125,8 @@ array_push1_dense(JSContext* cx, JSObject* obj, const Value &v, Value *rval)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool JS_FASTCALL
|
||||
js_ArrayCompPush(JSContext *cx, JSObject *obj, const Value *vp)
|
||||
JS_ALWAYS_INLINE JSBool
|
||||
ArrayCompPushImpl(JSContext *cx, JSObject *obj, const Value &v)
|
||||
{
|
||||
JS_ASSERT(obj->isDenseArray());
|
||||
uint32_t length = obj->getArrayLength();
|
||||
|
@ -2146,11 +2144,22 @@ js_ArrayCompPush(JSContext *cx, JSObject *obj, const Value *vp)
|
|||
}
|
||||
obj->setDenseArrayLength(length + 1);
|
||||
obj->incDenseArrayCountBy(1);
|
||||
obj->setDenseArrayElement(length, *vp);
|
||||
obj->setDenseArrayElement(length, v);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JS_DEFINE_CALLINFO_3(extern, BOOL, js_ArrayCompPush, CONTEXT, OBJECT, CVALUEPTR, 0,
|
||||
JSBool
|
||||
js_ArrayCompPush(JSContext *cx, JSObject *obj, const Value &vp)
|
||||
{
|
||||
return ArrayCompPushImpl(cx, obj, vp);
|
||||
}
|
||||
|
||||
JSBool JS_FASTCALL
|
||||
js_ArrayCompPush_tn(JSContext *cx, JSObject *obj, ValueArgType v)
|
||||
{
|
||||
return ArrayCompPushImpl(cx, obj, ValueArgToConstRef(v));
|
||||
}
|
||||
JS_DEFINE_CALLINFO_3(extern, BOOL, js_ArrayCompPush_tn, CONTEXT, OBJECT, VALUE, 0,
|
||||
nanojit::ACC_STORE_ANY)
|
||||
|
||||
static JSBool
|
||||
|
|
|
@ -206,8 +206,8 @@ extern JSBool
|
|||
js_ArrayInfo(JSContext *cx, JSObject *obj, uintN argc, js::Value *argv, js::Value *rval);
|
||||
#endif
|
||||
|
||||
extern JSBool JS_FASTCALL
|
||||
js_ArrayCompPush(JSContext *cx, JSObject *obj, const js::Value *vp);
|
||||
extern JSBool
|
||||
js_ArrayCompPush(JSContext *cx, JSObject *obj, const js::Value &vp);
|
||||
|
||||
/*
|
||||
* Fast dense-array-to-buffer conversion for use by canvas.
|
||||
|
|
|
@ -103,56 +103,51 @@ js_imod(int32 a, int32 b)
|
|||
}
|
||||
JS_DEFINE_CALLINFO_2(extern, INT32, js_imod, INT32, INT32, 1, ACC_NONE)
|
||||
|
||||
namespace js {
|
||||
|
||||
jsdouble JS_ALWAYS_INLINE
|
||||
UnboxDoubleHelper(uint32 tag, uint32 payload)
|
||||
{
|
||||
if (tag == JSVAL_TAG_INT32) {
|
||||
return int32(payload);
|
||||
} else {
|
||||
Value v;
|
||||
v.data.s.tag = (JSValueTag)tag;
|
||||
v.data.s.payload.u32 = payload;
|
||||
return v.asDouble();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#if JS_BITS_PER_WORD == 32
|
||||
|
||||
jsdouble FASTCALL
|
||||
js_UnboxDouble(uint32 tag, uint32 payload)
|
||||
{
|
||||
return UnboxDoubleHelper(tag, payload);
|
||||
if (tag == JSVAL_TAG_INT32)
|
||||
return (double)(int32)payload;
|
||||
|
||||
jsval_layout l;
|
||||
l.s.tag = (JSValueTag)tag;
|
||||
l.s.payload.u32 = payload;
|
||||
return l.asDouble;
|
||||
}
|
||||
JS_DEFINE_CALLINFO_2(extern, DOUBLE, js_UnboxDouble, UINT32, UINT32, 1, ACC_NONE)
|
||||
|
||||
int32 FASTCALL
|
||||
js_UnboxInt32(Value *v)
|
||||
js_UnboxInt32(const Value *v)
|
||||
{
|
||||
if (v->isInt32())
|
||||
return v->asInt32();
|
||||
return js_DoubleToECMAInt32(v->asDouble());
|
||||
}
|
||||
JS_DEFINE_CALLINFO_1(extern, INT32, js_UnboxInt32, VALUEPTR, 1, ACC_NONE)
|
||||
JS_DEFINE_CALLINFO_1(extern, INT32, js_UnboxInt32, VALUE, 1, ACC_NONE)
|
||||
|
||||
JSBool FASTCALL
|
||||
js_TryUnboxInt32(Value *v, int32* i32p)
|
||||
#elif JS_BITS_PER_WORD == 64
|
||||
|
||||
jsdouble FASTCALL
|
||||
js_UnboxDouble(Value v)
|
||||
{
|
||||
if (v->isInt32()) {
|
||||
*i32p = v->asInt32();
|
||||
return JS_TRUE;
|
||||
}
|
||||
if (!v->isDouble())
|
||||
return JS_FALSE;
|
||||
int32_t i;
|
||||
jsdouble d = v->asDouble();
|
||||
if (!JSDOUBLE_IS_INT32(d, i))
|
||||
return JS_FALSE;
|
||||
*i32p = i;
|
||||
return JS_TRUE;
|
||||
if (v.isInt32())
|
||||
return (jsdouble)v.asInt32();
|
||||
return v.asDouble();
|
||||
}
|
||||
JS_DEFINE_CALLINFO_2(extern, BOOL, js_TryUnboxInt32, VALUEPTR, INT32PTR, 1, ACC_NONE)
|
||||
JS_DEFINE_CALLINFO_1(extern, DOUBLE, js_UnboxDouble, JSVAL, 1, ACC_NONE)
|
||||
|
||||
int32 FASTCALL
|
||||
js_UnboxInt32(Value v)
|
||||
{
|
||||
if (v.isInt32())
|
||||
return v.asInt32();
|
||||
return js_DoubleToECMAInt32(v.asDouble());
|
||||
}
|
||||
JS_DEFINE_CALLINFO_1(extern, INT32, js_UnboxInt32, VALUE, 1, ACC_NONE)
|
||||
|
||||
#endif
|
||||
|
||||
int32 FASTCALL
|
||||
js_DoubleToInt32(jsdouble d)
|
||||
|
|
|
@ -86,7 +86,7 @@ enum {
|
|||
* 'o': a JSObject* argument
|
||||
* 'r': a JSObject* argument that is of class js_RegExpClass
|
||||
* 'f': a JSObject* argument that is of class js_FunctionClass
|
||||
* 'p': a js::Value* argument
|
||||
* 'v': a value argument: on 32-bit, a Value*, on 64-bit, a jsval
|
||||
*/
|
||||
struct JSSpecializedNative {
|
||||
const nanojit::CallInfo *builtin;
|
||||
|
@ -116,6 +116,8 @@ struct JSNativeTraceInfo {
|
|||
|
||||
#define _JS_I32_ARGTYPE nanojit::ARGTYPE_I
|
||||
#define _JS_I32_RETTYPE nanojit::ARGTYPE_I
|
||||
#define _JS_U64_ARGTYPE nanojit::ARGTYPE_Q
|
||||
#define _JS_U64_RETTYPE nanojit::ARGTYPE_Q
|
||||
#define _JS_F64_ARGTYPE nanojit::ARGTYPE_D
|
||||
#define _JS_F64_RETTYPE nanojit::ARGTYPE_D
|
||||
#define _JS_PTR_ARGTYPE nanojit::ARGTYPE_P
|
||||
|
@ -189,9 +191,10 @@ struct ClosureVarInfo;
|
|||
#define _JS_CTYPE_CALLEE_PROTOTYPE _JS_CTYPE(JSObject *, _JS_PTR,"p","", INFALLIBLE)
|
||||
#define _JS_CTYPE_FUNCTION _JS_CTYPE(JSFunction *, _JS_PTR, --, --, INFALLIBLE)
|
||||
#define _JS_CTYPE_PC _JS_CTYPE(jsbytecode *, _JS_PTR,"P", "", INFALLIBLE)
|
||||
#define _JS_CTYPE_VALUEPTR _JS_CTYPE(js::Value *, _JS_PTR, "","p", INFALLIBLE)
|
||||
#define _JS_CTYPE_CVALUEPTR _JS_CTYPE(const js::Value *, _JS_PTR, "","p", INFALLIBLE)
|
||||
#define _JS_CTYPE_SIZET _JS_CTYPE(size_t, _JS_PTR, --, --, INFALLIBLE)
|
||||
#define _JS_CTYPE_VALUEPTR _JS_CTYPE(js::Value *, _JS_PTR, --, --, INFALLIBLE)
|
||||
#define _JS_CTYPE_CVALUEPTR _JS_CTYPE(const js::Value *, _JS_PTR, --, --, INFALLIBLE)
|
||||
#define _JS_CTYPE_JSID _JS_CTYPE(jsid, _JS_PTR, --, --, INFALLIBLE)
|
||||
#define _JS_CTYPE_JSVAL _JS_CTYPE(js::Value, _JS_U64, --, --, INFALLIBLE)
|
||||
#define _JS_CTYPE_BOOL _JS_CTYPE(JSBool, _JS_I32, "","i", INFALLIBLE)
|
||||
#define _JS_CTYPE_BOOL_RETRY _JS_CTYPE(JSBool, _JS_I32, --, --, FAIL_NEITHER)
|
||||
#define _JS_CTYPE_BOOL_FAIL _JS_CTYPE(JSBool, _JS_I32, --, --, FAIL_STATUS)
|
||||
|
@ -230,6 +233,25 @@ struct ClosureVarInfo;
|
|||
#define _JS_CTYPE_CVIPTR _JS_CTYPE(const ClosureVarInfo *, _JS_PTR, --, --, INFALLIBLE)
|
||||
#define _JS_CTYPE_FRAMEINFO _JS_CTYPE(FrameInfo *, _JS_PTR, --, --, INFALLIBLE)
|
||||
|
||||
/*
|
||||
* The "VALUE" type is used to indicate that a native takes a js::Value
|
||||
* parameter by value. Unfortunately, for technical reasons, we can't simply
|
||||
* have the parameter type be js::Value. Furthermore, the right thing to pass
|
||||
* differs based on word size. Thus, a native that declares a parameter of type
|
||||
* VALUE should have the corresponding argument type be:
|
||||
* - on 32-bit: const Value*
|
||||
* - on 64-bit: jsval (which is a uint64)
|
||||
*
|
||||
* To write code that just does the right thing, use the pattern:
|
||||
* void foo(js::ValueArgType arg) {
|
||||
* const js::Value &v = js::ValueArgToConstRef(arg);
|
||||
*/
|
||||
#if JS_BITS_PER_WORD == 32
|
||||
# define _JS_CTYPE_VALUE _JS_CTYPE(js::ValueArgType, _JS_PTR, "","v", INFALLIBLE)
|
||||
#elif JS_BITS_PER_WORD == 64
|
||||
# define _JS_CTYPE_VALUE _JS_CTYPE(js::ValueArgType, _JS_U64, "","v", INFALLIBLE)
|
||||
#endif
|
||||
|
||||
#define _JS_EXPAND(tokens) tokens
|
||||
|
||||
#define _JS_CTYPE_TYPE2(t,s,p,a,f) t
|
||||
|
@ -528,12 +550,11 @@ JS_DECLARE_CALLINFO(js_Array_dense_setelem_double)
|
|||
JS_DECLARE_CALLINFO(js_NewEmptyArray)
|
||||
JS_DECLARE_CALLINFO(js_NewEmptyArrayWithLength)
|
||||
JS_DECLARE_CALLINFO(js_NewArrayWithSlots)
|
||||
JS_DECLARE_CALLINFO(js_ArrayCompPush)
|
||||
JS_DECLARE_CALLINFO(js_ArrayCompPush_tn)
|
||||
|
||||
/* Defined in jsbuiltins.cpp. */
|
||||
JS_DECLARE_CALLINFO(js_UnboxDouble)
|
||||
JS_DECLARE_CALLINFO(js_UnboxInt32)
|
||||
JS_DECLARE_CALLINFO(js_TryUnboxInt32)
|
||||
JS_DECLARE_CALLINFO(js_dmod)
|
||||
JS_DECLARE_CALLINFO(js_imod)
|
||||
JS_DECLARE_CALLINFO(js_DoubleToInt32)
|
||||
|
|
|
@ -1134,19 +1134,21 @@ SetCallVar(JSContext *cx, JSObject *obj, jsid id, Value *vp)
|
|||
|
||||
#if JS_TRACER
|
||||
JSBool JS_FASTCALL
|
||||
js_SetCallArg(JSContext *cx, JSObject *obj, size_t slotid, Value *vp)
|
||||
js_SetCallArg(JSContext *cx, JSObject *obj, jsid slotid, ValueArgType arg)
|
||||
{
|
||||
return CallPropertyOp(cx, obj, JSID_FROM_BITS(slotid), vp, JSCPK_ARG, true);
|
||||
Value argcopy = ValueArgToConstRef(arg);
|
||||
return CallPropertyOp(cx, obj, slotid, &argcopy, JSCPK_ARG, true);
|
||||
}
|
||||
JS_DEFINE_CALLINFO_4(extern, BOOL, js_SetCallArg, CONTEXT, OBJECT, JSID, VALUE, 0,
|
||||
nanojit::ACC_STORE_ANY)
|
||||
|
||||
JSBool JS_FASTCALL
|
||||
js_SetCallVar(JSContext *cx, JSObject *obj, size_t slotid, Value *vp)
|
||||
js_SetCallVar(JSContext *cx, JSObject *obj, jsid slotid, ValueArgType arg)
|
||||
{
|
||||
return CallPropertyOp(cx, obj, JSID_FROM_BITS(slotid), vp, JSCPK_VAR, true);
|
||||
Value argcopy = ValueArgToConstRef(arg);
|
||||
return CallPropertyOp(cx, obj, slotid, &argcopy, JSCPK_VAR, true);
|
||||
}
|
||||
JS_DEFINE_CALLINFO_4(extern, BOOL, js_SetCallArg, CONTEXT, OBJECT, SIZET, VALUEPTR, 0,
|
||||
nanojit::ACC_STORE_ANY)
|
||||
JS_DEFINE_CALLINFO_4(extern, BOOL, js_SetCallVar, CONTEXT, OBJECT, SIZET, VALUEPTR, 0,
|
||||
JS_DEFINE_CALLINFO_4(extern, BOOL, js_SetCallVar, CONTEXT, OBJECT, JSID, VALUE, 0,
|
||||
nanojit::ACC_STORE_ANY)
|
||||
#endif
|
||||
|
||||
|
|
|
@ -381,18 +381,6 @@ SetCallArg(JSContext *cx, JSObject *obj, jsid id, js::Value *vp);
|
|||
extern JSBool
|
||||
SetCallVar(JSContext *cx, JSObject *obj, jsid id, js::Value *vp);
|
||||
|
||||
/*
|
||||
* js_SetCallArg and js_SetCallVar are extern fastcall copies of the setter
|
||||
* functions. These versions are required in order to set call vars from traces.
|
||||
* The normal versions must not be fastcall because they are stored in the
|
||||
* property ops map.
|
||||
*/
|
||||
extern JSBool JS_FASTCALL
|
||||
js_SetCallArg(JSContext *cx, JSObject *obj, size_t slotid, js::Value *vp);
|
||||
|
||||
extern JSBool JS_FASTCALL
|
||||
js_SetCallVar(JSContext *cx, JSObject *obj, size_t slotid, js::Value *vp);
|
||||
|
||||
/*
|
||||
* Slower version of js_GetCallVar used when call_resolve detects an attempt to
|
||||
* leak an optimized closure via indirect or debugger eval.
|
||||
|
|
|
@ -1259,9 +1259,9 @@ js_DoIncDec(JSContext *cx, const JSCodeSpec *cs, Value *vp, Value *vp2)
|
|||
double d;
|
||||
if (!ValueToNumber(cx, *vp, &d))
|
||||
return JS_FALSE;
|
||||
vp->setDouble(d);
|
||||
vp->setNumber(d);
|
||||
(cs->format & JOF_INC) ? ++d : --d;
|
||||
vp2->setDouble(d);
|
||||
vp2->setNumber(d);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
@ -1269,8 +1269,8 @@ js_DoIncDec(JSContext *cx, const JSCodeSpec *cs, Value *vp, Value *vp2)
|
|||
if (!ValueToNumber(cx, *vp, &d))
|
||||
return JS_FALSE;
|
||||
(cs->format & JOF_INC) ? ++d : --d;
|
||||
vp->setDouble(d);
|
||||
vp2->setDouble(d);
|
||||
vp->setNumber(d);
|
||||
*vp2 = *vp;
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -4368,7 +4368,7 @@ BEGIN_CASE(JSOP_ARRAYPUSH)
|
|||
JS_ASSERT(script->nfixed <= slot);
|
||||
JS_ASSERT(slot < script->nslots);
|
||||
JSObject *obj = &fp->slots()[slot].asObject();
|
||||
if (!js_ArrayCompPush(cx, obj, ®s.sp[-1]))
|
||||
if (!js_ArrayCompPush(cx, obj, regs.sp[-1]))
|
||||
goto error;
|
||||
regs.sp--;
|
||||
}
|
||||
|
|
194
js/src/jspubtd.h
194
js/src/jspubtd.h
|
@ -170,8 +170,6 @@ typedef struct JSCompartment JSCompartment;
|
|||
*/
|
||||
# define VALUE_ALIGNMENT
|
||||
# define ASSERT_DOUBLE_ALIGN()
|
||||
#else
|
||||
# error "Need to add compiler support"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -206,8 +204,8 @@ JS_ENUM_HEADER(JSValueType, uint8)
|
|||
JSVAL_TYPE_FUNOBJ = 0xF,
|
||||
|
||||
/* Cannot not appear in any jsval ever; trace-jit only. */
|
||||
JSVAL_TYPE_STRORNULL = 0x97,
|
||||
JSVAL_TYPE_OBJORNULL = 0x98,
|
||||
JSVAL_TYPE_STRORNULL = 0x97,
|
||||
JSVAL_TYPE_OBJORNULL = 0x98,
|
||||
JSVAL_TYPE_BOXED = 0x99,
|
||||
JSVAL_TYPE_UNINITIALIZED = 0xcd
|
||||
} JS_ENUM_FOOTER(JSValueType);
|
||||
|
@ -244,8 +242,6 @@ JS_ENUM_HEADER(JSValueTag, uint32)
|
|||
JSVAL_TAG_FUNOBJ = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_FUNOBJ
|
||||
} JS_ENUM_FOOTER(JSValueType);
|
||||
|
||||
#else
|
||||
# error "Unsupported"
|
||||
#endif
|
||||
|
||||
#else /* defined(__cplusplus) */
|
||||
|
@ -260,8 +256,8 @@ typedef uint8 JSValueType;
|
|||
#define JSVAL_TYPE_NULL ((uint8)0x6)
|
||||
#define JSVAL_TYPE_NONFUNOBJ ((uint8)0x7)
|
||||
#define JSVAL_TYPE_FUNOBJ ((uint8)0xF)
|
||||
#define JSVAL_TYPE_STRORNULL ((uint8)0x97)
|
||||
#define JSVAL_TYPE_OBJORNULL ((uint8)0x98)
|
||||
#define JSVAL_TYPE_STRORNULL ((uint8)0x97)
|
||||
#define JSVAL_TYPE_OBJORNULL ((uint8)0x98)
|
||||
#define JSVAL_TYPE_BOXED ((uint8)0x99)
|
||||
#define JSVAL_TYPE_UNINITIALIZED ((uint8)0xcd)
|
||||
|
||||
|
@ -282,17 +278,15 @@ typedef uint32 JSValueTag;
|
|||
|
||||
typedef uint32 JSValueTag;
|
||||
#define JSVAL_TAG_MAX_DOUBLE ((uint32)(0x1FFF0))
|
||||
#define JSVAL_TAG_INT32 (uint32)(JSVAL_TAG_CLEAR | JSVAL_TYPE_INT32)
|
||||
#define JSVAL_TAG_UNDEFINED (uint32)(JSVAL_TAG_CLEAR | JSVAL_TYPE_UNDEFINED)
|
||||
#define JSVAL_TAG_STRING (uint32)(JSVAL_TAG_CLEAR | JSVAL_TYPE_STRING)
|
||||
#define JSVAL_TAG_BOOLEAN (uint32)(JSVAL_TAG_CLEAR | JSVAL_TYPE_BOOLEAN)
|
||||
#define JSVAL_TAG_MAGIC (uint32)(JSVAL_TAG_CLEAR | JSVAL_TYPE_MAGIC)
|
||||
#define JSVAL_TAG_NULL (uint32)(JSVAL_TAG_CLEAR | JSVAL_TYPE_NULL)
|
||||
#define JSVAL_TAG_NONFUNOBJ (uint32)(JSVAL_TAG_CLEAR | JSVAL_TYPE_NONFUNOBJ)
|
||||
#define JSVAL_TAG_FUNOBJ (uint32)(JSVAL_TAG_CLEAR | JSVAL_TYPE_FUNOBJ)
|
||||
#define JSVAL_TAG_INT32 (uint32)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_INT32)
|
||||
#define JSVAL_TAG_UNDEFINED (uint32)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_UNDEFINED)
|
||||
#define JSVAL_TAG_STRING (uint32)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_STRING)
|
||||
#define JSVAL_TAG_BOOLEAN (uint32)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_BOOLEAN)
|
||||
#define JSVAL_TAG_MAGIC (uint32)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_MAGIC)
|
||||
#define JSVAL_TAG_NULL (uint32)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_NULL)
|
||||
#define JSVAL_TAG_NONFUNOBJ (uint32)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_NONFUNOBJ)
|
||||
#define JSVAL_TAG_FUNOBJ (uint32)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_FUNOBJ)
|
||||
|
||||
#else
|
||||
# error "Unsupported"
|
||||
#endif /* JS_BITS_PER_WORD */
|
||||
|
||||
#endif /* defined(__cplusplus) */
|
||||
|
@ -300,9 +294,12 @@ typedef uint32 JSValueTag;
|
|||
#define JSVAL_LOWER_INCL_TYPE_OF_OBJ_OR_NULL_SET JSVAL_TYPE_NULL
|
||||
#define JSVAL_LOWER_INCL_TYPE_OF_OBJ_SET JSVAL_TYPE_NONFUNOBJ
|
||||
#define JSVAL_UPPER_INCL_TYPE_OF_OBJ_SET JSVAL_TYPE_FUNOBJ
|
||||
#define JSVAL_UPPER_INCL_TYPE_OF_NUMBER_SET JSVAL_TYPE_INT32
|
||||
|
||||
#if JS_BITS_PER_WORD == 32
|
||||
|
||||
#define JSVAL_TYPE_TO_TAG(type) ((JSValueTag)(JSVAL_TAG_CLEAR | type))
|
||||
|
||||
#define JSVAL_LOWER_INCL_TAG_OF_OBJ_OR_NULL_SET JSVAL_TAG_NULL
|
||||
#define JSVAL_LOWER_INCL_TAG_OF_OBJ_SET JSVAL_TAG_NONFUNOBJ
|
||||
#define JSVAL_UPPER_INCL_TAG_OF_OBJ_SET JSVAL_TAG_FUNOBJ
|
||||
|
@ -312,6 +309,9 @@ typedef uint32 JSValueTag;
|
|||
|
||||
#define JSVAL_TAG_SHIFT 47
|
||||
#define JSVAL_PAYLOAD_MASK 0x00007FFFFFFFFFFFLL
|
||||
#define JSVAL_TYPE_TO_TAG(type) ((JSValueTag)(JSVAL_TAG_MAX_DOUBLE | type))
|
||||
#define JSVAL_TYPE_TO_SHIFTED_TAG(type) (((uint64)JSVAL_TYPE_TO_TAG(type)) << JSVAL_TAG_SHIFT)
|
||||
|
||||
#define JSVAL_SHIFTED_TAG_MAX_DOUBLE (((uint64)JSVAL_TAG_MAX_DOUBLE) << JSVAL_TAG_SHIFT)
|
||||
#define JSVAL_SHIFTED_TAG_INT32 (((uint64)JSVAL_TAG_INT32) << JSVAL_TAG_SHIFT)
|
||||
#define JSVAL_SHIFTED_TAG_UNDEFINED (((uint64)JSVAL_TAG_UNDEFINED) << JSVAL_TAG_SHIFT)
|
||||
|
@ -345,6 +345,7 @@ typedef enum JSWhyMagic
|
|||
|
||||
typedef union jsval_layout
|
||||
{
|
||||
uint64 asBits;
|
||||
struct {
|
||||
union {
|
||||
int32 i32;
|
||||
|
@ -358,15 +359,15 @@ typedef union jsval_layout
|
|||
JSValueTag tag;
|
||||
} s;
|
||||
double asDouble;
|
||||
uint64 asBits;
|
||||
} jsval_layout;
|
||||
|
||||
#elif JS_BITS_PER_WORD == 64
|
||||
|
||||
typedef union jsval_layout
|
||||
{
|
||||
uint64 asBits;
|
||||
struct {
|
||||
uint64 payload : 47;
|
||||
uint64 payload47 : 47;
|
||||
JSValueTag tag : 17;
|
||||
} debugView;
|
||||
struct {
|
||||
|
@ -377,18 +378,15 @@ typedef union jsval_layout
|
|||
} payload;
|
||||
} s;
|
||||
double asDouble;
|
||||
uint64 asBits;
|
||||
} jsval_layout;
|
||||
|
||||
#endif /* JS_BITS_PER_WORD */
|
||||
#endif /* IS_LITTLE_ENDIAN */
|
||||
|
||||
typedef VALUE_ALIGNMENT uint64 jsval;
|
||||
|
||||
#if JS_BITS_PER_WORD == 32
|
||||
|
||||
#define BUILD_JSVAL(tag, payload) \
|
||||
((jsval)((((uint64)(uint32)(tag)) << 32) | (uint32)(payload)))
|
||||
((((uint64)(uint32)(tag)) << 32) | (uint32)(payload))
|
||||
|
||||
static JS_ALWAYS_INLINE JSBool
|
||||
JSVAL_IS_DOUBLE_IMPL(jsval_layout l)
|
||||
|
@ -550,7 +548,7 @@ static JS_ALWAYS_INLINE jsval_layout
|
|||
OBJECT_TO_JSVAL_IMPL(JSValueType type, JSObject *obj)
|
||||
{
|
||||
jsval_layout l;
|
||||
l.s.tag = (JSValueTag)(JSVAL_TAG_CLEAR | type);
|
||||
l.s.tag = JSVAL_TYPE_TO_TAG(type);
|
||||
l.s.payload.obj = obj;
|
||||
return l;
|
||||
}
|
||||
|
@ -604,17 +602,16 @@ JSVAL_SAME_PRIMITIVE_TYPE_OR_BOTH_OBJECTS_IMPL(jsval_layout lhs, jsval_layout rh
|
|||
static JS_ALWAYS_INLINE JSValueType
|
||||
JSVAL_EXTRACT_NON_DOUBLE_TYPE_IMPL(jsval_layout l)
|
||||
{
|
||||
JSValueType t = (JSValueType)(l.s.tag & 0xF);
|
||||
JS_ASSERT(!JSVAL_IS_DOUBLE_IMPL(l));
|
||||
return t;
|
||||
uint32 type = l.s.tag & 0xF;
|
||||
JS_ASSERT(type > JSVAL_TYPE_DOUBLE);
|
||||
return (JSValueType)type;
|
||||
}
|
||||
|
||||
static JS_ALWAYS_INLINE JSValueTag
|
||||
JSVAL_EXTRACT_NON_DOUBLE_TAG_IMPL(jsval_layout l)
|
||||
{
|
||||
JSValueTag t = l.s.tag;
|
||||
JS_ASSERT(!JSVAL_IS_DOUBLE_IMPL(l));
|
||||
JS_ASSERT(t >= JSVAL_TAG_INT32 && t <= JSVAL_UPPER_INCL_TAG_OF_OBJ_SET);
|
||||
JS_ASSERT(t >= JSVAL_TAG_INT32);
|
||||
return t;
|
||||
}
|
||||
|
||||
|
@ -634,10 +631,27 @@ JSVAL_TO_PRIVATE_UINT32_IMPL(jsval_layout l)
|
|||
return l.s.payload.u32;
|
||||
}
|
||||
|
||||
static JS_ALWAYS_INLINE jsval_layout
|
||||
BOX_NON_DOUBLE_JSVAL(JSValueType type, uint64 *slot)
|
||||
{
|
||||
jsval_layout l;
|
||||
JS_ASSERT(type > JSVAL_TYPE_DOUBLE);
|
||||
l.s.tag = JSVAL_TYPE_TO_TAG(type);
|
||||
l.s.payload.u32 = *(uint32 *)slot;
|
||||
return l;
|
||||
}
|
||||
|
||||
static JS_ALWAYS_INLINE void
|
||||
UNBOX_NON_DOUBLE_JSVAL(jsval_layout l, uint64 *out)
|
||||
{
|
||||
JS_ASSERT(!JSVAL_IS_DOUBLE_IMPL(l));
|
||||
*(uint32 *)out = l.s.payload.u32;
|
||||
}
|
||||
|
||||
#elif JS_BITS_PER_WORD == 64
|
||||
|
||||
#define BUILD_JSVAL(tag, payload) \
|
||||
((jsval)((((uint64)(uint32)(tag)) << JSVAL_TAG_SHIFT) | (payload)))
|
||||
((((uint64)(uint32)(tag)) << JSVAL_TAG_SHIFT) | (payload))
|
||||
|
||||
static JS_ALWAYS_INLINE JSBool
|
||||
JSVAL_IS_DOUBLE_IMPL(jsval_layout l)
|
||||
|
@ -799,7 +813,7 @@ OBJECT_TO_JSVAL_IMPL(JSValueType type, JSObject *obj)
|
|||
uint64 objBits = (uint64)obj;
|
||||
JS_ASSERT(type >= JSVAL_LOWER_INCL_TYPE_OF_OBJ_OR_NULL_SET);
|
||||
JS_ASSERT((objBits >> JSVAL_TAG_SHIFT) == 0);
|
||||
l.asBits = objBits | (((uint64)(JSVAL_TAG_MAX_DOUBLE | type)) << JSVAL_TAG_SHIFT);
|
||||
l.asBits = objBits | JSVAL_TYPE_TO_SHIFTED_TAG(type);
|
||||
return l;
|
||||
}
|
||||
|
||||
|
@ -848,16 +862,10 @@ JSVAL_SAME_PRIMITIVE_TYPE_OR_BOTH_OBJECTS_IMPL(jsval_layout lhs, jsval_layout rh
|
|||
* least one other bit.
|
||||
*/
|
||||
uint64 lbits = lhs.asBits, rbits = rhs.asBits;
|
||||
return (lbits < JSVAL_TAG_MAX_DOUBLE && rbits < JSVAL_TAG_MAX_DOUBLE) ||
|
||||
return (lbits < JSVAL_TAG_MAX_DOUBLE && rbits < JSVAL_TAG_MAX_DOUBLE) ||
|
||||
(((lbits ^ rbits) & 0xFFFB800000000000LL) == 0);
|
||||
}
|
||||
|
||||
static JS_ALWAYS_INLINE JSValueType
|
||||
JSVAL_EXTRACT_NON_DOUBLE_TYPE_IMPL(jsval_layout l)
|
||||
{
|
||||
return (JSValueType)((l.asBits >> JSVAL_TAG_SHIFT) & 0xF);
|
||||
}
|
||||
|
||||
static JS_ALWAYS_INLINE jsval_layout
|
||||
PRIVATE_UINT32_TO_JSVAL_IMPL(uint32 ui)
|
||||
{
|
||||
|
@ -874,8 +882,48 @@ JSVAL_TO_PRIVATE_UINT32_IMPL(jsval_layout l)
|
|||
return (uint32)l.asBits;
|
||||
}
|
||||
|
||||
#else
|
||||
# error "Unsupported configuration"
|
||||
static JS_ALWAYS_INLINE JSValueType
|
||||
JSVAL_EXTRACT_NON_DOUBLE_TYPE_IMPL(jsval_layout l)
|
||||
{
|
||||
uint64 type = (l.asBits >> JSVAL_TAG_SHIFT) & 0xF;
|
||||
JS_ASSERT(type > JSVAL_TYPE_DOUBLE);
|
||||
return (JSValueType)type;
|
||||
}
|
||||
|
||||
static JS_ALWAYS_INLINE JSValueTag
|
||||
JSVAL_EXTRACT_NON_DOUBLE_TAG_IMPL(jsval_layout l)
|
||||
{
|
||||
uint64 tag = l.asBits >> JSVAL_TAG_SHIFT;
|
||||
JS_ASSERT(tag > JSVAL_TAG_MAX_DOUBLE);
|
||||
return (JSValueTag)tag;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
JS_STATIC_ASSERT(offsetof(jsval_layout, s.payload) == 0);
|
||||
#endif
|
||||
|
||||
static JS_ALWAYS_INLINE jsval_layout
|
||||
BOX_NON_DOUBLE_JSVAL(JSValueType type, uint64 *slot)
|
||||
{
|
||||
/* N.B. for 32-bit payloads, the high 32 bits of the slot are trash. */
|
||||
jsval_layout l;
|
||||
JS_ASSERT(type > JSVAL_TYPE_DOUBLE && type <= JSVAL_TYPE_FUNOBJ);
|
||||
uint32 isI32 = (uint32)((type != JSVAL_TYPE_STRING) &
|
||||
(type < JSVAL_LOWER_INCL_TYPE_OF_OBJ_SET));
|
||||
uint32 shift = isI32 * 32;
|
||||
uint64 mask = ((uint64)-1) >> shift;
|
||||
uint64 payload = *slot & mask;
|
||||
l.asBits = payload | JSVAL_TYPE_TO_SHIFTED_TAG(type);
|
||||
return l;
|
||||
}
|
||||
|
||||
static JS_ALWAYS_INLINE void
|
||||
UNBOX_NON_DOUBLE_JSVAL(jsval_layout l, uint64 *out)
|
||||
{
|
||||
JS_ASSERT(!JSVAL_IS_DOUBLE_IMPL(l));
|
||||
*out = (l.asBits & JSVAL_PAYLOAD_MASK);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static JS_ALWAYS_INLINE JSBool
|
||||
|
@ -897,20 +945,58 @@ JSVAL_IS_UNDERLYING_TYPE_OF_PRIVATE_IMPL(jsval_layout l)
|
|||
return JSVAL_IS_DOUBLE_IMPL(l);
|
||||
}
|
||||
|
||||
/*
|
||||
* JavaScript engine unboxed value representation
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
typedef struct jsid
|
||||
{
|
||||
size_t bits;
|
||||
} jsid;
|
||||
# define JSID_BITS(id) (id.bits)
|
||||
#else
|
||||
typedef size_t jsid;
|
||||
# define JSID_BITS(id) (id)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* To catch subtle bugs that may arise fromt he implicit conversion of jsval
|
||||
* and jsid to each other, bool and integral types, debug builds make these
|
||||
* types structs.
|
||||
*/
|
||||
typedef VALUE_ALIGNMENT jsval_layout jsval;
|
||||
typedef struct jsid { size_t bits; } jsid;
|
||||
|
||||
#define JSVAL_BITS(v) (v.asBits)
|
||||
#define IMPL_TO_JSVAL(v) (v)
|
||||
#define JSID_BITS(id) (id.bits)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C++" {
|
||||
static JS_ALWAYS_INLINE bool
|
||||
operator==(jsid lhs, jsid rhs)
|
||||
{
|
||||
return JSID_BITS(lhs) == JSID_BITS(rhs);
|
||||
}
|
||||
|
||||
static JS_ALWAYS_INLINE bool
|
||||
operator!=(jsid lhs, jsid rhs)
|
||||
{
|
||||
return JSID_BITS(lhs) != JSID_BITS(rhs);
|
||||
}
|
||||
|
||||
static JS_ALWAYS_INLINE bool
|
||||
operator==(jsval lhs, jsval rhs)
|
||||
{
|
||||
return JSVAL_BITS(lhs) == JSVAL_BITS(rhs);
|
||||
}
|
||||
|
||||
static JS_ALWAYS_INLINE bool
|
||||
operator!=(jsval lhs, jsval rhs)
|
||||
{
|
||||
return JSVAL_BITS(lhs) != JSVAL_BITS(rhs);
|
||||
}
|
||||
}
|
||||
# endif /* defined(__cplusplus) */
|
||||
|
||||
#else /* defined(DEBUG) */
|
||||
|
||||
typedef VALUE_ALIGNMENT uint64 jsval;
|
||||
typedef size_t jsid;
|
||||
|
||||
#define JSVAL_BITS(v) (v)
|
||||
#define IMPL_TO_JSVAL(v) ((v).asBits)
|
||||
#define JSID_BITS(id) (id)
|
||||
|
||||
#endif /* defined(DEBUG) */
|
||||
|
||||
/* JSClass (and JSObjectOps where appropriate) function pointer typedefs. */
|
||||
|
||||
|
|
|
@ -324,7 +324,7 @@ TraceRecorder::upRecursion()
|
|||
rval_ins = get(&stackval(-1));
|
||||
JS_ASSERT(rval_ins);
|
||||
} else {
|
||||
rval_ins = INS_VOID();
|
||||
rval_ins = INS_UNDEFINED();
|
||||
}
|
||||
|
||||
JSValueType returnType = exit->stackTypeMap()[downPostSlots];
|
||||
|
@ -545,7 +545,7 @@ TraceRecorder::slurpDownFrames(jsbytecode* return_pc)
|
|||
rval_ins = demote(lir, rval_ins);
|
||||
}
|
||||
} else {
|
||||
rval_ins = INS_VOID();
|
||||
rval_ins = INS_UNDEFINED();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -726,50 +726,43 @@ TraceRecorder::downRecursion()
|
|||
return closeLoop(exit);
|
||||
}
|
||||
|
||||
JS_REQUIRES_STACK LIns*
|
||||
TraceRecorder::slurpDoubleSlot(LIns* addr_ins, ptrdiff_t offset, Value* vp, VMSideExit* exit)
|
||||
#if JS_BITS_PER_WORD == 32
|
||||
JS_REQUIRES_STACK inline LIns*
|
||||
TraceRecorder::slurpDoubleSlot(LIns* addr_ins, ptrdiff_t offset, VMSideExit* exit)
|
||||
{
|
||||
LIns *mask_ins = lir->insLoad(LIR_ldi, addr_ins, offset + sTagOffset, ACC_OTHER);
|
||||
guard(true, lir->ins2(LIR_leui, mask_ins, INS_CONSTU(JSVAL_TAG_INT32)), exit);
|
||||
LIns *val_ins = lir->insLoad(LIR_ldi, addr_ins, offset + sPayloadOffset, ACC_OTHER);
|
||||
LIns* args[] = { val_ins, mask_ins };
|
||||
return lir->insCall(&js_UnboxDouble_ci, args);
|
||||
LIns* tag_ins = lir->insLoad(LIR_ldi, addr_ins, offset + sTagOffset, ACC_OTHER);
|
||||
return unbox_number_as_double(addr_ins, offset, tag_ins, exit, ACC_OTHER);
|
||||
}
|
||||
|
||||
JS_REQUIRES_STACK LIns*
|
||||
TraceRecorder::slurpTypedSlot(LIns* addr_ins, ptrdiff_t offset, Value* vp, JSValueTag mask, VMSideExit* exit)
|
||||
JS_REQUIRES_STACK inline LIns*
|
||||
TraceRecorder::slurpNonDoubleSlot(LIns* addr_ins, ptrdiff_t offset, JSValueTag tag, VMSideExit* exit)
|
||||
{
|
||||
LIns *mask_ins = lir->insLoad(LIR_ldi, addr_ins, offset + sTagOffset, ACC_OTHER);
|
||||
guard(true, lir->ins2(LIR_eqi, mask_ins, INS_CONSTU(mask)), exit);
|
||||
if (mask == JSVAL_TAG_UNDEFINED)
|
||||
return INS_VOID();
|
||||
return lir->insLoad(LIR_ldi, addr_ins, offset + sPayloadOffset, ACC_OTHER);
|
||||
LIns* tag_ins = lir->insLoad(LIR_ldi, addr_ins, offset + sTagOffset, ACC_OTHER);
|
||||
return unbox_non_double(addr_ins, offset, tag_ins, tag, exit, ACC_OTHER);
|
||||
}
|
||||
JS_REQUIRES_STACK LIns*
|
||||
#elif JS_BITS_PER_WORD == 64
|
||||
JS_REQUIRES_STACK inline LIns*
|
||||
TraceRecorder::slurpDoubleSlot(LIns* addr_ins, ptrdiff_t offset, VMSideExit* exit)
|
||||
{
|
||||
LIns* v_ins = lir->insLoad(LIR_ldq, addr_ins, offset, ACC_OTHER);
|
||||
return unbox_number_as_double(v_ins, exit);
|
||||
}
|
||||
|
||||
JS_REQUIRES_STACK inline LIns*
|
||||
TraceRecorder::slurpNonDoubleSlot(LIns* addr_ins, ptrdiff_t offset, JSValueTag tag, VMSideExit* exit)
|
||||
{
|
||||
LIns* v_ins = lir->insLoad(LIR_ldq, addr_ins, offset, ACC_OTHER);
|
||||
return unbox_non_double(v_ins, tag, exit);
|
||||
}
|
||||
#endif
|
||||
|
||||
JS_REQUIRES_STACK inline LIns*
|
||||
TraceRecorder::slurpSlot(LIns* addr_ins, ptrdiff_t offset, Value* vp, VMSideExit* exit)
|
||||
{
|
||||
switch (exit->slurpType)
|
||||
{
|
||||
case JSVAL_TYPE_BOOLEAN:
|
||||
return slurpTypedSlot(addr_ins, offset, vp, JSVAL_TAG_BOOLEAN, exit);
|
||||
case JSVAL_TYPE_UNDEFINED:
|
||||
return slurpTypedSlot(addr_ins, offset, vp, JSVAL_TAG_UNDEFINED, exit);
|
||||
case JSVAL_TYPE_INT32:
|
||||
return slurpTypedSlot(addr_ins, offset, vp, JSVAL_TAG_INT32, exit);
|
||||
case JSVAL_TYPE_DOUBLE:
|
||||
return slurpDoubleSlot(addr_ins, offset, vp, exit);
|
||||
case JSVAL_TYPE_STRING:
|
||||
return slurpTypedSlot(addr_ins, offset, vp, JSVAL_TAG_STRING, exit);
|
||||
case JSVAL_TYPE_NULL:
|
||||
return slurpTypedSlot(addr_ins, offset, vp, JSVAL_TAG_NULL, exit);
|
||||
case JSVAL_TYPE_NONFUNOBJ:
|
||||
return slurpTypedSlot(addr_ins, offset, vp, JSVAL_TAG_NONFUNOBJ, exit);
|
||||
case JSVAL_TYPE_FUNOBJ:
|
||||
return slurpTypedSlot(addr_ins, offset, vp, JSVAL_TAG_FUNOBJ, exit);
|
||||
default:
|
||||
JS_NOT_REACHED("invalid type in typemap");
|
||||
return NULL;
|
||||
}
|
||||
if (exit->slurpType == JSVAL_TYPE_DOUBLE)
|
||||
return slurpDoubleSlot(addr_ins, offset, exit);
|
||||
JSValueTag tag = JSVAL_TYPE_TO_TAG(exit->slurpType);
|
||||
return slurpNonDoubleSlot(addr_ins, offset, tag, exit);
|
||||
}
|
||||
|
||||
JS_REQUIRES_STACK void
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1064,12 +1064,11 @@ class TraceRecorder
|
|||
JS_REQUIRES_STACK void guard(bool expected, nanojit::LIns* cond, VMSideExit* exit);
|
||||
JS_REQUIRES_STACK nanojit::LIns* guard_xov(nanojit::LOpcode op, nanojit::LIns* d0,
|
||||
nanojit::LIns* d1, VMSideExit* exit);
|
||||
JS_REQUIRES_STACK nanojit::LIns* slurpTypedSlot(nanojit::LIns* val_ins, ptrdiff_t offset, Value* vp,
|
||||
JSValueTag mask, VMSideExit* exit);
|
||||
JS_REQUIRES_STACK nanojit::LIns* slurpDoubleSlot(nanojit::LIns* val_ins, ptrdiff_t offset, Value* vp,
|
||||
JS_REQUIRES_STACK nanojit::LIns* slurpNonDoubleSlot(nanojit::LIns* val_ins, ptrdiff_t offset,
|
||||
JSValueTag mask, VMSideExit* exit);
|
||||
JS_REQUIRES_STACK nanojit::LIns* slurpDoubleSlot(nanojit::LIns* val_ins, ptrdiff_t offset,
|
||||
VMSideExit* exit);
|
||||
JS_REQUIRES_STACK nanojit::LIns* slurpSlot(nanojit::LIns* val_ins, ptrdiff_t offset, Value* vp,
|
||||
VMSideExit* exit);
|
||||
JS_REQUIRES_STACK nanojit::LIns* slurpSlot(nanojit::LIns* val_ins, ptrdiff_t offset, Value* vp, VMSideExit* exit);
|
||||
JS_REQUIRES_STACK void slurpSlot(nanojit::LIns* val_ins, ptrdiff_t offset, Value* vp, SlurpInfo* info);
|
||||
JS_REQUIRES_STACK AbortableRecordingStatus slurpDownFrames(jsbytecode* return_pc);
|
||||
JS_REQUIRES_STACK AbortableRecordingStatus upRecursion();
|
||||
|
@ -1186,36 +1185,26 @@ class TraceRecorder
|
|||
PropertyCacheEntry* entry,
|
||||
PCVal& pcval);
|
||||
|
||||
void stobj_set_fslot(nanojit::LIns *obj_ins, unsigned slot, const Value &v,
|
||||
void stobj_set_fslot(nanojit::LIns *obj_ins, unsigned slot, const Value &v,
|
||||
nanojit::LIns* v_ins);
|
||||
void stobj_set_dslot(nanojit::LIns *obj_ins, unsigned slot,
|
||||
nanojit::LIns*& dslots_ins, const Value &v, nanojit::LIns* v_ins);
|
||||
void stobj_set_slot(nanojit::LIns* obj_ins, unsigned slot,
|
||||
nanojit::LIns*& dslots_ins, const Value &v, nanojit::LIns* v_ins);
|
||||
void stobj_set_fslot_unboxed(nanojit::LIns *obj_ins, unsigned slot,
|
||||
nanojit::LIns* v_ins);
|
||||
void stobj_set_dslot_unboxed(nanojit::LIns *obj_ins, unsigned slot, nanojit::LIns*& dslots_ins,
|
||||
nanojit::LIns* v_ins);
|
||||
void stobj_set_slot_unboxed(nanojit::LIns* obj_ins, unsigned slot, nanojit::LIns*& dslots_ins,
|
||||
nanojit::LIns* v_ins);
|
||||
void set_array_fslot(nanojit::LIns *obj_ins, unsigned slot, uint32 val);
|
||||
|
||||
nanojit::LIns* stobj_get_const_fslot(nanojit::LIns* obj_ins, unsigned slot);
|
||||
nanojit::LIns* stobj_get_fslot(nanojit::LIns* obj_ins, unsigned slot);
|
||||
nanojit::LIns* stobj_get_dslot(nanojit::LIns* obj_ins, unsigned index,
|
||||
nanojit::LIns*& dslots_ins);
|
||||
nanojit::LIns* stobj_get_slot(nanojit::LIns* obj_ins, unsigned slot,
|
||||
nanojit::LIns*& dslots_ins);
|
||||
|
||||
nanojit::LIns* stobj_get_private(nanojit::LIns* obj_ins) {
|
||||
return stobj_get_fslot(obj_ins, JSSLOT_PRIVATE);
|
||||
}
|
||||
nanojit::LIns* stobj_get_const_private_ptr(nanojit::LIns* obj_ins);
|
||||
nanojit::LIns* stobj_get_fslot_uint32(nanojit::LIns* obj_ins, unsigned slot);
|
||||
nanojit::LIns* stobj_get_fslot_ptr(nanojit::LIns* obj_ins, unsigned slot);
|
||||
nanojit::LIns* unbox_slot(JSObject *obj, nanojit::LIns *obj_ins, uint32 slot,
|
||||
VMSideExit *exit);
|
||||
|
||||
nanojit::LIns* stobj_get_proto(nanojit::LIns* obj_ins) {
|
||||
return stobj_get_fslot(obj_ins, JSSLOT_PROTO);
|
||||
return stobj_get_fslot_ptr(obj_ins, JSSLOT_PROTO);
|
||||
}
|
||||
|
||||
nanojit::LIns* stobj_get_parent(nanojit::LIns* obj_ins) {
|
||||
return stobj_get_fslot(obj_ins, JSSLOT_PARENT);
|
||||
return stobj_get_fslot_ptr(obj_ins, JSSLOT_PARENT);
|
||||
}
|
||||
|
||||
JS_REQUIRES_STACK AbortableRecordingStatus name(Value*& vp, nanojit::LIns*& ins, NameResult& nr);
|
||||
|
@ -1236,8 +1225,8 @@ class TraceRecorder
|
|||
JS_REQUIRES_STACK AbortableRecordingStatus getProp(Value& v);
|
||||
JS_REQUIRES_STACK RecordingStatus getThis(nanojit::LIns*& this_ins);
|
||||
|
||||
JS_REQUIRES_STACK void storeHole(JSWhyMagic why, nanojit::LIns *addr_ins, ptrdiff_t offset,
|
||||
nanojit::AccSet accSet);
|
||||
JS_REQUIRES_STACK void storeMagic(JSWhyMagic why, nanojit::LIns *addr_ins, ptrdiff_t offset,
|
||||
nanojit::AccSet accSet);
|
||||
JS_REQUIRES_STACK AbortableRecordingStatus unboxNextValue(nanojit::LIns* &v_ins);
|
||||
|
||||
JS_REQUIRES_STACK VMSideExit* enterDeepBailCall();
|
||||
|
@ -1277,27 +1266,48 @@ class TraceRecorder
|
|||
JS_REQUIRES_STACK AbortableRecordingStatus setElem(int lval_spindex, int idx_spindex,
|
||||
int v_spindex);
|
||||
|
||||
JS_REQUIRES_STACK nanojit::LIns* unbox_value(const Value &v, nanojit::LIns *vaddr_ins,
|
||||
ptrdiff_t offset, VMSideExit *exit,
|
||||
bool force_double=false);
|
||||
JS_REQUIRES_STACK nanojit::LIns* unbox_value_load(const Value &v, nanojit::LIns *vload_ins,
|
||||
VMSideExit *exit);
|
||||
JS_REQUIRES_STACK nanojit::LIns* unbox_int(const Value &v, nanojit::LIns *vaddr_ins,
|
||||
ptrdiff_t offset);
|
||||
JS_REQUIRES_STACK nanojit::LIns* unbox_string(const Value &v, nanojit::LIns *vaddr_ins,
|
||||
ptrdiff_t offset);
|
||||
JS_REQUIRES_STACK nanojit::LIns* unbox_object(nanojit::LIns *vaddr_ins, ptrdiff_t offset);
|
||||
JS_REQUIRES_STACK nanojit::LIns* is_boxed_object(nanojit::LIns *vaddr_ins);
|
||||
JS_REQUIRES_STACK nanojit::LIns* is_boxed_true(nanojit::LIns *vaddr_ins);
|
||||
void box_undefined_into(nanojit::LIns *dstaddr_ins, ptrdiff_t offset, nanojit::AccSet);
|
||||
#if JS_BITS_PER_WORD == 32
|
||||
void box_null_into(nanojit::LIns *dstaddr_ins, ptrdiff_t offset, nanojit::AccSet);
|
||||
nanojit::LIns* unbox_number_as_double(nanojit::LIns* vaddr_ins, ptrdiff_t offset,
|
||||
nanojit::LIns* tag_ins, VMSideExit* exit,
|
||||
nanojit::AccSet);
|
||||
nanojit::LIns* unbox_non_double(nanojit::LIns* vaddr_ins, ptrdiff_t offset,
|
||||
nanojit::LIns* tag_ins, JSValueTag tag, VMSideExit* exit,
|
||||
nanojit::AccSet);
|
||||
#elif JS_BITS_PER_WORD == 64
|
||||
nanojit::LIns* non_double_value_has_tag(nanojit::LIns* v_ins, JSValueTag tag);
|
||||
nanojit::LIns* unpack_ptr(nanojit::LIns* v_ins);
|
||||
nanojit::LIns* unbox_number_as_double(nanojit::LIns* v_ins, VMSideExit* exit);
|
||||
nanojit::LIns* unbox_non_double(nanojit::LIns* v_ins, JSValueTag tag, VMSideExit* exit);
|
||||
#endif
|
||||
|
||||
JS_REQUIRES_STACK nanojit::LIns* is_string_id(nanojit::LIns *id_ins);
|
||||
JS_REQUIRES_STACK nanojit::LIns* unbox_string_id(nanojit::LIns *id_ins);
|
||||
JS_REQUIRES_STACK nanojit::LIns* unbox_int_id(nanojit::LIns *id_ins);
|
||||
nanojit::LIns* unbox_value(const Value& v, nanojit::LIns* vaddr_ins,
|
||||
ptrdiff_t offset, VMSideExit* exit,
|
||||
bool force_double=false);
|
||||
void unbox_object(nanojit::LIns* vaddr_ins, nanojit::LIns** obj_ins,
|
||||
nanojit::LIns** is_obj_ins, nanojit::AccSet);
|
||||
nanojit::LIns* is_boxed_true(nanojit::LIns* vaddr_ins, nanojit::AccSet);
|
||||
|
||||
JS_REQUIRES_STACK void box_value(const Value &v, nanojit::LIns* v_ins,
|
||||
nanojit::LIns *dstaddr_ins, ptrdiff_t offset,
|
||||
nanojit::AccSet accSet);
|
||||
JS_REQUIRES_STACK nanojit::LIns* box_value(const Value &v, nanojit::LIns* v_ins);
|
||||
nanojit::LIns* is_string_id(nanojit::LIns* id_ins);
|
||||
nanojit::LIns* unbox_string_id(nanojit::LIns* id_ins);
|
||||
nanojit::LIns* unbox_int_id(nanojit::LIns* id_ins);
|
||||
|
||||
/* Box a slot on trace into the given address at the given offset. */
|
||||
void box_value_into(const Value& v, nanojit::LIns* v_ins,
|
||||
nanojit::LIns* dstaddr_ins, ptrdiff_t offset,
|
||||
nanojit::AccSet);
|
||||
|
||||
/*
|
||||
* Box a slot so that it may be passed with value semantics to a native. On
|
||||
* 32-bit, this currently means boxing the value into insAlloc'd memory and
|
||||
* returning the address which is passed as a Value*. On 64-bit, this
|
||||
* currently means returning the boxed value which is passed as a jsval.
|
||||
*/
|
||||
nanojit::LIns* box_value_for_native_call(const Value& v, nanojit::LIns* v_ins);
|
||||
|
||||
/* Box a slot into insAlloc'd memory. */
|
||||
nanojit::LIns* box_value_into_alloc(const Value& v, nanojit::LIns* v_ins);
|
||||
|
||||
JS_REQUIRES_STACK void guardClassHelper(bool cond, nanojit::LIns* obj_ins, Class* clasp,
|
||||
VMSideExit* exit, nanojit::AccSet accSet);
|
||||
|
@ -1341,7 +1351,7 @@ class TraceRecorder
|
|||
JSScopeProperty* sprop,
|
||||
nanojit::LIns* obj_ins,
|
||||
bool setflag,
|
||||
nanojit::LIns* boxed_ins);
|
||||
nanojit::LIns* addr_boxed_val_ins);
|
||||
JS_REQUIRES_STACK RecordingStatus callSpecializedNative(JSNativeTraceInfo* trcinfo, uintN argc,
|
||||
bool constructing);
|
||||
JS_REQUIRES_STACK RecordingStatus callNative(uintN argc, JSOp mode);
|
||||
|
|
|
@ -1502,7 +1502,7 @@ mozJSComponentLoader::Import(const nsACString & registryLocation)
|
|||
|
||||
jsval *retval = nsnull;
|
||||
cc->GetRetValPtr(&retval);
|
||||
if (*retval)
|
||||
if (retval)
|
||||
*retval = OBJECT_TO_JSVAL(globalObj);
|
||||
|
||||
return rv;
|
||||
|
|
|
@ -149,7 +149,7 @@ public:
|
|||
|
||||
nsAutoJSValHolder &operator=(jsval aOther) {
|
||||
#ifdef DEBUG
|
||||
if (aOther) {
|
||||
if (JSVAL_IS_OBJECT(aOther) && JSVAL_TO_OBJECT(aOther)) {
|
||||
NS_ASSERTION(mHeld, "Not rooted!");
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -2352,7 +2352,7 @@ NS_IMETHODIMP
|
|||
nsXPConnect::JSToVariant(JSContext* ctx, jsval value, nsIVariant** _retval)
|
||||
{
|
||||
NS_PRECONDITION(ctx, "bad param");
|
||||
NS_PRECONDITION(value, "bad param");
|
||||
NS_PRECONDITION(value != JSVAL_NULL, "bad param");
|
||||
NS_PRECONDITION(_retval, "bad param");
|
||||
|
||||
XPCCallContext ccx(NATIVE_CALLER, ctx);
|
||||
|
@ -2804,7 +2804,7 @@ JS_EXPORT_API(void) DumpJSObject(JSObject* obj)
|
|||
|
||||
JS_EXPORT_API(void) DumpJSValue(jsval val)
|
||||
{
|
||||
printf("Dumping 0x%p.\n", (void *) val);
|
||||
printf("Dumping 0x%ll.\n", (long long) JSVAL_BITS(val));
|
||||
if(JSVAL_IS_NULL(val)) {
|
||||
printf("Value is null\n");
|
||||
}
|
||||
|
|
|
@ -1025,7 +1025,7 @@ def getTraceType(type):
|
|||
traceType = traceTypeMap.get(typeName)[0]
|
||||
else:
|
||||
assert isInterfaceType(type)
|
||||
traceType = "js::Value *"
|
||||
traceType = "js::ValueArgType "
|
||||
return traceType
|
||||
|
||||
def getTraceReturnType(type):
|
||||
|
@ -1043,7 +1043,7 @@ def getTraceInfoType(type):
|
|||
traceType = traceTypeMap.get(typeName)[1]
|
||||
else:
|
||||
assert isInterfaceType(type)
|
||||
traceType = "VALUEPTR"
|
||||
traceType = "VALUE"
|
||||
return traceType
|
||||
|
||||
def getTraceInfoReturnType(type):
|
||||
|
@ -1133,7 +1133,7 @@ def writeTraceableArgumentConversion(f, member, i, name, type, haveCcx,
|
|||
assert haveCcx
|
||||
template = (
|
||||
" nsCOMPtr<nsIVariant> ${name}(already_AddRefed<nsIVariant>("
|
||||
"XPCVariant::newVariant(ccx, *js::Jsvalify(${argVal}))));\n"
|
||||
"XPCVariant::newVariant(ccx, js::Jsvalify(js::ValueArgToConstRef(${argVal})))));\n"
|
||||
" if (!${name}) {\n")
|
||||
f.write(substitute(template, params))
|
||||
writeFailure(f, getTraceInfoDefaultReturn(member.realtype), 2)
|
||||
|
@ -1147,7 +1147,7 @@ def writeTraceableArgumentConversion(f, member, i, name, type, haveCcx,
|
|||
f.write(" %s *%s;\n" % (type.name, name))
|
||||
f.write(" xpc_qsSelfRef %sref;\n" % name)
|
||||
f.write(" rv = xpc_qsUnwrapArg<%s>("
|
||||
"cx, *js::Jsvalify(%s), &%s, &%sref.ptr, &vp.array[%d]);\n"
|
||||
"cx, js::Jsvalify(js::ValueArgToConstRef(%s)), &%s, &%sref.ptr, &vp.array[%d]);\n"
|
||||
% (type.name, argVal, name, name, 1 + i))
|
||||
f.write(" if (NS_FAILED(rv)) {\n")
|
||||
if haveCcx:
|
||||
|
|
|
@ -325,7 +325,7 @@ XPCConvert::NativeData2JS(XPCLazyCallContext& lccx, jsval* d, const void* s,
|
|||
|
||||
if(!p->IsVoid()) {
|
||||
jsval str = XPCStringConvert::ReadableToJSVal(cx, *p);
|
||||
if(!str)
|
||||
if(JSVAL_IS_NULL(str))
|
||||
return JS_FALSE;
|
||||
|
||||
*d = str;
|
||||
|
@ -2246,7 +2246,7 @@ XPCConvert::JSStringWithSize2Native(XPCCallContext& ccx, void* d, jsval s,
|
|||
JSBool useAllocator,
|
||||
uintN* pErr)
|
||||
{
|
||||
NS_PRECONDITION(s, "bad param");
|
||||
NS_PRECONDITION(!JSVAL_IS_NULL(s), "bad param");
|
||||
NS_PRECONDITION(d, "bad param");
|
||||
|
||||
JSContext* cx = ccx.GetJSContext();
|
||||
|
|
|
@ -262,6 +262,8 @@ extern const char XPC_XPCONNECT_CONTRACTID[];
|
|||
|
||||
#define WRAPPER_SLOTS (JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(1))
|
||||
|
||||
#define INVALID_OBJECT ((JSObject *)1)
|
||||
|
||||
/***************************************************************************/
|
||||
// Auto locking support class...
|
||||
|
||||
|
@ -2600,8 +2602,8 @@ public:
|
|||
// needs us alive and whole. Do not let our mFlatJSObject go away.
|
||||
// This is the only time we should be tracing our mFlatJSObject,
|
||||
// normally somebody else is doing that. Be careful not to trace the
|
||||
// bogus JSVAL_ONE value we can have during init, though.
|
||||
if(mFlatJSObject && mFlatJSObject != (JSObject*)JSVAL_ONE)
|
||||
// bogus INVALID_OBJECT value we can have during init, though.
|
||||
if(mFlatJSObject && mFlatJSObject != INVALID_OBJECT)
|
||||
{
|
||||
JS_CALL_OBJECT_TRACER(trc, mFlatJSObject,
|
||||
"XPCWrappedNative::mFlatJSObject");
|
||||
|
@ -4035,7 +4037,7 @@ class XPCMarkableJSVal
|
|||
{
|
||||
public:
|
||||
XPCMarkableJSVal(jsval val) : mVal(val), mValPtr(&mVal) {}
|
||||
XPCMarkableJSVal(jsval *pval) : mVal(0), mValPtr(pval) {}
|
||||
XPCMarkableJSVal(jsval *pval) : mVal(JSVAL_VOID), mValPtr(pval) {}
|
||||
~XPCMarkableJSVal() {}
|
||||
void Mark() {}
|
||||
void TraceJS(JSTracer* trc)
|
||||
|
|
|
@ -1062,7 +1062,7 @@ xpc_qsStringToJsval(JSContext *cx, const nsAString &str, jsval *rval)
|
|||
}
|
||||
|
||||
jsval jsstr = XPCStringConvert::ReadableToJSVal(cx, str);
|
||||
if(!jsstr)
|
||||
if(JSVAL_IS_NULL(jsstr))
|
||||
return JS_FALSE;
|
||||
*rval = jsstr;
|
||||
return JS_TRUE;
|
||||
|
@ -1079,7 +1079,7 @@ xpc_qsStringToJsstring(JSContext *cx, const nsAString &str, JSString **rval)
|
|||
}
|
||||
|
||||
jsval jsstr = XPCStringConvert::ReadableToJSVal(cx, str);
|
||||
if(!jsstr)
|
||||
if(JSVAL_IS_NULL(jsstr))
|
||||
return JS_FALSE;
|
||||
*rval = JSVAL_TO_STRING(jsstr);
|
||||
return JS_TRUE;
|
||||
|
|
|
@ -621,7 +621,7 @@ nsXPCWrappedJS::GetProperty(const nsAString & name, nsIVariant **_retval)
|
|||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
jsval jsstr = XPCStringConvert::ReadableToJSVal(ccx, name);
|
||||
if(!jsstr)
|
||||
if(JSVAL_IS_NULL(jsstr))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
return nsXPCWrappedJSClass::
|
||||
|
|
|
@ -846,7 +846,7 @@ XPCWrappedNative::XPCWrappedNative(already_AddRefed<nsISupports> aIdentity,
|
|||
XPCWrappedNativeProto* aProto)
|
||||
: mMaybeProto(aProto),
|
||||
mSet(aProto->GetSet()),
|
||||
mFlatJSObject((JSObject*)JSVAL_ONE), // non-null to pass IsValid() test
|
||||
mFlatJSObject(INVALID_OBJECT), // non-null to pass IsValid() test
|
||||
mScriptableInfo(nsnull),
|
||||
mWrapperWord(0)
|
||||
{
|
||||
|
@ -865,7 +865,7 @@ XPCWrappedNative::XPCWrappedNative(already_AddRefed<nsISupports> aIdentity,
|
|||
|
||||
: mMaybeScope(TagScope(aScope)),
|
||||
mSet(aSet),
|
||||
mFlatJSObject((JSObject*)JSVAL_ONE), // non-null to pass IsValid() test
|
||||
mFlatJSObject(INVALID_OBJECT), // non-null to pass IsValid() test
|
||||
mScriptableInfo(nsnull),
|
||||
mWrapperWord(0)
|
||||
{
|
||||
|
|
|
@ -1060,7 +1060,7 @@ XPC_WN_Helper_Call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
|||
{
|
||||
// this is a hack to get the obj of the actual object not the object
|
||||
// that JS thinks is the 'this' (which it passes as 'obj').
|
||||
if(!(obj = (JSObject*)argv[-2]))
|
||||
if(!(obj = JSVAL_TO_OBJECT(argv[-2])))
|
||||
return JS_FALSE;
|
||||
|
||||
SLIM_LOG_WILL_MORPH(cx, obj);
|
||||
|
@ -1075,7 +1075,7 @@ XPC_WN_Helper_Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
|||
{
|
||||
// this is a hack to get the obj of the actual object not the object
|
||||
// that JS thinks is the 'this' (which it passes as 'obj').
|
||||
if(!(obj = (JSObject*)argv[-2]))
|
||||
if(!(obj = JSVAL_TO_OBJECT(argv[-2])))
|
||||
return JS_FALSE;
|
||||
|
||||
SLIM_LOG_WILL_MORPH(cx, obj);
|
||||
|
|
|
@ -902,7 +902,7 @@ nsJSObjWrapper::NP_RemoveProperty(NPObject *npobj, NPIdentifier id)
|
|||
ok = ::JS_DeleteUCProperty2(cx, npjsobj->mJSObj, ::JS_GetStringChars(str),
|
||||
::JS_GetStringLength(str), &deleted);
|
||||
|
||||
if (ok && deleted) {
|
||||
if (ok && deleted == JSVAL_TRUE) {
|
||||
// FIXME: See bug 425823, we shouldn't need to do this, and once
|
||||
// that bug is fixed we can remove this code.
|
||||
|
||||
|
@ -922,7 +922,7 @@ nsJSObjWrapper::NP_RemoveProperty(NPObject *npobj, NPIdentifier id)
|
|||
|
||||
ok = ::JS_DeleteElement2(cx, npjsobj->mJSObj, NPIdentifierToInt(id), &deleted);
|
||||
|
||||
if (ok && deleted) {
|
||||
if (ok && deleted == JSVAL_TRUE) {
|
||||
// FIXME: See bug 425823, we shouldn't need to do this, and once
|
||||
// that bug is fixed we can remove this code.
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче