Back out 11 changesets (bug 1063233 and bug 1063247)

* * *
Backed out changeset 7c7c837585fb (bug 1063233)
* * *
Backed out changeset e584d23b3ce3 (bug 1063233)
* * *
Backed out changeset ee169ca2e00b (bug 1063247)
* * *
Backed out changeset 514c713b2313 (bug 1063247)
* * *
Backed out 3 changesets (bug 1063247)

Backed out changeset a6033944c4c1 (bug 1063247)
Backed out changeset c7ffa64956c6 (bug 1063247)
Backed out changeset dd80b2984fe2 (bug 1063247)
* * *
Backed out 4 changesets (bug 1063233)

Backed out changeset 1f6db27e6240 (bug 1063233)
Backed out changeset b8e3d887faa2 (bug 1063233)
Backed out changeset 8e1913c07322 (bug 1063233)
Backed out changeset 04d42b23a489 (bug 1063233)
This commit is contained in:
Wes Kocher 2014-09-05 17:42:45 -07:00
Родитель f69c1aae22
Коммит cff080e6ec
15 изменённых файлов: 29 добавлений и 144 удалений

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

@ -11,7 +11,6 @@
#include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/Move.h"
#include "jspubtd.h"
@ -250,19 +249,6 @@ class BuilderOrigin : public Builder {
JSObject *unwrap(Object &object) { return unwrapAny(object); }
};
// Finding the size of blocks allocated with malloc
// ------------------------------------------------
//
// Debugger.Memory wants to be able to report how many bytes items in memory are
// consuming. To do this, it needs a function that accepts a pointer to a block,
// and returns the number of bytes allocated to that block. SpiderMonkey itself
// doesn't know which function is appropriate to use, but the embedding does.
// Tell Debuggers in |runtime| to use |mallocSizeOf| to find the size of
// malloc'd blocks.
void SetDebuggerMallocSizeOf(JSRuntime *runtime, mozilla::MallocSizeOf mallocSizeOf);
} // namespace dbg
} // namespace JS

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

