зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1569924 - Run ./mach clang-format -p js/src r=sfink
# ignore-this-changeset Differential Revision: https://phabricator.services.mozilla.com/D39987 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
d138bffba8
Коммит
b7a967139e
|
@ -47,8 +47,7 @@ void DebugAPI::onNewScript(JSContext* cx, HandleScript script) {
|
|||
}
|
||||
|
||||
/* static */
|
||||
void DebugAPI::onNewGlobalObject(JSContext* cx,
|
||||
Handle<GlobalObject*> global) {
|
||||
void DebugAPI::onNewGlobalObject(JSContext* cx, Handle<GlobalObject*> global) {
|
||||
MOZ_ASSERT(!global->realm()->firedOnNewGlobalObject);
|
||||
#ifdef DEBUG
|
||||
global->realm()->firedOnNewGlobalObject = true;
|
||||
|
@ -180,6 +179,6 @@ void DebugAPI::sweepBreakpoints(FreeOp* fop, JSScript* script) {
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace js
|
||||
} // namespace js
|
||||
|
||||
#endif /* debugger_DebugAPI_inl_h */
|
||||
|
|
|
@ -341,8 +341,7 @@ class DebugAPI {
|
|||
* Get any instrumentation ID which has been associated with a script using
|
||||
* the specified debugger object.
|
||||
*/
|
||||
static bool getScriptInstrumentationId(JSContext* cx,
|
||||
HandleObject dbgObject,
|
||||
static bool getScriptInstrumentationId(JSContext* cx, HandleObject dbgObject,
|
||||
HandleScript script,
|
||||
MutableHandleValue rval);
|
||||
|
||||
|
|
|
@ -147,8 +147,8 @@ void DebugScript::destroyBreakpointSite(FreeOp* fop, JSScript* script,
|
|||
}
|
||||
|
||||
/* static */
|
||||
void DebugScript::clearBreakpointsIn(FreeOp* fop, Realm* realm,
|
||||
Debugger* dbg, JSObject* handler) {
|
||||
void DebugScript::clearBreakpointsIn(FreeOp* fop, Realm* realm, Debugger* dbg,
|
||||
JSObject* handler) {
|
||||
for (auto script = realm->zone()->cellIter<JSScript>(); !script.done();
|
||||
script.next()) {
|
||||
if (script->realm() == realm && script->hasDebugScript()) {
|
||||
|
@ -184,7 +184,7 @@ void DebugScript::clearBreakpointsIn(FreeOp* fop, JSScript* script,
|
|||
uint32_t DebugScript::getStepperCount(JSScript* script) {
|
||||
return script->hasDebugScript() ? get(script)->stepperCount : 0;
|
||||
}
|
||||
#endif // DEBUG
|
||||
#endif // DEBUG
|
||||
|
||||
/* static */
|
||||
bool DebugScript::incrementStepperCount(JSContext* cx, JSScript* script) {
|
||||
|
@ -293,7 +293,7 @@ void DebugAPI::checkDebugScriptAfterMovingGC(DebugScript* ds) {
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif // JSGC_HASH_TABLE_CHECKS
|
||||
#endif // JSGC_HASH_TABLE_CHECKS
|
||||
|
||||
/* static */
|
||||
void DebugAPI::sweepBreakpointsSlow(FreeOp* fop, JSScript* script) {
|
||||
|
@ -315,10 +315,10 @@ void DebugAPI::sweepBreakpointsSlow(FreeOp* fop, JSScript* script) {
|
|||
// if the breakpoint was added after we computed the sweep
|
||||
// groups. In this case both script and debugger object must be
|
||||
// live.
|
||||
MOZ_ASSERT_IF(script->zone()->isGCSweeping() &&
|
||||
dbgobj->zone()->isCollecting(),
|
||||
dbgobj->zone()->isGCSweeping() ||
|
||||
(!scriptGone && dbgobj->asTenured().isMarkedAny()));
|
||||
MOZ_ASSERT_IF(
|
||||
script->zone()->isGCSweeping() && dbgobj->zone()->isCollecting(),
|
||||
dbgobj->zone()->isGCSweeping() ||
|
||||
(!scriptGone && dbgobj->asTenured().isMarkedAny()));
|
||||
|
||||
bool dying = scriptGone || IsAboutToBeFinalized(&dbgobj);
|
||||
MOZ_ASSERT_IF(!dying, !IsAboutToBeFinalized(&bp->getHandlerRef()));
|
||||
|
@ -340,4 +340,4 @@ bool DebugAPI::hasBreakpointsAtSlow(JSScript* script, jsbytecode* pc) {
|
|||
return site && site->enabledCount > 0;
|
||||
}
|
||||
|
||||
} // namespace js
|
||||
} // namespace js
|
||||
|
|
|
@ -88,8 +88,8 @@ class DebugScript {
|
|||
|
||||
static void clearBreakpointsIn(FreeOp* fop, JS::Realm* realm, Debugger* dbg,
|
||||
JSObject* handler);
|
||||
static void clearBreakpointsIn(FreeOp* fop, JSScript* script,
|
||||
Debugger* dbg, JSObject* handler);
|
||||
static void clearBreakpointsIn(FreeOp* fop, JSScript* script, Debugger* dbg,
|
||||
JSObject* handler);
|
||||
|
||||
#ifdef DEBUG
|
||||
static uint32_t getStepperCount(JSScript* script);
|
||||
|
|
|
@ -531,14 +531,13 @@ static void GlobalDebuggerVectorHolder_finalize(FreeOp* fop, JSObject* obj) {
|
|||
}
|
||||
|
||||
static const ClassOps GlobalDebuggerVectorHolder_classOps = {
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
GlobalDebuggerVectorHolder_finalize
|
||||
};
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
GlobalDebuggerVectorHolder_finalize};
|
||||
|
||||
static const Class GlobalDebuggerVectorHolder_class = {
|
||||
"GlobalDebuggerVectorHolder",
|
||||
|
@ -547,9 +546,8 @@ static const Class GlobalDebuggerVectorHolder_class = {
|
|||
|
||||
/* static */
|
||||
JSObject* DebugAPI::newGlobalDebuggersHolder(JSContext* cx) {
|
||||
NativeObject* obj =
|
||||
NewNativeObjectWithGivenProto(cx, &GlobalDebuggerVectorHolder_class,
|
||||
nullptr);
|
||||
NativeObject* obj = NewNativeObjectWithGivenProto(
|
||||
cx, &GlobalDebuggerVectorHolder_class, nullptr);
|
||||
if (!obj) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -664,8 +662,8 @@ bool Debugger::getFrame(JSContext* cx, const FrameIter& iter,
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool DebuggerExists(GlobalObject* global,
|
||||
const std::function<bool(Debugger* dbg)>& predicate) {
|
||||
static bool DebuggerExists(
|
||||
GlobalObject* global, const std::function<bool(Debugger* dbg)>& predicate) {
|
||||
// The GC analysis can't determine that the predicate can't GC, so let it know
|
||||
// explicitly.
|
||||
JS::AutoSuppressGCAnalysis nogc;
|
||||
|
@ -685,29 +683,26 @@ static bool DebuggerExists(GlobalObject* global,
|
|||
/* static */
|
||||
bool Debugger::hasLiveHook(GlobalObject* global, Hook which) {
|
||||
return DebuggerExists(global, [=](Debugger* dbg) {
|
||||
return dbg->enabled && dbg->getHook(which);
|
||||
});
|
||||
return dbg->enabled && dbg->getHook(which);
|
||||
});
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool DebugAPI::debuggerObservesAllExecution(GlobalObject* global) {
|
||||
return DebuggerExists(global, [=](Debugger* dbg) {
|
||||
return dbg->observesAllExecution();
|
||||
});
|
||||
return DebuggerExists(
|
||||
global, [=](Debugger* dbg) { return dbg->observesAllExecution(); });
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool DebugAPI::debuggerObservesCoverage(GlobalObject* global) {
|
||||
return DebuggerExists(global, [=](Debugger* dbg) {
|
||||
return dbg->observesCoverage();
|
||||
});
|
||||
return DebuggerExists(global,
|
||||
[=](Debugger* dbg) { return dbg->observesCoverage(); });
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool DebugAPI::debuggerObservesAsmJS(GlobalObject* global) {
|
||||
return DebuggerExists(global, [=](Debugger* dbg) {
|
||||
return dbg->observesAsmJS();
|
||||
});
|
||||
return DebuggerExists(global,
|
||||
[=](Debugger* dbg) { return dbg->observesAsmJS(); });
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
@ -1118,7 +1113,8 @@ ResumeMode DebugAPI::slowPathOnExceptionUnwind(JSContext* cx,
|
|||
|
||||
RootedValue rval(cx);
|
||||
ResumeMode resumeMode = Debugger::dispatchHook(
|
||||
cx, [](Debugger* dbg) -> bool {
|
||||
cx,
|
||||
[](Debugger* dbg) -> bool {
|
||||
return dbg->getHook(Debugger::OnExceptionUnwind);
|
||||
},
|
||||
[&](Debugger* dbg) -> ResumeMode {
|
||||
|
@ -2461,8 +2457,7 @@ ResumeMode DebugAPI::onSingleStep(JSContext* cx, MutableHandleValue vp) {
|
|||
if (GlobalObject::DebuggerVector* debuggers = global->getDebuggers()) {
|
||||
for (auto p = debuggers->begin(); p != debuggers->end(); p++) {
|
||||
Debugger* dbg = *p;
|
||||
for (Debugger::FrameMap::Range r = dbg->frames.all();
|
||||
!r.empty();
|
||||
for (Debugger::FrameMap::Range r = dbg->frames.all(); !r.empty();
|
||||
r.popFront()) {
|
||||
AbstractFramePtr frame = r.front().key();
|
||||
NativeObject* frameobj = r.front().value();
|
||||
|
@ -2478,8 +2473,7 @@ ResumeMode DebugAPI::onSingleStep(JSContext* cx, MutableHandleValue vp) {
|
|||
|
||||
// Also count hooks set on suspended generator frames.
|
||||
for (Debugger::GeneratorWeakMap::Range r = dbg->generatorFrames.all();
|
||||
!r.empty();
|
||||
r.popFront()) {
|
||||
!r.empty(); r.popFront()) {
|
||||
AbstractGeneratorObject& genObj =
|
||||
r.front().key()->as<AbstractGeneratorObject>();
|
||||
DebuggerFrame& frameObj = r.front().value()->as<DebuggerFrame>();
|
||||
|
@ -2649,8 +2643,7 @@ void DebugAPI::slowPathOnNewGlobalObject(JSContext* cx,
|
|||
|
||||
/* static */
|
||||
void DebugAPI::slowPathNotifyParticipatesInGC(
|
||||
uint64_t majorGCNumber,
|
||||
GlobalObject::DebuggerVector& dbgs) {
|
||||
uint64_t majorGCNumber, GlobalObject::DebuggerVector& dbgs) {
|
||||
for (GlobalObject::DebuggerVector::Range r = dbgs.all(); !r.empty();
|
||||
r.popFront()) {
|
||||
if (!r.front().unbarrieredGet()->debuggeeIsBeingCollected(majorGCNumber)) {
|
||||
|
@ -3152,7 +3145,8 @@ static bool UpdateExecutionObservabilityOfScriptsInZone(
|
|||
|
||||
/* static */
|
||||
bool Debugger::updateExecutionObservabilityOfScripts(
|
||||
JSContext* cx, const DebugAPI::ExecutionObservableSet& obs, IsObserving observing) {
|
||||
JSContext* cx, const DebugAPI::ExecutionObservableSet& obs,
|
||||
IsObserving observing) {
|
||||
if (Zone* zone = obs.singleZone()) {
|
||||
return UpdateExecutionObservabilityOfScriptsInZone(cx, zone, obs,
|
||||
observing);
|
||||
|
@ -6178,8 +6172,8 @@ DebuggerScript* Debugger::wrapVariantReferent(
|
|||
} else if (referent.is<LazyScript*>()) {
|
||||
obj = wrapVariantReferent(cx, lazyScripts, referent);
|
||||
} else {
|
||||
referent.template as<WasmInstanceObject*>();
|
||||
obj = wrapVariantReferent(cx, wasmInstanceScripts, referent);
|
||||
referent.template as<WasmInstanceObject*>();
|
||||
obj = wrapVariantReferent(cx, wasmInstanceScripts, referent);
|
||||
}
|
||||
MOZ_ASSERT_IF(obj, obj->getReferent() == referent);
|
||||
return obj;
|
||||
|
@ -6377,10 +6371,8 @@ bool Debugger::replaceFrameGuts(JSContext* cx, AbstractFramePtr from,
|
|||
/* static */
|
||||
bool DebugAPI::inFrameMaps(AbstractFramePtr frame) {
|
||||
bool foundAny = false;
|
||||
Debugger::forEachDebuggerFrame(frame,
|
||||
[&](DebuggerFrame* frameobj) {
|
||||
foundAny = true;
|
||||
});
|
||||
Debugger::forEachDebuggerFrame(
|
||||
frame, [&](DebuggerFrame* frameobj) { foundAny = true; });
|
||||
return foundAny;
|
||||
}
|
||||
|
||||
|
|
|
@ -955,8 +955,8 @@ class Debugger : private mozilla::LinkedListElement<Debugger> {
|
|||
|
||||
MOZ_MUST_USE bool updateObservesAllExecutionOnDebuggees(
|
||||
JSContext* cx, IsObserving observing);
|
||||
MOZ_MUST_USE bool updateObservesCoverageOnDebuggees(
|
||||
JSContext* cx, IsObserving observing);
|
||||
MOZ_MUST_USE bool updateObservesCoverageOnDebuggees(JSContext* cx,
|
||||
IsObserving observing);
|
||||
void updateObservesAsmJSOnDebuggees(IsObserving observing);
|
||||
|
||||
JSObject* getHook(Hook hook) const;
|
||||
|
|
|
@ -406,7 +406,6 @@ void DebuggerFrame::clearGenerator(
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
// 2) generatorFrames must no longer map the AbstractGeneratorObject to the
|
||||
// DebuggerFrame.
|
||||
GeneratorInfo* info = generatorInfo();
|
||||
|
|
|
@ -1264,7 +1264,7 @@ bool DebuggerObject::makeDebuggeeNativeFunctionMethod(JSContext* cx,
|
|||
Value* vp) {
|
||||
THIS_DEBUGOBJECT(cx, argc, vp, "makeDebuggeeNativeFunction", args, object);
|
||||
if (!args.requireAtLeast(
|
||||
cx, "Debugger.Object.prototype.makeDebuggeeNativeFunction", 1)) {
|
||||
cx, "Debugger.Object.prototype.makeDebuggeeNativeFunction", 1)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1304,8 +1304,8 @@ bool DebuggerObject::setInstrumentationMethod(JSContext* cx, unsigned argc,
|
|||
Value* vp) {
|
||||
THIS_DEBUGOBJECT(cx, argc, vp, "setInstrumentation", args, object);
|
||||
|
||||
if (!args.requireAtLeast(
|
||||
cx, "Debugger.Object.prototype.setInstrumentation", 2)) {
|
||||
if (!args.requireAtLeast(cx, "Debugger.Object.prototype.setInstrumentation",
|
||||
2)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1367,8 +1367,7 @@ bool DebuggerObject::setInstrumentationMethod(JSContext* cx, unsigned argc,
|
|||
|
||||
/* static */
|
||||
bool DebuggerObject::setInstrumentationActiveMethod(JSContext* cx,
|
||||
unsigned argc,
|
||||
Value* vp) {
|
||||
unsigned argc, Value* vp) {
|
||||
THIS_DEBUGOBJECT(cx, argc, vp, "setInstrumentationActive", args, object);
|
||||
|
||||
if (!DebuggerObject::requireGlobal(cx, object)) {
|
||||
|
@ -1376,7 +1375,7 @@ bool DebuggerObject::setInstrumentationActiveMethod(JSContext* cx,
|
|||
}
|
||||
|
||||
if (!args.requireAtLeast(
|
||||
cx, "Debugger.Object.prototype.setInstrumentationActive", 1)) {
|
||||
cx, "Debugger.Object.prototype.setInstrumentationActive", 1)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -169,18 +169,19 @@ DebuggerSource* DebuggerSource::checkThis(JSContext* cx, const CallArgs& args,
|
|||
return thisobj;
|
||||
}
|
||||
|
||||
#define THIS_DEBUGSOURCE_REFERENT(cx, argc, vp, fnname, args, obj, referent) \
|
||||
CallArgs args = CallArgsFromVp(argc, vp); \
|
||||
RootedDebuggerSource obj(cx, DebuggerSource::check(cx, args.thisv(), fnname)); \
|
||||
if (!obj) return false; \
|
||||
#define THIS_DEBUGSOURCE_REFERENT(cx, argc, vp, fnname, args, obj, referent) \
|
||||
CallArgs args = CallArgsFromVp(argc, vp); \
|
||||
RootedDebuggerSource obj(cx, \
|
||||
DebuggerSource::check(cx, args.thisv(), fnname)); \
|
||||
if (!obj) return false; \
|
||||
Rooted<DebuggerSourceReferent> referent(cx, obj->getReferent())
|
||||
|
||||
#define THIS_DEBUGSOURCE_SOURCE(cx, argc, vp, fnname, args, obj, sourceObject) \
|
||||
CallArgs args = CallArgsFromVp(argc, vp); \
|
||||
RootedDebuggerSource obj(cx, DebuggerSource::checkThis<ScriptSourceObject*>( \
|
||||
cx, args, fnname, "a JS source")); \
|
||||
if (!obj) return false; \
|
||||
RootedScriptSourceObject sourceObject( \
|
||||
#define THIS_DEBUGSOURCE_SOURCE(cx, argc, vp, fnname, args, obj, sourceObject) \
|
||||
CallArgs args = CallArgsFromVp(argc, vp); \
|
||||
RootedDebuggerSource obj(cx, DebuggerSource::checkThis<ScriptSourceObject*>( \
|
||||
cx, args, fnname, "a JS source")); \
|
||||
if (!obj) return false; \
|
||||
RootedScriptSourceObject sourceObject( \
|
||||
cx, obj->getReferent().as<ScriptSourceObject*>())
|
||||
|
||||
class DebuggerSourceGetTextMatcher {
|
||||
|
|
|
@ -311,8 +311,7 @@ bool TryEmitter::instrumentEntryPoint() {
|
|||
// if an await operation threw an exception. While the frame might already be
|
||||
// on the stack, the Entry instrumentation kind only indicates that a new
|
||||
// frame *might* have been pushed.
|
||||
if (bce_->sc->isFunctionBox() &&
|
||||
bce_->sc->asFunctionBox()->isAsync()) {
|
||||
if (bce_->sc->isFunctionBox() && bce_->sc->asFunctionBox()->isAsync()) {
|
||||
return bce_->emitInstrumentation(InstrumentationKind::Entry);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace js {
|
|||
|
||||
namespace gc {
|
||||
class AutoSetThreadIsPerformingGC;
|
||||
} // namespace gc
|
||||
} // namespace gc
|
||||
|
||||
/*
|
||||
* A FreeOp can do one thing: free memory. For convenience, it has delete_
|
||||
|
|
|
@ -2139,8 +2139,8 @@ void ZoneHeapThreshold::updateAfterGC(size_t lastBytes,
|
|||
const AutoLockGC& lock) {
|
||||
float growthFactor =
|
||||
computeZoneHeapGrowthFactorForHeapSize(lastBytes, tunables, state);
|
||||
gcTriggerBytes_ = computeZoneTriggerBytes(growthFactor, lastBytes, gckind,
|
||||
tunables, lock);
|
||||
gcTriggerBytes_ =
|
||||
computeZoneTriggerBytes(growthFactor, lastBytes, gckind, tunables, lock);
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
|
|
@ -162,8 +162,9 @@
|
|||
* maybeGC. The reason for this is that this check is made after the
|
||||
* allocation and we cannot GC with an uninitialized thing in the heap.
|
||||
*
|
||||
* 11) Do an incremental, zonal GC with reason TOO_MUCH_MALLOC when the total amount
|
||||
* of malloced memory is greater than the malloc trigger limit for the zone.
|
||||
* 11) Do an incremental, zonal GC with reason TOO_MUCH_MALLOC when the total
|
||||
* amount of malloced memory is greater than the malloc trigger limit for the
|
||||
* zone.
|
||||
*
|
||||
*
|
||||
* Size Limitation Triggers Explanation
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include "vm/JSContext.h" // JSContext
|
||||
|
||||
#include "debugger/DebugAPI-inl.h" // js::DebugAPI
|
||||
#include "vm/JSContext-inl.h" // JSContext::check
|
||||
#include "vm/JSContext-inl.h" // JSContext::check
|
||||
|
||||
using mozilla::Utf8Unit;
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
#include "wasm/WasmInstance.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#include "vm/BytecodeIterator.h"
|
||||
#include "vm/BytecodeLocation.h"
|
||||
# include "vm/BytecodeIterator.h"
|
||||
# include "vm/BytecodeLocation.h"
|
||||
#endif
|
||||
|
||||
#include "gc/Marking-inl.h"
|
||||
|
@ -32,8 +32,8 @@
|
|||
#include "vm/TypeInference-inl.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#include "vm/BytecodeIterator-inl.h"
|
||||
#include "vm/BytecodeLocation-inl.h"
|
||||
# include "vm/BytecodeIterator-inl.h"
|
||||
# include "vm/BytecodeLocation-inl.h"
|
||||
#endif
|
||||
|
||||
using namespace js;
|
||||
|
|
|
@ -47,33 +47,31 @@ void RealmInstrumentation::holderTrace(JSTracer* trc, JSObject* obj) {
|
|||
}
|
||||
|
||||
static const ClassOps InstrumentationHolderClassOps = {
|
||||
nullptr, /* addProperty */
|
||||
nullptr, /* delProperty */
|
||||
nullptr, /* enumerate */
|
||||
nullptr, /* newEnumerate */
|
||||
nullptr, /* resolve */
|
||||
nullptr, /* mayResolve */
|
||||
RealmInstrumentation::holderFinalize,
|
||||
nullptr, /* call */
|
||||
nullptr, /* hasInstance */
|
||||
nullptr, /* construct */
|
||||
RealmInstrumentation::holderTrace,
|
||||
nullptr, /* addProperty */
|
||||
nullptr, /* delProperty */
|
||||
nullptr, /* enumerate */
|
||||
nullptr, /* newEnumerate */
|
||||
nullptr, /* resolve */
|
||||
nullptr, /* mayResolve */
|
||||
RealmInstrumentation::holderFinalize,
|
||||
nullptr, /* call */
|
||||
nullptr, /* hasInstance */
|
||||
nullptr, /* construct */
|
||||
RealmInstrumentation::holderTrace,
|
||||
};
|
||||
|
||||
static const Class InstrumentationHolderClass = {
|
||||
"Instrumentation Holder",
|
||||
JSCLASS_HAS_RESERVED_SLOTS(ReservedSlotCount) | JSCLASS_FOREGROUND_FINALIZE,
|
||||
&InstrumentationHolderClassOps, JS_NULL_CLASS_SPEC, JS_NULL_CLASS_EXT
|
||||
};
|
||||
&InstrumentationHolderClassOps, JS_NULL_CLASS_SPEC, JS_NULL_CLASS_EXT};
|
||||
|
||||
static const char* instrumentationNames[] = {
|
||||
#define DEFINE_INSTRUMENTATION_STRING(_1, String, _2) String,
|
||||
FOR_EACH_INSTRUMENTATION_KIND(DEFINE_INSTRUMENTATION_STRING)
|
||||
FOR_EACH_INSTRUMENTATION_KIND(DEFINE_INSTRUMENTATION_STRING)
|
||||
#undef DEFINE_INSTRUMENTATION_STRING
|
||||
};
|
||||
|
||||
static bool StringToInstrumentationKind(JSContext* cx,
|
||||
HandleString str,
|
||||
static bool StringToInstrumentationKind(JSContext* cx, HandleString str,
|
||||
InstrumentationKind* result) {
|
||||
for (size_t i = 0; i < mozilla::ArrayLength(instrumentationNames); i++) {
|
||||
bool match;
|
||||
|
@ -81,7 +79,7 @@ static bool StringToInstrumentationKind(JSContext* cx,
|
|||
return false;
|
||||
}
|
||||
if (match) {
|
||||
*result = (InstrumentationKind) (1 << i);
|
||||
*result = (InstrumentationKind)(1 << i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +92,7 @@ static bool StringToInstrumentationKind(JSContext* cx,
|
|||
JSAtom* RealmInstrumentation::getInstrumentationKindName(
|
||||
JSContext* cx, InstrumentationKind kind) {
|
||||
for (size_t i = 0; i < mozilla::ArrayLength(instrumentationNames); i++) {
|
||||
if (kind == (InstrumentationKind) (1 << i)) {
|
||||
if (kind == (InstrumentationKind)(1 << i)) {
|
||||
JSString* str = JS_AtomizeString(cx, instrumentationNames[i]);
|
||||
if (!str) {
|
||||
return nullptr;
|
||||
|
@ -134,7 +132,7 @@ bool RealmInstrumentation::install(JSContext* cx, Handle<GlobalObject*> global,
|
|||
if (!StringToInstrumentationKind(cx, str, &kind)) {
|
||||
return false;
|
||||
}
|
||||
kinds |= (uint32_t) kind;
|
||||
kinds |= (uint32_t)kind;
|
||||
}
|
||||
|
||||
Rooted<UniquePtr<RealmInstrumentation>> instrumentation(
|
||||
|
@ -160,8 +158,7 @@ bool RealmInstrumentation::install(JSContext* cx, Handle<GlobalObject*> global,
|
|||
/* static */
|
||||
bool RealmInstrumentation::setActive(JSContext* cx,
|
||||
Handle<GlobalObject*> global,
|
||||
Debugger* dbg,
|
||||
bool active) {
|
||||
Debugger* dbg, bool active) {
|
||||
MOZ_ASSERT(global == cx->global());
|
||||
|
||||
RootedObject holder(cx, global->getInstrumentationHolder());
|
||||
|
@ -226,8 +223,7 @@ uint32_t RealmInstrumentation::getInstrumentationKinds(GlobalObject* global) {
|
|||
/* static */
|
||||
bool RealmInstrumentation::getScriptId(JSContext* cx,
|
||||
Handle<GlobalObject*> global,
|
||||
HandleScript script,
|
||||
int32_t* id) {
|
||||
HandleScript script, int32_t* id) {
|
||||
MOZ_ASSERT(global == cx->global());
|
||||
RootedObject holder(cx, global->getInstrumentationHolder());
|
||||
RealmInstrumentation* instrumentation = GetInstrumentation(holder);
|
||||
|
@ -279,4 +275,4 @@ bool GlobalHasInstrumentation(JSObject* global) {
|
|||
global->as<js::GlobalObject>().getInstrumentationHolder();
|
||||
}
|
||||
|
||||
} // namespace js
|
||||
} // namespace js
|
||||
|
|
|
@ -14,20 +14,20 @@ namespace js {
|
|||
|
||||
// Logic related to instrumentation which can be performed in a realm.
|
||||
|
||||
#define FOR_EACH_INSTRUMENTATION_KIND(MACRO) \
|
||||
/* The main entry point of a script. */ \
|
||||
MACRO(Main, "main", 1 << 0) \
|
||||
#define FOR_EACH_INSTRUMENTATION_KIND(MACRO) \
|
||||
/* The main entry point of a script. */ \
|
||||
MACRO(Main, "main", 1 << 0) \
|
||||
/* Points other than the main entry point where a frame for the script */ \
|
||||
/* might start executing. */ \
|
||||
MACRO(Entry, "entry", 1 << 1) \
|
||||
/* Points at which a script's frame will be popped or suspended. */ \
|
||||
MACRO(Exit, "exit", 1 << 2) \
|
||||
/* Breakpoint sites. */ \
|
||||
MACRO(Breakpoint, "breakpoint", 1 << 3) \
|
||||
/* Property access operations. */ \
|
||||
MACRO(GetProperty, "getProperty", 1 << 4) \
|
||||
MACRO(SetProperty, "setProperty", 1 << 5) \
|
||||
MACRO(GetElement, "getElement", 1 << 6) \
|
||||
/* might start executing. */ \
|
||||
MACRO(Entry, "entry", 1 << 1) \
|
||||
/* Points at which a script's frame will be popped or suspended. */ \
|
||||
MACRO(Exit, "exit", 1 << 2) \
|
||||
/* Breakpoint sites. */ \
|
||||
MACRO(Breakpoint, "breakpoint", 1 << 3) \
|
||||
/* Property access operations. */ \
|
||||
MACRO(GetProperty, "getProperty", 1 << 4) \
|
||||
MACRO(SetProperty, "setProperty", 1 << 5) \
|
||||
MACRO(GetElement, "getElement", 1 << 6) \
|
||||
MACRO(SetElement, "setElement", 1 << 7)
|
||||
|
||||
// Points at which instrumentation can be added on the scripts in a realm.
|
||||
|
@ -55,8 +55,7 @@ class RealmInstrumentation {
|
|||
|
||||
public:
|
||||
static bool install(JSContext* cx, Handle<GlobalObject*> global,
|
||||
HandleObject callback,
|
||||
HandleObject dbgObject,
|
||||
HandleObject callback, HandleObject dbgObject,
|
||||
Handle<StringVector> kinds);
|
||||
|
||||
static JSObject* getCallback(GlobalObject* global);
|
||||
|
@ -99,7 +98,7 @@ JSObject* InstrumentationCallbackOperation(JSContext* cx);
|
|||
bool InstrumentationScriptIdOperation(JSContext* cx, HandleScript script,
|
||||
MutableHandleValue rv);
|
||||
|
||||
} // namespace js
|
||||
} // namespace js
|
||||
|
||||
namespace JS {
|
||||
|
||||
|
|
|
@ -1793,12 +1793,13 @@ static MOZ_NEVER_INLINE JS_HAZ_JSNATIVE_CALLER bool Interpret(JSContext* cx,
|
|||
COUNT_COVERAGE_PC(REGS.pc); \
|
||||
JS_END_MACRO
|
||||
|
||||
#define SET_SCRIPT(s) \
|
||||
JS_BEGIN_MACRO \
|
||||
script = (s); \
|
||||
MOZ_ASSERT(cx->realm() == script->realm()); \
|
||||
if (DebugAPI::hasAnyBreakpointsOrStepMode(script) || script->hasScriptCounts()) \
|
||||
activation.enableInterruptsUnconditionally(); \
|
||||
#define SET_SCRIPT(s) \
|
||||
JS_BEGIN_MACRO \
|
||||
script = (s); \
|
||||
MOZ_ASSERT(cx->realm() == script->realm()); \
|
||||
if (DebugAPI::hasAnyBreakpointsOrStepMode(script) || \
|
||||
script->hasScriptCounts()) \
|
||||
activation.enableInterruptsUnconditionally(); \
|
||||
JS_END_MACRO
|
||||
|
||||
#define SANITY_CHECKS() \
|
||||
|
|
|
@ -589,7 +589,8 @@ void AtomsTable::mergeAtomsAddedWhileSweeping(Partition& part) {
|
|||
js_delete(newAtoms);
|
||||
}
|
||||
|
||||
bool AtomsTable::traceWeakIncrementally(JSTracer* trc, SweepIterator& atomsToSweep,
|
||||
bool AtomsTable::traceWeakIncrementally(JSTracer* trc,
|
||||
SweepIterator& atomsToSweep,
|
||||
SliceBudget& budget) {
|
||||
// Sweep the table incrementally until we run out of work or budget.
|
||||
while (!atomsToSweep.empty()) {
|
||||
|
|
|
@ -580,8 +580,8 @@ XDRResult js::XDRInterpretedFunction(XDRState<mode>* xdr,
|
|||
}
|
||||
|
||||
atom = fun->displayAtom();
|
||||
flagsword =
|
||||
(fun->nargs() << 16) | (fun->flags().toRaw() & ~FunctionFlags::NO_XDR_FLAGS);
|
||||
flagsword = (fun->nargs() << 16) |
|
||||
(fun->flags().toRaw() & ~FunctionFlags::NO_XDR_FLAGS);
|
||||
|
||||
// The environment of any function which is not reused will always be
|
||||
// null, it is later defined when a function is cloned or reused to
|
||||
|
|
|
@ -183,7 +183,8 @@ inline void JSScript::setBaselineScript(
|
|||
|
||||
inline void JSScript::clearBaselineScript(js::FreeOp* fop) {
|
||||
MOZ_ASSERT(hasBaselineScript());
|
||||
fop->removeCellMemory(this, baseline->allocBytes(), js::MemoryUse::BaselineScript);
|
||||
fop->removeCellMemory(this, baseline->allocBytes(),
|
||||
js::MemoryUse::BaselineScript);
|
||||
baseline = nullptr;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче