mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 656059 - Ask for specific original prototypes in much of jstracer.cpp, not through a generic JSProtoKey-keyed interface. r=jorendorff
--HG-- extra : rebase_source : 9e6973a708ccbdd4785ef67fd6536c3f46c3dbb3
This commit is contained in:
parent
49b1d699b4
commit
dc5a9f3316
@ -58,14 +58,6 @@ JSObject::getDenseArrayInitializedLength()
|
||||
return initializedLength;
|
||||
}
|
||||
|
||||
inline void
|
||||
JSObject::setDenseArrayInitializedLength(uint32 length)
|
||||
{
|
||||
JS_ASSERT(isDenseArray());
|
||||
JS_ASSERT(length <= getDenseArrayCapacity());
|
||||
initializedLength = length;
|
||||
}
|
||||
|
||||
inline bool
|
||||
JSObject::isPackedDenseArray()
|
||||
{
|
||||
|
@ -41,6 +41,15 @@
|
||||
#define jsarrayinlines_h___
|
||||
|
||||
#include "jsinferinlines.h"
|
||||
#include "jsobjinlines.h"
|
||||
|
||||
inline void
|
||||
JSObject::setDenseArrayInitializedLength(uint32 length)
|
||||
{
|
||||
JS_ASSERT(isDenseArray());
|
||||
JS_ASSERT(length <= getDenseArrayCapacity());
|
||||
initializedLength = length;
|
||||
}
|
||||
|
||||
inline void
|
||||
JSObject::markDenseArrayNotPacked(JSContext *cx)
|
||||
|
@ -10909,30 +10909,74 @@ TraceRecorder::getClassPrototype(JSObject* ctor, LIns*& proto_ins)
|
||||
return RECORD_CONTINUE;
|
||||
}
|
||||
|
||||
RecordingStatus
|
||||
TraceRecorder::getClassPrototype(JSProtoKey key, LIns*& proto_ins)
|
||||
static inline void
|
||||
AssertValidPrototype(JSObject *proto, JSProtoKey key, DebugOnly<TraceMonitor *> localtm,
|
||||
JSContext *cx)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
TraceMonitor &localtm = *traceMonitor;
|
||||
/* This shouldn't have reentered. */
|
||||
JS_ASSERT(localtm->recorder);
|
||||
|
||||
/* Double-check for a matching emptyShape. */
|
||||
JS_ASSERT(proto->isNative());
|
||||
JS_ASSERT(proto->getNewType(cx)->emptyShapes);
|
||||
EmptyShape *empty = proto->getNewType(cx)->emptyShapes[0];
|
||||
JS_ASSERT(empty);
|
||||
JS_ASSERT(JSCLASS_CACHED_PROTO_KEY(empty->getClass()) == key);
|
||||
#endif
|
||||
}
|
||||
|
||||
JSObject* proto;
|
||||
if (!js_GetClassPrototype(cx, globalObj, key, &proto))
|
||||
RETURN_ERROR("error in js_GetClassPrototype");
|
||||
RecordingStatus
|
||||
TraceRecorder::getObjectPrototype(LIns*& proto_ins)
|
||||
{
|
||||
DebugOnly<TraceMonitor *> localtm = traceMonitor;
|
||||
|
||||
// This should not have reentered.
|
||||
JS_ASSERT(localtm.recorder);
|
||||
JSObject *proto = globalObj->asGlobal()->getOrCreateObjectPrototype(cx);
|
||||
if (!proto)
|
||||
RETURN_ERROR("error getting Object.prototype");
|
||||
AssertValidPrototype(proto, JSProto_Object, localtm, cx);
|
||||
|
||||
#ifdef DEBUG
|
||||
/* Double-check that a native proto has a matching emptyShape. */
|
||||
if (key != JSProto_Array) {
|
||||
JS_ASSERT(proto->isNative());
|
||||
JS_ASSERT(proto->getNewType(cx)->emptyShapes);
|
||||
EmptyShape *empty = proto->getNewType(cx)->emptyShapes[0];
|
||||
JS_ASSERT(empty);
|
||||
JS_ASSERT(JSCLASS_CACHED_PROTO_KEY(empty->getClass()) == key);
|
||||
}
|
||||
#endif
|
||||
proto_ins = w.immpObjGC(proto);
|
||||
return RECORD_CONTINUE;
|
||||
}
|
||||
|
||||
RecordingStatus
|
||||
TraceRecorder::getFunctionPrototype(LIns*& proto_ins)
|
||||
{
|
||||
DebugOnly<TraceMonitor *> localtm = traceMonitor;
|
||||
|
||||
JSObject *proto = globalObj->asGlobal()->getOrCreateFunctionPrototype(cx);
|
||||
if (!proto)
|
||||
RETURN_ERROR("error getting Function.prototype");
|
||||
AssertValidPrototype(proto, JSProto_Function, localtm, cx);
|
||||
|
||||
proto_ins = w.immpObjGC(proto);
|
||||
return RECORD_CONTINUE;
|
||||
}
|
||||
|
||||
RecordingStatus
|
||||
TraceRecorder::getArrayPrototype(LIns*& proto_ins)
|
||||
{
|
||||
DebugOnly<TraceMonitor *> localtm = traceMonitor;
|
||||
|
||||
JSObject *proto = globalObj->asGlobal()->getOrCreateArrayPrototype(cx);
|
||||
if (!proto)
|
||||
RETURN_ERROR("error getting Array.prototype");
|
||||
AssertValidPrototype(proto, JSProto_Array, localtm, cx);
|
||||
|
||||
proto_ins = w.immpObjGC(proto);
|
||||
return RECORD_CONTINUE;
|
||||
}
|
||||
|
||||
RecordingStatus
|
||||
TraceRecorder::getRegExpPrototype(LIns*& proto_ins)
|
||||
{
|
||||
DebugOnly<TraceMonitor *> localtm = traceMonitor;
|
||||
|
||||
JSObject *proto = globalObj->asGlobal()->getOrCreateRegExpPrototype(cx);
|
||||
if (!proto)
|
||||
RETURN_ERROR("error getting RegExp.prototype");
|
||||
AssertValidPrototype(proto, JSProto_RegExp, localtm, cx);
|
||||
|
||||
proto_ins = w.immpObjGC(proto);
|
||||
return RECORD_CONTINUE;
|
||||
@ -14334,15 +14378,16 @@ TraceRecorder::record_JSOP_NEWINIT()
|
||||
hadNewInit = true;
|
||||
|
||||
JSProtoKey key = JSProtoKey(cx->regs().pc[1]);
|
||||
JS_ASSERT(key == JSProto_Array || key == JSProto_Object);
|
||||
|
||||
LIns* proto_ins;
|
||||
CHECK_STATUS_A(getClassPrototype(key, proto_ins));
|
||||
|
||||
LIns *v_ins;
|
||||
if (key == JSProto_Array) {
|
||||
CHECK_STATUS_A(getArrayPrototype(proto_ins));
|
||||
LIns *args[] = { proto_ins, cx_ins };
|
||||
v_ins = w.call(&NewDenseEmptyArray_ci, args);
|
||||
} else {
|
||||
CHECK_STATUS_A(getObjectPrototype(proto_ins));
|
||||
LIns *args[] = { w.immpNull(), proto_ins, cx_ins };
|
||||
v_ins = w.call(&js_InitializerObject_ci, args);
|
||||
}
|
||||
@ -14357,7 +14402,7 @@ TraceRecorder::record_JSOP_NEWARRAY()
|
||||
initDepth++;
|
||||
|
||||
LIns* proto_ins;
|
||||
CHECK_STATUS_A(getClassPrototype(JSProto_Array, proto_ins));
|
||||
CHECK_STATUS_A(getArrayPrototype(proto_ins));
|
||||
|
||||
unsigned count = GET_UINT24(cx->regs().pc);
|
||||
LIns *args[] = { proto_ins, w.immi(count), cx_ins };
|
||||
@ -14374,7 +14419,7 @@ TraceRecorder::record_JSOP_NEWOBJECT()
|
||||
initDepth++;
|
||||
|
||||
LIns* proto_ins;
|
||||
CHECK_STATUS_A(getClassPrototype(JSProto_Object, proto_ins));
|
||||
CHECK_STATUS_A(getObjectPrototype(proto_ins));
|
||||
|
||||
JSObject* baseobj = cx->fp()->script()->getObject(getFullIndex(0));
|
||||
|
||||
@ -15280,7 +15325,7 @@ TraceRecorder::record_JSOP_LAMBDA()
|
||||
}
|
||||
|
||||
LIns *proto_ins;
|
||||
CHECK_STATUS_A(getClassPrototype(JSProto_Function, proto_ins));
|
||||
CHECK_STATUS_A(getFunctionPrototype(proto_ins));
|
||||
|
||||
LIns* args[] = { w.immpObjGC(globalObj), proto_ins, w.immpFunGC(fun), cx_ins };
|
||||
LIns* x = w.call(&js_NewNullClosure_ci, args);
|
||||
@ -15295,7 +15340,7 @@ TraceRecorder::record_JSOP_LAMBDA()
|
||||
RETURN_STOP_A("Unable to trace creating lambda in let");
|
||||
|
||||
LIns *proto_ins;
|
||||
CHECK_STATUS_A(getClassPrototype(JSProto_Function, proto_ins));
|
||||
CHECK_STATUS_A(getFunctionPrototype(proto_ins));
|
||||
LIns* scopeChain_ins = scopeChain();
|
||||
JS_ASSERT(scopeChain_ins);
|
||||
LIns* args[] = { proto_ins, scopeChain_ins, w.nameImmpNonGC(fun), cx_ins };
|
||||
@ -15466,7 +15511,7 @@ TraceRecorder::record_DefLocalFunSetSlot(uint32 slot, JSObject* obj)
|
||||
|
||||
if (fun->isNullClosure() && fun->getParent() == globalObj) {
|
||||
LIns *proto_ins;
|
||||
CHECK_STATUS_A(getClassPrototype(JSProto_Function, proto_ins));
|
||||
CHECK_STATUS_A(getFunctionPrototype(proto_ins));
|
||||
|
||||
LIns* args[] = { w.immpObjGC(globalObj), proto_ins, w.immpFunGC(fun), cx_ins };
|
||||
LIns* x = w.call(&js_NewNullClosure_ci, args);
|
||||
@ -15589,7 +15634,7 @@ TraceRecorder::record_JSOP_REGEXP()
|
||||
unsigned index = atoms - script->atoms + GET_INDEX(cx->regs().pc);
|
||||
|
||||
LIns* proto_ins;
|
||||
CHECK_STATUS_A(getClassPrototype(JSProto_RegExp, proto_ins));
|
||||
CHECK_STATUS_A(getRegExpPrototype(proto_ins));
|
||||
|
||||
LIns* args[] = {
|
||||
proto_ins,
|
||||
|
@ -1489,10 +1489,14 @@ class TraceRecorder
|
||||
unsigned *depthp);
|
||||
JS_REQUIRES_STACK nanojit::LIns* guardArgsLengthNotAssigned(nanojit::LIns* argsobj_ins);
|
||||
JS_REQUIRES_STACK void guardNotHole(nanojit::LIns* argsobj_ins, nanojit::LIns* ids_ins);
|
||||
|
||||
JS_REQUIRES_STACK RecordingStatus getClassPrototype(JSObject* ctor,
|
||||
nanojit::LIns*& proto_ins);
|
||||
JS_REQUIRES_STACK RecordingStatus getClassPrototype(JSProtoKey key,
|
||||
nanojit::LIns*& proto_ins);
|
||||
JS_REQUIRES_STACK RecordingStatus getObjectPrototype(nanojit::LIns*& proto_ins);
|
||||
JS_REQUIRES_STACK RecordingStatus getFunctionPrototype(nanojit::LIns*& proto_ins);
|
||||
JS_REQUIRES_STACK RecordingStatus getArrayPrototype(nanojit::LIns*& proto_ins);
|
||||
JS_REQUIRES_STACK RecordingStatus getRegExpPrototype(nanojit::LIns*& proto_ins);
|
||||
|
||||
JS_REQUIRES_STACK RecordingStatus newArray(JSObject* ctor, uint32 argc, Value* argv,
|
||||
Value* rval);
|
||||
JS_REQUIRES_STACK RecordingStatus newString(JSObject* ctor, uint32 argc, Value* argv,
|
||||
|
@ -41,6 +41,7 @@
|
||||
#ifndef GlobalObject_h___
|
||||
#define GlobalObject_h___
|
||||
|
||||
#include "jsarray.h"
|
||||
#include "jsbool.h"
|
||||
#include "jsfun.h"
|
||||
#include "jsiter.h"
|
||||
@ -186,6 +187,10 @@ class GlobalObject : public ::JSObject {
|
||||
return inited;
|
||||
}
|
||||
|
||||
bool arrayClassInitialized() const {
|
||||
return classIsInitialized(JSProto_Array);
|
||||
}
|
||||
|
||||
bool booleanClassInitialized() const {
|
||||
return classIsInitialized(JSProto_Boolean);
|
||||
}
|
||||
@ -244,6 +249,14 @@ class GlobalObject : public ::JSObject {
|
||||
return &getPrototype(JSProto_Function).toObject();
|
||||
}
|
||||
|
||||
JSObject *getOrCreateArrayPrototype(JSContext *cx) {
|
||||
if (!arrayClassInitialized()) {
|
||||
if (!js_InitArrayClass(cx, this))
|
||||
return NULL;
|
||||
}
|
||||
return &getPrototype(JSProto_Array).toObject();
|
||||
}
|
||||
|
||||
JSObject *getOrCreateBooleanPrototype(JSContext *cx) {
|
||||
if (!booleanClassInitialized()) {
|
||||
if (!js_InitBooleanClass(cx, this))
|
||||
|
Loading…
Reference in New Issue
Block a user