@ -10,7 +10,6 @@
#include "mozilla/Alignment.h"
#include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/Move.h"
#include "jspubtd.h"
@ -138,9 +137,15 @@
// Forward declarations of SpiderMonkey's ubi::Node reference types.
namespace js {
class LazyScript;
class Shape;
class BaseShape;
namespace jit {
class JitCode;
}
namespace types {
struct TypeObject;
}
}
@ -187,9 +192,7 @@ class Base {
// Return the size of this node, in bytes. Include any structures that this
// node owns exclusively that are not exposed as their own ubi::Nodes.
// |mallocSizeOf| should be a malloc block sizing function; see
// |mfbt/MemoryReporting.h.
virtual size_t size(mozilla::MallocSizeOf mallocSizeof) const = 0;
virtual size_t size() const = 0;
// Return an EdgeRange that initially contains all the referent's outgoing
// edges. The EdgeRange should be freed with 'js_delete'. (You could use
@ -282,7 +285,7 @@ class Node {
}
// Constructors accepting SpiderMonkey's other generic-pointer-ish types.
Node(JS::HandleValue value);
explicit Node(JS::Value value);
Node(JSGCTraceKind kind, void *ptr);
// copy construction and copy assignment just use memcpy, since we know
@ -332,13 +335,9 @@ class Node {
JS::Value exposeToJS() const;
const jschar *typeName() const { return base()->typeName(); }
size_t size() const { return base()->size(); }
JS::Zone *zone() const { return base()->zone(); }
JSCompartment *compartment() const { return base()->compartment(); }
size_t size(mozilla::MallocSizeOf mallocSizeof) const {
return base()->size(mallocSizeof);
}
EdgeRange *edges(JSContext *cx, bool wantNames = true) const {
return base()->edges(cx, wantNames);
}
@ -434,9 +433,7 @@ class EdgeRange {
template<typename Referent>
class TracerConcrete : public Base {
const jschar *typeName() const MOZ_OVERRIDE { return concreteTypeName; }
size_t size(mozilla::MallocSizeOf mallocSizeof) const MOZ_OVERRIDE {
return 0; // not implemented yet; bug 1011300
}
size_t size() const MOZ_OVERRIDE { return 0; } // not implemented yet; bug 1011300
EdgeRange *edges(JSContext *, bool wantNames) const MOZ_OVERRIDE;
JS::Zone *zone() const MOZ_OVERRIDE { return get().zone(); }
JSCompartment *compartment() const MOZ_OVERRIDE { return nullptr; }
@ -470,13 +467,17 @@ template<> struct Concrete<JSObject> : TracerConcreteWithCompartment<JSObject> {
template<> struct Concrete<JSString> : TracerConcrete<JSString> { };
template<> struct Concrete<JS::Symbol> : TracerConcrete<JS::Symbol> { };
template<> struct Concrete<JSScript> : TracerConcreteWithCompartment<JSScript> { };
template<> struct Concrete<js::LazyScript> : TracerConcrete<js::LazyScript> { };
template<> struct Concrete<js::jit::JitCode> : TracerConcrete<js::jit::JitCode> { };
template<> struct Concrete<js::Shape> : TracerConcreteWithCompartment<js::Shape> { };
template<> struct Concrete<js::BaseShape> : TracerConcreteWithCompartment<js::BaseShape> { };
template<> struct Concrete<js::types::TypeObject> : TracerConcrete<js::types::TypeObject> { };
// The ubi::Node null pointer. Any attempt to operate on a null ubi::Node asserts.
template<>
class Concrete<void> : public Base {
const jschar *typeName() const MOZ_OVERRIDE;
size_t size(mozilla::MallocSizeOf mallocSizeOf) const MOZ_OVERRIDE;
size_t size() const MOZ_OVERRIDE;
EdgeRange *edges(JSContext *cx, bool wantNames) const MOZ_OVERRIDE;
JS::Zone *zone() const MOZ_OVERRIDE;
JSCompartment *compartment() const MOZ_OVERRIDE;

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

@ -1992,19 +1992,6 @@ IsSimdAvailable(JSContext *cx, unsigned argc, Value *vp)
return true;
}
static bool
ByteSize(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
mozilla::MallocSizeOf mallocSizeOf = cx->runtime()->debuggerMallocSizeOf;
JS::ubi::Node node = args.get(0);
if (node)
args.rval().set(NumberValue(node.size(mallocSizeOf)));
else
args.rval().setUndefined();
return true;
}
static const JSFunctionSpecWithHelp TestingFunctions[] = {
JS_FN_HELP("gc", ::GC, 0, 0,
"gc([obj] | 'compartment')",
@ -2325,11 +2312,6 @@ static const JSFunctionSpecWithHelp TestingFunctions[] = {
" options.locals - show local variables in each frame\n"
" options.thisprops - show the properties of the 'this' object of each frame\n"),
JS_FN_HELP("byteSize", ByteSize, 1, 0,
"byteSize(value)",
" Return the size in bytes occupied by |value|, or |undefined| if value\n"
" is not allocated in memory.\n"),
JS_FS_HELP_END
};

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

@ -3914,8 +3914,8 @@ dnl ========================================================
dnl JavaScript shell
dnl ========================================================
AC_CHECK_HEADERS(malloc.h)
AC_CHECK_FUNCS(setlocale localeconv malloc_usable_size)
AC_HAVE_FUNCS(setlocale)
AC_HAVE_FUNCS(localeconv)
AC_SUBST(MOZILLA_VERSION)

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

@ -1047,9 +1047,6 @@ TypeObjectKey::ensureTrackedProperty(JSContext *cx, jsid id)
}
}
template<> const jschar JS::ubi::TracerConcrete<TypeObject>::concreteTypeName[] =
MOZ_UTF16("js::types::TypeObject");
bool
HeapTypeSetKey::instantiate(JSContext *cx)
{

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

@ -21,7 +21,6 @@
#include "gc/Barrier.h"
#include "gc/Marking.h"
#include "jit/IonTypes.h"
#include "js/UbiNode.h"
#include "js/Utility.h"
#include "js/Vector.h"
@ -1724,15 +1723,4 @@ MOZ_NORETURN void TypeFailure(JSContext *cx, const char *fmt, ...);
} /* namespace types */
} /* namespace js */
namespace JS {
namespace ubi {
// JS::ubi::Node can trace TypeObjects using JS_TraceChildren, and TypeObject
// instances don't belong to any particular compartment, so we can use the
// generic JS::ubi::TracerConcrete template for their JS::ubi::Concrete
// specialization.
template<> struct Concrete<js::types::TypeObject> : TracerConcrete<js::types::TypeObject> { };
}
}
#endif /* jsinfer_h */

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

@ -3752,9 +3752,6 @@ LazyScript::staticLevel(JSContext *cx) const
return 1;
}
template<> const jschar JS::ubi::TracerConcrete<LazyScript>::concreteTypeName[] =
MOZ_UTF16("js::LazyScript");
void
JSScript::updateBaselineOrIonRaw()
{

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

@ -22,7 +22,6 @@
#include "gc/Barrier.h"
#include "gc/Rooting.h"
#include "jit/IonCode.h"
#include "js/UbiNode.h"
#include "vm/Shape.h"
namespace JS {
@ -2038,15 +2037,4 @@ NormalizeOriginPrincipals(JSPrincipals *principals, JSPrincipals *originPrincipa
} /* namespace js */
namespace JS {
namespace ubi {
// A LazyScript can be traced with JS_TraceChildren, and belongs to no
// particular compartment, so we can use the generic JS::ubi::TracerConcrete
// template for LazyScript's JS::ubi::Concrete specialization..
template<> struct Concrete<js::LazyScript> : TracerConcrete<js::LazyScript> { };
} // namespace ubi
} // namespace JS
#endif /* jsscript_h */

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

@ -21,9 +21,6 @@
# include <io.h> /* for isatty() */
#endif
#include <locale.h>
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
#include <math.h>
#include <signal.h>
#include <stdio.h>
@ -59,7 +56,6 @@
#include "frontend/Parser.h"
#include "jit/arm/Simulator-arm.h"
#include "jit/Ion.h"
#include "js/Debug.h"
#include "js/OldDebugAPI.h"
#include "js/StructuredClone.h"
#include "perf/jsperf.h"
@ -5999,21 +5995,6 @@ DummyPreserveWrapperCallback(JSContext *cx, JSObject *obj)
return true;
}
size_t
ShellMallocSizeOf(const void *ptr)
{
if (!ptr)
return 0;
#if defined(HAVE_MALLOC_USABLE_SIZE)
return malloc_usable_size((void *) ptr);
#elif defined(HAVE_MALLOC_SIZE)
return malloc_size((void *) ptr);
#else
return 0;
#endif
}
int
main(int argc, char **argv, char **envp)
{
@ -6261,8 +6242,6 @@ main(int argc, char **argv, char **envp)
JS_SetNativeStackQuota(rt, gMaxStackSize);
JS::dbg::SetDebuggerMallocSizeOf(rt, ShellMallocSizeOf);
if (!offThreadState.init())
return 1;

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

@ -15,7 +15,6 @@
#include "jscompartment.h"
#include "gc/Marking.h"
#include "js/Debug.h"
#include "js/UbiNode.h"
#include "js/UbiNodeTraverse.h"
#include "vm/Debugger.h"
@ -250,11 +249,6 @@ DebuggerMemory::setMaxAllocationsLogLength(JSContext *cx, unsigned argc, Value *
/* Debugger.Memory.prototype.takeCensus */
void
JS::dbg::SetDebuggerMallocSizeOf(JSRuntime *rt, mozilla::MallocSizeOf mallocSizeOf) {
rt->debuggerMallocSizeOf = mallocSizeOf;
}
namespace js {
namespace dbg {

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

@ -121,12 +121,6 @@ static const JSWrapObjectCallbacks DefaultWrapObjectCallbacks = {
nullptr
};
static size_t
ReturnZeroSize(const void *p)
{
return 0;
}
JSRuntime::JSRuntime(JSRuntime *parentRuntime)
: JS::shadow::Runtime(
#ifdef JSGC_GENERATIONAL
@ -229,8 +223,7 @@ JSRuntime::JSRuntime(JSRuntime *parentRuntime)
enteredPolicy(nullptr),
#endif
largeAllocationFailureCallback(nullptr),
oomCallback(nullptr),
debuggerMallocSizeOf(ReturnZeroSize)
oomCallback(nullptr)
{
liveRuntimesCount++;

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

@ -1427,12 +1427,6 @@ struct JSRuntime : public JS::shadow::Runtime,
}
return (T *)onOutOfMemoryCanGC(p, newSize * sizeof(T));
}
/*
* Debugger.Memory functions like takeCensus use this embedding-provided
* function to assess the size of malloc'd blocks of memory.
*/
mozilla::MallocSizeOf debuggerMallocSizeOf;
};
namespace js {

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

@ -1438,9 +1438,6 @@ Shape::setObjectFlag(ExclusiveContext *cx, BaseShape::Flag flag, TaggedProto pro
return replaceLastProperty(cx, base, proto, lastRoot);
}
template<> const jschar JS::ubi::TracerConcrete<Shape>::concreteTypeName[] =
MOZ_UTF16("js::Shape");
/* static */ inline HashNumber
StackBaseShape::hash(const StackBaseShape *base)
{
@ -1572,9 +1569,6 @@ BaseShape::finalize(FreeOp *fop)
}
}
template<> const jschar JS::ubi::TracerConcrete<BaseShape>::concreteTypeName[] =
MOZ_UTF16("js::BaseShape");
inline
InitialShapeEntry::InitialShapeEntry() : shape(nullptr), proto(nullptr)
{

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

@ -28,7 +28,6 @@
#include "js/HashTable.h"
#include "js/MemoryMetrics.h"
#include "js/RootingAPI.h"
#include "js/UbiNode.h"
#include "vm/PropDesc.h"
#ifdef _MSC_VER
@ -1456,16 +1455,6 @@ IsImplicitDenseOrTypedArrayElement(Shape *prop)
namespace JS {
template<> class AnchorPermitted<js::Shape *> { };
template<> class AnchorPermitted<const js::Shape *> { };
namespace ubi {
// JS::ubi::Node can trace Shapes and BaseShapes with JS_TraceChildren, and both
// have a 'compartment' method, so we can use the generic
// JS::ubi::TracerConcrete template for their JS::ubi::Concrete specialization.
template<> struct Concrete<js::Shape> : TracerConcreteWithCompartment<js::Shape> { };
template<> struct Concrete<js::BaseShape> : TracerConcreteWithCompartment<js::BaseShape> { };
} // namespace ubi
} // namespace JS
}
#endif /* vm_Shape_h */

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

@ -29,16 +29,11 @@ using JS::ubi::TracerConcrete;
// All operations on null ubi::Nodes crash.
const jschar *Concrete<void>::typeName() const { MOZ_CRASH("null ubi::Node"); }
size_t Concrete<void>::size() const { MOZ_CRASH("null ubi::Node"); }
EdgeRange *Concrete<void>::edges(JSContext *, bool) const { MOZ_CRASH("null ubi::Node"); }
JS::Zone *Concrete<void>::zone() const { MOZ_CRASH("null ubi::Node"); }
JSCompartment *Concrete<void>::compartment() const { MOZ_CRASH("null ubi::Node"); }
size_t
Concrete<void>::size(mozilla::MallocSizeOf mallocSizeof) const
{
MOZ_CRASH("null ubi::Node");
}
Node::Node(JSGCTraceKind kind, void *ptr)
{
switch (kind) {
@ -57,7 +52,7 @@ Node::Node(JSGCTraceKind kind, void *ptr)
}
}
Node::Node(HandleValue value)
Node::Node(Value value)
{
if (value.isObject())
construct(&value.toObject());
@ -235,5 +230,13 @@ template<> const jschar TracerConcrete<JS::Symbol>::concreteTypeName[] =
MOZ_UTF16("JS::Symbol");
template<> const jschar TracerConcrete<JSScript>::concreteTypeName[] =
MOZ_UTF16("JSScript");
template<> const jschar TracerConcrete<js::LazyScript>::concreteTypeName[] =
MOZ_UTF16("js::LazyScript");
template<> const jschar TracerConcrete<js::jit::JitCode>::concreteTypeName[] =
MOZ_UTF16("js::jit::JitCode");
template<> const jschar TracerConcrete<js::Shape>::concreteTypeName[] =
MOZ_UTF16("js::Shape");
template<> const jschar TracerConcrete<js::BaseShape>::concreteTypeName[] =
MOZ_UTF16("js::BaseShape");
template<> const jschar TracerConcrete<js::types::TypeObject>::concreteTypeName[] =
MOZ_UTF16("js::types::TypeObject");