Fix strict-aliasing warning from 18d56745c3e6

--HG--
extra : rebase_source : 446fc01cba89ea45825cd1dc10716a05b9ec9818
This commit is contained in:
Luke Wagner 2010-11-08 14:35:06 -08:00
Родитель 2d417c6132
Коммит fea36bd719
5 изменённых файлов: 12 добавлений и 9 удалений

Просмотреть файл

@ -704,10 +704,10 @@ MarkWordConservatively(JSTracer *trc, jsuword w)
} }
static void static void
MarkRangeConservatively(JSTracer *trc, jsuword *begin, jsuword *end) MarkRangeConservatively(JSTracer *trc, const jsuword *begin, const jsuword *end)
{ {
JS_ASSERT(begin <= end); JS_ASSERT(begin <= end);
for (jsuword *i = begin; i != end; ++i) for (const jsuword *i = begin; i != end; ++i)
MarkWordConservatively(trc, *i); MarkWordConservatively(trc, *i);
} }
@ -734,15 +734,15 @@ MarkThreadDataConservatively(JSTracer *trc, JSThreadData *td)
void void
MarkStackRangeConservatively(JSTracer *trc, Value *beginv, Value *endv) MarkStackRangeConservatively(JSTracer *trc, Value *beginv, Value *endv)
{ {
jsuword *begin = beginv->payloadWord(); const jsuword *begin = beginv->payloadWord();
jsuword *end = endv->payloadWord();; const jsuword *end = endv->payloadWord();;
#ifdef JS_NUNBOX32 #ifdef JS_NUNBOX32
/* /*
* With 64-bit jsvals on 32-bit systems, we can optimize a bit by * With 64-bit jsvals on 32-bit systems, we can optimize a bit by
* scanning only the payloads. * scanning only the payloads.
*/ */
JS_ASSERT(begin <= end); JS_ASSERT(begin <= end);
for (jsuword *i = begin; i != end; i += sizeof(Value)/sizeof(jsuword)) for (const jsuword *i = begin; i != end; i += sizeof(Value)/sizeof(jsuword))
MarkWordConservatively(trc, *i); MarkWordConservatively(trc, *i);
#else #else
MarkRangeConservatively(trc, begin, end); MarkRangeConservatively(trc, begin, end);

Просмотреть файл

@ -5077,7 +5077,7 @@ js_GetProperty(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value
} }
JSBool JSBool
js::GetPropertyDefault(JSContext *cx, JSObject *obj, jsid id, Value def, Value *vp) js::GetPropertyDefault(JSContext *cx, JSObject *obj, jsid id, const Value &def, Value *vp)
{ {
JSProperty *prop; JSProperty *prop;
JSObject *obj2; JSObject *obj2;

Просмотреть файл

@ -220,7 +220,7 @@ js_GetProperty(JSContext *cx, JSObject *obj, jsid id, js::Value *vp)
namespace js { namespace js {
extern JSBool extern JSBool
GetPropertyDefault(JSContext *cx, JSObject *obj, jsid id, Value def, Value *vp); GetPropertyDefault(JSContext *cx, JSObject *obj, jsid id, const Value &def, Value *vp);
} /* namespace js */ } /* namespace js */

Просмотреть файл

@ -283,6 +283,7 @@ typedef union jsval_layout
JSObject *obj; JSObject *obj;
void *ptr; void *ptr;
JSWhyMagic why; JSWhyMagic why;
jsuword word;
} payload; } payload;
JSValueTag tag; JSValueTag tag;
} s; } s;
@ -305,6 +306,7 @@ typedef union jsval_layout
int32 i32; int32 i32;
uint32 u32; uint32 u32;
JSWhyMagic why; JSWhyMagic why;
jsuword word;
} payload; } payload;
} s; } s;
double asDouble; double asDouble;
@ -326,6 +328,7 @@ typedef union jsval_layout
JSObject *obj; JSObject *obj;
void *ptr; void *ptr;
JSWhyMagic why; JSWhyMagic why;
jsuword word;
} payload; } payload;
} s; } s;
double asDouble; double asDouble;

Просмотреть файл

@ -728,8 +728,8 @@ class Value
return data.asPtr; return data.asPtr;
} }
jsuword *payloadWord() const { const jsuword *payloadWord() const {
return (jsuword *)&data.s.payload; return &data.s.payload.word;
} }
private: private: