зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset eb9e244e3834 (bug 1227535) for static build bustage in ModuleObject.h CLOSED TREE
--HG-- extra : commitid : 27dFKkZdEs4
This commit is contained in:
Родитель
e379214094
Коммит
b40b9c497b
|
@ -219,11 +219,6 @@ IndirectBindingMap::Binding::Binding(ModuleEnvironmentObject* environment, Shape
|
|||
: environment(environment), shape(shape)
|
||||
{}
|
||||
|
||||
IndirectBindingMap::IndirectBindingMap(Zone* zone)
|
||||
: map_(ZoneAllocPolicy(zone))
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
IndirectBindingMap::init()
|
||||
{
|
||||
|
@ -588,8 +583,7 @@ ModuleObject::create(ExclusiveContext* cx, HandleObject enclosingStaticScope)
|
|||
|
||||
self->initReservedSlot(StaticScopeSlot, ObjectOrNullValue(enclosingStaticScope));
|
||||
|
||||
Zone* zone = cx->zone();
|
||||
IndirectBindingMap* bindings = zone->new_<IndirectBindingMap>(zone);
|
||||
IndirectBindingMap* bindings = cx->new_<IndirectBindingMap>();
|
||||
if (!bindings || !bindings->init()) {
|
||||
ReportOutOfMemory(cx);
|
||||
return nullptr;
|
||||
|
@ -597,11 +591,9 @@ ModuleObject::create(ExclusiveContext* cx, HandleObject enclosingStaticScope)
|
|||
|
||||
self->initReservedSlot(ImportBindingsSlot, PrivateValue(bindings));
|
||||
|
||||
FunctionDeclarationVector* funDecls = zone->new_<FunctionDeclarationVector>(zone);
|
||||
if (!funDecls) {
|
||||
ReportOutOfMemory(cx);
|
||||
FunctionDeclarationVector* funDecls = cx->new_<FunctionDeclarationVector>(cx);
|
||||
if (!funDecls)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
self->initReservedSlot(FunctionDeclarationsSlot, PrivateValue(funDecls));
|
||||
return self;
|
||||
|
@ -834,8 +826,7 @@ ModuleObject::createNamespace(JSContext* cx, HandleModuleObject self, HandleArra
|
|||
if (!ns)
|
||||
return nullptr;
|
||||
|
||||
Zone* zone = cx->zone();
|
||||
IndirectBindingMap* bindings = zone->new_<IndirectBindingMap>(zone);
|
||||
IndirectBindingMap* bindings = cx->new_<IndirectBindingMap>();
|
||||
if (!bindings || !bindings->init()) {
|
||||
ReportOutOfMemory(cx);
|
||||
return nullptr;
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
#include "jsapi.h"
|
||||
#include "jsatom.h"
|
||||
|
||||
#include "gc/Zone.h"
|
||||
|
||||
#include "js/TraceableVector.h"
|
||||
|
||||
#include "vm/NativeObject.h"
|
||||
|
@ -86,7 +84,6 @@ typedef Handle<ExportEntryObject*> HandleExportEntryObject;
|
|||
class IndirectBindingMap
|
||||
{
|
||||
public:
|
||||
IndirectBindingMap(Zone* zone);
|
||||
bool init();
|
||||
|
||||
void trace(JSTracer* trc);
|
||||
|
@ -118,7 +115,7 @@ class IndirectBindingMap
|
|||
RelocatablePtrShape shape;
|
||||
};
|
||||
|
||||
typedef HashMap<jsid, Binding, JsidHasher, ZoneAllocPolicy> Map;
|
||||
typedef HashMap<jsid, Binding, JsidHasher, SystemAllocPolicy> Map;
|
||||
|
||||
Map map_;
|
||||
};
|
||||
|
@ -192,7 +189,7 @@ struct FunctionDeclaration
|
|||
RelocatablePtrFunction fun;
|
||||
};
|
||||
|
||||
using FunctionDeclarationVector = TraceableVector<FunctionDeclaration, 0, ZoneAllocPolicy>;
|
||||
using FunctionDeclarationVector = TraceableVector<FunctionDeclaration>;
|
||||
|
||||
class ModuleObject : public NativeObject
|
||||
{
|
||||
|
|
|
@ -144,7 +144,7 @@ struct Zone : public JS::shadow::Zone,
|
|||
void onTooMuchMalloc();
|
||||
|
||||
void* onOutOfMemory(js::AllocFunction allocFunc, size_t nbytes, void* reallocPtr = nullptr) {
|
||||
if (!js::CurrentThreadCanAccessRuntime(runtime_))
|
||||
if (!CurrentThreadCanAccessRuntime(runtime_))
|
||||
return nullptr;
|
||||
return runtimeFromMainThread()->onOutOfMemory(allocFunc, nbytes, reallocPtr);
|
||||
}
|
||||
|
@ -576,62 +576,6 @@ class CompartmentsIterT
|
|||
|
||||
typedef CompartmentsIterT<ZonesIter> CompartmentsIter;
|
||||
|
||||
/*
|
||||
* Allocation policy that uses Zone::pod_malloc and friends, so that memory
|
||||
* pressure is accounted for on the zone. This is suitable for memory associated
|
||||
* with GC things allocated in the zone.
|
||||
*
|
||||
* Since it doesn't hold a JSContext (those may not live long enough), it can't
|
||||
* report out-of-memory conditions itself; the caller must check for OOM and
|
||||
* take the appropriate action.
|
||||
*
|
||||
* FIXME bug 647103 - replace these *AllocPolicy names.
|
||||
*/
|
||||
class ZoneAllocPolicy
|
||||
{
|
||||
Zone* const zone;
|
||||
|
||||
public:
|
||||
MOZ_IMPLICIT ZoneAllocPolicy(Zone* zone) : zone(zone) {}
|
||||
|
||||
template <typename T>
|
||||
T* maybe_pod_malloc(size_t numElems) {
|
||||
return zone->maybe_pod_malloc<T>(numElems);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T* maybe_pod_calloc(size_t numElems) {
|
||||
return zone->maybe_pod_calloc<T>(numElems);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T* maybe_pod_realloc(T* p, size_t oldSize, size_t newSize) {
|
||||
return zone->maybe_pod_realloc<T>(p, oldSize, newSize);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T* pod_malloc(size_t numElems) {
|
||||
return zone->pod_malloc<T>(numElems);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T* pod_calloc(size_t numElems) {
|
||||
return zone->pod_calloc<T>(numElems);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T* pod_realloc(T* p, size_t oldSize, size_t newSize) {
|
||||
return zone->pod_realloc<T>(p, oldSize, newSize);
|
||||
}
|
||||
|
||||
void free_(void* p) { js_free(p); }
|
||||
void reportAllocOverflow() const {}
|
||||
|
||||
bool checkSimulatedOOM() const {
|
||||
return !js::oom::ShouldFailWithOOM();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace js
|
||||
|
||||
#endif // gc_Zone_h
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "jsopcode.h"
|
||||
#include "jstypes.h"
|
||||
|
||||
#include "builtin/ModuleObject.h"
|
||||
#include "gc/Barrier.h"
|
||||
#include "gc/Rooting.h"
|
||||
#include "jit/IonCode.h"
|
||||
|
@ -46,7 +47,6 @@ class BreakpointSite;
|
|||
class BindingIter;
|
||||
class Debugger;
|
||||
class LazyScript;
|
||||
class ModuleObject;
|
||||
class NestedScopeObject;
|
||||
class RegExpObject;
|
||||
struct SourceCompressionTask;
|
||||
|
|
|
@ -21,11 +21,9 @@
|
|||
* - SystemAllocPolicy: No extra functionality over bare allocators.
|
||||
*
|
||||
* - TempAllocPolicy: Adds automatic error reporting to the provided
|
||||
* JSContext when allocations fail.
|
||||
* Context when allocations fail.
|
||||
*
|
||||
* - RuntimeAllocPolicy: Forwards to the JSRuntime MallocProvider.
|
||||
*
|
||||
* - ZoneAllocPolicy: Forwards to the Zone MallocProvider.
|
||||
* - RuntimeAllocPolicy: forwards to the JSRuntime MallocProvider.
|
||||
*
|
||||
* - MallocProvider. A mixin base class that handles automatically updating
|
||||
* the GC's state in response to allocations that are tied to a GC lifetime
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "jsobj.h"
|
||||
#include "jsweakmap.h"
|
||||
|
||||
#include "builtin/ModuleObject.h"
|
||||
#include "gc/Barrier.h"
|
||||
#include "vm/ArgumentsObject.h"
|
||||
#include "vm/ProxyObject.h"
|
||||
|
|
Загрузка…
Ссылка в новой задаче