mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 739512: Patch 4: move JS{Const,Object,TryNote}Array into the |js| namespace. r=sfink.
This commit is contained in:
parent
0449d38c5c
commit
2a519582cb
@ -113,7 +113,7 @@ DefineGlobals(JSContext *cx, GlobalScope &globalScope, JSScript* script)
|
||||
worklist.popBack();
|
||||
|
||||
if (outer->hasObjects()) {
|
||||
JSObjectArray *arr = outer->objects();
|
||||
ObjectArray *arr = outer->objects();
|
||||
|
||||
/*
|
||||
* If this is an eval script, don't treat the saved caller function
|
||||
|
@ -6982,7 +6982,7 @@ NewTryNote(JSContext *cx, BytecodeEmitter *bce, JSTryNoteKind kind, unsigned sta
|
||||
}
|
||||
|
||||
void
|
||||
frontend::FinishTakingTryNotes(BytecodeEmitter *bce, JSTryNoteArray *array)
|
||||
frontend::FinishTakingTryNotes(BytecodeEmitter *bce, TryNoteArray *array)
|
||||
{
|
||||
TryNode *tryNode;
|
||||
JSTryNote *tn;
|
||||
@ -7048,7 +7048,7 @@ CGObjectList::index(ObjectBox *objbox)
|
||||
}
|
||||
|
||||
void
|
||||
CGObjectList::finish(JSObjectArray *array)
|
||||
CGObjectList::finish(ObjectArray *array)
|
||||
{
|
||||
JS_ASSERT(length <= INDEX_LIMIT);
|
||||
JS_ASSERT(length == array->length);
|
||||
@ -7064,7 +7064,7 @@ CGObjectList::finish(JSObjectArray *array)
|
||||
}
|
||||
|
||||
void
|
||||
GCConstList::finish(JSConstArray *array)
|
||||
GCConstList::finish(ConstArray *array)
|
||||
{
|
||||
JS_ASSERT(array->length == list.length());
|
||||
Value *src = list.begin(), *srcend = list.end();
|
||||
|
@ -537,7 +537,7 @@ struct CGObjectList {
|
||||
CGObjectList() : length(0), lastbox(NULL) {}
|
||||
|
||||
unsigned index(ObjectBox *objbox);
|
||||
void finish(JSObjectArray *array);
|
||||
void finish(ObjectArray *array);
|
||||
};
|
||||
|
||||
class GCConstList {
|
||||
@ -546,7 +546,7 @@ class GCConstList {
|
||||
GCConstList(JSContext *cx) : list(cx) {}
|
||||
bool append(Value v) { return list.append(v); }
|
||||
size_t length() const { return list.length(); }
|
||||
void finish(JSConstArray *array);
|
||||
void finish(ConstArray *array);
|
||||
};
|
||||
|
||||
struct GlobalScope {
|
||||
@ -1004,7 +1004,7 @@ JSBool
|
||||
FinishTakingSrcNotes(JSContext *cx, BytecodeEmitter *bce, jssrcnote *notes);
|
||||
|
||||
void
|
||||
FinishTakingTryNotes(BytecodeEmitter *bce, JSTryNoteArray *array);
|
||||
FinishTakingTryNotes(BytecodeEmitter *bce, TryNoteArray *array);
|
||||
|
||||
} /* namespace frontend */
|
||||
|
||||
|
@ -1000,7 +1000,7 @@ JS_GetScriptTotalSize(JSContext *cx, JSScript *script)
|
||||
{
|
||||
size_t nbytes, pbytes;
|
||||
jssrcnote *sn, *notes;
|
||||
JSObjectArray *objarray;
|
||||
ObjectArray *objarray;
|
||||
JSPrincipals *principals;
|
||||
|
||||
nbytes = sizeof *script;
|
||||
@ -1035,10 +1035,8 @@ JS_GetScriptTotalSize(JSContext *cx, JSScript *script)
|
||||
} while (i != 0);
|
||||
}
|
||||
|
||||
if (script->hasTrynotes()) {
|
||||
nbytes += sizeof(JSTryNoteArray) +
|
||||
script->trynotes()->length * sizeof(JSTryNote);
|
||||
}
|
||||
if (script->hasTrynotes())
|
||||
nbytes += sizeof(TryNoteArray) + script->trynotes()->length * sizeof(JSTryNote);
|
||||
|
||||
principals = script->principals;
|
||||
if (principals) {
|
||||
|
@ -526,7 +526,7 @@ js_Disassemble1(JSContext *cx, JSScript *script, jsbytecode *pc,
|
||||
// with an offset. This simplifies code coverage analysis
|
||||
// based on this disassembled output.
|
||||
if (op == JSOP_TRY) {
|
||||
JSTryNoteArray *trynotes = script->trynotes();
|
||||
TryNoteArray *trynotes = script->trynotes();
|
||||
uint32_t i;
|
||||
for(i = 0; i < trynotes->length; i++) {
|
||||
JSTryNote note = trynotes->vector[i];
|
||||
|
@ -1031,10 +1031,10 @@ js::FreeScriptFilenames(JSCompartment *comp)
|
||||
*
|
||||
* Array type Array elements Offset Accessor
|
||||
* ---------- -------------- ------ --------
|
||||
* JSConstArray Consts constsOffset consts()
|
||||
* JSObjectArray Objects objectsOffset objects()
|
||||
* JSObjectArray Regexps regexpsOffset regexps()
|
||||
* JSTryNoteArray Try notes tryNotesOffset trynotes()
|
||||
* ConstArray Consts constsOffset consts()
|
||||
* ObjectArray Objects objectsOffset objects()
|
||||
* ObjectArray Regexps regexpsOffset regexps()
|
||||
* TryNoteArray Try notes tryNotesOffset trynotes()
|
||||
* GlobalSlotArray Globals globalsOffset globals()
|
||||
* ClosedSlotArray ClosedArgs closedArgsOffset closedArgs()
|
||||
* ClosedSlotArray ClosedVars closedVarsOffset closedVars()
|
||||
@ -1087,9 +1087,9 @@ js::FreeScriptFilenames(JSCompartment *comp)
|
||||
* jsval-aligned. (There is an assumption that |data| itself is jsval-aligned;
|
||||
* we check this below).
|
||||
*/
|
||||
JS_STATIC_ASSERT(KEEPS_JSVAL_ALIGNMENT(JSConstArray));
|
||||
JS_STATIC_ASSERT(KEEPS_JSVAL_ALIGNMENT(JSObjectArray)); /* there are two of these */
|
||||
JS_STATIC_ASSERT(KEEPS_JSVAL_ALIGNMENT(JSTryNoteArray));
|
||||
JS_STATIC_ASSERT(KEEPS_JSVAL_ALIGNMENT(ConstArray));
|
||||
JS_STATIC_ASSERT(KEEPS_JSVAL_ALIGNMENT(ObjectArray)); /* there are two of these */
|
||||
JS_STATIC_ASSERT(KEEPS_JSVAL_ALIGNMENT(TryNoteArray));
|
||||
JS_STATIC_ASSERT(KEEPS_JSVAL_ALIGNMENT(GlobalSlotArray));
|
||||
JS_STATIC_ASSERT(KEEPS_JSVAL_ALIGNMENT(ClosedSlotArray)); /* there are two of these */
|
||||
|
||||
@ -1111,12 +1111,12 @@ JS_STATIC_ASSERT(NO_PADDING_BETWEEN_ENTRIES(jsbytecode, jssrcnote));
|
||||
* closedVars array -- the last optional array -- still fits in 1 byte and does
|
||||
* not coincide with INVALID_OFFSET.
|
||||
*/
|
||||
JS_STATIC_ASSERT(sizeof(JSConstArray) +
|
||||
sizeof(JSObjectArray) +
|
||||
sizeof(JSObjectArray) +
|
||||
sizeof(JSTryNoteArray) +
|
||||
sizeof(js::GlobalSlotArray) +
|
||||
sizeof(js::ClosedSlotArray)
|
||||
JS_STATIC_ASSERT(sizeof(ConstArray) +
|
||||
sizeof(ObjectArray) +
|
||||
sizeof(ObjectArray) +
|
||||
sizeof(TryNoteArray) +
|
||||
sizeof(GlobalSlotArray) +
|
||||
sizeof(ClosedSlotArray)
|
||||
< JSScript::INVALID_OFFSET);
|
||||
JS_STATIC_ASSERT(JSScript::INVALID_OFFSET <= 255);
|
||||
|
||||
@ -1129,14 +1129,14 @@ JSScript::NewScript(JSContext *cx, uint32_t length, uint32_t nsrcnotes, uint32_t
|
||||
size_t size = 0;
|
||||
|
||||
if (nconsts != 0)
|
||||
size += sizeof(JSConstArray) + nconsts * sizeof(Value);
|
||||
size += sizeof(ConstArray) + nconsts * sizeof(Value);
|
||||
size += sizeof(JSAtom *) * natoms;
|
||||
if (nobjects != 0)
|
||||
size += sizeof(JSObjectArray) + nobjects * sizeof(JSObject *);
|
||||
size += sizeof(ObjectArray) + nobjects * sizeof(JSObject *);
|
||||
if (nregexps != 0)
|
||||
size += sizeof(JSObjectArray) + nregexps * sizeof(JSObject *);
|
||||
size += sizeof(ObjectArray) + nregexps * sizeof(JSObject *);
|
||||
if (ntrynotes != 0)
|
||||
size += sizeof(JSTryNoteArray) + ntrynotes * sizeof(JSTryNote);
|
||||
size += sizeof(TryNoteArray) + ntrynotes * sizeof(JSTryNote);
|
||||
if (nglobals != 0)
|
||||
size += sizeof(GlobalSlotArray) + nglobals * sizeof(GlobalSlotArray::Entry);
|
||||
if (nClosedArgs != 0)
|
||||
@ -1171,25 +1171,25 @@ JSScript::NewScript(JSContext *cx, uint32_t length, uint32_t nsrcnotes, uint32_t
|
||||
uint8_t *cursor = data;
|
||||
if (nconsts != 0) {
|
||||
script->constsOffset = uint8_t(cursor - data);
|
||||
cursor += sizeof(JSConstArray);
|
||||
cursor += sizeof(ConstArray);
|
||||
} else {
|
||||
script->constsOffset = JSScript::INVALID_OFFSET;
|
||||
}
|
||||
if (nobjects != 0) {
|
||||
script->objectsOffset = uint8_t(cursor - data);
|
||||
cursor += sizeof(JSObjectArray);
|
||||
cursor += sizeof(ObjectArray);
|
||||
} else {
|
||||
script->objectsOffset = JSScript::INVALID_OFFSET;
|
||||
}
|
||||
if (nregexps != 0) {
|
||||
script->regexpsOffset = uint8_t(cursor - data);
|
||||
cursor += sizeof(JSObjectArray);
|
||||
cursor += sizeof(ObjectArray);
|
||||
} else {
|
||||
script->regexpsOffset = JSScript::INVALID_OFFSET;
|
||||
}
|
||||
if (ntrynotes != 0) {
|
||||
script->trynotesOffset = uint8_t(cursor - data);
|
||||
cursor += sizeof(JSTryNoteArray);
|
||||
cursor += sizeof(TryNoteArray);
|
||||
} else {
|
||||
script->trynotesOffset = JSScript::INVALID_OFFSET;
|
||||
}
|
||||
@ -1994,17 +1994,17 @@ JSScript::markChildren(JSTracer *trc)
|
||||
}
|
||||
|
||||
if (hasObjects()) {
|
||||
JSObjectArray *objarray = objects();
|
||||
ObjectArray *objarray = objects();
|
||||
MarkObjectRange(trc, objarray->length, objarray->vector, "objects");
|
||||
}
|
||||
|
||||
if (hasRegexps()) {
|
||||
JSObjectArray *objarray = regexps();
|
||||
ObjectArray *objarray = regexps();
|
||||
MarkObjectRange(trc, objarray->length, objarray->vector, "objects");
|
||||
}
|
||||
|
||||
if (hasConsts()) {
|
||||
JSConstArray *constarray = consts();
|
||||
ConstArray *constarray = consts();
|
||||
MarkValueRange(trc, constarray->length, constarray->vector, "consts");
|
||||
}
|
||||
|
||||
|
@ -75,22 +75,22 @@ struct JSTryNote {
|
||||
uint32_t length; /* length of the try statement or for-in loop */
|
||||
};
|
||||
|
||||
typedef struct JSTryNoteArray {
|
||||
JSTryNote *vector; /* array of indexed try notes */
|
||||
uint32_t length; /* count of indexed try notes */
|
||||
} JSTryNoteArray;
|
||||
namespace js {
|
||||
|
||||
typedef struct JSObjectArray {
|
||||
js::HeapPtrObject *vector; /* array of indexed objects */
|
||||
uint32_t length; /* count of indexed objects */
|
||||
} JSObjectArray;
|
||||
|
||||
typedef struct JSConstArray {
|
||||
struct ConstArray {
|
||||
js::HeapValue *vector; /* array of indexed constant values */
|
||||
uint32_t length;
|
||||
} JSConstArray;
|
||||
};
|
||||
|
||||
namespace js {
|
||||
struct ObjectArray {
|
||||
js::HeapPtrObject *vector; /* array of indexed objects */
|
||||
uint32_t length; /* count of indexed objects */
|
||||
};
|
||||
|
||||
struct TryNoteArray {
|
||||
JSTryNote *vector; /* array of indexed try notes */
|
||||
uint32_t length; /* count of indexed try notes */
|
||||
};
|
||||
|
||||
struct GlobalSlotArray {
|
||||
struct Entry {
|
||||
@ -273,7 +273,7 @@ class Bindings
|
||||
} /* namespace js */
|
||||
|
||||
#define JS_OBJECT_ARRAY_SIZE(length) \
|
||||
(offsetof(JSObjectArray, vector) + sizeof(JSObject *) * (length))
|
||||
(offsetof(ObjectArray, vector) + sizeof(JSObject *) * (length))
|
||||
|
||||
#ifdef JS_METHODJIT
|
||||
namespace JSC {
|
||||
@ -744,24 +744,24 @@ struct JSScript : public js::gc::Cell
|
||||
bool hasClosedArgs() { return isValidOffset(closedArgsOffset); }
|
||||
bool hasClosedVars() { return isValidOffset(closedVarsOffset); }
|
||||
|
||||
JSConstArray *consts() {
|
||||
js::ConstArray *consts() {
|
||||
JS_ASSERT(hasConsts());
|
||||
return reinterpret_cast<JSConstArray *>(data + constsOffset);
|
||||
return reinterpret_cast<js::ConstArray *>(data + constsOffset);
|
||||
}
|
||||
|
||||
JSObjectArray *objects() {
|
||||
js::ObjectArray *objects() {
|
||||
JS_ASSERT(hasObjects());
|
||||
return reinterpret_cast<JSObjectArray *>(data + objectsOffset);
|
||||
return reinterpret_cast<js::ObjectArray *>(data + objectsOffset);
|
||||
}
|
||||
|
||||
JSObjectArray *regexps() {
|
||||
js::ObjectArray *regexps() {
|
||||
JS_ASSERT(hasRegexps());
|
||||
return reinterpret_cast<JSObjectArray *>(data + regexpsOffset);
|
||||
return reinterpret_cast<js::ObjectArray *>(data + regexpsOffset);
|
||||
}
|
||||
|
||||
JSTryNoteArray *trynotes() {
|
||||
js::TryNoteArray *trynotes() {
|
||||
JS_ASSERT(hasTrynotes());
|
||||
return reinterpret_cast<JSTryNoteArray *>(data + trynotesOffset);
|
||||
return reinterpret_cast<js::TryNoteArray *>(data + trynotesOffset);
|
||||
}
|
||||
|
||||
js::GlobalSlotArray *globals() {
|
||||
@ -797,7 +797,7 @@ struct JSScript : public js::gc::Cell
|
||||
}
|
||||
|
||||
JSObject *getObject(size_t index) {
|
||||
JSObjectArray *arr = objects();
|
||||
js::ObjectArray *arr = objects();
|
||||
JS_ASSERT(index < arr->length);
|
||||
return arr->vector[index];
|
||||
}
|
||||
@ -812,7 +812,7 @@ struct JSScript : public js::gc::Cell
|
||||
inline JSObject *getRegExp(size_t index);
|
||||
|
||||
const js::Value &getConst(size_t index) {
|
||||
JSConstArray *arr = consts();
|
||||
js::ConstArray *arr = consts();
|
||||
JS_ASSERT(index < arr->length);
|
||||
return arr->vector[index];
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ JSScript::getCallerFunction()
|
||||
inline JSObject *
|
||||
JSScript::getRegExp(size_t index)
|
||||
{
|
||||
JSObjectArray *arr = regexps();
|
||||
js::ObjectArray *arr = regexps();
|
||||
JS_ASSERT(uint32_t(index) < arr->length);
|
||||
JSObject *obj = arr->vector[index];
|
||||
JS_ASSERT(obj->isRegExp());
|
||||
|
@ -1706,7 +1706,7 @@ DisassembleScript(JSContext *cx, JSScript *script, JSFunction *fun, bool lines,
|
||||
TryNotes(cx, script, sp);
|
||||
|
||||
if (recursive && script->hasObjects()) {
|
||||
JSObjectArray *objects = script->objects();
|
||||
ObjectArray *objects = script->objects();
|
||||
for (unsigned i = 0; i != objects->length; ++i) {
|
||||
JSObject *obj = objects->vector[i];
|
||||
if (obj->isFunction()) {
|
||||
|
@ -2537,7 +2537,7 @@ DebuggerScript_getChildScripts(JSContext *cx, unsigned argc, Value *vp)
|
||||
* and the calling function is stored as script->objects()->vector[0].
|
||||
* It is not really a child script of this script, so skip it.
|
||||
*/
|
||||
JSObjectArray *objects = script->objects();
|
||||
ObjectArray *objects = script->objects();
|
||||
for (uint32_t i = script->savedCallerFun ? 1 : 0; i < objects->length; i++) {
|
||||
JSObject *obj = objects->vector[i];
|
||||
if (obj->isFunction()) {
|
||||
|
@ -878,7 +878,7 @@ Class js::BlockClass = {
|
||||
#define NO_PARENT_INDEX UINT32_MAX
|
||||
|
||||
static uint32_t
|
||||
FindObjectIndex(JSObjectArray *array, JSObject *obj)
|
||||
FindObjectIndex(ObjectArray *array, JSObject *obj)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user