mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 660734, part 1 - s/ContextAllocPolicy/TempAllocPolicy/ since it doesn't call cx->malloc_ (r=igor)
--HG-- extra : rebase_source : 7ea0d6a7ed86a9c561efdd2d7b93623ea37c5b90
This commit is contained in:
parent
973ee9f2df
commit
721022b341
@ -42,13 +42,13 @@
|
||||
namespace js {
|
||||
|
||||
void *
|
||||
ContextAllocPolicy::onOutOfMemory(void *p, size_t nbytes)
|
||||
TempAllocPolicy::onOutOfMemory(void *p, size_t nbytes)
|
||||
{
|
||||
return cx->runtime->onOutOfMemory(p, nbytes, cx);
|
||||
}
|
||||
|
||||
void
|
||||
ContextAllocPolicy::reportAllocOverflow() const
|
||||
TempAllocPolicy::reportAllocOverflow() const
|
||||
{
|
||||
js_ReportAllocationOverflow(cx);
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ class SystemAllocPolicy
|
||||
* FIXME bug 647103 - rewrite this in terms of temporary allocation functions,
|
||||
* not the system ones.
|
||||
*/
|
||||
class ContextAllocPolicy
|
||||
class TempAllocPolicy
|
||||
{
|
||||
JSContext *const cx;
|
||||
|
||||
@ -90,7 +90,7 @@ class ContextAllocPolicy
|
||||
JS_FRIEND_API(void *) onOutOfMemory(void *p, size_t nbytes);
|
||||
|
||||
public:
|
||||
ContextAllocPolicy(JSContext *cx) : cx(cx) {}
|
||||
TempAllocPolicy(JSContext *cx) : cx(cx) {}
|
||||
|
||||
JSContext *context() const {
|
||||
return cx;
|
||||
|
@ -117,9 +117,9 @@ JSCodeGenerator::JSCodeGenerator(Parser *parser,
|
||||
emitLevel(0),
|
||||
constMap(parser->context),
|
||||
constList(parser->context),
|
||||
globalUses(ContextAllocPolicy(parser->context)),
|
||||
closedArgs(ContextAllocPolicy(parser->context)),
|
||||
closedVars(ContextAllocPolicy(parser->context)),
|
||||
globalUses(parser->context),
|
||||
closedArgs(parser->context),
|
||||
closedVars(parser->context),
|
||||
traceIndex(0)
|
||||
{
|
||||
flags = TCF_COMPILING;
|
||||
|
@ -645,13 +645,13 @@ struct JSCodeGenerator : public JSTreeContext
|
||||
JSAtomList upvarList; /* map of atoms to upvar indexes */
|
||||
JSUpvarArray upvarMap; /* indexed upvar pairs (JS_realloc'ed) */
|
||||
|
||||
typedef js::Vector<js::GlobalSlotArray::Entry, 16, js::ContextAllocPolicy> GlobalUseVector;
|
||||
typedef js::Vector<js::GlobalSlotArray::Entry, 16> GlobalUseVector;
|
||||
|
||||
GlobalUseVector globalUses; /* per-script global uses */
|
||||
JSAtomList globalMap; /* per-script map of global name to globalUses vector */
|
||||
|
||||
/* Vectors of pn_cookie slot values. */
|
||||
typedef js::Vector<uint32, 8, js::ContextAllocPolicy> SlotVector;
|
||||
typedef js::Vector<uint32, 8> SlotVector;
|
||||
SlotVector closedArgs;
|
||||
SlotVector closedVars;
|
||||
|
||||
|
@ -808,7 +808,7 @@ struct DefaultHasher<T *>: PointerHasher<T *, tl::FloorLog2<sizeof(void *)>::res
|
||||
* HashPolicy requirements:
|
||||
* - see "Hash policy" above (default js::DefaultHasher<Key>)
|
||||
* AllocPolicy:
|
||||
* - see "Allocation policies" in jsalloc.h (default js::ContextAllocPolicy)
|
||||
* - see "Allocation policies" in jsalloc.h
|
||||
*
|
||||
* N.B: HashMap is not reentrant: Key/Value/HashPolicy/AllocPolicy members
|
||||
* called by HashMap must not call back into the same HashMap object.
|
||||
@ -1041,7 +1041,7 @@ class HashMap
|
||||
* HashPolicy requirements:
|
||||
* - see "Hash policy" above (default js::DefaultHasher<Key>)
|
||||
* AllocPolicy:
|
||||
* - see "Allocation policies" in jsalloc.h (default js::ContextAllocPolicy)
|
||||
* - see "Allocation policies" in jsalloc.h
|
||||
*
|
||||
* N.B: HashSet is not reentrant: T/HashPolicy/AllocPolicy members called by
|
||||
* HashSet must not call back into the same HashSet object.
|
||||
|
@ -155,7 +155,7 @@ struct IdHashPolicy {
|
||||
}
|
||||
};
|
||||
|
||||
typedef HashSet<jsid, IdHashPolicy, ContextAllocPolicy> IdSet;
|
||||
typedef HashSet<jsid, IdHashPolicy> IdSet;
|
||||
|
||||
static inline bool
|
||||
NewKeyValuePair(JSContext *cx, jsid id, const Value &val, Value *rval)
|
||||
|
@ -1209,7 +1209,7 @@ Compiler::defineGlobals(JSContext *cx, GlobalScope &globalScope, JSScript *scrip
|
||||
def.knownSlot = shape->slot;
|
||||
}
|
||||
|
||||
js::Vector<JSScript *, 16, ContextAllocPolicy> worklist(cx);
|
||||
js::Vector<JSScript *, 16> worklist(cx);
|
||||
if (!worklist.append(script))
|
||||
return false;
|
||||
|
||||
|
@ -158,12 +158,11 @@ struct Token;
|
||||
struct TokenPos;
|
||||
struct TokenPtr;
|
||||
|
||||
class ContextAllocPolicy;
|
||||
class SystemAllocPolicy;
|
||||
class TempAllocPolicy;
|
||||
|
||||
template <class T,
|
||||
size_t MinInlineCapacity = 0,
|
||||
class AllocPolicy = ContextAllocPolicy>
|
||||
class AllocPolicy = TempAllocPolicy>
|
||||
class Vector;
|
||||
|
||||
template <class>
|
||||
@ -172,12 +171,12 @@ struct DefaultHasher;
|
||||
template <class Key,
|
||||
class Value,
|
||||
class HashPolicy = DefaultHasher<Key>,
|
||||
class AllocPolicy = ContextAllocPolicy>
|
||||
class AllocPolicy = TempAllocPolicy>
|
||||
class HashMap;
|
||||
|
||||
template <class T,
|
||||
class HashPolicy = DefaultHasher<T>,
|
||||
class AllocPolicy = ContextAllocPolicy>
|
||||
class AllocPolicy = TempAllocPolicy>
|
||||
class HashSet;
|
||||
|
||||
class PropertyCache;
|
||||
|
@ -182,7 +182,7 @@ struct VectorImpl<T, N, AP, true>
|
||||
* N requirements:
|
||||
* - any value, however, N is clamped to min/max values
|
||||
* AllocPolicy:
|
||||
* - see "Allocation policies" in jsalloc.h (default js::ContextAllocPolicy)
|
||||
* - see "Allocation policies" in jsalloc.h (default js::TempAllocPolicy)
|
||||
*
|
||||
* N.B: Vector is not reentrant: T member functions called during Vector member
|
||||
* functions must not call back into the same object.
|
||||
|
@ -57,7 +57,7 @@ using namespace js::mjit;
|
||||
|
||||
|
||||
js::mjit::CompilerAllocPolicy::CompilerAllocPolicy(JSContext *cx, Compiler &compiler)
|
||||
: ContextAllocPolicy(cx),
|
||||
: TempAllocPolicy(cx),
|
||||
oomFlag(&compiler.oomInVector)
|
||||
{
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ class JaegerCompartment {
|
||||
* setting a flag on the compiler when OOM occurs. The compiler is required
|
||||
* to check for OOM only before trying to use the contents of the list.
|
||||
*/
|
||||
class CompilerAllocPolicy : public ContextAllocPolicy
|
||||
class CompilerAllocPolicy : public TempAllocPolicy
|
||||
{
|
||||
bool *oomFlag;
|
||||
|
||||
@ -282,12 +282,12 @@ class CompilerAllocPolicy : public ContextAllocPolicy
|
||||
|
||||
public:
|
||||
CompilerAllocPolicy(JSContext *cx, bool *oomFlag)
|
||||
: ContextAllocPolicy(cx), oomFlag(oomFlag) {}
|
||||
: TempAllocPolicy(cx), oomFlag(oomFlag) {}
|
||||
CompilerAllocPolicy(JSContext *cx, Compiler &compiler);
|
||||
|
||||
void *malloc_(size_t bytes) { return checkAlloc(ContextAllocPolicy::malloc_(bytes)); }
|
||||
void *malloc_(size_t bytes) { return checkAlloc(TempAllocPolicy::malloc_(bytes)); }
|
||||
void *realloc_(void *p, size_t oldBytes, size_t bytes) {
|
||||
return checkAlloc(ContextAllocPolicy::realloc_(p, oldBytes, bytes));
|
||||
return checkAlloc(TempAllocPolicy::realloc_(p, oldBytes, bytes));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1160,7 +1160,7 @@ class GetPropCompiler : public PICStubCompiler
|
||||
class ScopeNameCompiler : public PICStubCompiler
|
||||
{
|
||||
private:
|
||||
typedef Vector<Jump, 8, ContextAllocPolicy> JumpList;
|
||||
typedef Vector<Jump, 8> JumpList;
|
||||
|
||||
JSObject *scopeChain;
|
||||
JSAtom *atom;
|
||||
@ -1371,7 +1371,7 @@ class ScopeNameCompiler : public PICStubCompiler
|
||||
LookupStatus generateCallStub(JSObject *obj)
|
||||
{
|
||||
Assembler masm;
|
||||
Vector<Jump, 8, ContextAllocPolicy> fails(cx);
|
||||
Vector<Jump, 8> fails(cx);
|
||||
ScopeNameLabels &labels = pic.scopeNameLabels();
|
||||
|
||||
/* For GETXPROP, the object is already in objReg. */
|
||||
@ -1605,7 +1605,7 @@ class BindNameCompiler : public PICStubCompiler
|
||||
LookupStatus generateStub(JSObject *obj)
|
||||
{
|
||||
Assembler masm;
|
||||
js::Vector<Jump, 8, ContextAllocPolicy> fails(cx);
|
||||
Vector<Jump, 8> fails(cx);
|
||||
|
||||
BindNameLabels &labels = pic.bindNameLabels();
|
||||
|
||||
|
@ -1052,7 +1052,7 @@ ResolveRelativePath(JSContext *cx, const char *base, JSString *filename)
|
||||
return filename;
|
||||
|
||||
// Otherwise return base[:dirLen + 1] + filename.
|
||||
js::Vector<jschar, 0, js::ContextAllocPolicy> result(cx);
|
||||
js::Vector<jschar, 0> result(cx);
|
||||
size_t nchars;
|
||||
if (!JS_DecodeBytes(cx, base, dirLen + 1, NULL, &nchars))
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user