diff --git a/js/ipc/JavaScriptShared.cpp b/js/ipc/JavaScriptShared.cpp index aa12ddf5017b..250dcbec49df 100644 --- a/js/ipc/JavaScriptShared.cpp +++ b/js/ipc/JavaScriptShared.cpp @@ -386,7 +386,8 @@ JS::Symbol* JavaScriptShared::fromSymbolVariant(JSContext* cx, } } -/* static */ void JavaScriptShared::ConvertID(const nsID& from, JSIID* to) { +/* static */ +void JavaScriptShared::ConvertID(const nsID& from, JSIID* to) { to->m0() = from.m0; to->m1() = from.m1; to->m2() = from.m2; @@ -400,7 +401,8 @@ JS::Symbol* JavaScriptShared::fromSymbolVariant(JSContext* cx, to->m3_7() = from.m3[7]; } -/* static */ void JavaScriptShared::ConvertID(const JSIID& from, nsID* to) { +/* static */ +void JavaScriptShared::ConvertID(const JSIID& from, nsID* to) { to->m0 = from.m0(); to->m1 = from.m1(); to->m2 = from.m2(); diff --git a/js/src/builtin/AtomicsObject.cpp b/js/src/builtin/AtomicsObject.cpp index d4e7edb567ca..1690be3ff0a2 100644 --- a/js/src/builtin/AtomicsObject.cpp +++ b/js/src/builtin/AtomicsObject.cpp @@ -777,13 +777,15 @@ bool js::atomics_notify(JSContext* cx, unsigned argc, Value* vp) { return true; } -/* static */ bool js::FutexThread::initialize() { +/* static */ +bool js::FutexThread::initialize() { MOZ_ASSERT(!lock_); lock_ = js_new(mutexid::FutexThread); return lock_ != nullptr; } -/* static */ void js::FutexThread::destroy() { +/* static */ +void js::FutexThread::destroy() { if (lock_) { js::Mutex* lock = lock_; js_delete(lock); @@ -791,7 +793,8 @@ bool js::atomics_notify(JSContext* cx, unsigned argc, Value* vp) { } } -/* static */ void js::FutexThread::lock() { +/* static */ +void js::FutexThread::lock() { // Load the atomic pointer. js::Mutex* lock = lock_; @@ -802,7 +805,8 @@ bool js::atomics_notify(JSContext* cx, unsigned argc, Value* vp) { mozilla::recordreplay::Behavior::DontPreserve> FutexThread::lock_; -/* static */ void js::FutexThread::unlock() { +/* static */ +void js::FutexThread::unlock() { // Load the atomic pointer. js::Mutex* lock = lock_; diff --git a/js/src/builtin/DataViewObject.cpp b/js/src/builtin/DataViewObject.cpp index df0a974e25a6..c8c2ed03bc22 100644 --- a/js/src/builtin/DataViewObject.cpp +++ b/js/src/builtin/DataViewObject.cpp @@ -247,9 +247,11 @@ bool DataViewObject::construct(JSContext* cx, unsigned argc, Value* vp) { } template -/* static */ SharedMem DataViewObject::getDataPointer( - JSContext* cx, Handle obj, uint64_t offset, - bool* isSharedMemory) { +/* static */ +SharedMem DataViewObject::getDataPointer(JSContext* cx, + Handle obj, + uint64_t offset, + bool* isSharedMemory) { const size_t TypeSize = sizeof(NativeType); if (offset > UINT32_MAX - TypeSize || offset + TypeSize > obj->byteLength()) { JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, @@ -374,9 +376,9 @@ struct DataViewIO { }; template -/* static */ bool DataViewObject::read(JSContext* cx, - Handle obj, - const CallArgs& args, NativeType* val) { +/* static */ +bool DataViewObject::read(JSContext* cx, Handle obj, + const CallArgs& args, NativeType* val) { // Steps 1-2. done by the caller // Step 3. unnecessary assert @@ -476,9 +478,9 @@ inline bool WebIDLCast(JSContext* cx, HandleValue value, double* out) { // https://tc39.github.io/ecma262/#sec-setviewvalue // SetViewValue ( view, requestIndex, isLittleEndian, type, value ) template -/* static */ bool DataViewObject::write(JSContext* cx, - Handle obj, - const CallArgs& args) { +/* static */ +bool DataViewObject::write(JSContext* cx, Handle obj, + const CallArgs& args) { // Steps 1-2. done by the caller // Step 3. unnecessary assert diff --git a/js/src/builtin/Eval.cpp b/js/src/builtin/Eval.cpp index b6199e1944bc..413e5c439732 100644 --- a/js/src/builtin/Eval.cpp +++ b/js/src/builtin/Eval.cpp @@ -49,7 +49,8 @@ static bool IsEvalCacheCandidate(JSScript* script) { !script->hasObjects(); } -/* static */ HashNumber EvalCacheHashPolicy::hash(const EvalCacheLookup& l) { +/* static */ +HashNumber EvalCacheHashPolicy::hash(const EvalCacheLookup& l) { AutoCheckCannotGC nogc; uint32_t hash = l.str->hasLatin1Chars() ? HashString(l.str->latin1Chars(nogc), l.str->length()) @@ -57,8 +58,9 @@ static bool IsEvalCacheCandidate(JSScript* script) { return AddToHash(hash, l.callerScript.get(), l.pc); } -/* static */ bool EvalCacheHashPolicy::match(const EvalCacheEntry& cacheEntry, - const EvalCacheLookup& l) { +/* static */ +bool EvalCacheHashPolicy::match(const EvalCacheEntry& cacheEntry, + const EvalCacheLookup& l) { MOZ_ASSERT(IsEvalCacheCandidate(cacheEntry.script)); return EqualStrings(cacheEntry.str, l.str) && diff --git a/js/src/builtin/MapObject.cpp b/js/src/builtin/MapObject.cpp index 55fb592a68b5..899b2e1f2ec0 100644 --- a/js/src/builtin/MapObject.cpp +++ b/js/src/builtin/MapObject.cpp @@ -165,8 +165,9 @@ inline MapObject::IteratorKind MapIteratorObject::kind() const { return MapObject::IteratorKind(i); } -/* static */ bool GlobalObject::initMapIteratorProto( - JSContext* cx, Handle global) { +/* static */ +bool GlobalObject::initMapIteratorProto(JSContext* cx, + Handle global) { Rooted base( cx, GlobalObject::getOrCreateIteratorPrototype(cx, global)); if (!base) { @@ -342,7 +343,8 @@ bool MapIteratorObject::next(Handle mapIterator, return false; } -/* static */ JSObject* MapIteratorObject::createResultPair(JSContext* cx) { +/* static */ +JSObject* MapIteratorObject::createResultPair(JSContext* cx) { RootedArrayObject resultPairObj( cx, NewDenseFullyAllocatedArray(cx, 2, nullptr, TenuredObject)); if (!resultPairObj) { @@ -626,7 +628,8 @@ void MapObject::finalize(FreeOp* fop, JSObject* obj) { } } -/* static */ void MapObject::sweepAfterMinorGC(FreeOp* fop, MapObject* mapobj) { +/* static */ +void MapObject::sweepAfterMinorGC(FreeOp* fop, MapObject* mapobj) { if (IsInsideNursery(mapobj) && !IsForwarded(mapobj)) { finalize(fop, mapobj); return; @@ -935,8 +938,9 @@ inline SetObject::IteratorKind SetIteratorObject::kind() const { return SetObject::IteratorKind(i); } -/* static */ bool GlobalObject::initSetIteratorProto( - JSContext* cx, Handle global) { +/* static */ +bool GlobalObject::initSetIteratorProto(JSContext* cx, + Handle global) { Rooted base( cx, GlobalObject::getOrCreateIteratorPrototype(cx, global)); if (!base) { @@ -1082,7 +1086,8 @@ bool SetIteratorObject::next(Handle setIterator, return false; } -/* static */ JSObject* SetIteratorObject::createResult(JSContext* cx) { +/* static */ +JSObject* SetIteratorObject::createResult(JSContext* cx) { RootedArrayObject resultObj( cx, NewDenseFullyAllocatedArray(cx, 1, nullptr, TenuredObject)); if (!resultObj) { @@ -1241,7 +1246,8 @@ void SetObject::finalize(FreeOp* fop, JSObject* obj) { } } -/* static */ void SetObject::sweepAfterMinorGC(FreeOp* fop, SetObject* setobj) { +/* static */ +void SetObject::sweepAfterMinorGC(FreeOp* fop, SetObject* setobj) { if (IsInsideNursery(setobj) && !IsForwarded(setobj)) { finalize(fop, setobj); return; diff --git a/js/src/builtin/ModuleObject.cpp b/js/src/builtin/ModuleObject.cpp index 5ca3a4084307..dcf0e047c59b 100644 --- a/js/src/builtin/ModuleObject.cpp +++ b/js/src/builtin/ModuleObject.cpp @@ -94,12 +94,14 @@ DEFINE_ATOM_ACCESSOR_METHOD(ImportEntryObject, localName) DEFINE_UINT32_ACCESSOR_METHOD(ImportEntryObject, lineNumber) DEFINE_UINT32_ACCESSOR_METHOD(ImportEntryObject, columnNumber) -/* static */ bool ImportEntryObject::isInstance(HandleValue value) { +/* static */ +bool ImportEntryObject::isInstance(HandleValue value) { return value.isObject() && value.toObject().is(); } -/* static */ bool GlobalObject::initImportEntryProto( - JSContext* cx, Handle global) { +/* static */ +bool GlobalObject::initImportEntryProto(JSContext* cx, + Handle global) { static const JSPropertySpec protoAccessors[] = { JS_PSG("moduleRequest", ImportEntryObject_moduleRequestGetter, 0), JS_PSG("importName", ImportEntryObject_importNameGetter, 0), @@ -122,7 +124,8 @@ DEFINE_UINT32_ACCESSOR_METHOD(ImportEntryObject, columnNumber) return true; } -/* static */ ImportEntryObject* ImportEntryObject::create( +/* static */ +ImportEntryObject* ImportEntryObject::create( JSContext* cx, HandleAtom moduleRequest, HandleAtom importName, HandleAtom localName, uint32_t lineNumber, uint32_t columnNumber) { RootedObject proto( @@ -165,12 +168,14 @@ DEFINE_ATOM_OR_NULL_ACCESSOR_METHOD(ExportEntryObject, localName) DEFINE_UINT32_ACCESSOR_METHOD(ExportEntryObject, lineNumber) DEFINE_UINT32_ACCESSOR_METHOD(ExportEntryObject, columnNumber) -/* static */ bool ExportEntryObject::isInstance(HandleValue value) { +/* static */ +bool ExportEntryObject::isInstance(HandleValue value) { return value.isObject() && value.toObject().is(); } -/* static */ bool GlobalObject::initExportEntryProto( - JSContext* cx, Handle global) { +/* static */ +bool GlobalObject::initExportEntryProto(JSContext* cx, + Handle global) { static const JSPropertySpec protoAccessors[] = { JS_PSG("exportName", ExportEntryObject_exportNameGetter, 0), JS_PSG("moduleRequest", ExportEntryObject_moduleRequestGetter, 0), @@ -198,7 +203,8 @@ static Value StringOrNullValue(JSString* maybeString) { return maybeString ? StringValue(maybeString) : NullValue(); } -/* static */ ExportEntryObject* ExportEntryObject::create( +/* static */ +ExportEntryObject* ExportEntryObject::create( JSContext* cx, HandleAtom maybeExportName, HandleAtom maybeModuleRequest, HandleAtom maybeImportName, HandleAtom maybeLocalName, uint32_t lineNumber, uint32_t columnNumber) { @@ -243,12 +249,14 @@ DEFINE_ATOM_ACCESSOR_METHOD(RequestedModuleObject, moduleSpecifier) DEFINE_UINT32_ACCESSOR_METHOD(RequestedModuleObject, lineNumber) DEFINE_UINT32_ACCESSOR_METHOD(RequestedModuleObject, columnNumber) -/* static */ bool RequestedModuleObject::isInstance(HandleValue value) { +/* static */ +bool RequestedModuleObject::isInstance(HandleValue value) { return value.isObject() && value.toObject().is(); } -/* static */ bool GlobalObject::initRequestedModuleProto( - JSContext* cx, Handle global) { +/* static */ +bool GlobalObject::initRequestedModuleProto(JSContext* cx, + Handle global) { static const JSPropertySpec protoAccessors[] = { JS_PSG("moduleSpecifier", RequestedModuleObject_moduleSpecifierGetter, 0), JS_PSG("lineNumber", RequestedModuleObject_lineNumberGetter, 0), @@ -269,9 +277,11 @@ DEFINE_UINT32_ACCESSOR_METHOD(RequestedModuleObject, columnNumber) return true; } -/* static */ RequestedModuleObject* RequestedModuleObject::create( - JSContext* cx, HandleAtom moduleSpecifier, uint32_t lineNumber, - uint32_t columnNumber) { +/* static */ +RequestedModuleObject* RequestedModuleObject::create(JSContext* cx, + HandleAtom moduleSpecifier, + uint32_t lineNumber, + uint32_t columnNumber) { RootedObject proto( cx, GlobalObject::getOrCreateRequestedModulePrototype(cx, cx->global())); if (!proto) { @@ -357,14 +367,16 @@ bool IndirectBindingMap::lookup(jsid name, ModuleEnvironmentObject** envOut, /////////////////////////////////////////////////////////////////////////// // ModuleNamespaceObject -/* static */ const ModuleNamespaceObject::ProxyHandler - ModuleNamespaceObject::proxyHandler; +/* static */ +const ModuleNamespaceObject::ProxyHandler ModuleNamespaceObject::proxyHandler; -/* static */ bool ModuleNamespaceObject::isInstance(HandleValue value) { +/* static */ +bool ModuleNamespaceObject::isInstance(HandleValue value) { return value.isObject() && value.toObject().is(); } -/* static */ ModuleNamespaceObject* ModuleNamespaceObject::create( +/* static */ +ModuleNamespaceObject* ModuleNamespaceObject::create( JSContext* cx, HandleModuleObject module, HandleObject exports, UniquePtr bindings) { RootedValue priv(cx, ObjectValue(*module)); @@ -708,11 +720,13 @@ DEFINE_ARRAY_SLOT_ACCESSOR(ModuleObject, indirectExportEntries, DEFINE_ARRAY_SLOT_ACCESSOR(ModuleObject, starExportEntries, StarExportEntriesSlot) -/* static */ bool ModuleObject::isInstance(HandleValue value) { +/* static */ +bool ModuleObject::isInstance(HandleValue value) { return value.isObject() && value.toObject().is(); } -/* static */ ModuleObject* ModuleObject::create(JSContext* cx) { +/* static */ +ModuleObject* ModuleObject::create(JSContext* cx) { RootedObject proto( cx, GlobalObject::getOrCreateModulePrototype(cx, cx->global())); if (!proto) { @@ -741,7 +755,8 @@ DEFINE_ARRAY_SLOT_ACCESSOR(ModuleObject, starExportEntries, return self; } -/* static */ void ModuleObject::finalize(js::FreeOp* fop, JSObject* obj) { +/* static */ +void ModuleObject::finalize(js::FreeOp* fop, JSObject* obj) { MOZ_ASSERT(fop->maybeOnHelperThread()); ModuleObject* self = &obj->as(); if (self->hasImportBindings()) { @@ -836,7 +851,8 @@ static bool FreezeObjectProperty(JSContext* cx, HandleNativeObject obj, return FreezeObject(cx, property); } -/* static */ bool ModuleObject::Freeze(JSContext* cx, HandleModuleObject self) { +/* static */ +bool ModuleObject::Freeze(JSContext* cx, HandleModuleObject self) { return FreezeObjectProperty(cx, self, RequestedModulesSlot) && FreezeObjectProperty(cx, self, ImportEntriesSlot) && FreezeObjectProperty(cx, self, LocalExportEntriesSlot) && @@ -949,7 +965,8 @@ Scope* ModuleObject::enclosingScope() const { return script()->enclosingScope(); } -/* static */ void ModuleObject::trace(JSTracer* trc, JSObject* obj) { +/* static */ +void ModuleObject::trace(JSTracer* trc, JSObject* obj) { ModuleObject& module = obj->as(); if (module.hasImportBindings()) { @@ -972,8 +989,9 @@ bool ModuleObject::noteFunctionDeclaration(JSContext* cx, HandleAtom name, return true; } -/* static */ bool ModuleObject::instantiateFunctionDeclarations( - JSContext* cx, HandleModuleObject self) { +/* static */ +bool ModuleObject::instantiateFunctionDeclarations(JSContext* cx, + HandleModuleObject self) { #ifdef DEBUG MOZ_ASSERT(self->status() == MODULE_STATUS_INSTANTIATING); if (!AssertFrozen(cx, self)) { @@ -1011,8 +1029,9 @@ bool ModuleObject::noteFunctionDeclaration(JSContext* cx, HandleAtom name, return true; } -/* static */ bool ModuleObject::execute(JSContext* cx, HandleModuleObject self, - MutableHandleValue rval) { +/* static */ +bool ModuleObject::execute(JSContext* cx, HandleModuleObject self, + MutableHandleValue rval) { #ifdef DEBUG MOZ_ASSERT(self->status() == MODULE_STATUS_EVALUATING); if (!AssertFrozen(cx, self)) { @@ -1036,8 +1055,10 @@ bool ModuleObject::noteFunctionDeclaration(JSContext* cx, HandleAtom name, return Execute(cx, script, *scope, rval.address()); } -/* static */ ModuleNamespaceObject* ModuleObject::createNamespace( - JSContext* cx, HandleModuleObject self, HandleObject exports) { +/* static */ +ModuleNamespaceObject* ModuleObject::createNamespace(JSContext* cx, + HandleModuleObject self, + HandleObject exports) { MOZ_ASSERT(!self->namespace_()); MOZ_ASSERT(exports->is()); @@ -1065,17 +1086,18 @@ static bool InvokeSelfHostedMethod(JSContext* cx, HandleModuleObject self, return CallSelfHostedFunction(cx, name, thisv, args, &ignored); } -/* static */ bool ModuleObject::Instantiate(JSContext* cx, - HandleModuleObject self) { +/* static */ +bool ModuleObject::Instantiate(JSContext* cx, HandleModuleObject self) { return InvokeSelfHostedMethod(cx, self, cx->names().ModuleInstantiate); } -/* static */ bool ModuleObject::Evaluate(JSContext* cx, - HandleModuleObject self) { +/* static */ +bool ModuleObject::Evaluate(JSContext* cx, HandleModuleObject self) { return InvokeSelfHostedMethod(cx, self, cx->names().ModuleEvaluate); } -/* static */ ModuleNamespaceObject* ModuleObject::GetOrCreateModuleNamespace( +/* static */ +ModuleNamespaceObject* ModuleObject::GetOrCreateModuleNamespace( JSContext* cx, HandleModuleObject self) { FixedInvokeArgs<1> args(cx); args[0].setObject(*self); @@ -1102,8 +1124,9 @@ DEFINE_GETTER_FUNCTIONS(ModuleObject, starExportEntries, StarExportEntriesSlot) DEFINE_GETTER_FUNCTIONS(ModuleObject, dfsIndex, DFSIndexSlot) DEFINE_GETTER_FUNCTIONS(ModuleObject, dfsAncestorIndex, DFSAncestorIndexSlot) -/* static */ bool GlobalObject::initModuleProto(JSContext* cx, - Handle global) { +/* static */ +bool GlobalObject::initModuleProto(JSContext* cx, + Handle global) { static const JSPropertySpec protoAccessors[] = { JS_PSG("namespace", ModuleObject_namespace_Getter, 0), JS_PSG("status", ModuleObject_statusGetter, 0), diff --git a/js/src/builtin/Promise.cpp b/js/src/builtin/Promise.cpp index 9d15a62974a3..d468a85e3999 100644 --- a/js/src/builtin/Promise.cpp +++ b/js/src/builtin/Promise.cpp @@ -2130,9 +2130,10 @@ static bool PromiseConstructor(JSContext* cx, unsigned argc, Value* vp) { } // ES2016, 25.4.3.1. steps 3-11. -/* static */ PromiseObject* PromiseObject::create( - JSContext* cx, HandleObject executor, HandleObject proto /* = nullptr */, - bool needsWrapping /* = false */) { +/* static */ +PromiseObject* PromiseObject::create(JSContext* cx, HandleObject executor, + HandleObject proto /* = nullptr */, + bool needsWrapping /* = false */) { MOZ_ASSERT(executor->isCallable()); RootedObject usedProto(cx, proto); @@ -2220,8 +2221,8 @@ static bool PromiseConstructor(JSContext* cx, unsigned argc, Value* vp) { // ES2016, 25.4.3.1. skipping creation of resolution functions and executor // function invocation. -/* static */ PromiseObject* PromiseObject::createSkippingExecutor( - JSContext* cx) { +/* static */ +PromiseObject* PromiseObject::createSkippingExecutor(JSContext* cx) { return CreatePromiseObjectWithoutResolutionFunctions(cx); } @@ -3175,8 +3176,8 @@ static bool Promise_reject(JSContext* cx, unsigned argc, Value* vp) { /** * Unforgeable version of ES2016, 25.4.4.4, Promise.reject. */ -/* static */ JSObject* PromiseObject::unforgeableReject(JSContext* cx, - HandleValue value) { +/* static */ +JSObject* PromiseObject::unforgeableReject(JSContext* cx, HandleValue value) { JSObject* promiseCtor = JS::GetPromiseConstructor(cx); if (!promiseCtor) { return nullptr; @@ -3204,8 +3205,8 @@ static bool Promise_static_resolve(JSContext* cx, unsigned argc, Value* vp) { /** * Unforgeable version of ES2016, 25.4.4.5, Promise.resolve. */ -/* static */ JSObject* PromiseObject::unforgeableResolve(JSContext* cx, - HandleValue value) { +/* static */ +JSObject* PromiseObject::unforgeableResolve(JSContext* cx, HandleValue value) { JSObject* promiseCtor = JS::GetPromiseConstructor(cx); if (!promiseCtor) { return nullptr; @@ -4485,9 +4486,9 @@ bool PromiseObject::dependentPromises(JSContext* cx, return true; } -/* static */ bool PromiseObject::resolve(JSContext* cx, - Handle promise, - HandleValue resolutionValue) { +/* static */ +bool PromiseObject::resolve(JSContext* cx, Handle promise, + HandleValue resolutionValue) { MOZ_ASSERT(!PromiseHasAnyFlag(*promise, PROMISE_FLAG_ASYNC)); if (promise->state() != JS::PromiseState::Pending) { return true; @@ -4515,9 +4516,9 @@ bool PromiseObject::dependentPromises(JSContext* cx, return Call(cx, funVal, UndefinedHandleValue, resolutionValue, &dummy); } -/* static */ bool PromiseObject::reject(JSContext* cx, - Handle promise, - HandleValue rejectionValue) { +/* static */ +bool PromiseObject::reject(JSContext* cx, Handle promise, + HandleValue rejectionValue) { MOZ_ASSERT(!PromiseHasAnyFlag(*promise, PROMISE_FLAG_ASYNC)); if (promise->state() != JS::PromiseState::Pending) { return true; @@ -4535,8 +4536,8 @@ bool PromiseObject::dependentPromises(JSContext* cx, return Call(cx, funVal, UndefinedHandleValue, rejectionValue, &dummy); } -/* static */ void PromiseObject::onSettled(JSContext* cx, - Handle promise) { +/* static */ +void PromiseObject::onSettled(JSContext* cx, Handle promise) { PromiseDebugInfo::setResolutionInfo(cx, promise); if (promise->state() == JS::PromiseState::Rejected && @@ -5039,7 +5040,8 @@ void OffThreadPromiseRuntimeState::init( MOZ_ASSERT(initialized()); } -/* static */ bool OffThreadPromiseRuntimeState::internalDispatchToEventLoop( +/* static */ +bool OffThreadPromiseRuntimeState::internalDispatchToEventLoop( void* closure, JS::Dispatchable* d) { OffThreadPromiseRuntimeState& state = *reinterpret_cast(closure); diff --git a/js/src/builtin/Stream.cpp b/js/src/builtin/Stream.cpp index 662d49a83f8f..cf5d54295b17 100644 --- a/js/src/builtin/Stream.cpp +++ b/js/src/builtin/Stream.cpp @@ -880,8 +880,9 @@ MOZ_MUST_USE ReadableStream* CreateReadableStream( /** * Streams spec, 3.3.5. InitializeReadableStream ( stream ) */ -MOZ_MUST_USE /* static */ ReadableStream* ReadableStream::create( - JSContext* cx, HandleObject proto /* = nullptr */) { +MOZ_MUST_USE /* static */ + ReadableStream* + ReadableStream::create(JSContext* cx, HandleObject proto /* = nullptr */) { // In the spec, InitializeReadableStream is always passed a newly created // ReadableStream object. We instead create it here and return it below. Rooted stream( diff --git a/js/src/builtin/String.cpp b/js/src/builtin/String.cpp index 7b37abc63073..e78b6458fd92 100644 --- a/js/src/builtin/String.cpp +++ b/js/src/builtin/String.cpp @@ -3693,8 +3693,9 @@ static const JSFunctionSpec string_static_methods[] = { JS_SELF_HOSTED_FN("localeCompare", "String_static_localeCompare", 2, 0), JS_FS_END}; -/* static */ Shape* StringObject::assignInitialShape( - JSContext* cx, Handle obj) { +/* static */ +Shape* StringObject::assignInitialShape(JSContext* cx, + Handle obj) { MOZ_ASSERT(obj->empty()); return NativeObject::addDataProperty(cx, obj, cx->names().length, LENGTH_SLOT, diff --git a/js/src/builtin/TypedObject.cpp b/js/src/builtin/TypedObject.cpp index c4535df0a9b4..298b9f30fa1e 100644 --- a/js/src/builtin/TypedObject.cpp +++ b/js/src/builtin/TypedObject.cpp @@ -259,7 +259,8 @@ bool ScalarTypeDescr::call(JSContext* cx, unsigned argc, Value* vp) { return true; } -/* static */ TypeDescr* GlobalObject::getOrCreateScalarTypeDescr( +/* static */ +TypeDescr* GlobalObject::getOrCreateScalarTypeDescr( JSContext* cx, Handle global, Scalar::Type scalarType) { int32_t slot = 0; switch (scalarType) { @@ -287,7 +288,8 @@ bool ScalarTypeDescr::call(JSContext* cx, unsigned argc, Value* vp) { return &module->getReservedSlot(slot).toObject().as(); } -/* static */ TypeDescr* GlobalObject::getOrCreateReferenceTypeDescr( +/* static */ +TypeDescr* GlobalObject::getOrCreateReferenceTypeDescr( JSContext* cx, Handle global, ReferenceType type) { int32_t slot = 0; switch (type) { @@ -762,9 +764,9 @@ CheckedInt32 StructMetaTypeDescr::Layout::close(int32_t* alignment) { return RoundUpToAlignment(sizeSoFar, structAlignment); } -/* static */ JSObject* StructMetaTypeDescr::create(JSContext* cx, - HandleObject metaTypeDescr, - HandleObject fields) { +/* static */ +JSObject* StructMetaTypeDescr::create(JSContext* cx, HandleObject metaTypeDescr, + HandleObject fields) { // Obtain names of fields, which are the own properties of `fields` AutoIdVector ids(cx); if (!GetPropertyKeys(cx, fields, JSITER_OWNONLY | JSITER_SYMBOLS, &ids)) { @@ -833,7 +835,8 @@ CheckedInt32 StructMetaTypeDescr::Layout::close(int32_t* alignment) { fieldProps); } -/* static */ StructTypeDescr* StructMetaTypeDescr::createFromArrays( +/* static */ +StructTypeDescr* StructMetaTypeDescr::createFromArrays( JSContext* cx, HandleObject structTypePrototype, bool opaque, bool allowConstruct, AutoIdVector& ids, AutoValueVector& fieldTypeObjs, Vector& fieldProps) { @@ -1313,8 +1316,9 @@ static JSObject* DefineMetaTypeDescr(JSContext* cx, const char* name, * initializer for the `TypedObject` class populate the * `TypedObject` global (which is referred to as "module" herein). */ -/* static */ bool GlobalObject::initTypedObjectModule( - JSContext* cx, Handle global) { +/* static */ +bool GlobalObject::initTypedObjectModule(JSContext* cx, + Handle global) { RootedObject objProto(cx, GlobalObject::getOrCreateObjectPrototype(cx, global)); if (!objProto) { @@ -1490,8 +1494,8 @@ bool TypedObject::isAttached() const { return true; } -/* static */ bool TypedObject::GetByteOffset(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool TypedObject::GetByteOffset(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); args.rval().setInt32( AssertedCast(args[0].toObject().as().offset())); @@ -1502,8 +1506,10 @@ bool TypedObject::isAttached() const { * Outline typed objects */ -/*static*/ OutlineTypedObject* OutlineTypedObject::createUnattached( - JSContext* cx, HandleTypeDescr descr, gc::InitialHeap heap) { +/*static*/ +OutlineTypedObject* OutlineTypedObject::createUnattached(JSContext* cx, + HandleTypeDescr descr, + gc::InitialHeap heap) { if (descr->opaque()) { return createUnattachedWithClass(cx, &OutlineOpaqueTypedObject::class_, descr, heap); @@ -1539,7 +1545,8 @@ void OutlineTypedObject::setOwnerAndData(JSObject* owner, uint8_t* data) { } } -/*static*/ OutlineTypedObject* OutlineTypedObject::createUnattachedWithClass( +/*static*/ +OutlineTypedObject* OutlineTypedObject::createUnattachedWithClass( JSContext* cx, const Class* clasp, HandleTypeDescr descr, gc::InitialHeap heap) { MOZ_ASSERT(clasp == &OutlineTransparentTypedObject::class_ || @@ -1606,7 +1613,8 @@ void OutlineTypedObject::attach(JSContext* cx, TypedObject& typedObj, } } -/*static*/ OutlineTypedObject* OutlineTypedObject::createDerived( +/*static*/ +OutlineTypedObject* OutlineTypedObject::createDerived( JSContext* cx, HandleTypeDescr type, HandleTypedObject typedObj, uint32_t offset) { MOZ_ASSERT(offset <= typedObj->size()); @@ -1625,9 +1633,9 @@ void OutlineTypedObject::attach(JSContext* cx, TypedObject& typedObj, return obj; } -/*static*/ TypedObject* TypedObject::createZeroed(JSContext* cx, - HandleTypeDescr descr, - gc::InitialHeap heap) { +/*static*/ +TypedObject* TypedObject::createZeroed(JSContext* cx, HandleTypeDescr descr, + gc::InitialHeap heap) { // If possible, create an object with inline data. if (InlineTypedObject::canAccommodateType(descr)) { AutoSetNewObjectMetadata metadata(cx); @@ -1660,8 +1668,8 @@ void OutlineTypedObject::attach(JSContext* cx, TypedObject& typedObj, return obj; } -/* static */ void OutlineTypedObject::obj_trace(JSTracer* trc, - JSObject* object) { +/* static */ +void OutlineTypedObject::obj_trace(JSTracer* trc, JSObject* object) { OutlineTypedObject& typedObj = object->as(); TraceEdge(trc, typedObj.shapePtr(), "OutlineTypedObject_shape"); @@ -1722,9 +1730,10 @@ bool TypeDescr::hasProperty(const JSAtomState& names, jsid id) { MOZ_CRASH("Unexpected kind"); } -/* static */ bool TypedObject::obj_lookupProperty( - JSContext* cx, HandleObject obj, HandleId id, MutableHandleObject objp, - MutableHandle propp) { +/* static */ +bool TypedObject::obj_lookupProperty(JSContext* cx, HandleObject obj, + HandleId id, MutableHandleObject objp, + MutableHandle propp) { if (obj->as().typeDescr().hasProperty(cx->names(), id)) { propp.setNonNativeProperty(); objp.set(obj); @@ -1877,11 +1886,11 @@ bool TypedObject::obj_getElement(JSContext* cx, HandleObject obj, return GetElement(cx, proto, receiver, index, vp); } -/*static*/ bool TypedObject::obj_getArrayElement(JSContext* cx, - Handle typedObj, - Handle typeDescr, - uint32_t index, - MutableHandleValue vp) { +/*static*/ +bool TypedObject::obj_getArrayElement(JSContext* cx, + Handle typedObj, + Handle typeDescr, + uint32_t index, MutableHandleValue vp) { // Elements are not inherited from the prototype. if (index >= (size_t)typedObj->length()) { vp.setUndefined(); @@ -2117,8 +2126,10 @@ void OutlineTypedObject::notifyBufferDetached(void* newData) { * Inline typed objects */ -/* static */ InlineTypedObject* InlineTypedObject::create( - JSContext* cx, HandleTypeDescr descr, gc::InitialHeap heap) { +/* static */ +InlineTypedObject* InlineTypedObject::create(JSContext* cx, + HandleTypeDescr descr, + gc::InitialHeap heap) { gc::AllocKind allocKind = allocKindForTypeDescriptor(descr); const Class* clasp = descr->opaque() ? &InlineOpaqueTypedObject::class_ @@ -2136,7 +2147,8 @@ void OutlineTypedObject::notifyBufferDetached(void* newData) { return NewObjectWithGroup(cx, group, allocKind, newKind); } -/* static */ InlineTypedObject* InlineTypedObject::createCopy( +/* static */ +InlineTypedObject* InlineTypedObject::createCopy( JSContext* cx, Handle templateObject, gc::InitialHeap heap) { AutoSetNewObjectMetadata metadata(cx); @@ -2152,8 +2164,8 @@ void OutlineTypedObject::notifyBufferDetached(void* newData) { return res; } -/* static */ void InlineTypedObject::obj_trace(JSTracer* trc, - JSObject* object) { +/* static */ +void InlineTypedObject::obj_trace(JSTracer* trc, JSObject* object) { InlineTypedObject& typedObj = object->as(); TraceEdge(trc, typedObj.shapePtr(), "InlineTypedObject_shape"); @@ -2168,7 +2180,8 @@ void OutlineTypedObject::notifyBufferDetached(void* newData) { typedObj.typeDescr().traceInstances(trc, typedObj.inlineTypedMem(), 1); } -/* static */ size_t InlineTypedObject::obj_moved(JSObject* dst, JSObject* src) { +/* static */ +size_t InlineTypedObject::obj_moved(JSObject* dst, JSObject* src) { if (!IsInsideNursery(src)) { return 0; } @@ -2240,8 +2253,8 @@ DEFINE_TYPEDOBJ_CLASS(InlineTransparentTypedObject, DEFINE_TYPEDOBJ_CLASS(InlineOpaqueTypedObject, InlineTypedObject::obj_trace, InlineTypedObject::obj_moved); -/*static*/ bool TypedObject::construct(JSContext* cx, unsigned int argc, - Value* vp) { +/*static*/ +bool TypedObject::construct(JSContext* cx, unsigned int argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); MOZ_ASSERT(args.callee().is()); @@ -2900,7 +2913,8 @@ static bool CreateTraceList(JSContext* cx, HandleTypeDescr descr) { return true; } -/* static */ void TypeDescr::finalize(FreeOp* fop, JSObject* obj) { +/* static */ +void TypeDescr::finalize(FreeOp* fop, JSObject* obj) { TypeDescr& descr = obj->as(); if (descr.hasTraceList()) { js_free(const_cast(descr.traceList())); diff --git a/js/src/builtin/WeakMapObject.cpp b/js/src/builtin/WeakMapObject.cpp index 17e74a048b55..360b3d373038 100644 --- a/js/src/builtin/WeakMapObject.cpp +++ b/js/src/builtin/WeakMapObject.cpp @@ -44,7 +44,8 @@ using namespace js; return true; } -/* static */ bool WeakMapObject::has(JSContext* cx, unsigned argc, Value* vp) { +/* static */ +bool WeakMapObject::has(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); @@ -72,7 +73,8 @@ using namespace js; return true; } -/* static */ bool WeakMapObject::get(JSContext* cx, unsigned argc, Value* vp) { +/* static */ +bool WeakMapObject::get(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); @@ -101,8 +103,8 @@ using namespace js; return true; } -/* static */ bool WeakMapObject::delete_(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool WeakMapObject::delete_(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod( cx, args); @@ -127,7 +129,8 @@ using namespace js; return true; } -/* static */ bool WeakMapObject::set(JSContext* cx, unsigned argc, Value* vp) { +/* static */ +bool WeakMapObject::set(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); @@ -217,8 +220,8 @@ JS_PUBLIC_API bool JS::SetWeakMapEntry(JSContext* cx, HandleObject mapObj, return WeakCollectionPutEntryInternal(cx, rootedMap, key, val); } -/* static */ bool WeakMapObject::construct(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool WeakMapObject::construct(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); // ES6 draft rev 31 (15 Jan 2015) 23.3.1.1 step 1. diff --git a/js/src/builtin/WeakSetObject.cpp b/js/src/builtin/WeakSetObject.cpp index f232985e7dfc..5cb984bea336 100644 --- a/js/src/builtin/WeakSetObject.cpp +++ b/js/src/builtin/WeakSetObject.cpp @@ -50,7 +50,8 @@ using namespace js; return true; } -/* static */ bool WeakSetObject::add(JSContext* cx, unsigned argc, Value* vp) { +/* static */ +bool WeakSetObject::add(JSContext* cx, unsigned argc, Value* vp) { // Steps 1-3. CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, @@ -85,8 +86,8 @@ using namespace js; return true; } -/* static */ bool WeakSetObject::delete_(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool WeakSetObject::delete_(JSContext* cx, unsigned argc, Value* vp) { // Steps 1-3. CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod( @@ -120,7 +121,8 @@ using namespace js; return true; } -/* static */ bool WeakSetObject::has(JSContext* cx, unsigned argc, Value* vp) { +/* static */ +bool WeakSetObject::has(JSContext* cx, unsigned argc, Value* vp) { // Steps 1-3. CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, diff --git a/js/src/builtin/intl/IntlObject.cpp b/js/src/builtin/intl/IntlObject.cpp index 06ac7a25aaab..5967bd4daf0c 100644 --- a/js/src/builtin/intl/IntlObject.cpp +++ b/js/src/builtin/intl/IntlObject.cpp @@ -519,8 +519,8 @@ static const JSFunctionSpec intl_static_methods[] = { * Initializes the Intl Object and its standard built-in properties. * Spec: ECMAScript Internationalization API Specification, 8.0, 8.1 */ -/* static */ bool GlobalObject::initIntlObject(JSContext* cx, - Handle global) { +/* static */ +bool GlobalObject::initIntlObject(JSContext* cx, Handle global) { RootedObject proto(cx, GlobalObject::getOrCreateObjectPrototype(cx, global)); if (!proto) { return false; diff --git a/js/src/ctypes/CTypes.cpp b/js/src/ctypes/CTypes.cpp index ac81ef5e8c5a..6683db1082cd 100644 --- a/js/src/ctypes/CTypes.cpp +++ b/js/src/ctypes/CTypes.cpp @@ -6222,7 +6222,8 @@ JSObject* StructType::BuildFieldsArray(JSContext* cx, JSObject* obj) { return fieldsProp; } -/* static */ bool StructType::IsStruct(HandleValue v) { +/* static */ +bool StructType::IsStruct(HandleValue v) { if (!v.isObject()) { return false; } diff --git a/js/src/frontend/BinSourceRuntimeSupport.cpp b/js/src/frontend/BinSourceRuntimeSupport.cpp index 872f0c28ce15..a615377171d9 100644 --- a/js/src/frontend/BinSourceRuntimeSupport.cpp +++ b/js/src/frontend/BinSourceRuntimeSupport.cpp @@ -13,7 +13,8 @@ namespace js { namespace frontend { -/* static */ BinASTSourceMetadata* BinASTSourceMetadata::Create( +/* static */ +BinASTSourceMetadata* BinASTSourceMetadata::Create( const Vector& binKinds, uint32_t numStrings) { uint32_t numBinKinds = binKinds.length(); diff --git a/js/src/frontend/EmitterScope.cpp b/js/src/frontend/EmitterScope.cpp index 199bfbf7e927..7c31ab46438e 100644 --- a/js/src/frontend/EmitterScope.cpp +++ b/js/src/frontend/EmitterScope.cpp @@ -129,8 +129,8 @@ Scope* EmitterScope::enclosingScope(BytecodeEmitter* bce) const { return bce->sc->compilationEnclosingScope(); } -/* static */ bool EmitterScope::nameCanBeFree(BytecodeEmitter* bce, - JSAtom* name) { +/* static */ +bool EmitterScope::nameCanBeFree(BytecodeEmitter* bce, JSAtom* name) { // '.generator' cannot be accessed by name. return name != bce->cx->names().dotGenerator; } @@ -167,9 +167,9 @@ static bool NameIsOnEnvironment(Scope* scope, JSAtom* name) { } #endif -/* static */ NameLocation EmitterScope::searchInEnclosingScope(JSAtom* name, - Scope* scope, - uint8_t hops) { +/* static */ +NameLocation EmitterScope::searchInEnclosingScope(JSAtom* name, Scope* scope, + uint8_t hops) { for (ScopeIter si(scope); si; si++) { MOZ_ASSERT(NameIsOnEnvironment(si.scope(), name)); diff --git a/js/src/frontend/ParseNode.cpp b/js/src/frontend/ParseNode.cpp index add870d7c951..f99f316cea91 100644 --- a/js/src/frontend/ParseNode.cpp +++ b/js/src/frontend/ParseNode.cpp @@ -407,8 +407,8 @@ FunctionBox* ObjectBox::asFunctionBox() { return static_cast(this); } -/* static */ void TraceListNode::TraceList(JSTracer* trc, - TraceListNode* listHead) { +/* static */ +void TraceListNode::TraceList(JSTracer* trc, TraceListNode* listHead) { for (TraceListNode* node = listHead; node; node = node->traceLink) { node->trace(trc); } diff --git a/js/src/gc/Allocator.cpp b/js/src/gc/Allocator.cpp index 4fdd4f23cc87..e907aa3c5381 100644 --- a/js/src/gc/Allocator.cpp +++ b/js/src/gc/Allocator.cpp @@ -260,8 +260,9 @@ FOR_EACH_NONOBJECT_NONNURSERY_ALLOCKIND(DECL_ALLOCATOR_INSTANCES) #undef DECL_ALLOCATOR_INSTANCES template -/* static */ T* GCRuntime::tryNewTenuredThing(JSContext* cx, AllocKind kind, - size_t thingSize) { +/* static */ +T* GCRuntime::tryNewTenuredThing(JSContext* cx, AllocKind kind, + size_t thingSize) { // Bump allocate in the arena's current free-list span. T* t = reinterpret_cast(cx->freeLists().allocate(kind)); if (MOZ_UNLIKELY(!t)) { @@ -358,7 +359,8 @@ bool GCRuntime::gcIfNeededAtAllocation(JSContext* cx) { } template -/* static */ void GCRuntime::checkIncrementalZoneState(JSContext* cx, T* t) { +/* static */ +void GCRuntime::checkIncrementalZoneState(JSContext* cx, T* t) { #ifdef DEBUG if (cx->helperThread() || !t) { return; @@ -401,8 +403,9 @@ bool GCRuntime::startBackgroundAllocTaskIfIdle() { return allocTask.startWithLockHeld(helperLock); } -/* static */ TenuredCell* GCRuntime::refillFreeListFromAnyThread( - JSContext* cx, AllocKind thingKind) { +/* static */ +TenuredCell* GCRuntime::refillFreeListFromAnyThread(JSContext* cx, + AllocKind thingKind) { MOZ_ASSERT(cx->freeLists().isEmpty(thingKind)); if (!cx->helperThread()) { @@ -412,8 +415,9 @@ bool GCRuntime::startBackgroundAllocTaskIfIdle() { return refillFreeListFromHelperThread(cx, thingKind); } -/* static */ TenuredCell* GCRuntime::refillFreeListFromMainThread( - JSContext* cx, AllocKind thingKind) { +/* static */ +TenuredCell* GCRuntime::refillFreeListFromMainThread(JSContext* cx, + AllocKind thingKind) { // It should not be possible to allocate on the main thread while we are // inside a GC. MOZ_ASSERT(!JS::RuntimeHeapIsBusy(), "allocating while under GC"); @@ -422,8 +426,9 @@ bool GCRuntime::startBackgroundAllocTaskIfIdle() { cx->freeLists(), thingKind, ShouldCheckThresholds::CheckThresholds); } -/* static */ TenuredCell* GCRuntime::refillFreeListFromHelperThread( - JSContext* cx, AllocKind thingKind) { +/* static */ +TenuredCell* GCRuntime::refillFreeListFromHelperThread(JSContext* cx, + AllocKind thingKind) { // A GC may be happening on the main thread, but zones used by off thread // tasks are never collected. Zone* zone = cx->zone(); @@ -433,8 +438,8 @@ bool GCRuntime::startBackgroundAllocTaskIfIdle() { cx->freeLists(), thingKind, ShouldCheckThresholds::CheckThresholds); } -/* static */ TenuredCell* GCRuntime::refillFreeListInGC(Zone* zone, - AllocKind thingKind) { +/* static */ +TenuredCell* GCRuntime::refillFreeListInGC(Zone* zone, AllocKind thingKind) { // Called by compacting GC to refill a free list while we are in a GC. MOZ_ASSERT(JS::RuntimeHeapIsCollecting()); MOZ_ASSERT_IF(!JS::RuntimeHeapIsMinorCollecting(), @@ -717,7 +722,8 @@ void BackgroundAllocTask::run() { } } -/* static */ Chunk* Chunk::allocate(JSRuntime* rt) { +/* static */ +Chunk* Chunk::allocate(JSRuntime* rt) { Chunk* chunk = static_cast(MapAlignedPages(ChunkSize, ChunkSize)); if (!chunk) { return nullptr; diff --git a/js/src/gc/GC.cpp b/js/src/gc/GC.cpp index 2284f19589b7..123b70be1df2 100644 --- a/js/src/gc/GC.cpp +++ b/js/src/gc/GC.cpp @@ -539,7 +539,8 @@ void Arena::checkNoMarkedFreeCells() { } #endif -/* static */ void Arena::staticAsserts() { +/* static */ +void Arena::staticAsserts() { static_assert(size_t(AllocKind::LIMIT) <= 255, "We must be able to fit the allockind into uint8_t."); static_assert(mozilla::ArrayLength(ThingSizes) == size_t(AllocKind::LIMIT), @@ -1943,7 +1944,8 @@ float ZoneHeapThreshold::eagerAllocTrigger(bool highFrequencyGC) const { return eagerTriggerFactor * gcTriggerBytes(); } -/* static */ float ZoneHeapThreshold::computeZoneHeapGrowthFactorForHeapSize( +/* static */ +float ZoneHeapThreshold::computeZoneHeapGrowthFactorForHeapSize( size_t lastBytes, const GCSchedulingTunables& tunables, const GCSchedulingState& state) { if (!tunables.isDynamicHeapGrowthEnabled()) { @@ -1994,7 +1996,8 @@ float ZoneHeapThreshold::eagerAllocTrigger(bool highFrequencyGC) const { return factor; } -/* static */ size_t ZoneHeapThreshold::computeZoneTriggerBytes( +/* static */ +size_t ZoneHeapThreshold::computeZoneTriggerBytes( float growthFactor, size_t lastBytes, JSGCInvocationKind gckind, const GCSchedulingTunables& tunables, const AutoLockGC& lock) { size_t base = @@ -3082,8 +3085,9 @@ inline void ArenaLists::queueForBackgroundSweep(AllocKind thingKind) { concurrentUse(thingKind) = ConcurrentUse::BackgroundFinalize; } -/*static*/ void ArenaLists::backgroundFinalize(FreeOp* fop, Arena* listHead, - Arena** empty) { +/*static*/ +void ArenaLists::backgroundFinalize(FreeOp* fop, Arena* listHead, + Arena** empty) { MOZ_ASSERT(listHead); MOZ_ASSERT(empty); @@ -3686,7 +3690,8 @@ void GCRuntime::freeFromBackgroundThread(AutoLockHelperThreadState& lock) { void GCRuntime::waitBackgroundFreeEnd() { freeTask.join(); } -/* static */ bool UniqueIdGCPolicy::needsSweep(Cell** cellp, uint64_t*) { +/* static */ +bool UniqueIdGCPolicy::needsSweep(Cell** cellp, uint64_t*) { Cell* cell = *cellp; return MapGCThingTyped(cell, cell->getTraceKind(), [](auto t) { mozilla::DebugOnly prior = t; @@ -5019,7 +5024,8 @@ static bool IsGrayListObject(JSObject* obj) { return obj->is() && !IsDeadProxyObject(obj); } -/* static */ unsigned ProxyObject::grayLinkReservedSlot(JSObject* obj) { +/* static */ +unsigned ProxyObject::grayLinkReservedSlot(JSObject* obj) { MOZ_ASSERT(IsGrayListObject(obj)); return CrossCompartmentWrapperObject::GrayLinkReservedSlot; } diff --git a/js/src/gc/Nursery.cpp b/js/src/gc/Nursery.cpp index 959b19fd86dd..fa62c9f68f16 100644 --- a/js/src/gc/Nursery.cpp +++ b/js/src/gc/Nursery.cpp @@ -86,8 +86,8 @@ inline void js::NurseryChunk::poisonAfterSweep(size_t extent) { Poison(this, JS_SWEPT_NURSERY_PATTERN, extent, MemCheckKind::MakeNoAccess); } -/* static */ inline js::NurseryChunk* js::NurseryChunk::fromChunk( - Chunk* chunk) { +/* static */ +inline js::NurseryChunk* js::NurseryChunk::fromChunk(Chunk* chunk) { return reinterpret_cast(chunk); } @@ -658,7 +658,8 @@ void js::Nursery::renderProfileJSON(JSONPrinter& json) const { json.endObject(); } -/* static */ void js::Nursery::printProfileHeader() { +/* static */ +void js::Nursery::printProfileHeader() { fprintf(stderr, "MinorGC: Reason PRate Size "); #define PRINT_HEADER(name, text) fprintf(stderr, " %6s", text); FOR_EACH_NURSERY_PROFILE_TIME(PRINT_HEADER) @@ -666,8 +667,8 @@ void js::Nursery::renderProfileJSON(JSONPrinter& json) const { fprintf(stderr, "\n"); } -/* static */ void js::Nursery::printProfileDurations( - const ProfileDurations& times) { +/* static */ +void js::Nursery::printProfileDurations(const ProfileDurations& times) { for (auto time : times) { fprintf(stderr, " %6" PRIi64, static_cast(time.ToMicroseconds())); } diff --git a/js/src/gc/RootMarking.cpp b/js/src/gc/RootMarking.cpp index d3eb1461ed5e..3d9363a236a7 100644 --- a/js/src/gc/RootMarking.cpp +++ b/js/src/gc/RootMarking.cpp @@ -217,13 +217,15 @@ inline void AutoGCRooter::trace(JSTracer* trc) { MOZ_CRASH("Bad AutoGCRooter::Tag"); } -/* static */ void AutoGCRooter::traceAll(JSContext* cx, JSTracer* trc) { +/* static */ +void AutoGCRooter::traceAll(JSContext* cx, JSTracer* trc) { for (AutoGCRooter* gcr = cx->autoGCRooters_; gcr; gcr = gcr->down) { gcr->trace(trc); } } -/* static */ void AutoGCRooter::traceAllWrappers(JSContext* cx, JSTracer* trc) { +/* static */ +void AutoGCRooter::traceAllWrappers(JSContext* cx, JSTracer* trc) { for (AutoGCRooter* gcr = cx->autoGCRooters_; gcr; gcr = gcr->down) { if (gcr->tag_ == Tag::WrapperVector || gcr->tag_ == Tag::Wrapper) { gcr->trace(trc); diff --git a/js/src/gc/Statistics.cpp b/js/src/gc/Statistics.cpp index 5edcd50466b0..75462f0b8521 100644 --- a/js/src/gc/Statistics.cpp +++ b/js/src/gc/Statistics.cpp @@ -814,7 +814,8 @@ Statistics::~Statistics() { } } -/* static */ bool Statistics::initialize() { +/* static */ +bool Statistics::initialize() { #ifdef DEBUG // Sanity check generated tables. for (auto i : AllPhases()) { @@ -1463,7 +1464,8 @@ void Statistics::printProfileHeader() { fprintf(stderr, "\n"); } -/* static */ void Statistics::printProfileTimes(const ProfileDurations& times) { +/* static */ +void Statistics::printProfileTimes(const ProfileDurations& times) { for (auto time : times) { fprintf(stderr, " %6" PRIi64, static_cast(time.ToMilliseconds())); } diff --git a/js/src/jit/BaselineDebugModeOSR.cpp b/js/src/jit/BaselineDebugModeOSR.cpp index dca755422c84..ac1fe0c81691 100644 --- a/js/src/jit/BaselineDebugModeOSR.cpp +++ b/js/src/jit/BaselineDebugModeOSR.cpp @@ -1022,8 +1022,10 @@ JitCode* JitRuntime::generateBaselineDebugModeOSRHandler( return code; } -/* static */ void DebugModeOSRVolatileJitFrameIter::forwardLiveIterators( - JSContext* cx, uint8_t* oldAddr, uint8_t* newAddr) { +/* static */ +void DebugModeOSRVolatileJitFrameIter::forwardLiveIterators(JSContext* cx, + uint8_t* oldAddr, + uint8_t* newAddr) { DebugModeOSRVolatileJitFrameIter* iter; for (iter = cx->liveVolatileJitFrameIter_; iter; iter = iter->prev) { if (iter->isWasm()) { diff --git a/js/src/jit/BaselineIC.cpp b/js/src/jit/BaselineIC.cpp index 2bdfc5b7425e..f3ac969f9585 100644 --- a/js/src/jit/BaselineIC.cpp +++ b/js/src/jit/BaselineIC.cpp @@ -108,8 +108,8 @@ void ICEntry::trace(JSTracer* trc) { } } -/* static */ UniquePtr ICScript::create(JSContext* cx, - JSScript* script) { +/* static */ +UniquePtr ICScript::create(JSContext* cx, JSScript* script) { MOZ_ASSERT(cx->realm()->jitRealm()); MOZ_ASSERT(jit::IsBaselineEnabled(cx)); @@ -463,7 +463,8 @@ void ICStubIterator::unlink(JSContext* cx) { unlinked_ = true; } -/* static */ bool ICStub::NonCacheIRStubMakesGCCalls(Kind kind) { +/* static */ +bool ICStub::NonCacheIRStubMakesGCCalls(Kind kind) { MOZ_ASSERT(IsValidKind(kind)); MOZ_ASSERT(!IsCacheIRKind(kind)); @@ -514,7 +515,8 @@ void ICStub::updateCode(JitCode* code) { stubCode_ = code->raw(); } -/* static */ void ICStub::trace(JSTracer* trc) { +/* static */ +void ICStub::trace(JSTracer* trc) { traceCode(trc, "shared-stub-jitcode"); // If the stub is a monitored fallback stub, then trace the monitor ICs @@ -1043,8 +1045,9 @@ bool ICUpdatedStub::initUpdatingChain(JSContext* cx, ICStubSpace* space) { return true; } -/* static */ ICStubSpace* ICStubCompiler::StubSpaceForStub(bool makesGCCalls, - JSScript* script) { +/* static */ +ICStubSpace* ICStubCompiler::StubSpaceForStub(bool makesGCCalls, + JSScript* script) { if (makesGCCalls) { return script->icScript()->fallbackStubSpace(); } diff --git a/js/src/jit/CompileWrappers.cpp b/js/src/jit/CompileWrappers.cpp index d2e9a9ddb3d6..2a5ef7d2b0e3 100644 --- a/js/src/jit/CompileWrappers.cpp +++ b/js/src/jit/CompileWrappers.cpp @@ -19,7 +19,8 @@ JSRuntime* CompileRuntime::runtime() { return reinterpret_cast(this); } -/* static */ CompileRuntime* CompileRuntime::get(JSRuntime* rt) { +/* static */ +CompileRuntime* CompileRuntime::get(JSRuntime* rt) { return reinterpret_cast(rt); } @@ -99,7 +100,8 @@ bool CompileRuntime::runtimeMatches(JSRuntime* rt) { return rt == runtime(); } Zone* CompileZone::zone() { return reinterpret_cast(this); } -/* static */ CompileZone* CompileZone::get(Zone* zone) { +/* static */ +CompileZone* CompileZone::get(Zone* zone) { return reinterpret_cast(zone); } @@ -168,7 +170,8 @@ void CompileZone::setMinorGCShouldCancelIonCompilations() { JS::Realm* CompileRealm::realm() { return reinterpret_cast(this); } -/* static */ CompileRealm* CompileRealm::get(JS::Realm* realm) { +/* static */ +CompileRealm* CompileRealm::get(JS::Realm* realm) { return reinterpret_cast(realm); } diff --git a/js/src/jit/ExecutableAllocator.cpp b/js/src/jit/ExecutableAllocator.cpp index 1cc6bea766bd..394c68146119 100644 --- a/js/src/jit/ExecutableAllocator.cpp +++ b/js/src/jit/ExecutableAllocator.cpp @@ -154,8 +154,9 @@ ExecutablePool* ExecutableAllocator::poolForSize(size_t n) { return pool; } -/* static */ size_t ExecutableAllocator::roundUpAllocationSize( - size_t request, size_t granularity) { +/* static */ +size_t ExecutableAllocator::roundUpAllocationSize(size_t request, + size_t granularity) { if ((std::numeric_limits::max() - granularity) <= request) { return OVERSIZE_ALLOCATION; } @@ -257,16 +258,18 @@ void ExecutableAllocator::addSizeOfCode(JS::CodeSizes* sizes) const { } } -/* static */ void ExecutableAllocator::reprotectPool( - JSRuntime* rt, ExecutablePool* pool, ProtectionSetting protection) { +/* static */ +void ExecutableAllocator::reprotectPool(JSRuntime* rt, ExecutablePool* pool, + ProtectionSetting protection) { char* start = pool->m_allocation.pages; if (!ReprotectRegion(start, pool->m_freePtr - start, protection)) { MOZ_CRASH(); } } -/* static */ void ExecutableAllocator::poisonCode( - JSRuntime* rt, JitPoisonRangeVector& ranges) { +/* static */ +void ExecutableAllocator::poisonCode(JSRuntime* rt, + JitPoisonRangeVector& ranges) { MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt)); #ifdef DEBUG diff --git a/js/src/jit/Ion.cpp b/js/src/jit/Ion.cpp index 7f87a9608d95..1fdf87da114e 100644 --- a/js/src/jit/Ion.cpp +++ b/js/src/jit/Ion.cpp @@ -532,8 +532,8 @@ uint8_t* jit::LazyLinkTopActivation(JSContext* cx, return calleeScript->jitCodeRaw(); } -/* static */ void JitRuntime::Trace(JSTracer* trc, - const AutoAccessAtomsZone& access) { +/* static */ +void JitRuntime::Trace(JSTracer* trc, const AutoAccessAtomsZone& access) { MOZ_ASSERT(!JS::RuntimeHeapIsMinorCollecting()); // Shared stubs are allocated in the atoms zone, so do not iterate @@ -549,7 +549,8 @@ uint8_t* jit::LazyLinkTopActivation(JSContext* cx, } } -/* static */ void JitRuntime::TraceJitcodeGlobalTableForMinorGC(JSTracer* trc) { +/* static */ +void JitRuntime::TraceJitcodeGlobalTableForMinorGC(JSTracer* trc) { if (trc->runtime()->geckoProfiler().enabled() && trc->runtime()->hasJitRuntime() && trc->runtime()->jitRuntime()->hasJitcodeGlobalTable()) { @@ -557,8 +558,8 @@ uint8_t* jit::LazyLinkTopActivation(JSContext* cx, } } -/* static */ bool JitRuntime::MarkJitcodeGlobalTableIteratively( - GCMarker* marker) { +/* static */ +bool JitRuntime::MarkJitcodeGlobalTableIteratively(GCMarker* marker) { if (marker->runtime()->hasJitRuntime() && marker->runtime()->jitRuntime()->hasJitcodeGlobalTable()) { return marker->runtime() @@ -569,7 +570,8 @@ uint8_t* jit::LazyLinkTopActivation(JSContext* cx, return false; } -/* static */ void JitRuntime::SweepJitcodeGlobalTable(JSRuntime* rt) { +/* static */ +void JitRuntime::SweepJitcodeGlobalTable(JSRuntime* rt) { if (rt->hasJitRuntime() && rt->jitRuntime()->hasJitcodeGlobalTable()) { rt->jitRuntime()->getJitcodeGlobalTable()->sweep(rt); } @@ -904,7 +906,8 @@ void IonScript::trace(JSTracer* trc) { } } -/* static */ void IonScript::writeBarrierPre(Zone* zone, IonScript* ionScript) { +/* static */ +void IonScript::writeBarrierPre(Zone* zone, IonScript* ionScript) { if (zone->needsIncrementalBarrier()) { ionScript->trace(zone->barrierTracer()); } diff --git a/js/src/jit/IonIC.cpp b/js/src/jit/IonIC.cpp index 2336760168ff..30abfcb0e1b7 100644 --- a/js/src/jit/IonIC.cpp +++ b/js/src/jit/IonIC.cpp @@ -115,11 +115,10 @@ void IonIC::trace(JSTracer* trc) { MOZ_ASSERT(nextCodeRaw == fallbackLabel_.raw()); } -/* static */ bool IonGetPropertyIC::update(JSContext* cx, - HandleScript outerScript, - IonGetPropertyIC* ic, - HandleValue val, HandleValue idVal, - MutableHandleValue res) { +/* static */ +bool IonGetPropertyIC::update(JSContext* cx, HandleScript outerScript, + IonGetPropertyIC* ic, HandleValue val, + HandleValue idVal, MutableHandleValue res) { // Override the return value if we are invalidated (bug 728188). IonScript* ionScript = outerScript->ionScript(); AutoDetectInvalidation adi(cx, res, ionScript); @@ -199,10 +198,11 @@ void IonIC::trace(JSTracer* trc) { return true; } -/* static */ bool IonGetPropSuperIC::update( - JSContext* cx, HandleScript outerScript, IonGetPropSuperIC* ic, - HandleObject obj, HandleValue receiver, HandleValue idVal, - MutableHandleValue res) { +/* static */ +bool IonGetPropSuperIC::update(JSContext* cx, HandleScript outerScript, + IonGetPropSuperIC* ic, HandleObject obj, + HandleValue receiver, HandleValue idVal, + MutableHandleValue res) { // Override the return value if we are invalidated (bug 728188). IonScript* ionScript = outerScript->ionScript(); AutoDetectInvalidation adi(cx, res, ionScript); @@ -242,11 +242,10 @@ void IonIC::trace(JSTracer* trc) { return true; } -/* static */ bool IonSetPropertyIC::update(JSContext* cx, - HandleScript outerScript, - IonSetPropertyIC* ic, - HandleObject obj, HandleValue idVal, - HandleValue rhs) { +/* static */ +bool IonSetPropertyIC::update(JSContext* cx, HandleScript outerScript, + IonSetPropertyIC* ic, HandleObject obj, + HandleValue idVal, HandleValue rhs) { RootedShape oldShape(cx); RootedObjectGroup oldGroup(cx); IonScript* ionScript = outerScript->ionScript(); @@ -384,9 +383,10 @@ static void TryAttachIonStub(JSContext* cx, IC* ic, IonScript* ionScript, } } -/* static */ bool IonGetNameIC::update(JSContext* cx, HandleScript outerScript, - IonGetNameIC* ic, HandleObject envChain, - MutableHandleValue res) { +/* static */ +bool IonGetNameIC::update(JSContext* cx, HandleScript outerScript, + IonGetNameIC* ic, HandleObject envChain, + MutableHandleValue res) { IonScript* ionScript = outerScript->ionScript(); jsbytecode* pc = ic->pc(); RootedPropertyName name(cx, ic->script()->getName(pc)); @@ -417,10 +417,9 @@ static void TryAttachIonStub(JSContext* cx, IC* ic, IonScript* ionScript, return true; } -/* static */ JSObject* IonBindNameIC::update(JSContext* cx, - HandleScript outerScript, - IonBindNameIC* ic, - HandleObject envChain) { +/* static */ +JSObject* IonBindNameIC::update(JSContext* cx, HandleScript outerScript, + IonBindNameIC* ic, HandleObject envChain) { IonScript* ionScript = outerScript->ionScript(); jsbytecode* pc = ic->pc(); RootedPropertyName name(cx, ic->script()->getName(pc)); @@ -436,10 +435,9 @@ static void TryAttachIonStub(JSContext* cx, IC* ic, IonScript* ionScript, return holder; } -/* static */ JSObject* IonGetIteratorIC::update(JSContext* cx, - HandleScript outerScript, - IonGetIteratorIC* ic, - HandleValue value) { +/* static */ +JSObject* IonGetIteratorIC::update(JSContext* cx, HandleScript outerScript, + IonGetIteratorIC* ic, HandleValue value) { IonScript* ionScript = outerScript->ionScript(); TryAttachIonStub(cx, ic, ionScript, @@ -448,9 +446,10 @@ static void TryAttachIonStub(JSContext* cx, IC* ic, IonScript* ionScript, return ValueToIterator(cx, value); } -/* static */ bool IonHasOwnIC::update(JSContext* cx, HandleScript outerScript, - IonHasOwnIC* ic, HandleValue val, - HandleValue idVal, int32_t* res) { +/* static */ +bool IonHasOwnIC::update(JSContext* cx, HandleScript outerScript, + IonHasOwnIC* ic, HandleValue val, HandleValue idVal, + int32_t* res) { IonScript* ionScript = outerScript->ionScript(); TryAttachIonStub( @@ -465,9 +464,9 @@ static void TryAttachIonStub(JSContext* cx, IC* ic, IonScript* ionScript, return true; } -/* static */ bool IonInIC::update(JSContext* cx, HandleScript outerScript, - IonInIC* ic, HandleValue key, - HandleObject obj, bool* res) { +/* static */ +bool IonInIC::update(JSContext* cx, HandleScript outerScript, IonInIC* ic, + HandleValue key, HandleObject obj, bool* res) { IonScript* ionScript = outerScript->ionScript(); RootedValue objV(cx, ObjectValue(*obj)); @@ -476,10 +475,10 @@ static void TryAttachIonStub(JSContext* cx, IC* ic, IonScript* ionScript, return OperatorIn(cx, key, obj, res); } -/* static */ bool IonInstanceOfIC::update(JSContext* cx, - HandleScript outerScript, - IonInstanceOfIC* ic, HandleValue lhs, - HandleObject rhs, bool* res) { +/* static */ +bool IonInstanceOfIC::update(JSContext* cx, HandleScript outerScript, + IonInstanceOfIC* ic, HandleValue lhs, + HandleObject rhs, bool* res) { IonScript* ionScript = outerScript->ionScript(); TryAttachIonStub(cx, ic, ionScript, @@ -488,10 +487,10 @@ static void TryAttachIonStub(JSContext* cx, IC* ic, IonScript* ionScript, return HasInstance(cx, rhs, lhs, res); } -/* static */ bool IonUnaryArithIC::update(JSContext* cx, - HandleScript outerScript, - IonUnaryArithIC* ic, HandleValue val, - MutableHandleValue res) { +/* static */ +bool IonUnaryArithIC::update(JSContext* cx, HandleScript outerScript, + IonUnaryArithIC* ic, HandleValue val, + MutableHandleValue res) { IonScript* ionScript = outerScript->ionScript(); RootedScript script(cx, ic->script()); jsbytecode* pc = ic->pc(); @@ -535,11 +534,10 @@ static void TryAttachIonStub(JSContext* cx, IC* ic, IonScript* ionScript, return true; } -/* static */ bool IonBinaryArithIC::update(JSContext* cx, - HandleScript outerScript, - IonBinaryArithIC* ic, - HandleValue lhs, HandleValue rhs, - MutableHandleValue ret) { +/* static */ +bool IonBinaryArithIC::update(JSContext* cx, HandleScript outerScript, + IonBinaryArithIC* ic, HandleValue lhs, + HandleValue rhs, MutableHandleValue ret) { IonScript* ionScript = outerScript->ionScript(); RootedScript script(cx, ic->script()); jsbytecode* pc = ic->pc(); @@ -606,9 +604,10 @@ static void TryAttachIonStub(JSContext* cx, IC* ic, IonScript* ionScript, return true; } -/* static */ bool IonCompareIC::update(JSContext* cx, HandleScript outerScript, - IonCompareIC* ic, HandleValue lhs, - HandleValue rhs, bool* res) { +/* static */ +bool IonCompareIC::update(JSContext* cx, HandleScript outerScript, + IonCompareIC* ic, HandleValue lhs, HandleValue rhs, + bool* res) { IonScript* ionScript = outerScript->ionScript(); RootedScript script(cx, ic->script()); jsbytecode* pc = ic->pc(); diff --git a/js/src/jit/JitcodeMap.cpp b/js/src/jit/JitcodeMap.cpp index c5667774868c..7ba3ce29a474 100644 --- a/js/src/jit/JitcodeMap.cpp +++ b/js/src/jit/JitcodeMap.cpp @@ -245,8 +245,9 @@ static int ComparePointers(const void* a, const void* b) { return 0; } -/* static */ int JitcodeGlobalEntry::compare(const JitcodeGlobalEntry& ent1, - const JitcodeGlobalEntry& ent2) { +/* static */ +int JitcodeGlobalEntry::compare(const JitcodeGlobalEntry& ent1, + const JitcodeGlobalEntry& ent2) { // Both parts of compare cannot be a query. MOZ_ASSERT(!(ent1.isQuery() && ent2.isQuery())); @@ -275,9 +276,9 @@ static int ComparePointers(const void* a, const void* b) { return flip * -1; } -/* static */ char* JitcodeGlobalEntry::createScriptString(JSContext* cx, - JSScript* script, - size_t* length) { +/* static */ +char* JitcodeGlobalEntry::createScriptString(JSContext* cx, JSScript* script, + size_t* length) { // If the script has a function, try calculating its name. bool hasName = false; size_t nameLength = 0; @@ -1007,37 +1008,38 @@ void JitcodeGlobalEntry::IonCacheEntry::forEachOptimizationTypeInfo( entry.forEachOptimizationTypeInfo(rt, index, op); } -/* static */ void JitcodeRegionEntry::WriteHead(CompactBufferWriter& writer, - uint32_t nativeOffset, - uint8_t scriptDepth) { +/* static */ +void JitcodeRegionEntry::WriteHead(CompactBufferWriter& writer, + uint32_t nativeOffset, uint8_t scriptDepth) { writer.writeUnsigned(nativeOffset); writer.writeByte(scriptDepth); } -/* static */ void JitcodeRegionEntry::ReadHead(CompactBufferReader& reader, - uint32_t* nativeOffset, - uint8_t* scriptDepth) { +/* static */ +void JitcodeRegionEntry::ReadHead(CompactBufferReader& reader, + uint32_t* nativeOffset, + uint8_t* scriptDepth) { *nativeOffset = reader.readUnsigned(); *scriptDepth = reader.readByte(); } -/* static */ void JitcodeRegionEntry::WriteScriptPc(CompactBufferWriter& writer, - uint32_t scriptIdx, - uint32_t pcOffset) { +/* static */ +void JitcodeRegionEntry::WriteScriptPc(CompactBufferWriter& writer, + uint32_t scriptIdx, uint32_t pcOffset) { writer.writeUnsigned(scriptIdx); writer.writeUnsigned(pcOffset); } -/* static */ void JitcodeRegionEntry::ReadScriptPc(CompactBufferReader& reader, - uint32_t* scriptIdx, - uint32_t* pcOffset) { +/* static */ +void JitcodeRegionEntry::ReadScriptPc(CompactBufferReader& reader, + uint32_t* scriptIdx, uint32_t* pcOffset) { *scriptIdx = reader.readUnsigned(); *pcOffset = reader.readUnsigned(); } -/* static */ void JitcodeRegionEntry::WriteDelta(CompactBufferWriter& writer, - uint32_t nativeDelta, - int32_t pcDelta) { +/* static */ +void JitcodeRegionEntry::WriteDelta(CompactBufferWriter& writer, + uint32_t nativeDelta, int32_t pcDelta) { if (pcDelta >= 0) { // 1 and 2-byte formats possible. @@ -1090,9 +1092,9 @@ void JitcodeGlobalEntry::IonCacheEntry::forEachOptimizationTypeInfo( MOZ_CRASH("pcDelta/nativeDelta values are too large to encode."); } -/* static */ void JitcodeRegionEntry::ReadDelta(CompactBufferReader& reader, - uint32_t* nativeDelta, - int32_t* pcDelta) { +/* static */ +void JitcodeRegionEntry::ReadDelta(CompactBufferReader& reader, + uint32_t* nativeDelta, int32_t* pcDelta) { // NB: // It's possible to get nativeDeltas with value 0 in two cases: // @@ -1160,8 +1162,9 @@ void JitcodeGlobalEntry::IonCacheEntry::forEachOptimizationTypeInfo( MOZ_ASSERT_IF(*nativeDelta == 0, *pcDelta <= 0); } -/* static */ uint32_t JitcodeRegionEntry::ExpectedRunLength( - const NativeToBytecode* entry, const NativeToBytecode* end) { +/* static */ +uint32_t JitcodeRegionEntry::ExpectedRunLength(const NativeToBytecode* entry, + const NativeToBytecode* end) { MOZ_ASSERT(entry < end); // We always use the first entry, so runLength starts at 1 @@ -1251,11 +1254,11 @@ struct JitcodeMapBufferWriteSpewer { // Write a run, starting at the given NativeToBytecode entry, into the given // buffer writer. -/* static */ bool JitcodeRegionEntry::WriteRun(CompactBufferWriter& writer, - JSScript** scriptList, - uint32_t scriptListSize, - uint32_t runLength, - const NativeToBytecode* entry) { +/* static */ +bool JitcodeRegionEntry::WriteRun(CompactBufferWriter& writer, + JSScript** scriptList, + uint32_t scriptListSize, uint32_t runLength, + const NativeToBytecode* entry) { MOZ_ASSERT(runLength > 0); MOZ_ASSERT(runLength <= MAX_RUN_LENGTH); @@ -1495,7 +1498,8 @@ uint32_t JitcodeIonTable::findRegionEntry(uint32_t nativeOffset) const { return idx; } -/* static */ bool JitcodeIonTable::WriteIonTable( +/* static */ +bool JitcodeIonTable::WriteIonTable( CompactBufferWriter& writer, JSScript** scriptList, uint32_t scriptListSize, const NativeToBytecode* start, const NativeToBytecode* end, uint32_t* tableOffsetOut, uint32_t* numRegionsOut) { diff --git a/js/src/jit/MIR.cpp b/js/src/jit/MIR.cpp index 758b0b65fc31..ab3c36e5da67 100644 --- a/js/src/jit/MIR.cpp +++ b/js/src/jit/MIR.cpp @@ -3395,8 +3395,9 @@ static inline bool MustBeUInt32(MDefinition* def, MDefinition** pwrapped) { return false; } -/* static */ bool MBinaryInstruction::unsignedOperands(MDefinition* left, - MDefinition* right) { +/* static */ +bool MBinaryInstruction::unsignedOperands(MDefinition* left, + MDefinition* right) { MDefinition* replace; if (!MustBeUInt32(left, &replace)) { return false; diff --git a/js/src/jit/OptimizationTracking.cpp b/js/src/jit/OptimizationTracking.cpp index 1a2ee4486c6e..6013e4efe96a 100644 --- a/js/src/jit/OptimizationTracking.cpp +++ b/js/src/jit/OptimizationTracking.cpp @@ -205,8 +205,8 @@ static HashNumber HashVectorContents(const Vec* xs, HashNumber h) { return h; } -/* static */ HashNumber UniqueTrackedOptimizations::Key::hash( - const Lookup& lookup) { +/* static */ +HashNumber UniqueTrackedOptimizations::Key::hash(const Lookup& lookup) { HashNumber h = HashVectorContents(lookup.types, 0); h = HashVectorContents(lookup.attempts, h); h += (h << 3); @@ -215,8 +215,9 @@ static HashNumber HashVectorContents(const Vec* xs, HashNumber h) { return h; } -/* static */ bool UniqueTrackedOptimizations::Key::match(const Key& key, - const Lookup& lookup) { +/* static */ +bool UniqueTrackedOptimizations::Key::match(const Key& key, + const Lookup& lookup) { return VectorContentsMatch(key.attempts, lookup.attempts) && VectorContentsMatch(key.types, lookup.types); } @@ -526,7 +527,8 @@ IonTrackedOptimizationsRegionTable::findRegion(uint32_t offset) const { return Nothing(); } -/* static */ uint32_t IonTrackedOptimizationsRegion::ExpectedRunLength( +/* static */ +uint32_t IonTrackedOptimizationsRegion::ExpectedRunLength( const NativeToTrackedOptimizations* start, const NativeToTrackedOptimizations* end) { MOZ_ASSERT(start < end); @@ -577,9 +579,11 @@ bool OptimizationTypeInfo::writeCompact(CompactBufferWriter& writer, return true; } -/* static */ void IonTrackedOptimizationsRegion::ReadDelta( - CompactBufferReader& reader, uint32_t* startDelta, uint32_t* length, - uint8_t* index) { +/* static */ +void IonTrackedOptimizationsRegion::ReadDelta(CompactBufferReader& reader, + uint32_t* startDelta, + uint32_t* length, + uint8_t* index) { // 2 bytes // SSSS-SSSL LLLL-LII0 const uint32_t firstByte = reader.readByte(); @@ -630,9 +634,10 @@ bool OptimizationTypeInfo::writeCompact(CompactBufferWriter& writer, MOZ_ASSERT(length != 0); } -/* static */ void IonTrackedOptimizationsRegion::WriteDelta( - CompactBufferWriter& writer, uint32_t startDelta, uint32_t length, - uint8_t index) { +/* static */ +void IonTrackedOptimizationsRegion::WriteDelta(CompactBufferWriter& writer, + uint32_t startDelta, + uint32_t length, uint8_t index) { // 2 bytes // SSSS-SSSL LLLL-LII0 if (startDelta <= ENC1_START_DELTA_MAX && length <= ENC1_LENGTH_MAX && @@ -692,7 +697,8 @@ bool OptimizationTypeInfo::writeCompact(CompactBufferWriter& writer, MOZ_CRASH("startDelta,length,index triple too large to encode."); } -/* static */ bool IonTrackedOptimizationsRegion::WriteRun( +/* static */ +bool IonTrackedOptimizationsRegion::WriteRun( CompactBufferWriter& writer, const NativeToTrackedOptimizations* start, const NativeToTrackedOptimizations* end, const UniqueTrackedOptimizations& unique) { diff --git a/js/src/jit/RematerializedFrame.cpp b/js/src/jit/RematerializedFrame.cpp index f73a80cab95e..dfc38cce28cd 100644 --- a/js/src/jit/RematerializedFrame.cpp +++ b/js/src/jit/RematerializedFrame.cpp @@ -55,9 +55,10 @@ RematerializedFrame::RematerializedFrame(JSContext* cx, uint8_t* top, &newTarget_, ReadFrame_Actuals, fallback); } -/* static */ RematerializedFrame* RematerializedFrame::New( - JSContext* cx, uint8_t* top, InlineFrameIterator& iter, - MaybeReadFallback& fallback) { +/* static */ +RematerializedFrame* RematerializedFrame::New(JSContext* cx, uint8_t* top, + InlineFrameIterator& iter, + MaybeReadFallback& fallback) { unsigned numFormals = iter.isFunctionFrame() ? iter.calleeTemplate()->nargs() : 0; unsigned argSlots = Max(numFormals, iter.numActualArgs()); @@ -81,7 +82,8 @@ RematerializedFrame::RematerializedFrame(JSContext* cx, uint8_t* top, RematerializedFrame(cx, top, iter.numActualArgs(), iter, fallback); } -/* static */ bool RematerializedFrame::RematerializeInlineFrames( +/* static */ +bool RematerializedFrame::RematerializeInlineFrames( JSContext* cx, uint8_t* top, InlineFrameIterator& iter, MaybeReadFallback& fallback, GCVector& frames) { Rooted> tempFrames( @@ -112,8 +114,8 @@ RematerializedFrame::RematerializedFrame(JSContext* cx, uint8_t* top, return true; } -/* static */ void RematerializedFrame::FreeInVector( - GCVector& frames) { +/* static */ +void RematerializedFrame::FreeInVector(GCVector& frames) { for (size_t i = 0; i < frames.length(); i++) { RematerializedFrame* f = frames[i]; MOZ_ASSERT(!Debugger::inFrameMaps(f)); diff --git a/js/src/jit/VMFunctions.cpp b/js/src/jit/VMFunctions.cpp index 844819e4d5b4..ece7f48c5e92 100644 --- a/js/src/jit/VMFunctions.cpp +++ b/js/src/jit/VMFunctions.cpp @@ -146,7 +146,8 @@ bool JitRuntime::generateVMWrappers(JSContext* cx, MacroAssembler& masm) { } // Statics are initialized to null. -/* static */ VMFunction* VMFunction::functions; +/* static */ +VMFunction* VMFunction::functions; AutoDetectInvalidation::AutoDetectInvalidation(JSContext* cx, MutableHandleValue rval) diff --git a/js/src/jit/arm/Assembler-arm.cpp b/js/src/jit/arm/Assembler-arm.cpp index 7b0d3fdc0408..b4b4564159da 100644 --- a/js/src/jit/arm/Assembler-arm.cpp +++ b/js/src/jit/arm/Assembler-arm.cpp @@ -741,8 +741,9 @@ static void TraceOneDataRelocation(JSTracer* trc, InstructionIterator iter) { } } -/* static */ void Assembler::TraceDataRelocations(JSTracer* trc, JitCode* code, - CompactBufferReader& reader) { +/* static */ +void Assembler::TraceDataRelocations(JSTracer* trc, JitCode* code, + CompactBufferReader& reader) { while (reader.more()) { size_t offset = reader.readUnsigned(); InstructionIterator iter((Instruction*)(code->raw() + offset)); @@ -1073,7 +1074,8 @@ O2RegRegShift jit::asr(Register r, Register amt) { static js::jit::DoubleEncoder doubleEncoder; -/* static */ const js::jit::VFPImm js::jit::VFPImm::One(0x3FF00000); +/* static */ +const js::jit::VFPImm js::jit::VFPImm::One(0x3FF00000); js::jit::VFPImm::VFPImm(uint32_t top) { data_ = -1; @@ -1211,14 +1213,15 @@ BufferOffset Assembler::as_mov(Register dest, Operand2 op2, SBit s, return as_alu(dest, InvalidReg, op2, OpMov, s, c); } -/* static */ void Assembler::as_alu_patch(Register dest, Register src1, - Operand2 op2, ALUOp op, SBit s, - Condition c, uint32_t* pos) { +/* static */ +void Assembler::as_alu_patch(Register dest, Register src1, Operand2 op2, + ALUOp op, SBit s, Condition c, uint32_t* pos) { WriteInstStatic(EncodeAlu(dest, src1, op2, op, s, c), pos); } -/* static */ void Assembler::as_mov_patch(Register dest, Operand2 op2, SBit s, - Condition c, uint32_t* pos) { +/* static */ +void Assembler::as_mov_patch(Register dest, Operand2 op2, SBit s, Condition c, + uint32_t* pos) { as_alu_patch(dest, InvalidReg, op2, OpMov, s, c, pos); } @@ -1335,8 +1338,9 @@ BufferOffset Assembler::as_movw(Register dest, Imm16 imm, Condition c) { return writeInst(EncodeMovW(dest, imm, c)); } -/* static */ void Assembler::as_movw_patch(Register dest, Imm16 imm, - Condition c, Instruction* pos) { +/* static */ +void Assembler::as_movw_patch(Register dest, Imm16 imm, Condition c, + Instruction* pos) { WriteInstStatic(EncodeMovW(dest, imm, c), (uint32_t*)pos); } @@ -1344,8 +1348,9 @@ BufferOffset Assembler::as_movt(Register dest, Imm16 imm, Condition c) { return writeInst(EncodeMovT(dest, imm, c)); } -/* static */ void Assembler::as_movt_patch(Register dest, Imm16 imm, - Condition c, Instruction* pos) { +/* static */ +void Assembler::as_movt_patch(Register dest, Imm16 imm, Condition c, + Instruction* pos) { WriteInstStatic(EncodeMovT(dest, imm, c), (uint32_t*)pos); } @@ -1428,9 +1433,9 @@ BufferOffset Assembler::as_dtr(LoadStore ls, int size, Index mode, Register rt, return writeInst(EncodeDtr(ls, size, mode, rt, addr, c)); } -/* static */ void Assembler::as_dtr_patch(LoadStore ls, int size, Index mode, - Register rt, DTRAddr addr, - Condition c, uint32_t* dest) { +/* static */ +void Assembler::as_dtr_patch(LoadStore ls, int size, Index mode, Register rt, + DTRAddr addr, Condition c, uint32_t* dest) { WriteInstStatic(EncodeDtr(ls, size, mode, rt, addr, c), dest); } @@ -1594,8 +1599,8 @@ BufferOffset Assembler::as_Imm32Pool(Register dest, uint32_t value, return offs; } -/* static */ void Assembler::WritePoolEntry(Instruction* addr, Condition c, - uint32_t data) { +/* static */ +void Assembler::WritePoolEntry(Instruction* addr, Condition c, uint32_t data) { MOZ_ASSERT(addr->is()); *addr->as()->dest() = data; MOZ_ASSERT(addr->extractCond() == c); @@ -1954,8 +1959,8 @@ BufferOffset Assembler::writeVFPInst(vfp_size sz, uint32_t blob) { return writeInst(VfpTag | sz | blob); } -/* static */ void Assembler::WriteVFPInstStatic(vfp_size sz, uint32_t blob, - uint32_t* dest) { +/* static */ +void Assembler::WriteVFPInstStatic(vfp_size sz, uint32_t blob, uint32_t* dest) { MOZ_ASSERT((sz & blob) == 0); MOZ_ASSERT((VfpTag & blob) == 0); WriteInstStatic(VfpTag | sz | blob, dest); @@ -2146,9 +2151,9 @@ BufferOffset Assembler::as_vdtr( return writeVFPInst(sz, EncodeVdtr(ls, vd, addr, c)); } -/* static */ void Assembler::as_vdtr_patch(LoadStore ls, VFPRegister vd, - VFPAddr addr, Condition c, - uint32_t* dest) { +/* static */ +void Assembler::as_vdtr_patch(LoadStore ls, VFPRegister vd, VFPAddr addr, + Condition c, uint32_t* dest) { vfp_size sz = vd.isDouble() ? IsDouble : IsSingle; WriteVFPInstStatic(sz, EncodeVdtr(ls, vd, addr, c), dest); } @@ -2794,8 +2799,9 @@ SecondScratchRegisterScope::SecondScratchRegisterScope(MacroAssembler& masm) #ifdef JS_DISASM_ARM -/* static */ void Assembler::disassembleInstruction(const Instruction* i, - DisasmBuffer& buffer) { +/* static */ +void Assembler::disassembleInstruction(const Instruction* i, + DisasmBuffer& buffer) { disasm::NameConverter converter; disasm::Disassembler dasm(converter); uint8_t* loc = reinterpret_cast(const_cast(i->raw())); diff --git a/js/src/jit/arm/Simulator-arm.cpp b/js/src/jit/arm/Simulator-arm.cpp index 3a878e72db65..d6376c558836 100644 --- a/js/src/jit/arm/Simulator-arm.cpp +++ b/js/src/jit/arm/Simulator-arm.cpp @@ -1036,7 +1036,8 @@ static void FlushICacheLocked(SimulatorProcess::ICacheMap& i_cache, } } -/* static */ void SimulatorProcess::checkICacheLocked(SimInstruction* instr) { +/* static */ +void SimulatorProcess::checkICacheLocked(SimInstruction* instr) { intptr_t address = reinterpret_cast(instr); void* page = reinterpret_cast(address & (~CachePage::kPageMask)); void* line = reinterpret_cast(address & (~CachePage::kLineMask)); @@ -1075,7 +1076,8 @@ void Simulator::setLastDebuggerInput(char* input) { lastDebuggerInput_ = input; } -/* static */ void SimulatorProcess::FlushICache(void* start_addr, size_t size) { +/* static */ +void SimulatorProcess::FlushICache(void* start_addr, size_t size) { JitSpewCont(JitSpew_CacheFlush, "[%p %zx]", start_addr, size); if (!ICacheCheckingDisableCount) { AutoLockSimulatorCache als; @@ -1241,8 +1243,9 @@ SimulatorProcess::~SimulatorProcess() { } } -/* static */ void* Simulator::RedirectNativeFunction(void* nativeFunction, - ABIFunctionType type) { +/* static */ +void* Simulator::RedirectNativeFunction(void* nativeFunction, + ABIFunctionType type) { Redirection* redirection = Redirection::Get(nativeFunction, type); return redirection->addressOfSwiInstruction(); } diff --git a/js/src/jit/arm64/Assembler-arm64.cpp b/js/src/jit/arm64/Assembler-arm64.cpp index 1cf905bd0d43..1df60e081790 100644 --- a/js/src/jit/arm64/Assembler-arm64.cpp +++ b/js/src/jit/arm64/Assembler-arm64.cpp @@ -601,8 +601,9 @@ void Assembler::TraceJumpRelocations(JSTracer* trc, JitCode* code, } } -/* static */ void Assembler::TraceDataRelocations(JSTracer* trc, JitCode* code, - CompactBufferReader& reader) { +/* static */ +void Assembler::TraceDataRelocations(JSTracer* trc, JitCode* code, + CompactBufferReader& reader) { uint8_t* buffer = code->raw(); while (reader.more()) { diff --git a/js/src/jit/mips32/Assembler-mips32.cpp b/js/src/jit/mips32/Assembler-mips32.cpp index 99aa56e9b52e..4b4a6031ad79 100644 --- a/js/src/jit/mips32/Assembler-mips32.cpp +++ b/js/src/jit/mips32/Assembler-mips32.cpp @@ -161,8 +161,9 @@ static void TraceOneDataRelocation(JSTracer* trc, Instruction* inst) { } } -/* static */ void Assembler::TraceDataRelocations(JSTracer* trc, JitCode* code, - CompactBufferReader& reader) { +/* static */ +void Assembler::TraceDataRelocations(JSTracer* trc, JitCode* code, + CompactBufferReader& reader) { while (reader.more()) { size_t offset = reader.readUnsigned(); Instruction* inst = (Instruction*)(code->raw() + offset); diff --git a/js/src/jit/mips32/Simulator-mips32.cpp b/js/src/jit/mips32/Simulator-mips32.cpp index 6dbf38cda1cd..70123a26f460 100644 --- a/js/src/jit/mips32/Simulator-mips32.cpp +++ b/js/src/jit/mips32/Simulator-mips32.cpp @@ -1114,7 +1114,8 @@ static void FlushICacheLocked(SimulatorProcess::ICacheMap& i_cache, } } -/* static */ void SimulatorProcess::checkICacheLocked(SimInstruction* instr) { +/* static */ +void SimulatorProcess::checkICacheLocked(SimInstruction* instr) { intptr_t address = reinterpret_cast(instr); void* page = reinterpret_cast(address & (~CachePage::kPageMask)); void* line = reinterpret_cast(address & (~CachePage::kLineMask)); @@ -1147,7 +1148,8 @@ bool SimulatorProcess::ICacheHasher::match(const Key& k, const Lookup& l) { return k == l; } -/* static */ void SimulatorProcess::FlushICache(void* start_addr, size_t size) { +/* static */ +void SimulatorProcess::FlushICache(void* start_addr, size_t size) { if (!ICacheCheckingDisableCount) { AutoLockSimulatorCache als; js::jit::FlushICacheLocked(icache(), start_addr, size); @@ -1299,8 +1301,9 @@ SimulatorProcess::~SimulatorProcess() { } } -/* static */ void* Simulator::RedirectNativeFunction(void* nativeFunction, - ABIFunctionType type) { +/* static */ +void* Simulator::RedirectNativeFunction(void* nativeFunction, + ABIFunctionType type) { Redirection* redirection = Redirection::Get(nativeFunction, type); return redirection->addressOfSwiInstruction(); } diff --git a/js/src/jit/mips64/Assembler-mips64.cpp b/js/src/jit/mips64/Assembler-mips64.cpp index d6a17137c0c4..e57dbbe6c987 100644 --- a/js/src/jit/mips64/Assembler-mips64.cpp +++ b/js/src/jit/mips64/Assembler-mips64.cpp @@ -135,8 +135,9 @@ static void TraceOneDataRelocation(JSTracer* trc, Instruction* inst) { } } -/* static */ void Assembler::TraceDataRelocations(JSTracer* trc, JitCode* code, - CompactBufferReader& reader) { +/* static */ +void Assembler::TraceDataRelocations(JSTracer* trc, JitCode* code, + CompactBufferReader& reader) { while (reader.more()) { size_t offset = reader.readUnsigned(); Instruction* inst = (Instruction*)(code->raw() + offset); diff --git a/js/src/jit/mips64/Simulator-mips64.cpp b/js/src/jit/mips64/Simulator-mips64.cpp index 710aef8fef1d..3ae59b562144 100644 --- a/js/src/jit/mips64/Simulator-mips64.cpp +++ b/js/src/jit/mips64/Simulator-mips64.cpp @@ -1141,7 +1141,8 @@ static void FlushICacheLocked(SimulatorProcess::ICacheMap& i_cache, } } -/* static */ void SimulatorProcess::checkICacheLocked(SimInstruction* instr) { +/* static */ +void SimulatorProcess::checkICacheLocked(SimInstruction* instr) { intptr_t address = reinterpret_cast(instr); void* page = reinterpret_cast(address & (~CachePage::kPageMask)); void* line = reinterpret_cast(address & (~CachePage::kLineMask)); @@ -1174,7 +1175,8 @@ bool SimulatorProcess::ICacheHasher::match(const Key& k, const Lookup& l) { return k == l; } -/* static */ void SimulatorProcess::FlushICache(void* start_addr, size_t size) { +/* static */ +void SimulatorProcess::FlushICache(void* start_addr, size_t size) { if (!ICacheCheckingDisableCount) { AutoLockSimulatorCache als; js::jit::FlushICacheLocked(icache(), start_addr, size); @@ -1326,8 +1328,9 @@ SimulatorProcess::~SimulatorProcess() { } } -/* static */ void* Simulator::RedirectNativeFunction(void* nativeFunction, - ABIFunctionType type) { +/* static */ +void* Simulator::RedirectNativeFunction(void* nativeFunction, + ABIFunctionType type) { Redirection* redirection = Redirection::Get(nativeFunction, type); return redirection->addressOfSwiInstruction(); } diff --git a/js/src/jit/x86-shared/Assembler-x86-shared.cpp b/js/src/jit/x86-shared/Assembler-x86-shared.cpp index 762dc1068d24..0f371d7e1cd7 100644 --- a/js/src/jit/x86-shared/Assembler-x86-shared.cpp +++ b/js/src/jit/x86-shared/Assembler-x86-shared.cpp @@ -36,8 +36,9 @@ void AssemblerX86Shared::copyDataRelocationTable(uint8_t* dest) { } } -/* static */ void AssemblerX86Shared::TraceDataRelocations( - JSTracer* trc, JitCode* code, CompactBufferReader& reader) { +/* static */ +void AssemblerX86Shared::TraceDataRelocations(JSTracer* trc, JitCode* code, + CompactBufferReader& reader) { while (reader.more()) { size_t offset = reader.readUnsigned(); MOZ_ASSERT(offset >= sizeof(void*) && offset <= code->instructionsSize()); diff --git a/js/src/jsexn.cpp b/js/src/jsexn.cpp index a0b6b41b4593..1ac722dec8fb 100644 --- a/js/src/jsexn.cpp +++ b/js/src/jsexn.cpp @@ -546,7 +546,8 @@ static bool exn_toSource(JSContext* cx, unsigned argc, Value* vp) { return true; } -/* static */ JSObject* ErrorObject::createProto(JSContext* cx, JSProtoKey key) { +/* static */ +JSObject* ErrorObject::createProto(JSContext* cx, JSProtoKey key) { JSExnType type = ExnTypeFromProtoKey(key); if (type == JSEXN_ERR) { @@ -564,8 +565,8 @@ static bool exn_toSource(JSContext* cx, unsigned argc, Value* vp) { cx, &ErrorObject::protoClasses[type], protoProto); } -/* static */ JSObject* ErrorObject::createConstructor(JSContext* cx, - JSProtoKey key) { +/* static */ +JSObject* ErrorObject::createConstructor(JSContext* cx, JSProtoKey key) { JSExnType type = ExnTypeFromProtoKey(key); RootedObject ctor(cx); diff --git a/js/src/proxy/Proxy.cpp b/js/src/proxy/Proxy.cpp index 2412c5c42d1f..bbd97d238f09 100644 --- a/js/src/proxy/Proxy.cpp +++ b/js/src/proxy/Proxy.cpp @@ -162,8 +162,9 @@ JS_FRIEND_API bool js::AppendUnique(JSContext* cx, AutoIdVector& base, return base.appendAll(uniqueOthers); } -/* static */ bool Proxy::getPrototype(JSContext* cx, HandleObject proxy, - MutableHandleObject proto) { +/* static */ +bool Proxy::getPrototype(JSContext* cx, HandleObject proxy, + MutableHandleObject proto) { MOZ_ASSERT(proxy->hasDynamicPrototype()); if (!CheckRecursionLimit(cx)) { return false; @@ -171,9 +172,9 @@ JS_FRIEND_API bool js::AppendUnique(JSContext* cx, AutoIdVector& base, return proxy->as().handler()->getPrototype(cx, proxy, proto); } -/* static */ bool Proxy::setPrototype(JSContext* cx, HandleObject proxy, - HandleObject proto, - ObjectOpResult& result) { +/* static */ +bool Proxy::setPrototype(JSContext* cx, HandleObject proxy, HandleObject proto, + ObjectOpResult& result) { MOZ_ASSERT(proxy->hasDynamicPrototype()); if (!CheckRecursionLimit(cx)) { return false; @@ -182,10 +183,10 @@ JS_FRIEND_API bool js::AppendUnique(JSContext* cx, AutoIdVector& base, result); } -/* static */ bool Proxy::getPrototypeIfOrdinary(JSContext* cx, - HandleObject proxy, - bool* isOrdinary, - MutableHandleObject proto) { +/* static */ +bool Proxy::getPrototypeIfOrdinary(JSContext* cx, HandleObject proxy, + bool* isOrdinary, + MutableHandleObject proto) { if (!CheckRecursionLimit(cx)) { return false; } @@ -193,9 +194,9 @@ JS_FRIEND_API bool js::AppendUnique(JSContext* cx, AutoIdVector& base, cx, proxy, isOrdinary, proto); } -/* static */ bool Proxy::setImmutablePrototype(JSContext* cx, - HandleObject proxy, - bool* succeeded) { +/* static */ +bool Proxy::setImmutablePrototype(JSContext* cx, HandleObject proxy, + bool* succeeded) { if (!CheckRecursionLimit(cx)) { return false; } @@ -203,8 +204,9 @@ JS_FRIEND_API bool js::AppendUnique(JSContext* cx, AutoIdVector& base, return handler->setImmutablePrototype(cx, proxy, succeeded); } -/* static */ bool Proxy::preventExtensions(JSContext* cx, HandleObject proxy, - ObjectOpResult& result) { +/* static */ +bool Proxy::preventExtensions(JSContext* cx, HandleObject proxy, + ObjectOpResult& result) { if (!CheckRecursionLimit(cx)) { return false; } @@ -212,8 +214,8 @@ JS_FRIEND_API bool js::AppendUnique(JSContext* cx, AutoIdVector& base, return handler->preventExtensions(cx, proxy, result); } -/* static */ bool Proxy::isExtensible(JSContext* cx, HandleObject proxy, - bool* extensible) { +/* static */ +bool Proxy::isExtensible(JSContext* cx, HandleObject proxy, bool* extensible) { if (!CheckRecursionLimit(cx)) { return false; } @@ -612,9 +614,9 @@ bool Proxy::boxedValue_unbox(JSContext* cx, HandleObject proxy, JSObject* const TaggedProto::LazyProto = reinterpret_cast(0x1); -/* static */ bool Proxy::getElements(JSContext* cx, HandleObject proxy, - uint32_t begin, uint32_t end, - ElementAdder* adder) { +/* static */ +bool Proxy::getElements(JSContext* cx, HandleObject proxy, uint32_t begin, + uint32_t end, ElementAdder* adder) { if (!CheckRecursionLimit(cx)) { return false; } @@ -632,7 +634,8 @@ JSObject* const TaggedProto::LazyProto = reinterpret_cast(0x1); return handler->getElements(cx, proxy, begin, end, adder); } -/* static */ void Proxy::trace(JSTracer* trc, JSObject* proxy) { +/* static */ +void Proxy::trace(JSTracer* trc, JSObject* proxy) { const BaseProxyHandler* handler = proxy->as().handler(); handler->trace(trc, proxy); } @@ -663,12 +666,13 @@ static bool proxy_DeleteProperty(JSContext* cx, HandleObject obj, HandleId id, return SuppressDeletedProperty(cx, obj, id); // XXX is this necessary? } -/* static */ void ProxyObject::traceEdgeToTarget(JSTracer* trc, - ProxyObject* obj) { +/* static */ +void ProxyObject::traceEdgeToTarget(JSTracer* trc, ProxyObject* obj) { TraceCrossCompartmentEdge(trc, obj, obj->slotOfPrivate(), "proxy target"); } -/* static */ void ProxyObject::trace(JSTracer* trc, JSObject* obj) { +/* static */ +void ProxyObject::trace(JSTracer* trc, JSObject* obj) { ProxyObject* proxy = &obj->as(); TraceEdge(trc, proxy->shapePtr(), "ProxyObject_shape"); diff --git a/js/src/proxy/ScriptedProxyHandler.cpp b/js/src/proxy/ScriptedProxyHandler.cpp index ba0daab87444..7dba5bf92312 100644 --- a/js/src/proxy/ScriptedProxyHandler.cpp +++ b/js/src/proxy/ScriptedProxyHandler.cpp @@ -166,8 +166,8 @@ static bool IsCompatiblePropertyDescriptor(JSContext* cx, bool extensible, } // Get the [[ProxyHandler]] of a scripted proxy. -/* static */ JSObject* ScriptedProxyHandler::handlerObject( - const JSObject* proxy) { +/* static */ +JSObject* ScriptedProxyHandler::handlerObject(const JSObject* proxy) { MOZ_ASSERT(proxy->as().handler() == &ScriptedProxyHandler::singleton); return proxy->as() diff --git a/js/src/shell/OSObject.cpp b/js/src/shell/OSObject.cpp index 965946332277..50f402e65068 100644 --- a/js/src/shell/OSObject.cpp +++ b/js/src/shell/OSObject.cpp @@ -380,8 +380,8 @@ static bool osfile_writeTypedArrayToFile(JSContext* cx, unsigned argc, return true; } -/* static */ RCFile* RCFile::create(JSContext* cx, const char* filename, - const char* mode) { +/* static */ +RCFile* RCFile::create(JSContext* cx, const char* filename, const char* mode) { FILE* fp = fopen(filename, mode); if (!fp) { return nullptr; diff --git a/js/src/threading/Mutex.cpp b/js/src/threading/Mutex.cpp index a4727fc95cd1..c15df3dac318 100644 --- a/js/src/threading/Mutex.cpp +++ b/js/src/threading/Mutex.cpp @@ -14,9 +14,11 @@ using namespace js; MOZ_THREAD_LOCAL(js::Mutex::MutexVector*) js::Mutex::HeldMutexStack; -/* static */ bool js::Mutex::Init() { return HeldMutexStack.init(); } +/* static */ +bool js::Mutex::Init() { return HeldMutexStack.init(); } -/* static */ void js::Mutex::ShutDown() { +/* static */ +void js::Mutex::ShutDown() { js_delete(HeldMutexStack.get()); HeldMutexStack.set(nullptr); } diff --git a/js/src/util/StructuredSpewer.cpp b/js/src/util/StructuredSpewer.cpp index 107a26b7dd96..5c65b63c42c8 100644 --- a/js/src/util/StructuredSpewer.cpp +++ b/js/src/util/StructuredSpewer.cpp @@ -102,7 +102,8 @@ static bool MatchJSScript(JSScript* script, const char* pattern) { return result != nullptr; } -/* static */ bool StructuredSpewer::enabled(JSScript* script) { +/* static */ +bool StructuredSpewer::enabled(JSScript* script) { // We cannot call getenv under record/replay. if (mozilla::recordreplay::IsRecordingOrReplaying()) { return false; @@ -139,8 +140,9 @@ void StructuredSpewer::startObject(JSContext* cx, const JSScript* script, json.endObject(); } -/* static */ void StructuredSpewer::spew(JSContext* cx, SpewChannel channel, - const char* fmt, ...) { +/* static */ +void StructuredSpewer::spew(JSContext* cx, SpewChannel channel, const char* fmt, + ...) { // Because we don't have a script here, use the singleton's // filter to determine if the channel is active. if (!cx->spewer().filter().enabled(channel)) { diff --git a/js/src/vm/ArgumentsObject.cpp b/js/src/vm/ArgumentsObject.cpp index 8005b6ceb284..3cddcf54eb34 100644 --- a/js/src/vm/ArgumentsObject.cpp +++ b/js/src/vm/ArgumentsObject.cpp @@ -24,13 +24,15 @@ using namespace js; using JS::AutoStableStringChars; -/* static */ size_t RareArgumentsData::bytesRequired(size_t numActuals) { +/* static */ +size_t RareArgumentsData::bytesRequired(size_t numActuals) { size_t extraBytes = NumWordsForBitArrayOfLength(numActuals) * sizeof(size_t); return offsetof(RareArgumentsData, deletedBits_) + extraBytes; } -/* static */ RareArgumentsData* RareArgumentsData::create( - JSContext* cx, ArgumentsObject* obj) { +/* static */ +RareArgumentsData* RareArgumentsData::create(JSContext* cx, + ArgumentsObject* obj) { size_t bytes = RareArgumentsData::bytesRequired(obj->initialLength()); uint8_t* data = AllocateObjectBuffer(cx, obj, bytes); @@ -80,8 +82,10 @@ static void CopyStackFrameArguments(const AbstractFramePtr frame, } } -/* static */ void ArgumentsObject::MaybeForwardToCallObject( - AbstractFramePtr frame, ArgumentsObject* obj, ArgumentsData* data) { +/* static */ +void ArgumentsObject::MaybeForwardToCallObject(AbstractFramePtr frame, + ArgumentsObject* obj, + ArgumentsData* data) { JSScript* script = frame.script(); if (frame.callee()->needsCallObject() && script->argumentsAliasesFormals()) { obj->initFixedSlot(MAYBE_CALL_SLOT, ObjectValue(frame.callObj())); @@ -93,9 +97,11 @@ static void CopyStackFrameArguments(const AbstractFramePtr frame, } } -/* static */ void ArgumentsObject::MaybeForwardToCallObject( - jit::JitFrameLayout* frame, HandleObject callObj, ArgumentsObject* obj, - ArgumentsData* data) { +/* static */ +void ArgumentsObject::MaybeForwardToCallObject(jit::JitFrameLayout* frame, + HandleObject callObj, + ArgumentsObject* obj, + ArgumentsData* data) { JSFunction* callee = jit::CalleeTokenToFunction(frame->calleeToken()); JSScript* script = callee->nonLazyScript(); if (callee->needsCallObject() && script->argumentsAliasesFormals()) { @@ -263,10 +269,9 @@ ArgumentsObject* Realm::getOrCreateArgumentsTemplateObject(JSContext* cx, } template -/* static */ ArgumentsObject* ArgumentsObject::create(JSContext* cx, - HandleFunction callee, - unsigned numActuals, - CopyArgs& copy) { +/* static */ +ArgumentsObject* ArgumentsObject::create(JSContext* cx, HandleFunction callee, + unsigned numActuals, CopyArgs& copy) { bool mapped = callee->nonLazyScript()->hasMappedArgsObj(); ArgumentsObject* templateObj = cx->realm()->getOrCreateArgumentsTemplateObject(cx, mapped); @@ -369,9 +374,11 @@ ArgumentsObject* ArgumentsObject::createForIon(JSContext* cx, return create(cx, callee, frame->numActualArgs(), copy); } -/* static */ ArgumentsObject* ArgumentsObject::finishForIonPure( - JSContext* cx, jit::JitFrameLayout* frame, JSObject* scopeChain, - ArgumentsObject* obj) { +/* static */ +ArgumentsObject* ArgumentsObject::finishForIonPure(JSContext* cx, + jit::JitFrameLayout* frame, + JSObject* scopeChain, + ArgumentsObject* obj) { // JIT code calls this directly (no callVM), because it's faster, so we're // not allowed to GC in here. AutoUnsafeCallWithABI unsafe; @@ -415,10 +422,9 @@ ArgumentsObject* ArgumentsObject::createForIon(JSContext* cx, return obj; } -/* static */ bool ArgumentsObject::obj_delProperty(JSContext* cx, - HandleObject obj, - HandleId id, - ObjectOpResult& result) { +/* static */ +bool ArgumentsObject::obj_delProperty(JSContext* cx, HandleObject obj, + HandleId id, ObjectOpResult& result) { ArgumentsObject& argsobj = obj->as(); if (JSID_IS_INT(id)) { unsigned arg = unsigned(JSID_TO_INT(id)); @@ -438,8 +444,9 @@ ArgumentsObject* ArgumentsObject::createForIon(JSContext* cx, return result.succeed(); } -/* static */ bool ArgumentsObject::obj_mayResolve(const JSAtomState& names, - jsid id, JSObject*) { +/* static */ +bool ArgumentsObject::obj_mayResolve(const JSAtomState& names, jsid id, + JSObject*) { // Arguments might resolve indexes, Symbol.iterator, or length/callee. if (JSID_IS_ATOM(id)) { JSAtom* atom = JSID_TO_ATOM(id); @@ -543,8 +550,8 @@ static bool DefineArgumentsIterator(JSContext* cx, JSPROP_RESOLVING); } -/* static */ bool ArgumentsObject::reifyLength(JSContext* cx, - Handle obj) { +/* static */ +bool ArgumentsObject::reifyLength(JSContext* cx, Handle obj) { if (obj->hasOverriddenLength()) { return true; } @@ -559,8 +566,9 @@ static bool DefineArgumentsIterator(JSContext* cx, return true; } -/* static */ bool ArgumentsObject::reifyIterator(JSContext* cx, - Handle obj) { +/* static */ +bool ArgumentsObject::reifyIterator(JSContext* cx, + Handle obj) { if (obj->hasOverriddenIterator()) { return true; } @@ -573,10 +581,9 @@ static bool DefineArgumentsIterator(JSContext* cx, return true; } -/* static */ bool MappedArgumentsObject::obj_resolve(JSContext* cx, - HandleObject obj, - HandleId id, - bool* resolvedp) { +/* static */ +bool MappedArgumentsObject::obj_resolve(JSContext* cx, HandleObject obj, + HandleId id, bool* resolvedp) { Rooted argsobj(cx, &obj->as()); if (JSID_IS_SYMBOL(id) && @@ -623,8 +630,8 @@ static bool DefineArgumentsIterator(JSContext* cx, return true; } -/* static */ bool MappedArgumentsObject::obj_enumerate(JSContext* cx, - HandleObject obj) { +/* static */ +bool MappedArgumentsObject::obj_enumerate(JSContext* cx, HandleObject obj) { Rooted argsobj(cx, &obj->as()); RootedId id(cx); @@ -657,9 +664,11 @@ static bool DefineArgumentsIterator(JSContext* cx, } // ES 2017 draft 9.4.4.2 -/* static */ bool MappedArgumentsObject::obj_defineProperty( - JSContext* cx, HandleObject obj, HandleId id, - Handle desc, ObjectOpResult& result) { +/* static */ +bool MappedArgumentsObject::obj_defineProperty(JSContext* cx, HandleObject obj, + HandleId id, + Handle desc, + ObjectOpResult& result) { // Step 1. Rooted argsobj(cx, &obj->as()); @@ -794,10 +803,9 @@ static bool UnmappedArgSetter(JSContext* cx, HandleObject obj, HandleId id, NativeDefineDataProperty(cx, argsobj, id, v, attrs, result); } -/* static */ bool UnmappedArgumentsObject::obj_resolve(JSContext* cx, - HandleObject obj, - HandleId id, - bool* resolvedp) { +/* static */ +bool UnmappedArgumentsObject::obj_resolve(JSContext* cx, HandleObject obj, + HandleId id, bool* resolvedp) { Rooted argsobj(cx, &obj->as()); @@ -857,8 +865,8 @@ static bool UnmappedArgSetter(JSContext* cx, HandleObject obj, HandleId id, return true; } -/* static */ bool UnmappedArgumentsObject::obj_enumerate(JSContext* cx, - HandleObject obj) { +/* static */ +bool UnmappedArgumentsObject::obj_enumerate(JSContext* cx, HandleObject obj) { Rooted argsobj(cx, &obj->as()); @@ -907,7 +915,8 @@ void ArgumentsObject::trace(JSTracer* trc, JSObject* obj) { } } -/* static */ size_t ArgumentsObject::objectMoved(JSObject* dst, JSObject* src) { +/* static */ +size_t ArgumentsObject::objectMoved(JSObject* dst, JSObject* src) { ArgumentsObject* ndst = &dst->as(); const ArgumentsObject* nsrc = &src->as(); MOZ_ASSERT(ndst->data() == nsrc->data()); diff --git a/js/src/vm/ArrayBufferObject.cpp b/js/src/vm/ArrayBufferObject.cpp index 586b5c19b225..eee8000b5769 100644 --- a/js/src/vm/ArrayBufferObject.cpp +++ b/js/src/vm/ArrayBufferObject.cpp @@ -463,8 +463,9 @@ static uint8_t* NewCopiedBufferContents(JSContext* cx, return dataCopy; } -/* static */ void ArrayBufferObject::detach(JSContext* cx, - Handle buffer) { +/* static */ +void ArrayBufferObject::detach(JSContext* cx, + Handle buffer) { cx->check(buffer); MOZ_ASSERT(!buffer->isPreparedForAsmJS()); @@ -683,7 +684,8 @@ class js::WasmArrayRawBuffer { #endif // WASM_HUGE_MEMORY }; -/* static */ WasmArrayRawBuffer* WasmArrayRawBuffer::Allocate( +/* static */ +WasmArrayRawBuffer* WasmArrayRawBuffer::Allocate( uint32_t numBytes, const Maybe& maxSize) { MOZ_RELEASE_ASSERT(numBytes <= ArrayBufferObject::MaxBufferByteLength); @@ -715,7 +717,8 @@ class js::WasmArrayRawBuffer { return rawBuf; } -/* static */ void WasmArrayRawBuffer::Release(void* mem) { +/* static */ +void WasmArrayRawBuffer::Release(void* mem) { WasmArrayRawBuffer* header = (WasmArrayRawBuffer*)((uint8_t*)mem - sizeof(WasmArrayRawBuffer)); @@ -1029,7 +1032,8 @@ static void CheckStealPreconditions(Handle buffer, "asm.js-prepared buffers don't have detachable/stealable data"); } -/* static */ bool ArrayBufferObject::wasmGrowToSizeInPlace( +/* static */ +bool ArrayBufferObject::wasmGrowToSizeInPlace( uint32_t newSize, HandleArrayBufferObject oldBuf, MutableHandleArrayBufferObject newBuf, JSContext* cx) { CheckStealPreconditions(oldBuf, cx); @@ -1073,7 +1077,8 @@ static void CheckStealPreconditions(Handle buffer, } #ifndef WASM_HUGE_MEMORY -/* static */ bool ArrayBufferObject::wasmMovingGrowToSize( +/* static */ +bool ArrayBufferObject::wasmMovingGrowToSize( uint32_t newSize, HandleArrayBufferObject oldBuf, MutableHandleArrayBufferObject newBuf, JSContext* cx) { // On failure, do not throw and ensure that the original buffer is @@ -1403,7 +1408,8 @@ ArrayBufferObject::extractStructuredCloneContents( return BufferContents::createFailed(); } -/* static */ void ArrayBufferObject::addSizeOfExcludingThis( +/* static */ +void ArrayBufferObject::addSizeOfExcludingThis( JSObject* obj, mozilla::MallocSizeOf mallocSizeOf, JS::ClassInfo* info) { ArrayBufferObject& buffer = AsArrayBuffer(obj); switch (buffer.bufferKind()) { @@ -1443,13 +1449,16 @@ ArrayBufferObject::extractStructuredCloneContents( } } -/* static */ void ArrayBufferObject::finalize(FreeOp* fop, JSObject* obj) { +/* static */ +void ArrayBufferObject::finalize(FreeOp* fop, JSObject* obj) { obj->as().releaseData(fop); } -/* static */ void ArrayBufferObject::copyData( - Handle toBuffer, uint32_t toIndex, - Handle fromBuffer, uint32_t fromIndex, uint32_t count) { +/* static */ +void ArrayBufferObject::copyData(Handle toBuffer, + uint32_t toIndex, + Handle fromBuffer, + uint32_t fromIndex, uint32_t count) { MOZ_ASSERT(toBuffer->byteLength() >= count); MOZ_ASSERT(toBuffer->byteLength() >= toIndex + count); MOZ_ASSERT(fromBuffer->byteLength() >= fromIndex); @@ -1459,8 +1468,8 @@ ArrayBufferObject::extractStructuredCloneContents( fromBuffer->dataPointer() + fromIndex, count); } -/* static */ size_t ArrayBufferObject::objectMoved(JSObject* obj, - JSObject* old) { +/* static */ +size_t ArrayBufferObject::objectMoved(JSObject* obj, JSObject* old) { ArrayBufferObject& dst = obj->as(); const ArrayBufferObject& src = old->as(); @@ -1568,8 +1577,8 @@ void InnerViewTable::removeViews(ArrayBufferObject* buffer) { map.remove(p); } -/* static */ bool InnerViewTable::sweepEntry(JSObject** pkey, - ViewVector& views) { +/* static */ +bool InnerViewTable::sweepEntry(JSObject** pkey, ViewVector& views) { if (IsAboutToBeFinalizedUnbarriered(pkey)) { return true; } diff --git a/js/src/vm/ArrayBufferViewObject.cpp b/js/src/vm/ArrayBufferViewObject.cpp index b2e73ec3fbda..a605b3ec7460 100644 --- a/js/src/vm/ArrayBufferViewObject.cpp +++ b/js/src/vm/ArrayBufferViewObject.cpp @@ -22,8 +22,8 @@ using namespace js; * a custom tracer to move the object's data pointer if its owner was moved and * stores its data inline. */ -/* static */ void ArrayBufferViewObject::trace(JSTracer* trc, - JSObject* objArg) { +/* static */ +void ArrayBufferViewObject::trace(JSTracer* trc, JSObject* objArg) { NativeObject* obj = &objArg->as(); HeapSlot& bufSlot = obj->getFixedSlotRef(BUFFER_SLOT); TraceEdge(trc, &bufSlot, "ArrayBufferViewObject.buffer"); @@ -72,7 +72,8 @@ void ArrayBufferViewObject::setDataPointerUnshared(uint8_t* data) { setPrivate(data); } -/* static */ ArrayBufferObjectMaybeShared* ArrayBufferViewObject::bufferObject( +/* static */ +ArrayBufferObjectMaybeShared* ArrayBufferViewObject::bufferObject( JSContext* cx, Handle thisObject) { if (thisObject->is()) { Rooted typedArray(cx, diff --git a/js/src/vm/AsyncFunction.cpp b/js/src/vm/AsyncFunction.cpp index efcd86c2510c..c587967f5c23 100644 --- a/js/src/vm/AsyncFunction.cpp +++ b/js/src/vm/AsyncFunction.cpp @@ -21,8 +21,9 @@ using namespace js; using mozilla::Maybe; -/* static */ bool GlobalObject::initAsyncFunction( - JSContext* cx, Handle global) { +/* static */ +bool GlobalObject::initAsyncFunction(JSContext* cx, + Handle global) { if (global->getReservedSlot(ASYNC_FUNCTION_PROTO).isObject()) { return true; } diff --git a/js/src/vm/AsyncIteration.cpp b/js/src/vm/AsyncIteration.cpp index e44f36dc5540..3794e0fabe0b 100644 --- a/js/src/vm/AsyncIteration.cpp +++ b/js/src/vm/AsyncIteration.cpp @@ -65,8 +65,9 @@ JSObject* js::CreateAsyncFromSyncIterator(JSContext* cx, HandleObject iter, } // Async Iteration proposal 11.1.3.1 steps 2-4. -/* static */ JSObject* AsyncFromSyncIteratorObject::create( - JSContext* cx, HandleObject iter, HandleValue nextMethod) { +/* static */ +JSObject* AsyncFromSyncIteratorObject::create(JSContext* cx, HandleObject iter, + HandleValue nextMethod) { // Step 2. RootedObject proto(cx, GlobalObject::getOrCreateAsyncFromSyncIteratorPrototype( @@ -162,8 +163,9 @@ static AsyncGeneratorObject* OrdinaryCreateFromConstructorAsynGen( return NewObjectWithGivenProto(cx, proto); } -/* static */ AsyncGeneratorObject* AsyncGeneratorObject::create( - JSContext* cx, HandleFunction asyncGen) { +/* static */ +AsyncGeneratorObject* AsyncGeneratorObject::create(JSContext* cx, + HandleFunction asyncGen) { MOZ_ASSERT(asyncGen->isAsync() && asyncGen->isGenerator()); AsyncGeneratorObject* asyncGenObj = @@ -186,7 +188,8 @@ static AsyncGeneratorObject* OrdinaryCreateFromConstructorAsynGen( return asyncGenObj; } -/* static */ AsyncGeneratorRequest* AsyncGeneratorObject::createRequest( +/* static */ +AsyncGeneratorRequest* AsyncGeneratorObject::createRequest( JSContext* cx, Handle asyncGenObj, CompletionKind completionKind, HandleValue completionValue, Handle promise) { @@ -232,7 +235,8 @@ static AsyncGeneratorObject* OrdinaryCreateFromConstructorAsynGen( return queue->append(cx, requestVal); } -/* static */ AsyncGeneratorRequest* AsyncGeneratorObject::dequeueRequest( +/* static */ +AsyncGeneratorRequest* AsyncGeneratorObject::dequeueRequest( JSContext* cx, Handle asyncGenObj) { if (asyncGenObj->isSingleQueue()) { AsyncGeneratorRequest* request = asyncGenObj->singleQueueRequest(); @@ -244,7 +248,8 @@ static AsyncGeneratorObject* OrdinaryCreateFromConstructorAsynGen( return &queue->popFirstAs(cx); } -/* static */ AsyncGeneratorRequest* AsyncGeneratorObject::peekRequest( +/* static */ +AsyncGeneratorRequest* AsyncGeneratorObject::peekRequest( Handle asyncGenObj) { if (asyncGenObj->isSingleQueue()) { return asyncGenObj->singleQueueRequest(); @@ -258,7 +263,8 @@ const Class AsyncGeneratorRequest::class_ = { JSCLASS_HAS_RESERVED_SLOTS(AsyncGeneratorRequest::Slots)}; // Async Iteration proposal 11.4.3.1. -/* static */ AsyncGeneratorRequest* AsyncGeneratorRequest::create( +/* static */ +AsyncGeneratorRequest* AsyncGeneratorRequest::create( JSContext* cx, CompletionKind completionKind, HandleValue completionValue, Handle promise) { AsyncGeneratorRequest* request = diff --git a/js/src/vm/Compartment.cpp b/js/src/vm/Compartment.cpp index a3aa9175c7a4..5aacb704e983 100644 --- a/js/src/vm/Compartment.cpp +++ b/js/src/vm/Compartment.cpp @@ -405,8 +405,8 @@ void Compartment::traceOutgoingCrossCompartmentWrappers(JSTracer* trc) { } } -/* static */ void Compartment::traceIncomingCrossCompartmentEdgesForZoneGC( - JSTracer* trc) { +/* static */ +void Compartment::traceIncomingCrossCompartmentEdgesForZoneGC(JSTracer* trc) { gcstats::AutoPhase ap(trc->runtime()->gc.stats(), gcstats::PhaseKind::MARK_CCWS); MOZ_ASSERT(JS::RuntimeHeapIsMajorCollecting()); @@ -447,8 +447,8 @@ bool CrossCompartmentKey::needsSweep() { return applyToWrapped(needsSweep) || applyToDebugger(needsSweep); } -/* static */ void Compartment::fixupCrossCompartmentWrappersAfterMovingGC( - JSTracer* trc) { +/* static */ +void Compartment::fixupCrossCompartmentWrappersAfterMovingGC(JSTracer* trc) { MOZ_ASSERT(trc->runtime()->gc.isHeapCompacting()); for (CompartmentsIter comp(trc->runtime()); !comp.done(); comp.next()) { diff --git a/js/src/vm/DateTime.cpp b/js/src/vm/DateTime.cpp index 021f7b9b60f6..a66697de9b3e 100644 --- a/js/src/vm/DateTime.cpp +++ b/js/src/vm/DateTime.cpp @@ -520,7 +520,8 @@ bool js::InitDateTimeState() { return true; } -/* static */ void js::FinishDateTimeState() { +/* static */ +void js::FinishDateTimeState() { js_delete(IcuTimeZoneState); IcuTimeZoneState = nullptr; diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index 0ab54392685b..e53e84a6c5e6 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -370,8 +370,8 @@ class MOZ_RAII js::LeaveDebuggeeNoExecute { } }; -/* static */ bool Debugger::slowPathCheckNoExecute(JSContext* cx, - HandleScript script) { +/* static */ +bool Debugger::slowPathCheckNoExecute(JSContext* cx, HandleScript script) { MOZ_ASSERT(cx->realm()->isDebuggee()); MOZ_ASSERT(cx->noExecuteDebuggerTop); return EnterDebuggeeNoExecute::reportIfFoundInStack(cx, script); @@ -655,7 +655,8 @@ JS_STATIC_ASSERT(unsigned(JSSLOT_DEBUGFRAME_OWNER) == JS_STATIC_ASSERT(unsigned(JSSLOT_DEBUGFRAME_OWNER) == unsigned(DebuggerEnvironment::OWNER_SLOT)); -/* static */ Debugger* Debugger::fromChildJSObject(JSObject* obj) { +/* static */ +Debugger* Debugger::fromChildJSObject(JSObject* obj) { MOZ_ASSERT(obj->getClass() == &DebuggerFrame::class_ || obj->getClass() == &DebuggerScript_class || obj->getClass() == &DebuggerSource_class || @@ -788,7 +789,8 @@ bool Debugger::addGeneratorFrame(JSContext* cx, return true; } -/* static */ bool Debugger::hasLiveHook(GlobalObject* global, Hook which) { +/* static */ +bool Debugger::hasLiveHook(GlobalObject* global, Hook which) { if (GlobalObject::DebuggerVector* debuggers = global->getDebuggers()) { for (auto p = debuggers->begin(); p != debuggers->end(); p++) { Debugger* dbg = *p; @@ -856,8 +858,9 @@ bool Debugger::hasAnyLiveHooks(JSRuntime* rt) const { return false; } -/* static */ ResumeMode Debugger::slowPathOnEnterFrame(JSContext* cx, - AbstractFramePtr frame) { +/* static */ +ResumeMode Debugger::slowPathOnEnterFrame(JSContext* cx, + AbstractFramePtr frame) { RootedValue rval(cx); ResumeMode resumeMode = dispatchHook(cx, [frame](Debugger* dbg) -> bool { @@ -891,8 +894,9 @@ bool Debugger::hasAnyLiveHooks(JSRuntime* rt) const { return resumeMode; } -/* static */ ResumeMode Debugger::slowPathOnResumeFrame( - JSContext* cx, AbstractFramePtr frame) { +/* static */ +ResumeMode Debugger::slowPathOnResumeFrame(JSContext* cx, + AbstractFramePtr frame) { // Don't count on this method to be called every time a generator is // resumed! This is called only if the frame's debuggee bit is set, // i.e. the script has breakpoints or the frame is stepping. @@ -977,9 +981,9 @@ class MOZ_RAII AutoSetGeneratorRunning { * the frame is exiting normally or abruptly. Set |cx|'s exception and/or * |cx->fp()|'s return value, and return a new success value. */ -/* static */ bool Debugger::slowPathOnLeaveFrame(JSContext* cx, - AbstractFramePtr frame, - jsbytecode* pc, bool frameOk) { +/* static */ +bool Debugger::slowPathOnLeaveFrame(JSContext* cx, AbstractFramePtr frame, + jsbytecode* pc, bool frameOk) { mozilla::DebugOnly> debuggeeGlobal = cx->global(); // Determine if we are suspending this frame or popping it forever. @@ -1099,9 +1103,9 @@ class MOZ_RAII AutoSetGeneratorRunning { } } -/* static */ bool Debugger::slowPathOnNewGenerator( - JSContext* cx, AbstractFramePtr frame, - Handle genObj) { +/* static */ +bool Debugger::slowPathOnNewGenerator(JSContext* cx, AbstractFramePtr frame, + Handle genObj) { // This is called from JSOP_GENERATOR, after default parameter expressions // are evaluated and well after onEnterFrame, so Debugger.Frame objects for // `frame` may already have been exposed to debugger code. The @@ -1127,8 +1131,9 @@ class MOZ_RAII AutoSetGeneratorRunning { return ok; } -/* static */ ResumeMode Debugger::slowPathOnDebuggerStatement( - JSContext* cx, AbstractFramePtr frame) { +/* static */ +ResumeMode Debugger::slowPathOnDebuggerStatement(JSContext* cx, + AbstractFramePtr frame) { RootedValue rval(cx); ResumeMode resumeMode = dispatchHook( cx, @@ -1157,8 +1162,9 @@ class MOZ_RAII AutoSetGeneratorRunning { return resumeMode; } -/* static */ ResumeMode Debugger::slowPathOnExceptionUnwind( - JSContext* cx, AbstractFramePtr frame) { +/* static */ +ResumeMode Debugger::slowPathOnExceptionUnwind(JSContext* cx, + AbstractFramePtr frame) { // Invoking more JS on an over-recursed stack or after OOM is only going // to result in more of the same error. if (cx->isThrowingOverRecursed() || cx->isThrowingOutOfMemory()) { @@ -1827,10 +1833,10 @@ ResumeMode Debugger::processHandlerResult(Maybe& ar, bool success, /*** Debuggee completion values *********************************************/ -/* static */ void Debugger::resultToCompletion(JSContext* cx, bool ok, - const Value& rv, - ResumeMode* resumeMode, - MutableHandleValue value) { +/* static */ +void Debugger::resultToCompletion(JSContext* cx, bool ok, const Value& rv, + ResumeMode* resumeMode, + MutableHandleValue value) { MOZ_ASSERT_IF(ok, !cx->isExceptionPending()); if (ok) { @@ -2072,9 +2078,9 @@ void Debugger::fireOnGarbageCollectionHook( template -/* static */ ResumeMode Debugger::dispatchHook(JSContext* cx, - HookIsEnabledFun hookIsEnabled, - FireHookFun fireHook) { +/* static */ +ResumeMode Debugger::dispatchHook(JSContext* cx, HookIsEnabledFun hookIsEnabled, + FireHookFun fireHook) { // Determine which debuggers will receive this event, and in what order. // Make a copy of the list, since the original is mutable and we will be // calling into arbitrary JS. @@ -2164,7 +2170,8 @@ void Debugger::slowPathOnNewWasmInstance( MOZ_ASSERT(resumeMode == ResumeMode::Continue); } -/* static */ ResumeMode Debugger::onTrap(JSContext* cx, MutableHandleValue vp) { +/* static */ +ResumeMode Debugger::onTrap(JSContext* cx, MutableHandleValue vp) { FrameIter iter(cx); JS::AutoSaveExceptionState savedExc(cx); Rooted global(cx); @@ -2273,8 +2280,8 @@ void Debugger::slowPathOnNewWasmInstance( return ResumeMode::Continue; } -/* static */ ResumeMode Debugger::onSingleStep(JSContext* cx, - MutableHandleValue vp) { +/* static */ +ResumeMode Debugger::onSingleStep(JSContext* cx, MutableHandleValue vp) { FrameIter iter(cx); // We may be stepping over a JSOP_EXCEPTION, that pushes the context's @@ -2460,9 +2467,11 @@ void Debugger::slowPathOnNewGlobalObject(JSContext* cx, MOZ_ASSERT(!cx->isExceptionPending()); } -/* static */ bool Debugger::slowPathOnLogAllocationSite( - JSContext* cx, HandleObject obj, HandleSavedFrame frame, - mozilla::TimeStamp when, GlobalObject::DebuggerVector& dbgs) { +/* static */ +bool Debugger::slowPathOnLogAllocationSite(JSContext* cx, HandleObject obj, + HandleSavedFrame frame, + mozilla::TimeStamp when, + GlobalObject::DebuggerVector& dbgs) { MOZ_ASSERT(!dbgs.empty()); mozilla::DebugOnly*> begin = dbgs.begin(); @@ -2578,8 +2587,9 @@ ResumeMode Debugger::firePromiseHook(JSContext* cx, Hook hook, return resumeMode; } -/* static */ void Debugger::slowPathPromiseHook( - JSContext* cx, Hook hook, Handle promise) { +/* static */ +void Debugger::slowPathPromiseHook(JSContext* cx, Hook hook, + Handle promise) { MOZ_ASSERT(hook == OnNewPromise || hook == OnPromiseSettled); if (hook == OnPromiseSettled) { @@ -2750,7 +2760,8 @@ class MOZ_RAII ExecutionObservableScript MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER }; -/* static */ bool Debugger::updateExecutionObservabilityOfFrames( +/* static */ +bool Debugger::updateExecutionObservabilityOfFrames( JSContext* cx, const ExecutionObservableSet& obs, IsObserving observing) { AutoSuppressProfilerSampling suppressProfilerSampling(cx); @@ -2900,7 +2911,8 @@ static bool UpdateExecutionObservabilityOfScriptsInZone( return true; } -/* static */ bool Debugger::updateExecutionObservabilityOfScripts( +/* static */ +bool Debugger::updateExecutionObservabilityOfScripts( JSContext* cx, const ExecutionObservableSet& obs, IsObserving observing) { if (Zone* zone = obs.singleZone()) { return UpdateExecutionObservabilityOfScriptsInZone(cx, zone, obs, @@ -2919,8 +2931,8 @@ static bool UpdateExecutionObservabilityOfScriptsInZone( } template -/* static */ void Debugger::forEachDebuggerFrame(AbstractFramePtr frame, - FrameFn fn) { +/* static */ +void Debugger::forEachDebuggerFrame(AbstractFramePtr frame, FrameFn fn) { GlobalObject* global = frame.global(); if (GlobalObject::DebuggerVector* debuggers = global->getDebuggers()) { for (auto p = debuggers->begin(); p != debuggers->end(); p++) { @@ -2932,8 +2944,9 @@ template } } -/* static */ bool Debugger::getDebuggerFrames( - AbstractFramePtr frame, MutableHandle frames) { +/* static */ +bool Debugger::getDebuggerFrames(AbstractFramePtr frame, + MutableHandle frames) { bool hadOOM = false; forEachDebuggerFrame(frame, [&](DebuggerFrame* frameobj) { if (!hadOOM && !frames.append(frameobj)) { @@ -2943,8 +2956,10 @@ template return !hadOOM; } -/* static */ bool Debugger::updateExecutionObservability( - JSContext* cx, ExecutionObservableSet& obs, IsObserving observing) { +/* static */ +bool Debugger::updateExecutionObservability(JSContext* cx, + ExecutionObservableSet& obs, + IsObserving observing) { if (!obs.singleZone() && obs.zones()->empty()) { return true; } @@ -2955,8 +2970,9 @@ template updateExecutionObservabilityOfFrames(cx, obs, observing); } -/* static */ bool Debugger::ensureExecutionObservabilityOfScript( - JSContext* cx, JSScript* script) { +/* static */ +bool Debugger::ensureExecutionObservabilityOfScript(JSContext* cx, + JSScript* script) { if (script->isDebuggee()) { return true; } @@ -2964,8 +2980,9 @@ template return updateExecutionObservability(cx, obs, Observing); } -/* static */ bool Debugger::ensureExecutionObservabilityOfOsrFrame( - JSContext* cx, InterpreterFrame* frame) { +/* static */ +bool Debugger::ensureExecutionObservabilityOfOsrFrame(JSContext* cx, + InterpreterFrame* frame) { MOZ_ASSERT(frame->isDebuggee()); if (frame->script()->hasBaselineScript() && frame->script()->baselineScript()->hasDebugInstrumentation()) { @@ -2975,8 +2992,9 @@ template return updateExecutionObservabilityOfFrames(cx, obs, Observing); } -/* static */ bool Debugger::ensureExecutionObservabilityOfFrame( - JSContext* cx, AbstractFramePtr frame) { +/* static */ +bool Debugger::ensureExecutionObservabilityOfFrame(JSContext* cx, + AbstractFramePtr frame) { MOZ_ASSERT_IF(frame.hasScript() && frame.script()->isDebuggee(), frame.isDebuggee()); MOZ_ASSERT_IF(frame.isWasmDebugFrame(), frame.wasmInstance()->debugEnabled()); @@ -2987,8 +3005,9 @@ template return updateExecutionObservabilityOfFrames(cx, obs, Observing); } -/* static */ bool Debugger::ensureExecutionObservabilityOfRealm(JSContext* cx, - Realm* realm) { +/* static */ +bool Debugger::ensureExecutionObservabilityOfRealm(JSContext* cx, + Realm* realm) { if (realm->debuggerObservesAllExecution()) { return true; } @@ -3000,7 +3019,8 @@ template return updateExecutionObservability(cx, obs, Observing); } -/* static */ bool Debugger::hookObservesAllExecution(Hook which) { +/* static */ +bool Debugger::hookObservesAllExecution(Hook which) { return which == OnEnterFrame; } @@ -3122,12 +3142,14 @@ void Debugger::updateObservesAsmJSOnDebuggees(IsObserving observing) { /*** Allocations Tracking ***************************************************/ -/* static */ bool Debugger::cannotTrackAllocations(const GlobalObject& global) { +/* static */ +bool Debugger::cannotTrackAllocations(const GlobalObject& global) { auto existingCallback = global.realm()->getAllocationMetadataBuilder(); return existingCallback && existingCallback != &SavedStacks::metadataBuilder; } -/* static */ bool Debugger::isObservedByDebuggerTrackingAllocations( +/* static */ +bool Debugger::isObservedByDebuggerTrackingAllocations( const GlobalObject& debuggee) { if (auto* v = debuggee.getDebuggers()) { for (auto p = v->begin(); p != v->end(); p++) { @@ -3143,8 +3165,9 @@ void Debugger::updateObservesAsmJSOnDebuggees(IsObserving observing) { return false; } -/* static */ bool Debugger::addAllocationsTracking( - JSContext* cx, Handle debuggee) { +/* static */ +bool Debugger::addAllocationsTracking(JSContext* cx, + Handle debuggee) { // Precondition: the given global object is being observed by at least one // Debugger that is tracking allocations. MOZ_ASSERT(isObservedByDebuggerTrackingAllocations(*debuggee)); @@ -3161,7 +3184,8 @@ void Debugger::updateObservesAsmJSOnDebuggees(IsObserving observing) { return true; } -/* static */ void Debugger::removeAllocationsTracking(GlobalObject& global) { +/* static */ +void Debugger::removeAllocationsTracking(GlobalObject& global) { // If there are still Debuggers that are observing allocations, we cannot // remove the metadata callback yet. Recompute the sampling probability // based on the remaining debuggers' needs. @@ -3248,7 +3272,8 @@ void Debugger::traceCrossCompartmentEdges(JSTracer* trc) { * This method is also used during compacting GC to update cross compartment * pointers into zones that are being compacted. */ -/* static */ void Debugger::traceIncomingCrossCompartmentEdges(JSTracer* trc) { +/* static */ +void Debugger::traceIncomingCrossCompartmentEdges(JSTracer* trc) { JSRuntime* rt = trc->runtime(); gc::State state = rt->gc.state(); MOZ_ASSERT(state == gc::State::MarkRoots || state == gc::State::Compact); @@ -3271,7 +3296,8 @@ void Debugger::traceCrossCompartmentEdges(JSTracer* trc) { * returns true if it has to mark anything; GC calls it repeatedly until it * returns false. */ -/* static */ bool Debugger::markIteratively(GCMarker* marker) { +/* static */ +bool Debugger::markIteratively(GCMarker* marker) { MOZ_ASSERT(JS::RuntimeHeapIsCollecting(), "This method should be called during GC."); bool markedAny = false; @@ -3347,7 +3373,8 @@ void Debugger::traceCrossCompartmentEdges(JSTracer* trc) { return markedAny; } -/* static */ void Debugger::traceAllForMovingGC(JSTracer* trc) { +/* static */ +void Debugger::traceAllForMovingGC(JSTracer* trc) { JSRuntime* rt = trc->runtime(); for (Debugger* dbg : rt->debuggerList()) { dbg->traceForMovingGC(trc); @@ -3382,7 +3409,8 @@ void Debugger::traceForMovingGC(JSTracer* trc) { } } -/* static */ void Debugger::traceObject(JSTracer* trc, JSObject* obj) { +/* static */ +void Debugger::traceObject(JSTracer* trc, JSObject* obj) { if (Debugger* dbg = Debugger::fromJSObject(obj)) { dbg->trace(trc); } @@ -3416,7 +3444,8 @@ void Debugger::trace(JSTracer* trc) { wasmInstanceSources.trace(trc); } -/* static */ void Debugger::sweepAll(FreeOp* fop) { +/* static */ +void Debugger::sweepAll(FreeOp* fop) { JSRuntime* rt = fop->runtime(); Debugger* dbg = rt->debuggerList().getFirst(); @@ -3443,8 +3472,8 @@ void Debugger::trace(JSTracer* trc) { } } -/* static */ void Debugger::detachAllDebuggersFromGlobal(FreeOp* fop, - GlobalObject* global) { +/* static */ +void Debugger::detachAllDebuggersFromGlobal(FreeOp* fop, GlobalObject* global) { const GlobalObject::DebuggerVector* debuggers = global->getDebuggers(); MOZ_ASSERT(!debuggers->empty()); while (!debuggers->empty()) { @@ -3452,7 +3481,8 @@ void Debugger::trace(JSTracer* trc) { } } -/* static */ bool Debugger::findSweepGroupEdges(Zone* zone) { +/* static */ +bool Debugger::findSweepGroupEdges(Zone* zone) { JSRuntime* rt = zone->runtimeFromMainThread(); for (Debugger* dbg : rt->debuggerList()) { Zone* debuggerZone = dbg->object->zone(); @@ -3540,15 +3570,15 @@ static Debugger* Debugger_fromThisValue(JSContext* cx, const CallArgs& args, Debugger* dbg = Debugger_fromThisValue(cx, args, fnname); \ if (!dbg) return false -/* static */ bool Debugger::getEnabled(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool Debugger::getEnabled(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER(cx, argc, vp, "get enabled", args, dbg); args.rval().setBoolean(dbg->enabled); return true; } -/* static */ bool Debugger::setEnabled(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool Debugger::setEnabled(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER(cx, argc, vp, "set enabled", args, dbg); if (!args.requireAtLeast(cx, "Debugger.set enabled", 1)) { return false; @@ -3605,15 +3635,17 @@ static Debugger* Debugger_fromThisValue(JSContext* cx, const CallArgs& args, return true; } -/* static */ bool Debugger::getHookImpl(JSContext* cx, CallArgs& args, - Debugger& dbg, Hook which) { +/* static */ +bool Debugger::getHookImpl(JSContext* cx, CallArgs& args, Debugger& dbg, + Hook which) { MOZ_ASSERT(which >= 0 && which < HookCount); args.rval().set(dbg.object->getReservedSlot(JSSLOT_DEBUG_HOOK_START + which)); return true; } -/* static */ bool Debugger::setHookImpl(JSContext* cx, CallArgs& args, - Debugger& dbg, Hook which) { +/* static */ +bool Debugger::setHookImpl(JSContext* cx, CallArgs& args, Debugger& dbg, + Hook which) { MOZ_ASSERT(which >= 0 && which < HookCount); if (!args.requireAtLeast(cx, "Debugger.setHook", 1)) { return false; @@ -3641,86 +3673,86 @@ static Debugger* Debugger_fromThisValue(JSContext* cx, const CallArgs& args, return true; } -/* static */ bool Debugger::getOnDebuggerStatement(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool Debugger::getOnDebuggerStatement(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER(cx, argc, vp, "(get onDebuggerStatement)", args, dbg); return getHookImpl(cx, args, *dbg, OnDebuggerStatement); } -/* static */ bool Debugger::setOnDebuggerStatement(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool Debugger::setOnDebuggerStatement(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER(cx, argc, vp, "(set onDebuggerStatement)", args, dbg); return setHookImpl(cx, args, *dbg, OnDebuggerStatement); } -/* static */ bool Debugger::getOnExceptionUnwind(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool Debugger::getOnExceptionUnwind(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER(cx, argc, vp, "(get onExceptionUnwind)", args, dbg); return getHookImpl(cx, args, *dbg, OnExceptionUnwind); } -/* static */ bool Debugger::setOnExceptionUnwind(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool Debugger::setOnExceptionUnwind(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER(cx, argc, vp, "(set onExceptionUnwind)", args, dbg); return setHookImpl(cx, args, *dbg, OnExceptionUnwind); } -/* static */ bool Debugger::getOnNewScript(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool Debugger::getOnNewScript(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER(cx, argc, vp, "(get onNewScript)", args, dbg); return getHookImpl(cx, args, *dbg, OnNewScript); } -/* static */ bool Debugger::setOnNewScript(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool Debugger::setOnNewScript(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER(cx, argc, vp, "(set onNewScript)", args, dbg); return setHookImpl(cx, args, *dbg, OnNewScript); } -/* static */ bool Debugger::getOnNewPromise(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool Debugger::getOnNewPromise(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER(cx, argc, vp, "(get onNewPromise)", args, dbg); return getHookImpl(cx, args, *dbg, OnNewPromise); } -/* static */ bool Debugger::setOnNewPromise(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool Debugger::setOnNewPromise(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER(cx, argc, vp, "(set onNewPromise)", args, dbg); return setHookImpl(cx, args, *dbg, OnNewPromise); } -/* static */ bool Debugger::getOnPromiseSettled(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool Debugger::getOnPromiseSettled(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER(cx, argc, vp, "(get onPromiseSettled)", args, dbg); return getHookImpl(cx, args, *dbg, OnPromiseSettled); } -/* static */ bool Debugger::setOnPromiseSettled(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool Debugger::setOnPromiseSettled(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER(cx, argc, vp, "(set onPromiseSettled)", args, dbg); return setHookImpl(cx, args, *dbg, OnPromiseSettled); } -/* static */ bool Debugger::getOnEnterFrame(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool Debugger::getOnEnterFrame(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER(cx, argc, vp, "(get onEnterFrame)", args, dbg); return getHookImpl(cx, args, *dbg, OnEnterFrame); } -/* static */ bool Debugger::setOnEnterFrame(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool Debugger::setOnEnterFrame(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER(cx, argc, vp, "(set onEnterFrame)", args, dbg); return setHookImpl(cx, args, *dbg, OnEnterFrame); } -/* static */ bool Debugger::getOnNewGlobalObject(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool Debugger::getOnNewGlobalObject(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER(cx, argc, vp, "(get onNewGlobalObject)", args, dbg); return getHookImpl(cx, args, *dbg, OnNewGlobalObject); } -/* static */ bool Debugger::setOnNewGlobalObject(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool Debugger::setOnNewGlobalObject(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER(cx, argc, vp, "setOnNewGlobalObject", args, dbg); RootedObject oldHook(cx, dbg->getHook(OnNewGlobalObject)); @@ -3742,15 +3774,17 @@ static Debugger* Debugger_fromThisValue(JSContext* cx, const CallArgs& args, return true; } -/* static */ bool Debugger::getUncaughtExceptionHook(JSContext* cx, - unsigned argc, Value* vp) { +/* static */ +bool Debugger::getUncaughtExceptionHook(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGGER(cx, argc, vp, "get uncaughtExceptionHook", args, dbg); args.rval().setObjectOrNull(dbg->uncaughtExceptionHook); return true; } -/* static */ bool Debugger::setUncaughtExceptionHook(JSContext* cx, - unsigned argc, Value* vp) { +/* static */ +bool Debugger::setUncaughtExceptionHook(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGGER(cx, argc, vp, "set uncaughtExceptionHook", args, dbg); if (!args.requireAtLeast(cx, "Debugger.set uncaughtExceptionHook", 1)) { return false; @@ -3767,15 +3801,17 @@ static Debugger* Debugger_fromThisValue(JSContext* cx, const CallArgs& args, return true; } -/* static */ bool Debugger::getAllowUnobservedAsmJS(JSContext* cx, - unsigned argc, Value* vp) { +/* static */ +bool Debugger::getAllowUnobservedAsmJS(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGGER(cx, argc, vp, "get allowUnobservedAsmJS", args, dbg); args.rval().setBoolean(dbg->allowUnobservedAsmJS); return true; } -/* static */ bool Debugger::setAllowUnobservedAsmJS(JSContext* cx, - unsigned argc, Value* vp) { +/* static */ +bool Debugger::setAllowUnobservedAsmJS(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGGER(cx, argc, vp, "set allowUnobservedAsmJS", args, dbg); if (!args.requireAtLeast(cx, "Debugger.set allowUnobservedAsmJS", 1)) { return false; @@ -3793,15 +3829,15 @@ static Debugger* Debugger_fromThisValue(JSContext* cx, const CallArgs& args, return true; } -/* static */ bool Debugger::getCollectCoverageInfo(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool Debugger::getCollectCoverageInfo(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER(cx, argc, vp, "get collectCoverageInfo", args, dbg); args.rval().setBoolean(dbg->collectCoverageInfo); return true; } -/* static */ bool Debugger::setCollectCoverageInfo(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool Debugger::setCollectCoverageInfo(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER(cx, argc, vp, "set collectCoverageInfo", args, dbg); if (!args.requireAtLeast(cx, "Debugger.set collectCoverageInfo", 1)) { return false; @@ -3817,7 +3853,8 @@ static Debugger* Debugger_fromThisValue(JSContext* cx, const CallArgs& args, return true; } -/* static */ bool Debugger::getMemory(JSContext* cx, unsigned argc, Value* vp) { +/* static */ +bool Debugger::getMemory(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER(cx, argc, vp, "get memory", args, dbg); Value memoryValue = dbg->object->getReservedSlot(JSSLOT_DEBUG_MEMORY_INSTANCE); @@ -3883,8 +3920,8 @@ GlobalObject* Debugger::unwrapDebuggeeArgument(JSContext* cx, const Value& v) { return &obj->as(); } -/* static */ bool Debugger::addDebuggee(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool Debugger::addDebuggee(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER(cx, argc, vp, "addDebuggee", args, dbg); if (!args.requireAtLeast(cx, "Debugger.addDebuggee", 1)) { return false; @@ -3906,8 +3943,9 @@ GlobalObject* Debugger::unwrapDebuggeeArgument(JSContext* cx, const Value& v) { return true; } -/* static */ bool Debugger::addAllGlobalsAsDebuggees(JSContext* cx, - unsigned argc, Value* vp) { +/* static */ +bool Debugger::addAllGlobalsAsDebuggees(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGGER(cx, argc, vp, "addAllGlobalsAsDebuggees", args, dbg); for (CompartmentsIter comp(cx->runtime()); !comp.done(); comp.next()) { if (comp == dbg->object->compartment()) { @@ -3932,8 +3970,8 @@ GlobalObject* Debugger::unwrapDebuggeeArgument(JSContext* cx, const Value& v) { return true; } -/* static */ bool Debugger::removeDebuggee(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool Debugger::removeDebuggee(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER(cx, argc, vp, "removeDebuggee", args, dbg); if (!args.requireAtLeast(cx, "Debugger.removeDebuggee", 1)) { @@ -3964,8 +4002,8 @@ GlobalObject* Debugger::unwrapDebuggeeArgument(JSContext* cx, const Value& v) { return true; } -/* static */ bool Debugger::removeAllDebuggees(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool Debugger::removeAllDebuggees(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER(cx, argc, vp, "removeAllDebuggees", args, dbg); ExecutionObservableRealms obs(cx); @@ -3988,8 +4026,8 @@ GlobalObject* Debugger::unwrapDebuggeeArgument(JSContext* cx, const Value& v) { return true; } -/* static */ bool Debugger::hasDebuggee(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool Debugger::hasDebuggee(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER(cx, argc, vp, "hasDebuggee", args, dbg); if (!args.requireAtLeast(cx, "Debugger.hasDebuggee", 1)) { return false; @@ -4002,8 +4040,8 @@ GlobalObject* Debugger::unwrapDebuggeeArgument(JSContext* cx, const Value& v) { return true; } -/* static */ bool Debugger::getDebuggees(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool Debugger::getDebuggees(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER(cx, argc, vp, "getDebuggees", args, dbg); // Obtain the list of debuggees before wrapping each debuggee, as a GC could @@ -4039,8 +4077,8 @@ GlobalObject* Debugger::unwrapDebuggeeArgument(JSContext* cx, const Value& v) { return true; } -/* static */ bool Debugger::getNewestFrame(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool Debugger::getNewestFrame(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER(cx, argc, vp, "getNewestFrame", args, dbg); // Since there may be multiple contexts, use AllFramesIter. @@ -4064,8 +4102,8 @@ GlobalObject* Debugger::unwrapDebuggeeArgument(JSContext* cx, const Value& v) { return true; } -/* static */ bool Debugger::clearAllBreakpoints(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool Debugger::clearAllBreakpoints(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER(cx, argc, vp, "clearAllBreakpoints", args, dbg); for (WeakGlobalObjectSet::Range r = dbg->debuggees.all(); !r.empty(); r.popFront()) { @@ -4075,7 +4113,8 @@ GlobalObject* Debugger::unwrapDebuggeeArgument(JSContext* cx, const Value& v) { return true; } -/* static */ bool Debugger::construct(JSContext* cx, unsigned argc, Value* vp) { +/* static */ +bool Debugger::construct(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); // Check that the arguments, if any, are cross-compartment wrappers. @@ -4981,8 +5020,8 @@ class MOZ_STACK_CLASS Debugger::ScriptQuery : public Debugger::QueryBase { } }; -/* static */ bool Debugger::findScripts(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool Debugger::findScripts(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER(cx, argc, vp, "findScripts", args, dbg); ScriptQuery query(cx, dbg); @@ -5168,8 +5207,8 @@ static inline DebuggerSourceReferent AsSourceReferent(JSObject* obj) { return AsVariant(&obj->as()); } -/* static */ bool Debugger::findSources(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool Debugger::findSources(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER(cx, argc, vp, "findSources", args, dbg); SourceQuery query(cx, dbg); @@ -5422,8 +5461,8 @@ bool Debugger::findObjects(JSContext* cx, unsigned argc, Value* vp) { return true; } -/* static */ bool Debugger::findAllGlobals(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool Debugger::findAllGlobals(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER(cx, argc, vp, "findAllGlobals", args, dbg); AutoObjectVector globals(cx); @@ -5477,9 +5516,9 @@ bool Debugger::findObjects(JSContext* cx, unsigned argc, Value* vp) { return true; } -/* static */ bool Debugger::makeGlobalObjectReference(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool Debugger::makeGlobalObjectReference(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGGER(cx, argc, vp, "makeGlobalObjectReference", args, dbg); if (!args.requireAtLeast(cx, "Debugger.makeGlobalObjectReference", 1)) { return false; @@ -5561,8 +5600,9 @@ bool Debugger::isCompilableUnit(JSContext* cx, unsigned argc, Value* vp) { return true; } -/* static */ bool Debugger::recordReplayProcessKind(JSContext* cx, - unsigned argc, Value* vp) { +/* static */ +bool Debugger::recordReplayProcessKind(JSContext* cx, unsigned argc, + Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (mozilla::recordreplay::IsMiddleman()) { @@ -7487,10 +7527,9 @@ bool Debugger::observesWasm(wasm::Instance* instance) const { return observesGlobal(&instance->object()->global()); } -/* static */ bool Debugger::replaceFrameGuts(JSContext* cx, - AbstractFramePtr from, - AbstractFramePtr to, - ScriptFrameIter& iter) { +/* static */ +bool Debugger::replaceFrameGuts(JSContext* cx, AbstractFramePtr from, + AbstractFramePtr to, ScriptFrameIter& iter) { auto removeFromDebuggerFramesOnExit = MakeScopeExit([&] { // Remove any remaining old entries on exit, as the 'from' frame will // be gone. This is only done in the failure case. On failure, the @@ -7571,15 +7610,18 @@ bool Debugger::observesWasm(wasm::Instance* instance) const { return true; } -/* static */ bool Debugger::inFrameMaps(AbstractFramePtr frame) { +/* static */ +bool Debugger::inFrameMaps(AbstractFramePtr frame) { bool foundAny = false; forEachDebuggerFrame(frame, [&](DebuggerFrame* frameobj) { foundAny = true; }); return foundAny; } -/* static */ void Debugger::removeFromFrameMapsAndClearBreakpointsIn( - JSContext* cx, AbstractFramePtr frame, bool suspending) { +/* static */ +void Debugger::removeFromFrameMapsAndClearBreakpointsIn(JSContext* cx, + AbstractFramePtr frame, + bool suspending) { forEachDebuggerFrame(frame, [&](DebuggerFrame* frameobj) { FreeOp* fop = cx->runtime()->defaultFreeOp(); frameobj->freeFrameIterData(fop); @@ -7609,17 +7651,17 @@ bool Debugger::observesWasm(wasm::Instance* instance) const { } } -/* static */ bool Debugger::handleBaselineOsr(JSContext* cx, - InterpreterFrame* from, - jit::BaselineFrame* to) { +/* static */ +bool Debugger::handleBaselineOsr(JSContext* cx, InterpreterFrame* from, + jit::BaselineFrame* to) { ScriptFrameIter iter(cx); MOZ_ASSERT(iter.abstractFramePtr() == to); return replaceFrameGuts(cx, from, to, iter); } -/* static */ bool Debugger::handleIonBailout(JSContext* cx, - jit::RematerializedFrame* from, - jit::BaselineFrame* to) { +/* static */ +bool Debugger::handleIonBailout(JSContext* cx, jit::RematerializedFrame* from, + jit::BaselineFrame* to) { // When we return to a bailed-out Ion real frame, we must update all // Debugger.Frames that refer to its inline frames. However, since we // can't pop individual inline frames off the stack (we can only pop the @@ -7635,7 +7677,8 @@ bool Debugger::observesWasm(wasm::Instance* instance) const { return replaceFrameGuts(cx, from, to, iter); } -/* static */ void Debugger::handleUnrecoverableIonBailoutError( +/* static */ +void Debugger::handleUnrecoverableIonBailoutError( JSContext* cx, jit::RematerializedFrame* frame) { // Ion bailout can fail due to overrecursion. In such cases we cannot // honor any further Debugger hooks on the frame, and need to ensure that @@ -7643,9 +7686,9 @@ bool Debugger::observesWasm(wasm::Instance* instance) const { removeFromFrameMapsAndClearBreakpointsIn(cx, frame); } -/* static */ void Debugger::propagateForcedReturn(JSContext* cx, - AbstractFramePtr frame, - HandleValue rval) { +/* static */ +void Debugger::propagateForcedReturn(JSContext* cx, AbstractFramePtr frame, + HandleValue rval) { // Invoking the interrupt handler is considered a step and invokes the // youngest frame's onStep handler, if any. However, we cannot handle // { return: ... } resumption values straightforwardly from the interrupt @@ -8755,16 +8798,17 @@ bool DebuggerFrame::hasAnyLiveHooks() const { !getReservedSlot(JSSLOT_DEBUGFRAME_ONPOP_HANDLER).isUndefined(); } -/* static */ NativeObject* DebuggerFrame::initClass( - JSContext* cx, HandleObject dbgCtor, Handle global) { +/* static */ +NativeObject* DebuggerFrame::initClass(JSContext* cx, HandleObject dbgCtor, + Handle global) { return InitClass(cx, dbgCtor, nullptr, &class_, construct, 0, properties_, methods_, nullptr, nullptr); } -/* static */ DebuggerFrame* DebuggerFrame::create(JSContext* cx, - HandleObject proto, - const FrameIter& iter, - HandleNativeObject debugger) { +/* static */ +DebuggerFrame* DebuggerFrame::create(JSContext* cx, HandleObject proto, + const FrameIter& iter, + HandleNativeObject debugger) { DebuggerFrame* frame = NewObjectWithGivenProto(cx, proto); if (!frame) { return nullptr; @@ -8781,9 +8825,9 @@ bool DebuggerFrame::hasAnyLiveHooks() const { return frame; } -/* static */ bool DebuggerFrame::getCallee(JSContext* cx, - HandleDebuggerFrame frame, - MutableHandleDebuggerObject result) { +/* static */ +bool DebuggerFrame::getCallee(JSContext* cx, HandleDebuggerFrame frame, + MutableHandleDebuggerObject result) { MOZ_ASSERT(frame->isLive()); AbstractFramePtr referent = DebuggerFrame::getReferent(frame); @@ -8798,9 +8842,9 @@ bool DebuggerFrame::hasAnyLiveHooks() const { return dbg->wrapDebuggeeObject(cx, callee, result); } -/* static */ bool DebuggerFrame::getIsConstructing(JSContext* cx, - HandleDebuggerFrame frame, - bool& result) { +/* static */ +bool DebuggerFrame::getIsConstructing(JSContext* cx, HandleDebuggerFrame frame, + bool& result) { MOZ_ASSERT(frame->isLive()); Maybe maybeIter; @@ -8860,9 +8904,9 @@ static void UpdateFrameIterPc(FrameIter& iter) { iter.updatePcQuadratic(); } -/* static */ bool DebuggerFrame::getEnvironment( - JSContext* cx, HandleDebuggerFrame frame, - MutableHandleDebuggerEnvironment result) { +/* static */ +bool DebuggerFrame::getEnvironment(JSContext* cx, HandleDebuggerFrame frame, + MutableHandleDebuggerEnvironment result) { MOZ_ASSERT(frame->isLive()); Debugger* dbg = frame->owner(); @@ -8886,14 +8930,15 @@ static void UpdateFrameIterPc(FrameIter& iter) { return dbg->wrapEnvironment(cx, env, result); } -/* static */ bool DebuggerFrame::getIsGenerator(HandleDebuggerFrame frame) { +/* static */ +bool DebuggerFrame::getIsGenerator(HandleDebuggerFrame frame) { AbstractFramePtr referent = DebuggerFrame::getReferent(frame); return referent.hasScript() && referent.script()->isGenerator(); } -/* static */ bool DebuggerFrame::getOffset(JSContext* cx, - HandleDebuggerFrame frame, - size_t& result) { +/* static */ +bool DebuggerFrame::getOffset(JSContext* cx, HandleDebuggerFrame frame, + size_t& result) { MOZ_ASSERT(frame->isLive()); Maybe maybeIter; @@ -8915,9 +8960,9 @@ static void UpdateFrameIterPc(FrameIter& iter) { return true; } -/* static */ bool DebuggerFrame::getOlder(JSContext* cx, - HandleDebuggerFrame frame, - MutableHandleDebuggerFrame result) { +/* static */ +bool DebuggerFrame::getOlder(JSContext* cx, HandleDebuggerFrame frame, + MutableHandleDebuggerFrame result) { MOZ_ASSERT(frame->isLive()); Debugger* dbg = frame->owner(); @@ -8941,9 +8986,9 @@ static void UpdateFrameIterPc(FrameIter& iter) { return true; } -/* static */ bool DebuggerFrame::getThis(JSContext* cx, - HandleDebuggerFrame frame, - MutableHandleValue result) { +/* static */ +bool DebuggerFrame::getThis(JSContext* cx, HandleDebuggerFrame frame, + MutableHandleValue result) { MOZ_ASSERT(frame->isLive()); if (!requireScriptReferent(cx, frame)) { @@ -8973,8 +9018,8 @@ static void UpdateFrameIterPc(FrameIter& iter) { return dbg->wrapDebuggeeValue(cx, result); } -/* static */ DebuggerFrameType DebuggerFrame::getType( - HandleDebuggerFrame frame) { +/* static */ +DebuggerFrameType DebuggerFrame::getType(HandleDebuggerFrame frame) { AbstractFramePtr referent = DebuggerFrame::getReferent(frame); // Indirect eval frames are both isGlobalFrame() and isEvalFrame(), so the @@ -8993,7 +9038,8 @@ static void UpdateFrameIterPc(FrameIter& iter) { MOZ_CRASH("Unknown frame type"); } -/* static */ DebuggerFrameImplementation DebuggerFrame::getImplementation( +/* static */ +DebuggerFrameImplementation DebuggerFrame::getImplementation( HandleDebuggerFrame frame) { AbstractFramePtr referent = DebuggerFrame::getReferent(frame); @@ -9012,9 +9058,9 @@ static void UpdateFrameIterPc(FrameIter& iter) { * Debugger.Frame. Note that on failure, the ownership of `handler` is not * transferred, and the caller is responsible for cleaning it up. */ -/* static */ bool DebuggerFrame::setOnStepHandler(JSContext* cx, - HandleDebuggerFrame frame, - OnStepHandler* handler) { +/* static */ +bool DebuggerFrame::setOnStepHandler(JSContext* cx, HandleDebuggerFrame frame, + OnStepHandler* handler) { MOZ_ASSERT(frame->isLive()); OnStepHandler* prior = frame->onStepHandler(); @@ -9066,9 +9112,9 @@ static void UpdateFrameIterPc(FrameIter& iter) { return true; } -/* static */ bool DebuggerFrame::getArguments( - JSContext* cx, HandleDebuggerFrame frame, - MutableHandleDebuggerArguments result) { +/* static */ +bool DebuggerFrame::getArguments(JSContext* cx, HandleDebuggerFrame frame, + MutableHandleDebuggerArguments result) { Value argumentsv = frame->getReservedSlot(JSSLOT_DEBUGFRAME_ARGUMENTS); if (!argumentsv.isUndefined()) { result.set(argumentsv.isObject() @@ -9263,12 +9309,11 @@ static bool DebuggerGenericEval(JSContext* cx, return dbg->wrapDebuggeeValue(cx, value); } -/* static */ bool DebuggerFrame::eval(JSContext* cx, HandleDebuggerFrame frame, - mozilla::Range chars, - HandleObject bindings, - const EvalOptions& options, - ResumeMode& resumeMode, - MutableHandleValue value) { +/* static */ +bool DebuggerFrame::eval(JSContext* cx, HandleDebuggerFrame frame, + mozilla::Range chars, + HandleObject bindings, const EvalOptions& options, + ResumeMode& resumeMode, MutableHandleValue value) { MOZ_ASSERT(frame->isLive()); Debugger* dbg = frame->owner(); @@ -9285,7 +9330,8 @@ static bool DebuggerGenericEval(JSContext* cx, dbg, nullptr, &iter); } -/* static */ bool DebuggerFrame::isLive() const { return !!getPrivate(); } +/* static */ +bool DebuggerFrame::isLive() const { return !!getPrivate(); } OnStepHandler* DebuggerFrame::onStepHandler() const { Value value = getReservedSlot(JSSLOT_DEBUGFRAME_ONSTEP_HANDLER); @@ -9326,21 +9372,22 @@ FrameIter::Data* DebuggerFrame::frameIterData() const { return static_cast(getPrivate()); } -/* static */ AbstractFramePtr DebuggerFrame::getReferent( - HandleDebuggerFrame frame) { +/* static */ +AbstractFramePtr DebuggerFrame::getReferent(HandleDebuggerFrame frame) { FrameIter iter(*frame->frameIterData()); return iter.abstractFramePtr(); } -/* static */ bool DebuggerFrame::getFrameIter(JSContext* cx, - HandleDebuggerFrame frame, - Maybe& result) { +/* static */ +bool DebuggerFrame::getFrameIter(JSContext* cx, HandleDebuggerFrame frame, + Maybe& result) { result.emplace(*frame->frameIterData()); return true; } -/* static */ bool DebuggerFrame::requireScriptReferent( - JSContext* cx, HandleDebuggerFrame frame) { +/* static */ +bool DebuggerFrame::requireScriptReferent(JSContext* cx, + HandleDebuggerFrame frame) { AbstractFramePtr referent = DebuggerFrame::getReferent(frame); if (!referent.hasScript()) { RootedValue frameobj(cx, ObjectValue(*frame)); @@ -9454,8 +9501,8 @@ static DebuggerFrame* DebuggerFrame_checkThis(JSContext* cx, FrameIter iter(*thisobj->frameIterData()); \ AbstractFramePtr frame = iter.abstractFramePtr() -/* static */ bool DebuggerFrame::typeGetter(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerFrame::typeGetter(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER_FRAME(cx, argc, vp, "get type", args, frame); DebuggerFrameType type = DebuggerFrame::getType(frame); @@ -9485,9 +9532,9 @@ static DebuggerFrame* DebuggerFrame_checkThis(JSContext* cx, return true; } -/* static */ bool DebuggerFrame::implementationGetter(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerFrame::implementationGetter(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGGER_FRAME(cx, argc, vp, "get implementation", args, frame); DebuggerFrameImplementation implementation = @@ -9520,8 +9567,8 @@ static DebuggerFrame* DebuggerFrame_checkThis(JSContext* cx, return true; } -/* static */ bool DebuggerFrame::environmentGetter(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerFrame::environmentGetter(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER_FRAME(cx, argc, vp, "get environment", args, frame); RootedDebuggerEnvironment result(cx); @@ -9533,8 +9580,8 @@ static DebuggerFrame* DebuggerFrame_checkThis(JSContext* cx, return true; } -/* static */ bool DebuggerFrame::calleeGetter(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerFrame::calleeGetter(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER_FRAME(cx, argc, vp, "get callee", args, frame); RootedDebuggerObject result(cx); @@ -9546,16 +9593,17 @@ static DebuggerFrame* DebuggerFrame_checkThis(JSContext* cx, return true; } -/* static */ bool DebuggerFrame::generatorGetter(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerFrame::generatorGetter(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER_FRAME(cx, argc, vp, "get callee", args, frame); args.rval().setBoolean(DebuggerFrame::getIsGenerator(frame)); return true; } -/* static */ bool DebuggerFrame::constructingGetter(JSContext* cx, - unsigned argc, Value* vp) { +/* static */ +bool DebuggerFrame::constructingGetter(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGGER_FRAME(cx, argc, vp, "get callee", args, frame); bool result; @@ -9567,15 +9615,15 @@ static DebuggerFrame* DebuggerFrame_checkThis(JSContext* cx, return true; } -/* static */ bool DebuggerFrame::thisGetter(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerFrame::thisGetter(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER_FRAME(cx, argc, vp, "get this", args, frame); return DebuggerFrame::getThis(cx, frame, args.rval()); } -/* static */ bool DebuggerFrame::olderGetter(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerFrame::olderGetter(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER_FRAME(cx, argc, vp, "get older", args, frame); RootedDebuggerFrame result(cx); @@ -9656,8 +9704,9 @@ static bool DebuggerArguments_getArg(JSContext* cx, unsigned argc, Value* vp) { return true; } -/* static */ DebuggerArguments* DebuggerArguments::create( - JSContext* cx, HandleObject proto, HandleDebuggerFrame frame) { +/* static */ +DebuggerArguments* DebuggerArguments::create(JSContext* cx, HandleObject proto, + HandleDebuggerFrame frame) { AbstractFramePtr referent = DebuggerFrame::getReferent(frame); Rooted obj( @@ -9695,8 +9744,8 @@ static bool DebuggerArguments_getArg(JSContext* cx, unsigned argc, Value* vp) { return obj; } -/* static */ bool DebuggerFrame::argumentsGetter(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerFrame::argumentsGetter(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER_FRAME(cx, argc, vp, "get arguments", args, frame); RootedDebuggerArguments result(cx); @@ -9732,8 +9781,8 @@ static bool DebuggerFrame_getScript(JSContext* cx, unsigned argc, Value* vp) { return true; } -/* static */ bool DebuggerFrame::offsetGetter(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerFrame::offsetGetter(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER_FRAME(cx, argc, vp, "get offset", args, frame); size_t result; @@ -9745,8 +9794,8 @@ static bool DebuggerFrame_getScript(JSContext* cx, unsigned argc, Value* vp) { return true; } -/* static */ bool DebuggerFrame::liveGetter(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerFrame::liveGetter(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedDebuggerFrame frame( cx, DebuggerFrame_checkThis(cx, args, "get live", false)); @@ -9762,8 +9811,8 @@ static bool IsValidHook(const Value& v) { return v.isUndefined() || (v.isObject() && v.toObject().isCallable()); } -/* static */ bool DebuggerFrame::onStepGetter(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerFrame::onStepGetter(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER_FRAME(cx, argc, vp, "get onStep", args, frame); OnStepHandler* handler = frame->onStepHandler(); @@ -9774,8 +9823,8 @@ static bool IsValidHook(const Value& v) { return true; } -/* static */ bool DebuggerFrame::onStepSetter(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerFrame::onStepSetter(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER_FRAME(cx, argc, vp, "set onStep", args, frame); if (!args.requireAtLeast(cx, "Debugger.Frame.set onStep", 1)) { return false; @@ -9803,8 +9852,8 @@ static bool IsValidHook(const Value& v) { return true; } -/* static */ bool DebuggerFrame::onPopGetter(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerFrame::onPopGetter(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER_FRAME(cx, argc, vp, "get onPop", args, frame); OnPopHandler* handler = frame->onPopHandler(); @@ -9815,8 +9864,8 @@ static bool IsValidHook(const Value& v) { return true; } -/* static */ bool DebuggerFrame::onPopSetter(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerFrame::onPopSetter(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER_FRAME(cx, argc, vp, "set onPop", args, frame); if (!args.requireAtLeast(cx, "Debugger.Frame.set onPop", 1)) { return false; @@ -9841,8 +9890,8 @@ static bool IsValidHook(const Value& v) { return true; } -/* static */ bool DebuggerFrame::evalMethod(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerFrame::evalMethod(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER_FRAME(cx, argc, vp, "eval", args, frame); if (!args.requireAtLeast(cx, "Debugger.Frame.prototype.eval", 1)) { return false; @@ -9870,9 +9919,9 @@ static bool IsValidHook(const Value& v) { return frame->owner()->newCompletionValue(cx, resumeMode, value, args.rval()); } -/* static */ bool DebuggerFrame::evalWithBindingsMethod(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerFrame::evalWithBindingsMethod(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGGER_FRAME(cx, argc, vp, "evalWithBindings", args, frame); if (!args.requireAtLeast(cx, "Debugger.Frame.prototype.evalWithBindings", 2)) { @@ -9906,8 +9955,8 @@ static bool IsValidHook(const Value& v) { return frame->owner()->newCompletionValue(cx, resumeMode, value, args.rval()); } -/* static */ bool DebuggerFrame::construct(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerFrame::construct(JSContext* cx, unsigned argc, Value* vp) { JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_NO_CONSTRUCTOR, "Debugger.Frame"); return false; @@ -10027,24 +10076,24 @@ static DebuggerObject* DebuggerObject_checkThis(JSContext* cx, } \ Rooted promise(cx, &obj->as()); -/* static */ bool DebuggerObject::construct(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::construct(JSContext* cx, unsigned argc, Value* vp) { JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_NO_CONSTRUCTOR, "Debugger.Object"); return false; } -/* static */ bool DebuggerObject::callableGetter(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::callableGetter(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "get callable", args, object) args.rval().setBoolean(object->isCallable()); return true; } -/* static */ bool DebuggerObject::isBoundFunctionGetter(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::isBoundFunctionGetter(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "get isBoundFunction", args, object) if (!object->isDebuggeeFunction()) { @@ -10056,9 +10105,9 @@ static DebuggerObject* DebuggerObject_checkThis(JSContext* cx, return true; } -/* static */ bool DebuggerObject::isArrowFunctionGetter(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::isArrowFunctionGetter(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "get isArrowFunction", args, object) if (!object->isDebuggeeFunction()) { @@ -10070,9 +10119,9 @@ static DebuggerObject* DebuggerObject_checkThis(JSContext* cx, return true; } -/* static */ bool DebuggerObject::isAsyncFunctionGetter(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::isAsyncFunctionGetter(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "get isAsyncFunction", args, object) if (!object->isDebuggeeFunction()) { @@ -10084,9 +10133,9 @@ static DebuggerObject* DebuggerObject_checkThis(JSContext* cx, return true; } -/* static */ bool DebuggerObject::isGeneratorFunctionGetter(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::isGeneratorFunctionGetter(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "get isGeneratorFunction", args, object) if (!object->isDebuggeeFunction()) { @@ -10098,8 +10147,8 @@ static DebuggerObject* DebuggerObject_checkThis(JSContext* cx, return true; } -/* static */ bool DebuggerObject::protoGetter(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::protoGetter(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "get proto", args, object) RootedDebuggerObject result(cx); @@ -10111,8 +10160,8 @@ static DebuggerObject* DebuggerObject_checkThis(JSContext* cx, return true; } -/* static */ bool DebuggerObject::classGetter(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::classGetter(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "get class", args, object) RootedString result(cx); @@ -10124,8 +10173,8 @@ static DebuggerObject* DebuggerObject_checkThis(JSContext* cx, return true; } -/* static */ bool DebuggerObject::nameGetter(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::nameGetter(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "get name", args, object) if (!object->isFunction()) { @@ -10142,8 +10191,9 @@ static DebuggerObject* DebuggerObject_checkThis(JSContext* cx, return true; } -/* static */ bool DebuggerObject::displayNameGetter(JSContext* cx, - unsigned argc, Value* vp) { +/* static */ +bool DebuggerObject::displayNameGetter(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "get displayName", args, object) if (!object->isFunction()) { @@ -10160,9 +10210,9 @@ static DebuggerObject* DebuggerObject_checkThis(JSContext* cx, return true; } -/* static */ bool DebuggerObject::parameterNamesGetter(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::parameterNamesGetter(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "get parameterNames", args, object) if (!object->isDebuggeeFunction()) { @@ -10195,8 +10245,8 @@ static DebuggerObject* DebuggerObject_checkThis(JSContext* cx, return true; } -/* static */ bool DebuggerObject::scriptGetter(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::scriptGetter(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGOBJECT_OWNER_REFERENT(cx, argc, vp, "get script", args, dbg, obj); if (!obj->is()) { @@ -10230,8 +10280,9 @@ static DebuggerObject* DebuggerObject_checkThis(JSContext* cx, return true; } -/* static */ bool DebuggerObject::environmentGetter(JSContext* cx, - unsigned argc, Value* vp) { +/* static */ +bool DebuggerObject::environmentGetter(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT_OWNER_REFERENT(cx, argc, vp, "get environment", args, dbg, obj); @@ -10266,9 +10317,9 @@ static DebuggerObject* DebuggerObject_checkThis(JSContext* cx, return dbg->wrapEnvironment(cx, env, args.rval()); } -/* static */ bool DebuggerObject::boundTargetFunctionGetter(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::boundTargetFunctionGetter(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "get boundTargetFunction", args, object) if (!object->isDebuggeeFunction() || !object->isBoundFunction()) { @@ -10285,8 +10336,8 @@ static DebuggerObject* DebuggerObject_checkThis(JSContext* cx, return true; } -/* static */ bool DebuggerObject::boundThisGetter(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::boundThisGetter(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "get boundThis", args, object) if (!object->isDebuggeeFunction() || !object->isBoundFunction()) { @@ -10297,9 +10348,9 @@ static DebuggerObject* DebuggerObject_checkThis(JSContext* cx, return DebuggerObject::getBoundThis(cx, object, args.rval()); } -/* static */ bool DebuggerObject::boundArgumentsGetter(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::boundArgumentsGetter(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "get boundArguments", args, object) if (!object->isDebuggeeFunction() || !object->isBoundFunction()) { @@ -10322,9 +10373,9 @@ static DebuggerObject* DebuggerObject_checkThis(JSContext* cx, return true; } -/* static */ bool DebuggerObject::allocationSiteGetter(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::allocationSiteGetter(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "get allocationSite", args, object) RootedObject result(cx); @@ -10339,9 +10390,9 @@ static DebuggerObject* DebuggerObject_checkThis(JSContext* cx, // Returns the "name" field (see js.msg), which may be used as a unique // identifier, for any error object with a JSErrorReport or undefined // if the object has no JSErrorReport. -/* static */ bool DebuggerObject::errorMessageNameGetter(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::errorMessageNameGetter(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "get errorMessageName", args, object) RootedString result(cx); @@ -10357,39 +10408,40 @@ static DebuggerObject* DebuggerObject_checkThis(JSContext* cx, return true; } -/* static */ bool DebuggerObject::errorNotesGetter(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::errorNotesGetter(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "get errorNotes", args, object) return DebuggerObject::getErrorNotes(cx, object, args.rval()); } -/* static */ bool DebuggerObject::errorLineNumberGetter(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::errorLineNumberGetter(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "get errorLineNumber", args, object) return DebuggerObject::getErrorLineNumber(cx, object, args.rval()); } -/* static */ bool DebuggerObject::errorColumnNumberGetter(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::errorColumnNumberGetter(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "get errorColumnNumber", args, object) return DebuggerObject::getErrorColumnNumber(cx, object, args.rval()); } -/* static */ bool DebuggerObject::isProxyGetter(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::isProxyGetter(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "get isProxy", args, object) args.rval().setBoolean(object->isScriptedProxy()); return true; } -/* static */ bool DebuggerObject::proxyTargetGetter(JSContext* cx, - unsigned argc, Value* vp) { +/* static */ +bool DebuggerObject::proxyTargetGetter(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "get proxyTarget", args, object) if (!object->isScriptedProxy()) { @@ -10406,8 +10458,9 @@ static DebuggerObject* DebuggerObject_checkThis(JSContext* cx, return true; } -/* static */ bool DebuggerObject::proxyHandlerGetter(JSContext* cx, - unsigned argc, Value* vp) { +/* static */ +bool DebuggerObject::proxyHandlerGetter(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "get proxyHandler", args, object) if (!object->isScriptedProxy()) { @@ -10423,16 +10476,17 @@ static DebuggerObject* DebuggerObject_checkThis(JSContext* cx, return true; } -/* static */ bool DebuggerObject::isPromiseGetter(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::isPromiseGetter(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "get isPromise", args, object) args.rval().setBoolean(object->isPromise()); return true; } -/* static */ bool DebuggerObject::promiseStateGetter(JSContext* cx, - unsigned argc, Value* vp) { +/* static */ +bool DebuggerObject::promiseStateGetter(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "get promiseState", args, object); if (!DebuggerObject::requirePromise(cx, object)) { @@ -10456,8 +10510,9 @@ static DebuggerObject* DebuggerObject_checkThis(JSContext* cx, return true; } -/* static */ bool DebuggerObject::promiseValueGetter(JSContext* cx, - unsigned argc, Value* vp) { +/* static */ +bool DebuggerObject::promiseValueGetter(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "get promiseValue", args, object); if (!DebuggerObject::requirePromise(cx, object)) { @@ -10474,9 +10529,9 @@ static DebuggerObject* DebuggerObject_checkThis(JSContext* cx, ; } -/* static */ bool DebuggerObject::promiseReasonGetter(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::promiseReasonGetter(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "get promiseReason", args, object); if (!DebuggerObject::requirePromise(cx, object)) { @@ -10493,9 +10548,9 @@ static DebuggerObject* DebuggerObject_checkThis(JSContext* cx, ; } -/* static */ bool DebuggerObject::promiseLifetimeGetter(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::promiseLifetimeGetter(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "get promiseLifetime", args, object); if (!DebuggerObject::requirePromise(cx, object)) { @@ -10506,9 +10561,9 @@ static DebuggerObject* DebuggerObject_checkThis(JSContext* cx, return true; } -/* static */ bool DebuggerObject::promiseTimeToResolutionGetter(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::promiseTimeToResolutionGetter(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "get promiseTimeToResolution", args, object); if (!DebuggerObject::requirePromise(cx, object)) { @@ -10525,9 +10580,9 @@ static DebuggerObject* DebuggerObject_checkThis(JSContext* cx, return true; } -/* static */ bool DebuggerObject::promiseAllocationSiteGetter(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::promiseAllocationSiteGetter(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT_PROMISE(cx, argc, vp, "get promiseAllocationSite", args, refobj); @@ -10544,9 +10599,9 @@ static DebuggerObject* DebuggerObject_checkThis(JSContext* cx, return true; } -/* static */ bool DebuggerObject::promiseResolutionSiteGetter(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::promiseResolutionSiteGetter(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT_PROMISE(cx, argc, vp, "get promiseResolutionSite", args, refobj); @@ -10569,17 +10624,17 @@ static DebuggerObject* DebuggerObject_checkThis(JSContext* cx, return true; } -/* static */ bool DebuggerObject::promiseIDGetter(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::promiseIDGetter(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGOBJECT_PROMISE(cx, argc, vp, "get promiseID", args, refobj); args.rval().setNumber(double(promise->getID())); return true; } -/* static */ bool DebuggerObject::promiseDependentPromisesGetter(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::promiseDependentPromisesGetter(JSContext* cx, + unsigned argc, Value* vp) { THIS_DEBUGOBJECT_OWNER_PROMISE(cx, argc, vp, "get promiseDependentPromises", args, dbg, refobj); @@ -10608,8 +10663,9 @@ static DebuggerObject* DebuggerObject_checkThis(JSContext* cx, return true; } -/* static */ bool DebuggerObject::isExtensibleMethod(JSContext* cx, - unsigned argc, Value* vp) { +/* static */ +bool DebuggerObject::isExtensibleMethod(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "isExtensible", args, object) bool result; @@ -10621,8 +10677,8 @@ static DebuggerObject* DebuggerObject_checkThis(JSContext* cx, return true; } -/* static */ bool DebuggerObject::isSealedMethod(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::isSealedMethod(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "isSealed", args, object) bool result; @@ -10634,8 +10690,8 @@ static DebuggerObject* DebuggerObject_checkThis(JSContext* cx, return true; } -/* static */ bool DebuggerObject::isFrozenMethod(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::isFrozenMethod(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "isFrozen", args, object) bool result; @@ -10674,9 +10730,9 @@ static JSObject* IdVectorToArray(JSContext* cx, Handle ids) { return NewDenseCopiedArray(cx, vals.length(), vals.begin()); } -/* static */ bool DebuggerObject::getOwnPropertyNamesMethod(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::getOwnPropertyNamesMethod(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "getOwnPropertyNames", args, object) Rooted ids(cx, IdVector(cx)); @@ -10693,9 +10749,9 @@ static JSObject* IdVectorToArray(JSContext* cx, Handle ids) { return true; } -/* static */ bool DebuggerObject::getOwnPropertySymbolsMethod(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::getOwnPropertySymbolsMethod(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "getOwnPropertySymbols", args, object) Rooted ids(cx, IdVector(cx)); @@ -10712,9 +10768,9 @@ static JSObject* IdVectorToArray(JSContext* cx, Handle ids) { return true; } -/* static */ bool DebuggerObject::getOwnPropertyDescriptorMethod(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::getOwnPropertyDescriptorMethod(JSContext* cx, + unsigned argc, Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "getOwnPropertyDescriptor", args, object) RootedId id(cx); @@ -10730,9 +10786,9 @@ static JSObject* IdVectorToArray(JSContext* cx, Handle ids) { return JS::FromPropertyDescriptor(cx, desc, args.rval()); } -/* static */ bool DebuggerObject::preventExtensionsMethod(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::preventExtensionsMethod(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "preventExtensions", args, object) if (!DebuggerObject::preventExtensions(cx, object)) { @@ -10743,8 +10799,8 @@ static JSObject* IdVectorToArray(JSContext* cx, Handle ids) { return true; } -/* static */ bool DebuggerObject::sealMethod(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::sealMethod(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "seal", args, object) if (!DebuggerObject::seal(cx, object)) { @@ -10755,8 +10811,8 @@ static JSObject* IdVectorToArray(JSContext* cx, Handle ids) { return true; } -/* static */ bool DebuggerObject::freezeMethod(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::freezeMethod(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "freeze", args, object) if (!DebuggerObject::freeze(cx, object)) { @@ -10767,9 +10823,9 @@ static JSObject* IdVectorToArray(JSContext* cx, Handle ids) { return true; } -/* static */ bool DebuggerObject::definePropertyMethod(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::definePropertyMethod(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "defineProperty", args, object) if (!args.requireAtLeast(cx, "Debugger.Object.defineProperty", 2)) { return false; @@ -10793,9 +10849,9 @@ static JSObject* IdVectorToArray(JSContext* cx, Handle ids) { return true; } -/* static */ bool DebuggerObject::definePropertiesMethod(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::definePropertiesMethod(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "defineProperties", args, object); if (!args.requireAtLeast(cx, "Debugger.Object.defineProperties", 1)) { return false; @@ -10828,9 +10884,9 @@ static JSObject* IdVectorToArray(JSContext* cx, Handle ids) { * This does a non-strict delete, as a matter of API design. The case where the * property is non-configurable isn't necessarily exceptional here. */ -/* static */ bool DebuggerObject::deletePropertyMethod(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::deletePropertyMethod(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "deleteProperty", args, object) RootedId id(cx); @@ -10847,8 +10903,8 @@ static JSObject* IdVectorToArray(JSContext* cx, Handle ids) { return true; } -/* static */ bool DebuggerObject::callMethod(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::callMethod(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "call", callArgs, object); RootedValue thisv(cx, callArgs.get(0)); @@ -10866,8 +10922,9 @@ static JSObject* IdVectorToArray(JSContext* cx, Handle ids) { return object->call(cx, object, thisv, args, callArgs.rval()); } -/* static */ bool DebuggerObject::getPropertyMethod(JSContext* cx, - unsigned argc, Value* vp) { +/* static */ +bool DebuggerObject::getPropertyMethod(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "getProperty", args, object) RootedId id(cx); @@ -10885,8 +10942,9 @@ static JSObject* IdVectorToArray(JSContext* cx, Handle ids) { return true; } -/* static */ bool DebuggerObject::setPropertyMethod(JSContext* cx, - unsigned argc, Value* vp) { +/* static */ +bool DebuggerObject::setPropertyMethod(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "setProperty", args, object) RootedId id(cx); @@ -10907,8 +10965,8 @@ static JSObject* IdVectorToArray(JSContext* cx, Handle ids) { return true; } -/* static */ bool DebuggerObject::applyMethod(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::applyMethod(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "apply", callArgs, object); RootedValue thisv(cx, callArgs.get(0)); @@ -10945,9 +11003,9 @@ static void EnterDebuggeeObjectRealm(JSContext* cx, Maybe& ar, ar.emplace(cx, referent->maybeCCWRealm()->maybeGlobal()); } -/* static */ bool DebuggerObject::asEnvironmentMethod(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::asEnvironmentMethod(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT_OWNER_REFERENT(cx, argc, vp, "asEnvironment", args, dbg, referent); if (!RequireGlobalObject(cx, args.thisv(), referent)) { @@ -10970,8 +11028,10 @@ static void EnterDebuggeeObjectRealm(JSContext* cx, Maybe& ar, // if it is an uninitialized lexical, otherwise do nothing. The method's // JavaScript return value is true _only_ when an uninitialized lexical has been // altered, otherwise it is false. -/* static */ bool DebuggerObject::forceLexicalInitializationByNameMethod( - JSContext* cx, unsigned argc, Value* vp) { +/* static */ +bool DebuggerObject::forceLexicalInitializationByNameMethod(JSContext* cx, + unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "forceLexicalInitializationByName", args, object) if (!args.requireAtLeast( @@ -10999,9 +11059,9 @@ static void EnterDebuggeeObjectRealm(JSContext* cx, Maybe& ar, return true; } -/* static */ bool DebuggerObject::executeInGlobalMethod(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::executeInGlobalMethod(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "executeInGlobal", args, object); if (!args.requireAtLeast(cx, "Debugger.Object.prototype.executeInGlobal", 1)) { @@ -11035,8 +11095,10 @@ static void EnterDebuggeeObjectRealm(JSContext* cx, Maybe& ar, args.rval()); } -/* static */ bool DebuggerObject::executeInGlobalWithBindingsMethod( - JSContext* cx, unsigned argc, Value* vp) { +/* static */ +bool DebuggerObject::executeInGlobalWithBindingsMethod(JSContext* cx, + unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "executeInGlobalWithBindings", args, object); if (!args.requireAtLeast( cx, "Debugger.Object.prototype.executeInGlobalWithBindings", 2)) { @@ -11076,9 +11138,9 @@ static void EnterDebuggeeObjectRealm(JSContext* cx, Maybe& ar, args.rval()); } -/* static */ bool DebuggerObject::makeDebuggeeValueMethod(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::makeDebuggeeValueMethod(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "makeDebuggeeValue", args, object); if (!args.requireAtLeast(cx, "Debugger.Object.prototype.makeDebuggeeValue", 1)) { @@ -11088,9 +11150,9 @@ static void EnterDebuggeeObjectRealm(JSContext* cx, Maybe& ar, return DebuggerObject::makeDebuggeeValue(cx, object, args[0], args.rval()); } -/* static */ bool DebuggerObject::unsafeDereferenceMethod(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::unsafeDereferenceMethod(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "unsafeDereference", args, object); RootedObject result(cx); @@ -11102,8 +11164,8 @@ static void EnterDebuggeeObjectRealm(JSContext* cx, Maybe& ar, return true; } -/* static */ bool DebuggerObject::unwrapMethod(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerObject::unwrapMethod(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "unwrap", args, object); RootedDebuggerObject result(cx); @@ -11189,8 +11251,10 @@ const JSFunctionSpec DebuggerObject::methods_[] = { JS_FN("unwrap", DebuggerObject::unwrapMethod, 0, 0), JS_FS_END}; -/* static */ NativeObject* DebuggerObject::initClass( - JSContext* cx, Handle global, HandleObject debugCtor) { +/* static */ +NativeObject* DebuggerObject::initClass(JSContext* cx, + Handle global, + HandleObject debugCtor) { RootedNativeObject objectProto( cx, InitClass(cx, debugCtor, nullptr, &class_, construct, 0, properties_, methods_, nullptr, nullptr)); @@ -11207,9 +11271,10 @@ const JSFunctionSpec DebuggerObject::methods_[] = { return objectProto; } -/* static */ DebuggerObject* DebuggerObject::create( - JSContext* cx, HandleObject proto, HandleObject referent, - HandleNativeObject debugger) { +/* static */ +DebuggerObject* DebuggerObject::create(JSContext* cx, HandleObject proto, + HandleObject referent, + HandleNativeObject debugger) { NewObjectKind newKind = IsInsideNursery(referent) ? GenericObject : TenuredObject; DebuggerObject* obj = @@ -11277,9 +11342,9 @@ bool DebuggerObject::isPromise() const { return referent->is(); } -/* static */ bool DebuggerObject::getClassName(JSContext* cx, - HandleDebuggerObject object, - MutableHandleString result) { +/* static */ +bool DebuggerObject::getClassName(JSContext* cx, HandleDebuggerObject object, + MutableHandleString result) { RootedObject referent(cx, object->referent()); const char* className; @@ -11330,9 +11395,10 @@ double DebuggerObject::promiseTimeToResolution() const { return promise()->timeToResolution(); } -/* static */ bool DebuggerObject::getParameterNames( - JSContext* cx, HandleDebuggerObject object, - MutableHandle result) { +/* static */ +bool DebuggerObject::getParameterNames(JSContext* cx, + HandleDebuggerObject object, + MutableHandle result) { MOZ_ASSERT(object->isDebuggeeFunction()); RootedFunction referent(cx, &object->referent()->as()); @@ -11368,7 +11434,8 @@ double DebuggerObject::promiseTimeToResolution() const { return true; } -/* static */ bool DebuggerObject::getBoundTargetFunction( +/* static */ +bool DebuggerObject::getBoundTargetFunction( JSContext* cx, HandleDebuggerObject object, MutableHandleDebuggerObject result) { MOZ_ASSERT(object->isBoundFunction()); @@ -11380,9 +11447,9 @@ double DebuggerObject::promiseTimeToResolution() const { return dbg->wrapDebuggeeObject(cx, target, result); } -/* static */ bool DebuggerObject::getBoundThis(JSContext* cx, - HandleDebuggerObject object, - MutableHandleValue result) { +/* static */ +bool DebuggerObject::getBoundThis(JSContext* cx, HandleDebuggerObject object, + MutableHandleValue result) { MOZ_ASSERT(object->isBoundFunction()); RootedFunction referent(cx, &object->referent()->as()); @@ -11392,9 +11459,10 @@ double DebuggerObject::promiseTimeToResolution() const { return dbg->wrapDebuggeeValue(cx, result); } -/* static */ bool DebuggerObject::getBoundArguments( - JSContext* cx, HandleDebuggerObject object, - MutableHandle result) { +/* static */ +bool DebuggerObject::getBoundArguments(JSContext* cx, + HandleDebuggerObject object, + MutableHandle result) { MOZ_ASSERT(object->isBoundFunction()); RootedFunction referent(cx, &object->referent()->as()); @@ -11413,7 +11481,8 @@ double DebuggerObject::promiseTimeToResolution() const { return true; } -/* static */ SavedFrame* Debugger::getObjectAllocationSite(JSObject& obj) { +/* static */ +SavedFrame* Debugger::getObjectAllocationSite(JSObject& obj) { JSObject* metadata = GetAllocationMetadata(&obj); if (!metadata) { return nullptr; @@ -11423,8 +11492,10 @@ double DebuggerObject::promiseTimeToResolution() const { return metadata->is() ? &metadata->as() : nullptr; } -/* static */ bool DebuggerObject::getAllocationSite( - JSContext* cx, HandleDebuggerObject object, MutableHandleObject result) { +/* static */ +bool DebuggerObject::getAllocationSite(JSContext* cx, + HandleDebuggerObject object, + MutableHandleObject result) { RootedObject referent(cx, object->referent()); RootedObject allocSite(cx, Debugger::getObjectAllocationSite(*referent)); @@ -11436,9 +11507,9 @@ double DebuggerObject::promiseTimeToResolution() const { return true; } -/* static */ bool DebuggerObject::getErrorReport(JSContext* cx, - HandleObject maybeError, - JSErrorReport*& report) { +/* static */ +bool DebuggerObject::getErrorReport(JSContext* cx, HandleObject maybeError, + JSErrorReport*& report) { JSObject* obj = maybeError; if (IsCrossCompartmentWrapper(obj)) { /* We only care about Error objects, so CheckedUnwrapStatic is OK. */ @@ -11459,8 +11530,10 @@ double DebuggerObject::promiseTimeToResolution() const { return true; } -/* static */ bool DebuggerObject::getErrorMessageName( - JSContext* cx, HandleDebuggerObject object, MutableHandleString result) { +/* static */ +bool DebuggerObject::getErrorMessageName(JSContext* cx, + HandleDebuggerObject object, + MutableHandleString result) { RootedObject referent(cx, object->referent()); JSErrorReport* report; if (!getErrorReport(cx, referent, report)) { @@ -11487,9 +11560,9 @@ double DebuggerObject::promiseTimeToResolution() const { return true; } -/* static */ bool DebuggerObject::getErrorNotes(JSContext* cx, - HandleDebuggerObject object, - MutableHandleValue result) { +/* static */ +bool DebuggerObject::getErrorNotes(JSContext* cx, HandleDebuggerObject object, + MutableHandleValue result) { RootedObject referent(cx, object->referent()); JSErrorReport* report; if (!getErrorReport(cx, referent, report)) { @@ -11513,8 +11586,10 @@ double DebuggerObject::promiseTimeToResolution() const { return true; } -/* static */ bool DebuggerObject::getErrorLineNumber( - JSContext* cx, HandleDebuggerObject object, MutableHandleValue result) { +/* static */ +bool DebuggerObject::getErrorLineNumber(JSContext* cx, + HandleDebuggerObject object, + MutableHandleValue result) { RootedObject referent(cx, object->referent()); JSErrorReport* report; if (!getErrorReport(cx, referent, report)) { @@ -11530,8 +11605,10 @@ double DebuggerObject::promiseTimeToResolution() const { return true; } -/* static */ bool DebuggerObject::getErrorColumnNumber( - JSContext* cx, HandleDebuggerObject object, MutableHandleValue result) { +/* static */ +bool DebuggerObject::getErrorColumnNumber(JSContext* cx, + HandleDebuggerObject object, + MutableHandleValue result) { RootedObject referent(cx, object->referent()); JSErrorReport* report; if (!getErrorReport(cx, referent, report)) { @@ -11547,27 +11624,28 @@ double DebuggerObject::promiseTimeToResolution() const { return true; } -/* static */ bool DebuggerObject::getPromiseValue(JSContext* cx, - HandleDebuggerObject object, - MutableHandleValue result) { +/* static */ +bool DebuggerObject::getPromiseValue(JSContext* cx, HandleDebuggerObject object, + MutableHandleValue result) { MOZ_ASSERT(object->promiseState() == JS::PromiseState::Fulfilled); result.set(object->promise()->value()); return object->owner()->wrapDebuggeeValue(cx, result); } -/* static */ bool DebuggerObject::getPromiseReason(JSContext* cx, - HandleDebuggerObject object, - MutableHandleValue result) { +/* static */ +bool DebuggerObject::getPromiseReason(JSContext* cx, + HandleDebuggerObject object, + MutableHandleValue result) { MOZ_ASSERT(object->promiseState() == JS::PromiseState::Rejected); result.set(object->promise()->reason()); return object->owner()->wrapDebuggeeValue(cx, result); } -/* static */ bool DebuggerObject::isExtensible(JSContext* cx, - HandleDebuggerObject object, - bool& result) { +/* static */ +bool DebuggerObject::isExtensible(JSContext* cx, HandleDebuggerObject object, + bool& result) { RootedObject referent(cx, object->referent()); Maybe ar; @@ -11577,9 +11655,9 @@ double DebuggerObject::promiseTimeToResolution() const { return IsExtensible(cx, referent, &result); } -/* static */ bool DebuggerObject::isSealed(JSContext* cx, - HandleDebuggerObject object, - bool& result) { +/* static */ +bool DebuggerObject::isSealed(JSContext* cx, HandleDebuggerObject object, + bool& result) { RootedObject referent(cx, object->referent()); Maybe ar; @@ -11589,9 +11667,9 @@ double DebuggerObject::promiseTimeToResolution() const { return TestIntegrityLevel(cx, referent, IntegrityLevel::Sealed, &result); } -/* static */ bool DebuggerObject::isFrozen(JSContext* cx, - HandleDebuggerObject object, - bool& result) { +/* static */ +bool DebuggerObject::isFrozen(JSContext* cx, HandleDebuggerObject object, + bool& result) { RootedObject referent(cx, object->referent()); Maybe ar; @@ -11601,9 +11679,9 @@ double DebuggerObject::promiseTimeToResolution() const { return TestIntegrityLevel(cx, referent, IntegrityLevel::Frozen, &result); } -/* static */ bool DebuggerObject::getPrototypeOf( - JSContext* cx, HandleDebuggerObject object, - MutableHandleDebuggerObject result) { +/* static */ +bool DebuggerObject::getPrototypeOf(JSContext* cx, HandleDebuggerObject object, + MutableHandleDebuggerObject result) { RootedObject referent(cx, object->referent()); Debugger* dbg = object->owner(); @@ -11624,9 +11702,10 @@ double DebuggerObject::promiseTimeToResolution() const { return dbg->wrapDebuggeeObject(cx, proto, result); } -/* static */ bool DebuggerObject::getOwnPropertyNames( - JSContext* cx, HandleDebuggerObject object, - MutableHandle result) { +/* static */ +bool DebuggerObject::getOwnPropertyNames(JSContext* cx, + HandleDebuggerObject object, + MutableHandle result) { RootedObject referent(cx, object->referent()); AutoIdVector ids(cx); @@ -11647,9 +11726,10 @@ double DebuggerObject::promiseTimeToResolution() const { return result.append(ids.begin(), ids.end()); } -/* static */ bool DebuggerObject::getOwnPropertySymbols( - JSContext* cx, HandleDebuggerObject object, - MutableHandle result) { +/* static */ +bool DebuggerObject::getOwnPropertySymbols(JSContext* cx, + HandleDebuggerObject object, + MutableHandle result) { RootedObject referent(cx, object->referent()); AutoIdVector ids(cx); @@ -11672,7 +11752,8 @@ double DebuggerObject::promiseTimeToResolution() const { return result.append(ids.begin(), ids.end()); } -/* static */ bool DebuggerObject::getOwnPropertyDescriptor( +/* static */ +bool DebuggerObject::getOwnPropertyDescriptor( JSContext* cx, HandleDebuggerObject object, HandleId id, MutableHandle desc) { RootedObject referent(cx, object->referent()); @@ -11720,8 +11801,9 @@ double DebuggerObject::promiseTimeToResolution() const { return true; } -/* static */ bool DebuggerObject::preventExtensions( - JSContext* cx, HandleDebuggerObject object) { +/* static */ +bool DebuggerObject::preventExtensions(JSContext* cx, + HandleDebuggerObject object) { RootedObject referent(cx, object->referent()); Maybe ar; @@ -11731,8 +11813,8 @@ double DebuggerObject::promiseTimeToResolution() const { return PreventExtensions(cx, referent); } -/* static */ bool DebuggerObject::seal(JSContext* cx, - HandleDebuggerObject object) { +/* static */ +bool DebuggerObject::seal(JSContext* cx, HandleDebuggerObject object) { RootedObject referent(cx, object->referent()); Maybe ar; @@ -11742,8 +11824,8 @@ double DebuggerObject::promiseTimeToResolution() const { return SetIntegrityLevel(cx, referent, IntegrityLevel::Sealed); } -/* static */ bool DebuggerObject::freeze(JSContext* cx, - HandleDebuggerObject object) { +/* static */ +bool DebuggerObject::freeze(JSContext* cx, HandleDebuggerObject object) { RootedObject referent(cx, object->referent()); Maybe ar; @@ -11753,9 +11835,10 @@ double DebuggerObject::promiseTimeToResolution() const { return SetIntegrityLevel(cx, referent, IntegrityLevel::Frozen); } -/* static */ bool DebuggerObject::defineProperty( - JSContext* cx, HandleDebuggerObject object, HandleId id, - Handle desc_) { +/* static */ +bool DebuggerObject::defineProperty(JSContext* cx, HandleDebuggerObject object, + HandleId id, + Handle desc_) { RootedObject referent(cx, object->referent()); Debugger* dbg = object->owner(); @@ -11781,9 +11864,11 @@ double DebuggerObject::promiseTimeToResolution() const { return true; } -/* static */ bool DebuggerObject::defineProperties( - JSContext* cx, HandleDebuggerObject object, Handle ids, - Handle descs_) { +/* static */ +bool DebuggerObject::defineProperties(JSContext* cx, + HandleDebuggerObject object, + Handle ids, + Handle descs_) { RootedObject referent(cx, object->referent()); Debugger* dbg = object->owner(); @@ -11818,10 +11903,9 @@ double DebuggerObject::promiseTimeToResolution() const { return true; } -/* static */ bool DebuggerObject::deleteProperty(JSContext* cx, - HandleDebuggerObject object, - HandleId id, - ObjectOpResult& result) { +/* static */ +bool DebuggerObject::deleteProperty(JSContext* cx, HandleDebuggerObject object, + HandleId id, ObjectOpResult& result) { RootedObject referent(cx, object->referent()); Maybe ar; @@ -11833,11 +11917,10 @@ double DebuggerObject::promiseTimeToResolution() const { return DeleteProperty(cx, referent, id, result); } -/* static */ bool DebuggerObject::getProperty(JSContext* cx, - HandleDebuggerObject object, - HandleId id, - HandleValue receiver_, - MutableHandleValue result) { +/* static */ +bool DebuggerObject::getProperty(JSContext* cx, HandleDebuggerObject object, + HandleId id, HandleValue receiver_, + MutableHandleValue result) { RootedObject referent(cx, object->referent()); Debugger* dbg = object->owner(); @@ -11866,11 +11949,11 @@ double DebuggerObject::promiseTimeToResolution() const { return dbg->receiveCompletionValue(ar, ok, result, result); } -/* static */ bool DebuggerObject::setProperty(JSContext* cx, - HandleDebuggerObject object, - HandleId id, HandleValue value_, - HandleValue receiver_, - MutableHandleValue result) { +/* static */ +bool DebuggerObject::setProperty(JSContext* cx, HandleDebuggerObject object, + HandleId id, HandleValue value_, + HandleValue receiver_, + MutableHandleValue result) { RootedObject referent(cx, object->referent()); Debugger* dbg = object->owner(); @@ -11904,11 +11987,10 @@ double DebuggerObject::promiseTimeToResolution() const { return dbg->receiveCompletionValue(ar, ok, result, result); } -/* static */ bool DebuggerObject::call(JSContext* cx, - HandleDebuggerObject object, - HandleValue thisv_, - Handle args, - MutableHandleValue result) { +/* static */ +bool DebuggerObject::call(JSContext* cx, HandleDebuggerObject object, + HandleValue thisv_, Handle args, + MutableHandleValue result) { RootedObject referent(cx, object->referent()); Debugger* dbg = object->owner(); @@ -11973,7 +12055,8 @@ double DebuggerObject::promiseTimeToResolution() const { return dbg->receiveCompletionValue(ar, ok, result, result); } -/* static */ bool DebuggerObject::forceLexicalInitializationByName( +/* static */ +bool DebuggerObject::forceLexicalInitializationByName( JSContext* cx, HandleDebuggerObject object, HandleId id, bool& result) { if (!JSID_IS_STRING(id)) { JS_ReportErrorNumberASCII( @@ -12010,11 +12093,13 @@ double DebuggerObject::promiseTimeToResolution() const { return true; } -/* static */ bool DebuggerObject::executeInGlobal( - JSContext* cx, HandleDebuggerObject object, - mozilla::Range chars, HandleObject bindings, - const EvalOptions& options, ResumeMode& resumeMode, - MutableHandleValue value) { +/* static */ +bool DebuggerObject::executeInGlobal(JSContext* cx, HandleDebuggerObject object, + mozilla::Range chars, + HandleObject bindings, + const EvalOptions& options, + ResumeMode& resumeMode, + MutableHandleValue value) { MOZ_ASSERT(object->isGlobal()); Rooted referent(cx, &object->referent()->as()); @@ -12025,10 +12110,11 @@ double DebuggerObject::promiseTimeToResolution() const { dbg, globalLexical, nullptr); } -/* static */ bool DebuggerObject::makeDebuggeeValue(JSContext* cx, - HandleDebuggerObject object, - HandleValue value_, - MutableHandleValue result) { +/* static */ +bool DebuggerObject::makeDebuggeeValue(JSContext* cx, + HandleDebuggerObject object, + HandleValue value_, + MutableHandleValue result) { RootedObject referent(cx, object->referent()); Debugger* dbg = object->owner(); @@ -12057,8 +12143,10 @@ double DebuggerObject::promiseTimeToResolution() const { return true; } -/* static */ bool DebuggerObject::unsafeDereference( - JSContext* cx, HandleDebuggerObject object, MutableHandleObject result) { +/* static */ +bool DebuggerObject::unsafeDereference(JSContext* cx, + HandleDebuggerObject object, + MutableHandleObject result) { RootedObject referent(cx, object->referent()); if (!cx->compartment()->wrap(cx, &referent)) { @@ -12072,9 +12160,9 @@ double DebuggerObject::promiseTimeToResolution() const { return true; } -/* static */ bool DebuggerObject::unwrap(JSContext* cx, - HandleDebuggerObject object, - MutableHandleDebuggerObject result) { +/* static */ +bool DebuggerObject::unwrap(JSContext* cx, HandleDebuggerObject object, + MutableHandleDebuggerObject result) { RootedObject referent(cx, object->referent()); Debugger* dbg = object->owner(); @@ -12096,8 +12184,8 @@ double DebuggerObject::promiseTimeToResolution() const { return dbg->wrapDebuggeeObject(cx, unwrapped, result); } -/* static */ bool DebuggerObject::requireGlobal(JSContext* cx, - HandleDebuggerObject object) { +/* static */ +bool DebuggerObject::requireGlobal(JSContext* cx, HandleDebuggerObject object) { if (!object->isGlobal()) { RootedObject referent(cx, object->referent()); @@ -12130,8 +12218,9 @@ double DebuggerObject::promiseTimeToResolution() const { return true; } -/* static */ bool DebuggerObject::requirePromise(JSContext* cx, - HandleDebuggerObject object) { +/* static */ +bool DebuggerObject::requirePromise(JSContext* cx, + HandleDebuggerObject object) { RootedObject referent(cx, object->referent()); if (IsCrossCompartmentWrapper(referent)) { @@ -12153,7 +12242,8 @@ double DebuggerObject::promiseTimeToResolution() const { return true; } -/* static */ bool DebuggerObject::getScriptedProxyTarget( +/* static */ +bool DebuggerObject::getScriptedProxyTarget( JSContext* cx, HandleDebuggerObject object, MutableHandleDebuggerObject result) { MOZ_ASSERT(object->isScriptedProxy()); @@ -12167,7 +12257,8 @@ double DebuggerObject::promiseTimeToResolution() const { return dbg->wrapDebuggeeObject(cx, unwrapped, result); } -/* static */ bool DebuggerObject::getScriptedProxyHandler( +/* static */ +bool DebuggerObject::getScriptedProxyHandler( JSContext* cx, HandleDebuggerObject object, MutableHandleDebuggerObject result) { MOZ_ASSERT(object->isScriptedProxy()); @@ -12240,8 +12331,8 @@ static DebuggerEnvironment* DebuggerEnvironment_checkThis( cx, DebuggerEnvironment_checkThis(cx, args, fnname, false)); \ if (!environment) return false; -/* static */ bool DebuggerEnvironment::construct(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerEnvironment::construct(JSContext* cx, unsigned argc, Value* vp) { JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_NO_CONSTRUCTOR, "Debugger.Environment"); return false; @@ -12289,8 +12380,9 @@ bool DebuggerEnvironment::typeGetter(JSContext* cx, unsigned argc, Value* vp) { return true; } -/* static */ bool DebuggerEnvironment::parentGetter(JSContext* cx, - unsigned argc, Value* vp) { +/* static */ +bool DebuggerEnvironment::parentGetter(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGGER_ENVIRONMENT(cx, argc, vp, "get type", args, environment); if (!environment->requireDebuggee(cx)) { @@ -12306,8 +12398,9 @@ bool DebuggerEnvironment::typeGetter(JSContext* cx, unsigned argc, Value* vp) { return true; } -/* static */ bool DebuggerEnvironment::objectGetter(JSContext* cx, - unsigned argc, Value* vp) { +/* static */ +bool DebuggerEnvironment::objectGetter(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGGER_ENVIRONMENT(cx, argc, vp, "get type", args, environment); if (!environment->requireDebuggee(cx)) { @@ -12329,8 +12422,9 @@ bool DebuggerEnvironment::typeGetter(JSContext* cx, unsigned argc, Value* vp) { return true; } -/* static */ bool DebuggerEnvironment::calleeGetter(JSContext* cx, - unsigned argc, Value* vp) { +/* static */ +bool DebuggerEnvironment::calleeGetter(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGGER_ENVIRONMENT(cx, argc, vp, "get callee", args, environment); if (!environment->requireDebuggee(cx)) { @@ -12346,18 +12440,18 @@ bool DebuggerEnvironment::typeGetter(JSContext* cx, unsigned argc, Value* vp) { return true; } -/* static */ bool DebuggerEnvironment::inspectableGetter(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerEnvironment::inspectableGetter(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGGER_ENVIRONMENT(cx, argc, vp, "get inspectable", args, environment); args.rval().setBoolean(environment->isDebuggee()); return true; } -/* static */ bool DebuggerEnvironment::optimizedOutGetter(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerEnvironment::optimizedOutGetter(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGGER_ENVIRONMENT(cx, argc, vp, "get optimizedOut", args, environment); @@ -12365,8 +12459,8 @@ bool DebuggerEnvironment::typeGetter(JSContext* cx, unsigned argc, Value* vp) { return true; } -/* static */ bool DebuggerEnvironment::namesMethod(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerEnvironment::namesMethod(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER_ENVIRONMENT(cx, argc, vp, "names", args, environment); if (!environment->requireDebuggee(cx)) { @@ -12387,8 +12481,8 @@ bool DebuggerEnvironment::typeGetter(JSContext* cx, unsigned argc, Value* vp) { return true; } -/* static */ bool DebuggerEnvironment::findMethod(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerEnvironment::findMethod(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER_ENVIRONMENT(cx, argc, vp, "find", args, environment); if (!args.requireAtLeast(cx, "Debugger.Environment.find", 1)) { return false; @@ -12412,9 +12506,9 @@ bool DebuggerEnvironment::typeGetter(JSContext* cx, unsigned argc, Value* vp) { return true; } -/* static */ bool DebuggerEnvironment::getVariableMethod(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerEnvironment::getVariableMethod(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGGER_ENVIRONMENT(cx, argc, vp, "getVariable", args, environment); if (!args.requireAtLeast(cx, "Debugger.Environment.getVariable", 1)) { return false; @@ -12432,9 +12526,9 @@ bool DebuggerEnvironment::typeGetter(JSContext* cx, unsigned argc, Value* vp) { return DebuggerEnvironment::getVariable(cx, environment, id, args.rval()); } -/* static */ bool DebuggerEnvironment::setVariableMethod(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerEnvironment::setVariableMethod(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGGER_ENVIRONMENT(cx, argc, vp, "setVariable", args, environment); if (!args.requireAtLeast(cx, "Debugger.Environment.setVariable", 2)) { return false; @@ -12485,15 +12579,19 @@ const JSFunctionSpec DebuggerEnvironment::methods_[] = { JS_FN("setVariable", DebuggerEnvironment::setVariableMethod, 2, 0), JS_FS_END}; -/* static */ NativeObject* DebuggerEnvironment::initClass( - JSContext* cx, HandleObject dbgCtor, Handle global) { +/* static */ +NativeObject* DebuggerEnvironment::initClass(JSContext* cx, + HandleObject dbgCtor, + Handle global) { return InitClass(cx, dbgCtor, nullptr, &DebuggerEnvironment::class_, construct, 0, properties_, methods_, nullptr, nullptr); } -/* static */ DebuggerEnvironment* DebuggerEnvironment::create( - JSContext* cx, HandleObject proto, HandleObject referent, - HandleNativeObject debugger) { +/* static */ +DebuggerEnvironment* DebuggerEnvironment::create(JSContext* cx, + HandleObject proto, + HandleObject referent, + HandleNativeObject debugger) { NewObjectKind newKind = IsInsideNursery(referent) ? GenericObject : TenuredObject; DebuggerEnvironment* obj = @@ -12508,7 +12606,8 @@ const JSFunctionSpec DebuggerEnvironment::methods_[] = { return obj; } -/* static */ DebuggerEnvironmentType DebuggerEnvironment::type() const { +/* static */ +DebuggerEnvironmentType DebuggerEnvironment::type() const { // Don't bother switching compartments just to check env's type. if (IsDeclarative(referent())) { return DebuggerEnvironmentType::Declarative; @@ -12591,9 +12690,10 @@ bool DebuggerEnvironment::isOptimized() const { referent()->as().isOptimizedOut(); } -/* static */ bool DebuggerEnvironment::getNames( - JSContext* cx, HandleDebuggerEnvironment environment, - MutableHandle result) { +/* static */ +bool DebuggerEnvironment::getNames(JSContext* cx, + HandleDebuggerEnvironment environment, + MutableHandle result) { MOZ_ASSERT(environment->isDebuggee()); Rooted referent(cx, environment->referent()); @@ -12622,9 +12722,11 @@ bool DebuggerEnvironment::isOptimized() const { return true; } -/* static */ bool DebuggerEnvironment::find( - JSContext* cx, HandleDebuggerEnvironment environment, HandleId id, - MutableHandleDebuggerEnvironment result) { +/* static */ +bool DebuggerEnvironment::find(JSContext* cx, + HandleDebuggerEnvironment environment, + HandleId id, + MutableHandleDebuggerEnvironment result) { MOZ_ASSERT(environment->isDebuggee()); Rooted env(cx, environment->referent()); @@ -12657,9 +12759,10 @@ bool DebuggerEnvironment::isOptimized() const { return dbg->wrapEnvironment(cx, env, result); } -/* static */ bool DebuggerEnvironment::getVariable( - JSContext* cx, HandleDebuggerEnvironment environment, HandleId id, - MutableHandleValue result) { +/* static */ +bool DebuggerEnvironment::getVariable(JSContext* cx, + HandleDebuggerEnvironment environment, + HandleId id, MutableHandleValue result) { MOZ_ASSERT(environment->isDebuggee()); Rooted referent(cx, environment->referent()); @@ -12713,9 +12816,10 @@ bool DebuggerEnvironment::isOptimized() const { return dbg->wrapDebuggeeValue(cx, result); } -/* static */ bool DebuggerEnvironment::setVariable( - JSContext* cx, HandleDebuggerEnvironment environment, HandleId id, - HandleValue value_) { +/* static */ +bool DebuggerEnvironment::setVariable(JSContext* cx, + HandleDebuggerEnvironment environment, + HandleId id, HandleValue value_) { MOZ_ASSERT(environment->isDebuggee()); Rooted referent(cx, environment->referent()); @@ -12942,8 +13046,9 @@ JS_PUBLIC_API bool JS::dbg::GetDebuggeeGlobals(JSContext* cx, JSObject& dbgObj, } #ifdef DEBUG -/* static */ bool Debugger::isDebuggerCrossCompartmentEdge( - JSObject* obj, const gc::Cell* target) { +/* static */ +bool Debugger::isDebuggerCrossCompartmentEdge(JSObject* obj, + const gc::Cell* target) { MOZ_ASSERT(target); auto cls = obj->getClass(); diff --git a/js/src/vm/DebuggerMemory.cpp b/js/src/vm/DebuggerMemory.cpp index 2569d458b991..975a5ca8c8fe 100644 --- a/js/src/vm/DebuggerMemory.cpp +++ b/js/src/vm/DebuggerMemory.cpp @@ -35,8 +35,8 @@ using namespace js; using mozilla::Maybe; using mozilla::Nothing; -/* static */ DebuggerMemory* DebuggerMemory::create(JSContext* cx, - Debugger* dbg) { +/* static */ +DebuggerMemory* DebuggerMemory::create(JSContext* cx, Debugger* dbg) { Value memoryProtoValue = dbg->object->getReservedSlot(Debugger::JSSLOT_DEBUG_MEMORY_PROTO); RootedObject memoryProto(cx, &memoryProtoValue.toObject()); @@ -58,8 +58,8 @@ Debugger* DebuggerMemory::getDebugger() { return Debugger::fromJSObject(&dbgVal.toObject()); } -/* static */ bool DebuggerMemory::construct(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool DebuggerMemory::construct(JSContext* cx, unsigned argc, Value* vp) { JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_NO_CONSTRUCTOR, "Debugger.Source"); return false; @@ -68,9 +68,9 @@ Debugger* DebuggerMemory::getDebugger() { /* static */ const Class DebuggerMemory::class_ = { "Memory", JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(JSSLOT_COUNT)}; -/* static */ DebuggerMemory* DebuggerMemory::checkThis(JSContext* cx, - CallArgs& args, - const char* fnName) { +/* static */ +DebuggerMemory* DebuggerMemory::checkThis(JSContext* cx, CallArgs& args, + const char* fnName) { const Value& thisValue = args.thisv(); if (!thisValue.isObject()) { @@ -127,9 +127,9 @@ static bool undefined(CallArgs& args) { return true; } -/* static */ bool DebuggerMemory::setTrackingAllocationSites(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerMemory::setTrackingAllocationSites(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGGER_MEMORY(cx, argc, vp, "(set trackingAllocationSites)", args, memory); if (!args.requireAtLeast(cx, "(set trackingAllocationSites)", 1)) { @@ -161,18 +161,18 @@ static bool undefined(CallArgs& args) { return undefined(args); } -/* static */ bool DebuggerMemory::getTrackingAllocationSites(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerMemory::getTrackingAllocationSites(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGGER_MEMORY(cx, argc, vp, "(get trackingAllocationSites)", args, memory); args.rval().setBoolean(memory->getDebugger()->trackingAllocationSites); return true; } -/* static */ bool DebuggerMemory::drainAllocationsLog(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerMemory::drainAllocationsLog(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGGER_MEMORY(cx, argc, vp, "drainAllocationsLog", args, memory); Debugger* dbg = memory->getDebugger(); @@ -256,18 +256,18 @@ static bool undefined(CallArgs& args) { return true; } -/* static */ bool DebuggerMemory::getMaxAllocationsLogLength(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerMemory::getMaxAllocationsLogLength(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGGER_MEMORY(cx, argc, vp, "(get maxAllocationsLogLength)", args, memory); args.rval().setInt32(memory->getDebugger()->maxAllocationsLogLength); return true; } -/* static */ bool DebuggerMemory::setMaxAllocationsLogLength(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerMemory::setMaxAllocationsLogLength(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGGER_MEMORY(cx, argc, vp, "(set maxAllocationsLogLength)", args, memory); if (!args.requireAtLeast(cx, "(set maxAllocationsLogLength)", 1)) { @@ -297,16 +297,20 @@ static bool undefined(CallArgs& args) { return true; } -/* static */ bool DebuggerMemory::getAllocationSamplingProbability( - JSContext* cx, unsigned argc, Value* vp) { +/* static */ +bool DebuggerMemory::getAllocationSamplingProbability(JSContext* cx, + unsigned argc, + Value* vp) { THIS_DEBUGGER_MEMORY(cx, argc, vp, "(get allocationSamplingProbability)", args, memory); args.rval().setDouble(memory->getDebugger()->allocationSamplingProbability); return true; } -/* static */ bool DebuggerMemory::setAllocationSamplingProbability( - JSContext* cx, unsigned argc, Value* vp) { +/* static */ +bool DebuggerMemory::setAllocationSamplingProbability(JSContext* cx, + unsigned argc, + Value* vp) { THIS_DEBUGGER_MEMORY(cx, argc, vp, "(set allocationSamplingProbability)", args, memory); if (!args.requireAtLeast(cx, "(set allocationSamplingProbability)", 1)) { @@ -344,26 +348,26 @@ static bool undefined(CallArgs& args) { return true; } -/* static */ bool DebuggerMemory::getAllocationsLogOverflowed(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerMemory::getAllocationsLogOverflowed(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGGER_MEMORY(cx, argc, vp, "(get allocationsLogOverflowed)", args, memory); args.rval().setBoolean(memory->getDebugger()->allocationsLogOverflowed); return true; } -/* static */ bool DebuggerMemory::getOnGarbageCollection(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerMemory::getOnGarbageCollection(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGGER_MEMORY(cx, argc, vp, "(get onGarbageCollection)", args, memory); return Debugger::getHookImpl(cx, args, *memory->getDebugger(), Debugger::OnGarbageCollection); } -/* static */ bool DebuggerMemory::setOnGarbageCollection(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool DebuggerMemory::setOnGarbageCollection(JSContext* cx, unsigned argc, + Value* vp) { THIS_DEBUGGER_MEMORY(cx, argc, vp, "(set onGarbageCollection)", args, memory); return Debugger::setHookImpl(cx, args, *memory->getDebugger(), Debugger::OnGarbageCollection); diff --git a/js/src/vm/EnvironmentObject.cpp b/js/src/vm/EnvironmentObject.cpp index 4a1827188441..1e0c2bf91592 100644 --- a/js/src/vm/EnvironmentObject.cpp +++ b/js/src/vm/EnvironmentObject.cpp @@ -226,9 +226,11 @@ const Class CallObject::class_ = { /*****************************************************************************/ -/* static */ VarEnvironmentObject* VarEnvironmentObject::create( - JSContext* cx, HandleShape shape, HandleObject enclosing, - gc::InitialHeap heap) { +/* static */ +VarEnvironmentObject* VarEnvironmentObject::create(JSContext* cx, + HandleShape shape, + HandleObject enclosing, + gc::InitialHeap heap) { MOZ_ASSERT(shape->getObjectClass() == &class_); RootedObjectGroup group( @@ -254,8 +256,10 @@ const Class CallObject::class_ = { return env; } -/* static */ VarEnvironmentObject* VarEnvironmentObject::create( - JSContext* cx, HandleScope scope, AbstractFramePtr frame) { +/* static */ +VarEnvironmentObject* VarEnvironmentObject::create(JSContext* cx, + HandleScope scope, + AbstractFramePtr frame) { #ifdef DEBUG if (frame.isEvalFrame()) { MOZ_ASSERT(scope->is() && scope == frame.script()->bodyScope()); @@ -283,7 +287,8 @@ const Class CallObject::class_ = { return env; } -/* static */ VarEnvironmentObject* VarEnvironmentObject::createHollowForDebug( +/* static */ +VarEnvironmentObject* VarEnvironmentObject::createHollowForDebug( JSContext* cx, Handle scope) { MOZ_ASSERT(!scope->hasEnvironment()); @@ -346,7 +351,8 @@ const Class ModuleEnvironmentObject::class_ = { JS_NULL_CLASS_EXT, &ModuleEnvironmentObject::objectOps_}; -/* static */ ModuleEnvironmentObject* ModuleEnvironmentObject::create( +/* static */ +ModuleEnvironmentObject* ModuleEnvironmentObject::create( JSContext* cx, HandleModuleObject module) { RootedScript script(cx, module->script()); RootedShape shape(cx, @@ -435,7 +441,8 @@ void ModuleEnvironmentObject::fixEnclosingEnvironmentAfterCompartmentMerge( setEnclosingEnvironment(&global.lexicalEnvironment()); } -/* static */ bool ModuleEnvironmentObject::lookupProperty( +/* static */ +bool ModuleEnvironmentObject::lookupProperty( JSContext* cx, HandleObject obj, HandleId id, MutableHandleObject objp, MutableHandle propp) { const IndirectBindingMap& bindings = @@ -457,10 +464,9 @@ void ModuleEnvironmentObject::fixEnclosingEnvironmentAfterCompartmentMerge( return true; } -/* static */ bool ModuleEnvironmentObject::hasProperty(JSContext* cx, - HandleObject obj, - HandleId id, - bool* foundp) { +/* static */ +bool ModuleEnvironmentObject::hasProperty(JSContext* cx, HandleObject obj, + HandleId id, bool* foundp) { if (obj->as().importBindings().has(id)) { *foundp = true; return true; @@ -470,11 +476,10 @@ void ModuleEnvironmentObject::fixEnclosingEnvironmentAfterCompartmentMerge( return NativeHasProperty(cx, self, id, foundp); } -/* static */ bool ModuleEnvironmentObject::getProperty(JSContext* cx, - HandleObject obj, - HandleValue receiver, - HandleId id, - MutableHandleValue vp) { +/* static */ +bool ModuleEnvironmentObject::getProperty(JSContext* cx, HandleObject obj, + HandleValue receiver, HandleId id, + MutableHandleValue vp) { const IndirectBindingMap& bindings = obj->as().importBindings(); Shape* shape; @@ -488,9 +493,11 @@ void ModuleEnvironmentObject::fixEnclosingEnvironmentAfterCompartmentMerge( return NativeGetProperty(cx, self, receiver, id, vp); } -/* static */ bool ModuleEnvironmentObject::setProperty( - JSContext* cx, HandleObject obj, HandleId id, HandleValue v, - HandleValue receiver, JS::ObjectOpResult& result) { +/* static */ +bool ModuleEnvironmentObject::setProperty(JSContext* cx, HandleObject obj, + HandleId id, HandleValue v, + HandleValue receiver, + JS::ObjectOpResult& result) { RootedModuleEnvironmentObject self(cx, &obj->as()); if (self->importBindings().has(id)) { return result.failReadOnly(); @@ -499,7 +506,8 @@ void ModuleEnvironmentObject::fixEnclosingEnvironmentAfterCompartmentMerge( return NativeSetProperty(cx, self, id, v, receiver, result); } -/* static */ bool ModuleEnvironmentObject::getOwnPropertyDescriptor( +/* static */ +bool ModuleEnvironmentObject::getOwnPropertyDescriptor( JSContext* cx, HandleObject obj, HandleId id, MutableHandle desc) { const IndirectBindingMap& bindings = @@ -519,14 +527,17 @@ void ModuleEnvironmentObject::fixEnclosingEnvironmentAfterCompartmentMerge( return NativeGetOwnPropertyDescriptor(cx, self, id, desc); } -/* static */ bool ModuleEnvironmentObject::deleteProperty( - JSContext* cx, HandleObject obj, HandleId id, ObjectOpResult& result) { +/* static */ +bool ModuleEnvironmentObject::deleteProperty(JSContext* cx, HandleObject obj, + HandleId id, + ObjectOpResult& result) { return result.failCantDelete(); } -/* static */ bool ModuleEnvironmentObject::newEnumerate( - JSContext* cx, HandleObject obj, AutoIdVector& properties, - bool enumerableOnly) { +/* static */ +bool ModuleEnvironmentObject::newEnumerate(JSContext* cx, HandleObject obj, + AutoIdVector& properties, + bool enumerableOnly) { RootedModuleEnvironmentObject self(cx, &obj->as()); const IndirectBindingMap& bs(self->importBindings()); @@ -553,7 +564,8 @@ const Class WasmInstanceEnvironmentObject::class_ = { "WasmInstance", JSCLASS_HAS_RESERVED_SLOTS(WasmInstanceEnvironmentObject::RESERVED_SLOTS)}; -/* static */ WasmInstanceEnvironmentObject* +/* static */ +WasmInstanceEnvironmentObject* WasmInstanceEnvironmentObject::createHollowForDebug( JSContext* cx, Handle scope) { RootedObjectGroup group( @@ -589,10 +601,9 @@ const Class WasmFunctionCallObject::class_ = { "WasmCall", JSCLASS_HAS_RESERVED_SLOTS(WasmFunctionCallObject::RESERVED_SLOTS)}; -/* static */ WasmFunctionCallObject* -WasmFunctionCallObject::createHollowForDebug(JSContext* cx, - HandleObject enclosing, - Handle scope) { +/* static */ +WasmFunctionCallObject* WasmFunctionCallObject::createHollowForDebug( + JSContext* cx, HandleObject enclosing, Handle scope) { RootedObjectGroup group( cx, ObjectGroup::defaultNewGroup(cx, &class_, TaggedProto(nullptr))); if (!group) { @@ -792,7 +803,8 @@ const Class WithEnvironmentObject::class_ = { JS_NULL_CLASS_EXT, &WithEnvironmentObjectOps}; -/* static */ NonSyntacticVariablesObject* NonSyntacticVariablesObject::create( +/* static */ +NonSyntacticVariablesObject* NonSyntacticVariablesObject::create( JSContext* cx) { Rooted obj( cx, NewObjectWithNullTaggedProto( @@ -862,10 +874,10 @@ bool js::CreateNonSyntacticEnvironmentChain(JSContext* cx, /*****************************************************************************/ -/* static */ LexicalEnvironmentObject* -LexicalEnvironmentObject::createTemplateObject(JSContext* cx, HandleShape shape, - HandleObject enclosing, - gc::InitialHeap heap) { +/* static */ +LexicalEnvironmentObject* LexicalEnvironmentObject::createTemplateObject( + JSContext* cx, HandleShape shape, HandleObject enclosing, + gc::InitialHeap heap) { MOZ_ASSERT(shape->getObjectClass() == &LexicalEnvironmentObject::class_); RootedObjectGroup group( @@ -895,7 +907,8 @@ LexicalEnvironmentObject::createTemplateObject(JSContext* cx, HandleShape shape, return env; } -/* static */ LexicalEnvironmentObject* LexicalEnvironmentObject::create( +/* static */ +LexicalEnvironmentObject* LexicalEnvironmentObject::create( JSContext* cx, Handle scope, HandleObject enclosing, gc::InitialHeap heap) { cx->check(enclosing); @@ -919,13 +932,15 @@ LexicalEnvironmentObject::createTemplateObject(JSContext* cx, HandleShape shape, return env; } -/* static */ LexicalEnvironmentObject* LexicalEnvironmentObject::create( +/* static */ +LexicalEnvironmentObject* LexicalEnvironmentObject::create( JSContext* cx, Handle scope, AbstractFramePtr frame) { RootedObject enclosing(cx, frame.environmentChain()); return create(cx, scope, enclosing, gc::DefaultHeap); } -/* static */ LexicalEnvironmentObject* LexicalEnvironmentObject::createGlobal( +/* static */ +LexicalEnvironmentObject* LexicalEnvironmentObject::createGlobal( JSContext* cx, Handle global) { MOZ_ASSERT(global); @@ -949,10 +964,9 @@ LexicalEnvironmentObject::createTemplateObject(JSContext* cx, HandleShape shape, return env; } -/* static */ LexicalEnvironmentObject* -LexicalEnvironmentObject::createNonSyntactic(JSContext* cx, - HandleObject enclosing, - HandleObject thisv) { +/* static */ +LexicalEnvironmentObject* LexicalEnvironmentObject::createNonSyntactic( + JSContext* cx, HandleObject enclosing, HandleObject thisv) { MOZ_ASSERT(enclosing); MOZ_ASSERT(!IsSyntacticEnvironment(enclosing)); @@ -973,9 +987,9 @@ LexicalEnvironmentObject::createNonSyntactic(JSContext* cx, return env; } -/* static */ LexicalEnvironmentObject* -LexicalEnvironmentObject::createHollowForDebug(JSContext* cx, - Handle scope) { +/* static */ +LexicalEnvironmentObject* LexicalEnvironmentObject::createHollowForDebug( + JSContext* cx, Handle scope) { MOZ_ASSERT(!scope->hasEnvironment()); RootedShape shape(cx, LexicalScope::getEmptyExtensibleEnvironmentShape(cx)); @@ -1012,7 +1026,8 @@ LexicalEnvironmentObject::createHollowForDebug(JSContext* cx, return env; } -/* static */ LexicalEnvironmentObject* LexicalEnvironmentObject::clone( +/* static */ +LexicalEnvironmentObject* LexicalEnvironmentObject::clone( JSContext* cx, Handle env) { Rooted scope(cx, &env->scope()); RootedObject enclosing(cx, &env->enclosingEnvironment()); @@ -1032,7 +1047,8 @@ LexicalEnvironmentObject::createHollowForDebug(JSContext* cx, return copy; } -/* static */ LexicalEnvironmentObject* LexicalEnvironmentObject::recreate( +/* static */ +LexicalEnvironmentObject* LexicalEnvironmentObject::recreate( JSContext* cx, Handle env) { Rooted scope(cx, &env->scope()); RootedObject enclosing(cx, &env->enclosingEnvironment()); @@ -1068,9 +1084,12 @@ const Class LexicalEnvironmentObject::class_ = { JS_NULL_CLASS_EXT, JS_NULL_OBJECT_OPS}; -/* static */ NamedLambdaObject* NamedLambdaObject::create( - JSContext* cx, HandleFunction callee, HandleFunction func, - HandleObject enclosing, gc::InitialHeap heap) { +/* static */ +NamedLambdaObject* NamedLambdaObject::create(JSContext* cx, + HandleFunction callee, + HandleFunction func, + HandleObject enclosing, + gc::InitialHeap heap) { MOZ_ASSERT(callee->isNamedLambda()); RootedScope scope(cx, callee->nonLazyScript()->maybeNamedLambdaScope()); MOZ_ASSERT(scope && scope->environmentShape()); @@ -1094,24 +1113,28 @@ const Class LexicalEnvironmentObject::class_ = { return static_cast(obj); } -/* static */ NamedLambdaObject* NamedLambdaObject::createTemplateObject( +/* static */ +NamedLambdaObject* NamedLambdaObject::createTemplateObject( JSContext* cx, HandleFunction callee, gc::InitialHeap heap) { return create(cx, callee, callee, nullptr, heap); } -/* static */ NamedLambdaObject* NamedLambdaObject::create( - JSContext* cx, AbstractFramePtr frame) { +/* static */ +NamedLambdaObject* NamedLambdaObject::create(JSContext* cx, + AbstractFramePtr frame) { RootedFunction fun(cx, frame.callee()); RootedObject enclosing(cx, frame.environmentChain()); return create(cx, fun, fun, enclosing, gc::DefaultHeap); } -/* static */ size_t NamedLambdaObject::lambdaSlot() { +/* static */ +size_t NamedLambdaObject::lambdaSlot() { // Named lambda environments have exactly one name. return JSSLOT_FREE(&LexicalEnvironmentObject::class_); } -/* static */ RuntimeLexicalErrorObject* RuntimeLexicalErrorObject::create( +/* static */ +RuntimeLexicalErrorObject* RuntimeLexicalErrorObject::create( JSContext* cx, HandleObject enclosing, unsigned errorNumber) { RuntimeLexicalErrorObject* obj = NewObjectWithNullTaggedProto( @@ -1342,12 +1365,14 @@ bool EnvironmentIter::hasNonSyntacticEnvironmentObject() const { return false; } -/* static */ HashNumber MissingEnvironmentKey::hash(MissingEnvironmentKey ek) { +/* static */ +HashNumber MissingEnvironmentKey::hash(MissingEnvironmentKey ek) { return size_t(ek.frame_.raw()) ^ size_t(ek.scope_); } -/* static */ bool MissingEnvironmentKey::match(MissingEnvironmentKey ek1, - MissingEnvironmentKey ek2) { +/* static */ +bool MissingEnvironmentKey::match(MissingEnvironmentKey ek1, + MissingEnvironmentKey ek2) { return ek1.frame_ == ek2.frame_ && ek1.scope_ == ek2.scope_; } @@ -2335,8 +2360,10 @@ bool JSObject::is() const { const char DebugEnvironmentProxyHandler::family = 0; const DebugEnvironmentProxyHandler DebugEnvironmentProxyHandler::singleton; -/* static */ DebugEnvironmentProxy* DebugEnvironmentProxy::create( - JSContext* cx, EnvironmentObject& env, HandleObject enclosing) { +/* static */ +DebugEnvironmentProxy* DebugEnvironmentProxy::create(JSContext* cx, + EnvironmentObject& env, + HandleObject enclosing) { MOZ_ASSERT(env.realm() == cx->realm()); MOZ_ASSERT(!enclosing->is()); @@ -2380,7 +2407,8 @@ bool DebugEnvironmentProxy::isForDeclarative() const { e.is() || e.is(); } -/* static */ bool DebugEnvironmentProxy::getMaybeSentinelValue( +/* static */ +bool DebugEnvironmentProxy::getMaybeSentinelValue( JSContext* cx, Handle env, HandleId id, MutableHandleValue vp) { return DebugEnvironmentProxyHandler::singleton.getMaybeSentinelValue(cx, env, @@ -2516,7 +2544,8 @@ DebugEnvironments* DebugEnvironments::ensureRealmData(JSContext* cx) { return realm->debugEnvs(); } -/* static */ DebugEnvironmentProxy* DebugEnvironments::hasDebugEnvironment( +/* static */ +DebugEnvironmentProxy* DebugEnvironments::hasDebugEnvironment( JSContext* cx, EnvironmentObject& env) { DebugEnvironments* envs = env.realm()->debugEnvs(); if (!envs) { @@ -2531,7 +2560,8 @@ DebugEnvironments* DebugEnvironments::ensureRealmData(JSContext* cx) { return nullptr; } -/* static */ bool DebugEnvironments::addDebugEnvironment( +/* static */ +bool DebugEnvironments::addDebugEnvironment( JSContext* cx, Handle env, Handle debugEnv) { MOZ_ASSERT(cx->realm() == env->realm()); @@ -2549,7 +2579,8 @@ DebugEnvironments* DebugEnvironments::ensureRealmData(JSContext* cx) { return envs->proxiedEnvs.add(cx, env, debugEnv); } -/* static */ DebugEnvironmentProxy* DebugEnvironments::hasDebugEnvironment( +/* static */ +DebugEnvironmentProxy* DebugEnvironments::hasDebugEnvironment( JSContext* cx, const EnvironmentIter& ei) { MOZ_ASSERT(!ei.hasSyntacticEnvironment()); @@ -2566,7 +2597,8 @@ DebugEnvironments* DebugEnvironments::ensureRealmData(JSContext* cx) { return nullptr; } -/* static */ bool DebugEnvironments::addDebugEnvironment( +/* static */ +bool DebugEnvironments::addDebugEnvironment( JSContext* cx, const EnvironmentIter& ei, Handle debugEnv) { MOZ_ASSERT(!ei.hasSyntacticEnvironment()); @@ -2607,7 +2639,8 @@ DebugEnvironments* DebugEnvironments::ensureRealmData(JSContext* cx) { return true; } -/* static */ void DebugEnvironments::takeFrameSnapshot( +/* static */ +void DebugEnvironments::takeFrameSnapshot( JSContext* cx, Handle debugEnv, AbstractFramePtr frame) { /* @@ -2717,8 +2750,8 @@ DebugEnvironments* DebugEnvironments::ensureRealmData(JSContext* cx) { debugEnv->initSnapshot(*snapshot); } -/* static */ void DebugEnvironments::onPopCall(JSContext* cx, - AbstractFramePtr frame) { +/* static */ +void DebugEnvironments::onPopCall(JSContext* cx, AbstractFramePtr frame) { cx->check(frame); DebugEnvironments* envs = cx->realm()->debugEnvs(); @@ -2932,8 +2965,9 @@ LiveEnvironmentVal* DebugEnvironments::hasLiveEnvironment( return nullptr; } -/* static */ void DebugEnvironments::unsetPrevUpToDateUntil( - JSContext* cx, AbstractFramePtr until) { +/* static */ +void DebugEnvironments::unsetPrevUpToDateUntil(JSContext* cx, + AbstractFramePtr until) { // This are two exceptions where fp->prevUpToDate() is cleared without // popping the frame. When a frame is rematerialized or has its // debuggeeness toggled off->on, all frames younger than the frame must @@ -2960,9 +2994,9 @@ LiveEnvironmentVal* DebugEnvironments::hasLiveEnvironment( } } -/* static */ void DebugEnvironments::forwardLiveFrame(JSContext* cx, - AbstractFramePtr from, - AbstractFramePtr to) { +/* static */ +void DebugEnvironments::forwardLiveFrame(JSContext* cx, AbstractFramePtr from, + AbstractFramePtr to) { DebugEnvironments* envs = cx->realm()->debugEnvs(); if (!envs) { return; @@ -2985,8 +3019,8 @@ LiveEnvironmentVal* DebugEnvironments::hasLiveEnvironment( } } -/* static */ void DebugEnvironments::traceLiveFrame(JSTracer* trc, - AbstractFramePtr frame) { +/* static */ +void DebugEnvironments::traceLiveFrame(JSTracer* trc, AbstractFramePtr frame) { for (MissingEnvironmentMap::Enum e(missingEnvs); !e.empty(); e.popFront()) { if (e.front().key().frame() == frame) { TraceEdge(trc, &e.front().value(), "debug-env-live-frame-missing-env"); diff --git a/js/src/vm/ErrorObject.cpp b/js/src/vm/ErrorObject.cpp index f899d8f116cd..7c82ab40ace8 100644 --- a/js/src/vm/ErrorObject.cpp +++ b/js/src/vm/ErrorObject.cpp @@ -26,8 +26,9 @@ using namespace js; -/* static */ Shape* js::ErrorObject::assignInitialShape( - JSContext* cx, Handle obj) { +/* static */ +Shape* js::ErrorObject::assignInitialShape(JSContext* cx, + Handle obj) { MOZ_ASSERT(obj->empty()); if (!NativeObject::addDataProperty(cx, obj, cx->names().fileName, @@ -42,14 +43,12 @@ using namespace js; COLUMNNUMBER_SLOT, 0); } -/* static */ bool js::ErrorObject::init(JSContext* cx, Handle obj, - JSExnType type, - UniquePtr errorReport, - HandleString fileName, - HandleObject stack, uint32_t sourceId, - uint32_t lineNumber, - uint32_t columnNumber, - HandleString message) { +/* static */ +bool js::ErrorObject::init(JSContext* cx, Handle obj, + JSExnType type, UniquePtr errorReport, + HandleString fileName, HandleObject stack, + uint32_t sourceId, uint32_t lineNumber, + uint32_t columnNumber, HandleString message) { AssertObjectIsSavedFrameOrWrapper(cx, stack); cx->check(obj, stack); @@ -114,12 +113,14 @@ using namespace js; return true; } -/* static */ ErrorObject* js::ErrorObject::create( - JSContext* cx, JSExnType errorType, HandleObject stack, - HandleString fileName, uint32_t sourceId, - uint32_t lineNumber, uint32_t columnNumber, - UniquePtr report, HandleString message, - HandleObject protoArg /* = nullptr */) { +/* static */ +ErrorObject* js::ErrorObject::create(JSContext* cx, JSExnType errorType, + HandleObject stack, HandleString fileName, + uint32_t sourceId, uint32_t lineNumber, + uint32_t columnNumber, + UniquePtr report, + HandleString message, + HandleObject protoArg /* = nullptr */) { AssertObjectIsSavedFrameOrWrapper(cx, stack); RootedObject proto(cx, protoArg); @@ -244,15 +245,15 @@ static bool FindErrorInstanceOrPrototype(JSContext* cx, HandleObject obj, static MOZ_ALWAYS_INLINE bool IsObject(HandleValue v) { return v.isObject(); } -/* static */ bool js::ErrorObject::getStack(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool js::ErrorObject::getStack(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); // We accept any object here, because of poor-man's subclassing of Error. return CallNonGenericMethod(cx, args); } -/* static */ bool js::ErrorObject::getStack_impl(JSContext* cx, - const CallArgs& args) { +/* static */ +bool js::ErrorObject::getStack_impl(JSContext* cx, const CallArgs& args) { RootedObject thisObj(cx, &args.thisv().toObject()); RootedObject obj(cx); @@ -298,15 +299,15 @@ static MOZ_ALWAYS_INLINE bool IsObject(HandleValue v) { return v.isObject(); } return true; } -/* static */ bool js::ErrorObject::setStack(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool js::ErrorObject::setStack(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); // We accept any object here, because of poor-man's subclassing of Error. return CallNonGenericMethod(cx, args); } -/* static */ bool js::ErrorObject::setStack_impl(JSContext* cx, - const CallArgs& args) { +/* static */ +bool js::ErrorObject::setStack_impl(JSContext* cx, const CallArgs& args) { RootedObject thisObj(cx, &args.thisv().toObject()); if (!args.requireAtLeast(cx, "(set stack)", 1)) { diff --git a/js/src/vm/GeckoProfiler.cpp b/js/src/vm/GeckoProfiler.cpp index c677c69234c0..8c4b1e1b9947 100644 --- a/js/src/vm/GeckoProfiler.cpp +++ b/js/src/vm/GeckoProfiler.cpp @@ -432,8 +432,8 @@ JS_FRIEND_API jsbytecode* ProfilingStackFrame::pc() const { return script ? script->offsetToPC(pcOffsetIfJS_) : nullptr; } -/* static */ int32_t ProfilingStackFrame::pcToOffset(JSScript* aScript, - jsbytecode* aPc) { +/* static */ +int32_t ProfilingStackFrame::pcToOffset(JSScript* aScript, jsbytecode* aPc) { return aPc ? aScript->pcToOffset(aPc) : NullPCOffset; } diff --git a/js/src/vm/GeneratorObject.cpp b/js/src/vm/GeneratorObject.cpp index 88f51837bea3..e4e3633c513a 100644 --- a/js/src/vm/GeneratorObject.cpp +++ b/js/src/vm/GeneratorObject.cpp @@ -239,8 +239,8 @@ JSObject* js::NewSingletonObjectWithFunctionPrototype( return obj; } -/* static */ bool GlobalObject::initGenerators(JSContext* cx, - Handle global) { +/* static */ +bool GlobalObject::initGenerators(JSContext* cx, Handle global) { if (global->getReservedSlot(GENERATOR_OBJECT_PROTO).isObject()) { return true; } diff --git a/js/src/vm/GlobalObject.cpp b/js/src/vm/GlobalObject.cpp index 48f5950731b2..ced5dc34272a 100644 --- a/js/src/vm/GlobalObject.cpp +++ b/js/src/vm/GlobalObject.cpp @@ -88,8 +88,8 @@ TypedObjectModuleObject& js::GlobalObject::getTypedObjectModule() const { return v.toObject().as(); } -/* static */ bool GlobalObject::skipDeselectedConstructor(JSContext* cx, - JSProtoKey key) { +/* static */ +bool GlobalObject::skipDeselectedConstructor(JSContext* cx, JSProtoKey key) { switch (key) { case JSProto_WebAssembly: return !wasm::HasSupport(cx); @@ -114,10 +114,10 @@ TypedObjectModuleObject& js::GlobalObject::getTypedObjectModule() const { } } -/* static*/ bool GlobalObject::resolveConstructor(JSContext* cx, - Handle global, - JSProtoKey key, - IfClassIsDisabled mode) { +/* static*/ +bool GlobalObject::resolveConstructor(JSContext* cx, + Handle global, + JSProtoKey key, IfClassIsDisabled mode) { MOZ_ASSERT(key != JSProto_Null); MOZ_ASSERT(!global->isStandardClassResolved(key)); MOZ_ASSERT(cx->compartment() == global->compartment()); @@ -316,8 +316,10 @@ TypedObjectModuleObject& js::GlobalObject::getTypedObjectModule() const { // // Refactoring global object creation code to support this approach is a // challenge for another day. -/* static */ bool GlobalObject::maybeResolveGlobalThis( - JSContext* cx, Handle global, bool* resolved) { +/* static */ +bool GlobalObject::maybeResolveGlobalThis(JSContext* cx, + Handle global, + bool* resolved) { if (global->getSlot(GLOBAL_THIS_RESOLVED).isUndefined()) { RootedValue v(cx, ObjectValue(*ToWindowProxyIfWindow(global))); if (!DefineDataProperty(cx, global, cx->names().globalThis, v, @@ -332,10 +334,10 @@ TypedObjectModuleObject& js::GlobalObject::getTypedObjectModule() const { return true; } -/* static */ JSObject* GlobalObject::createObject(JSContext* cx, - Handle global, - unsigned slot, - ObjectInitOp init) { +/* static */ +JSObject* GlobalObject::createObject(JSContext* cx, + Handle global, + unsigned slot, ObjectInitOp init) { if (global->zone()->createdForHelperThread()) { return createOffThreadObject(cx, global, slot); } @@ -368,8 +370,10 @@ inline int32_t GlobalObject::OffThreadPlaceholderObject::getSlotIndex() const { return getReservedSlot(SlotIndexSlot).toInt32(); } -/* static */ bool GlobalObject::resolveOffThreadConstructor( - JSContext* cx, Handle global, JSProtoKey key) { +/* static */ +bool GlobalObject::resolveOffThreadConstructor(JSContext* cx, + Handle global, + JSProtoKey key) { // Don't resolve constructors for off-thread parse globals. Instead create a // placeholder object for the prototype which we can use to find the real // prototype when the off-thread compartment is merged back into the target @@ -404,8 +408,10 @@ inline int32_t GlobalObject::OffThreadPlaceholderObject::getSlotIndex() const { return true; } -/* static */ JSObject* GlobalObject::createOffThreadObject( - JSContext* cx, Handle global, unsigned slot) { +/* static */ +JSObject* GlobalObject::createOffThreadObject(JSContext* cx, + Handle global, + unsigned slot) { // Don't create prototype objects for off-thread parse globals. Instead // create a placeholder object which we can use to find the real prototype // when the off-thread compartment is merged back into the target @@ -431,9 +437,11 @@ JSObject* GlobalObject::getPrototypeForOffThreadPlaceholder(JSObject* obj) { return &getSlot(placeholder->getSlotIndex()).toObject(); } -/* static */ bool GlobalObject::initBuiltinConstructor( - JSContext* cx, Handle global, JSProtoKey key, - HandleObject ctor, HandleObject proto) { +/* static */ +bool GlobalObject::initBuiltinConstructor(JSContext* cx, + Handle global, + JSProtoKey key, HandleObject ctor, + HandleObject proto) { MOZ_ASSERT(!global->empty()); // reserved slots already allocated MOZ_ASSERT(key != JSProto_Null); MOZ_ASSERT(ctor); @@ -457,7 +465,8 @@ static bool ThrowTypeError(JSContext* cx, unsigned argc, Value* vp) { return false; } -/* static */ JSObject* GlobalObject::getOrCreateThrowTypeError( +/* static */ +JSObject* GlobalObject::getOrCreateThrowTypeError( JSContext* cx, Handle global) { Value v = global->getReservedSlot(THROWTYPEERROR); if (v.isObject()) { @@ -553,9 +562,11 @@ GlobalObject* GlobalObject::createInternal(JSContext* cx, const Class* clasp) { return global; } -/* static */ GlobalObject* GlobalObject::new_( - JSContext* cx, const Class* clasp, JSPrincipals* principals, - JS::OnNewGlobalHookOption hookOption, const JS::RealmOptions& options) { +/* static */ +GlobalObject* GlobalObject::new_(JSContext* cx, const Class* clasp, + JSPrincipals* principals, + JS::OnNewGlobalHookOption hookOption, + const JS::RealmOptions& options) { MOZ_ASSERT(!cx->isExceptionPending()); MOZ_ASSERT_IF(cx->zone(), !cx->zone()->isAtomsZone()); @@ -592,9 +603,9 @@ GlobalScope& GlobalObject::emptyGlobalScope() const { return static_cast(v.toGCThing())->as(); } -/* static */ bool GlobalObject::getOrCreateEval(JSContext* cx, - Handle global, - MutableHandleObject eval) { +/* static */ +bool GlobalObject::getOrCreateEval(JSContext* cx, Handle global, + MutableHandleObject eval) { if (!getOrCreateObjectPrototype(cx, global)) { return false; } @@ -607,8 +618,9 @@ bool GlobalObject::valueIsEval(const Value& val) { return eval.isObject() && eval == val; } -/* static */ bool GlobalObject::initStandardClasses( - JSContext* cx, Handle global) { +/* static */ +bool GlobalObject::initStandardClasses(JSContext* cx, + Handle global) { /* Define a top-level property 'undefined' with the undefined value. */ if (!DefineDataProperty( cx, global, cx->names().undefined, UndefinedHandleValue, @@ -665,9 +677,10 @@ static bool InitBareBuiltinCtor(JSContext* cx, Handle global, * Even those are only created as bare constructors without any properties * or functions. */ -/* static */ bool GlobalObject::initSelfHostingBuiltins( - JSContext* cx, Handle global, - const JSFunctionSpec* builtins) { +/* static */ +bool GlobalObject::initSelfHostingBuiltins(JSContext* cx, + Handle global, + const JSFunctionSpec* builtins) { // Define a top-level property 'undefined' with the undefined value. if (!DefineDataProperty(cx, global, cx->names().undefined, UndefinedHandleValue, @@ -708,8 +721,9 @@ static bool InitBareBuiltinCtor(JSContext* cx, Handle global, DefineFunctions(cx, global, builtins, AsIntrinsic); } -/* static */ bool GlobalObject::isRuntimeCodeGenEnabled( - JSContext* cx, HandleValue code, Handle global) { +/* static */ +bool GlobalObject::isRuntimeCodeGenEnabled(JSContext* cx, HandleValue code, + Handle global) { HeapSlot& v = global->getSlotRef(RUNTIME_CODEGEN_ENABLED); if (v.isUndefined()) { /* @@ -730,9 +744,11 @@ static bool InitBareBuiltinCtor(JSContext* cx, Handle global, return !v.isFalse(); } -/* static */ JSFunction* GlobalObject::createConstructor( - JSContext* cx, Native ctor, JSAtom* nameArg, unsigned length, - gc::AllocKind kind, const JSJitInfo* jitInfo) { +/* static */ +JSFunction* GlobalObject::createConstructor(JSContext* cx, Native ctor, + JSAtom* nameArg, unsigned length, + gc::AllocKind kind, + const JSJitInfo* jitInfo) { RootedAtom name(cx, nameArg); JSFunction* fun = NewNativeConstructor(cx, ctor, length, name, kind); if (!fun) { @@ -759,8 +775,10 @@ static NativeObject* CreateBlankProto(JSContext* cx, const Class* clasp, return blankProto; } -/* static */ NativeObject* GlobalObject::createBlankPrototype( - JSContext* cx, Handle global, const Class* clasp) { +/* static */ +NativeObject* GlobalObject::createBlankPrototype(JSContext* cx, + Handle global, + const Class* clasp) { RootedObject objectProto(cx, getOrCreateObjectPrototype(cx, global)); if (!objectProto) { return nullptr; @@ -769,8 +787,10 @@ static NativeObject* CreateBlankProto(JSContext* cx, const Class* clasp, return CreateBlankProto(cx, clasp, objectProto); } -/* static */ NativeObject* GlobalObject::createBlankPrototypeInheriting( - JSContext* cx, const Class* clasp, HandleObject proto) { +/* static */ +NativeObject* GlobalObject::createBlankPrototypeInheriting(JSContext* cx, + const Class* clasp, + HandleObject proto) { return CreateBlankProto(cx, clasp, proto); } @@ -856,7 +876,8 @@ GlobalObject::DebuggerVector* GlobalObject::getDebuggers() const { return debuggers; } -/* static */ NativeObject* GlobalObject::getOrCreateForOfPICObject( +/* static */ +NativeObject* GlobalObject::getOrCreateForOfPICObject( JSContext* cx, Handle global) { cx->check(global); NativeObject* forOfPIC = global->getForOfPICObject(); @@ -876,8 +897,9 @@ bool GlobalObject::hasRegExpStatics() const { return !getSlot(REGEXP_STATICS).isUndefined(); } -/* static */ RegExpStatics* GlobalObject::getRegExpStatics( - JSContext* cx, Handle global) { +/* static */ +RegExpStatics* GlobalObject::getRegExpStatics(JSContext* cx, + Handle global) { MOZ_ASSERT(cx); RegExpStaticsObject* resObj = nullptr; const Value& val = global->getSlot(REGEXP_STATICS); @@ -902,8 +924,9 @@ RegExpStatics* GlobalObject::getAlreadyCreatedRegExpStatics() const { val.toObject().as().getPrivate(/* nfixed = */ 1)); } -/* static */ NativeObject* GlobalObject::getIntrinsicsHolder( - JSContext* cx, Handle global) { +/* static */ +NativeObject* GlobalObject::getIntrinsicsHolder(JSContext* cx, + Handle global) { Value slot = global->getReservedSlot(INTRINSICS); MOZ_ASSERT(slot.isUndefined() || slot.isObject()); @@ -935,10 +958,12 @@ RegExpStatics* GlobalObject::getAlreadyCreatedRegExpStatics() const { return intrinsicsHolder; } -/* static */ bool GlobalObject::getSelfHostedFunction( - JSContext* cx, Handle global, - HandlePropertyName selfHostedName, HandleAtom name, unsigned nargs, - MutableHandleValue funVal) { +/* static */ +bool GlobalObject::getSelfHostedFunction(JSContext* cx, + Handle global, + HandlePropertyName selfHostedName, + HandleAtom name, unsigned nargs, + MutableHandleValue funVal) { bool exists = false; if (!GlobalObject::maybeGetIntrinsicValue(cx, global, selfHostedName, funVal, &exists)) { @@ -983,10 +1008,11 @@ RegExpStatics* GlobalObject::getAlreadyCreatedRegExpStatics() const { return GlobalObject::addIntrinsicValue(cx, global, selfHostedName, funVal); } -/* static */ bool GlobalObject::addIntrinsicValue(JSContext* cx, - Handle global, - HandlePropertyName name, - HandleValue value) { +/* static */ +bool GlobalObject::addIntrinsicValue(JSContext* cx, + Handle global, + HandlePropertyName name, + HandleValue value) { RootedNativeObject holder(cx, GlobalObject::getIntrinsicsHolder(cx, global)); if (!holder) { return false; @@ -1011,8 +1037,9 @@ RegExpStatics* GlobalObject::getAlreadyCreatedRegExpStatics() const { return true; } -/* static */ bool GlobalObject::ensureModulePrototypesCreated( - JSContext* cx, Handle global) { +/* static */ +bool GlobalObject::ensureModulePrototypesCreated(JSContext* cx, + Handle global) { return getOrCreateModulePrototype(cx, global) && getOrCreateImportEntryPrototype(cx, global) && getOrCreateExportEntryPrototype(cx, global) && diff --git a/js/src/vm/Iteration.cpp b/js/src/vm/Iteration.cpp index f1403913d9c3..a4dd6618a0f7 100644 --- a/js/src/vm/Iteration.cpp +++ b/js/src/vm/Iteration.cpp @@ -793,8 +793,9 @@ NativeIterator::NativeIterator(JSContext* cx, MOZ_ASSERT(!*hadError); } -/* static */ bool IteratorHashPolicy::match(PropertyIteratorObject* obj, - const Lookup& lookup) { +/* static */ +bool IteratorHashPolicy::match(PropertyIteratorObject* obj, + const Lookup& lookup) { NativeIterator* ni = obj->getNativeIterator(); if (ni->guardKey() != lookup.key || ni->guardCount() != lookup.numGuards) { return false; @@ -1501,8 +1502,9 @@ bool js::SuppressDeletedElement(JSContext* cx, HandleObject obj, static const JSFunctionSpec iterator_proto_methods[] = { JS_SELF_HOSTED_SYM_FN(iterator, "IteratorIdentity", 0, 0), JS_FS_END}; -/* static */ bool GlobalObject::initIteratorProto( - JSContext* cx, Handle global) { +/* static */ +bool GlobalObject::initIteratorProto(JSContext* cx, + Handle global) { if (global->getReservedSlot(ITERATOR_PROTO).isObject()) { return true; } @@ -1518,8 +1520,9 @@ static const JSFunctionSpec iterator_proto_methods[] = { return true; } -/* static */ bool GlobalObject::initArrayIteratorProto( - JSContext* cx, Handle global) { +/* static */ +bool GlobalObject::initArrayIteratorProto(JSContext* cx, + Handle global) { if (global->getReservedSlot(ARRAY_ITERATOR_PROTO).isObject()) { return true; } @@ -1544,8 +1547,9 @@ static const JSFunctionSpec iterator_proto_methods[] = { return true; } -/* static */ bool GlobalObject::initStringIteratorProto( - JSContext* cx, Handle global) { +/* static */ +bool GlobalObject::initStringIteratorProto(JSContext* cx, + Handle global) { if (global->getReservedSlot(STRING_ITERATOR_PROTO).isObject()) { return true; } @@ -1570,8 +1574,9 @@ static const JSFunctionSpec iterator_proto_methods[] = { return true; } -/* static */ bool GlobalObject::initRegExpStringIteratorProto( - JSContext* cx, Handle global) { +/* static */ +bool GlobalObject::initRegExpStringIteratorProto(JSContext* cx, + Handle global) { if (global->getReservedSlot(REGEXP_STRING_ITERATOR_PROTO).isObject()) { return true; } diff --git a/js/src/vm/JSFunction.cpp b/js/src/vm/JSFunction.cpp index d618bc43d9a2..c0b73fc5194c 100644 --- a/js/src/vm/JSFunction.cpp +++ b/js/src/vm/JSFunction.cpp @@ -1235,8 +1235,9 @@ bool JSFunction::isDerivedClassConstructor() { return derived; } -/* static */ bool JSFunction::getLength(JSContext* cx, HandleFunction fun, - uint16_t* length) { +/* static */ +bool JSFunction::getLength(JSContext* cx, HandleFunction fun, + uint16_t* length) { MOZ_ASSERT(!fun->isBoundFunction()); if (fun->isInterpretedLazy() && !getOrCreateScript(cx, fun)) { return false; @@ -1246,9 +1247,9 @@ bool JSFunction::isDerivedClassConstructor() { return true; } -/* static */ bool JSFunction::getUnresolvedLength(JSContext* cx, - HandleFunction fun, - MutableHandleValue v) { +/* static */ +bool JSFunction::getUnresolvedLength(JSContext* cx, HandleFunction fun, + MutableHandleValue v) { MOZ_ASSERT(!IsInternalFunctionObject(*fun)); MOZ_ASSERT(!fun->hasResolvedLength()); @@ -1285,9 +1286,9 @@ JSAtom* JSFunction::infallibleGetUnresolvedName(JSContext* cx) { return cx->names().empty; } -/* static */ bool JSFunction::getUnresolvedName(JSContext* cx, - HandleFunction fun, - MutableHandleString v) { +/* static */ +bool JSFunction::getUnresolvedName(JSContext* cx, HandleFunction fun, + MutableHandleString v) { if (fun->isBoundFunction()) { JSLinearString* name = JSFunction::getBoundFunctionName(cx, fun); if (!name) { @@ -1302,8 +1303,9 @@ JSAtom* JSFunction::infallibleGetUnresolvedName(JSContext* cx) { return true; } -/* static */ JSLinearString* JSFunction::getBoundFunctionName( - JSContext* cx, HandleFunction fun) { +/* static */ +JSLinearString* JSFunction::getBoundFunctionName(JSContext* cx, + HandleFunction fun) { MOZ_ASSERT(fun->isBoundFunction()); JSAtom* name = fun->explicitName(); @@ -1408,10 +1410,10 @@ static JSAtom* AppendBoundFunctionPrefix(JSContext* cx, JSString* str) { return sb.finishAtom(); } -/* static */ bool JSFunction::finishBoundFunctionInit(JSContext* cx, - HandleFunction bound, - HandleObject targetObj, - int32_t argCount) { +/* static */ +bool JSFunction::finishBoundFunctionInit(JSContext* cx, HandleFunction bound, + HandleObject targetObj, + int32_t argCount) { bound->setIsBoundFunction(); MOZ_ASSERT(bound->getBoundFunctionTarget() == targetObj); @@ -1534,8 +1536,9 @@ static JSAtom* AppendBoundFunctionPrefix(JSContext* cx, JSString* str) { return true; } -/* static */ bool JSFunction::createScriptForLazilyInterpretedFunction( - JSContext* cx, HandleFunction fun) { +/* static */ +bool JSFunction::createScriptForLazilyInterpretedFunction(JSContext* cx, + HandleFunction fun) { MOZ_ASSERT(fun->isInterpretedLazy()); MOZ_ASSERT(cx->compartment() == fun->compartment()); diff --git a/js/src/vm/JSObject.cpp b/js/src/vm/JSObject.cpp index 9edfd4116f95..eb42f62d9fac 100644 --- a/js/src/vm/JSObject.cpp +++ b/js/src/vm/JSObject.cpp @@ -1235,18 +1235,19 @@ JSObject* js::CreateThisForFunction(JSContext* cx, HandleFunction callee, return obj; } -/* static */ bool JSObject::nonNativeSetProperty(JSContext* cx, - HandleObject obj, HandleId id, - HandleValue v, - HandleValue receiver, - ObjectOpResult& result) { +/* static */ +bool JSObject::nonNativeSetProperty(JSContext* cx, HandleObject obj, + HandleId id, HandleValue v, + HandleValue receiver, + ObjectOpResult& result) { return obj->getOpsSetProperty()(cx, obj, id, v, receiver, result); } -/* static */ bool JSObject::nonNativeSetElement(JSContext* cx, HandleObject obj, - uint32_t index, HandleValue v, - HandleValue receiver, - ObjectOpResult& result) { +/* static */ +bool JSObject::nonNativeSetElement(JSContext* cx, HandleObject obj, + uint32_t index, HandleValue v, + HandleValue receiver, + ObjectOpResult& result) { RootedId id(cx); if (!IndexToId(cx, index, &id)) { return false; @@ -1711,10 +1712,9 @@ template XDRResult js::XDRObjectLiteral(XDRState* xdr, template XDRResult js::XDRObjectLiteral(XDRState* xdr, MutableHandleObject obj); -/* static */ bool NativeObject::fillInAfterSwap(JSContext* cx, - HandleNativeObject obj, - const AutoValueVector& values, - void* priv) { +/* static */ +bool NativeObject::fillInAfterSwap(JSContext* cx, HandleNativeObject obj, + const AutoValueVector& values, void* priv) { // This object has just been swapped with some other object, and its shape // no longer reflects its allocated size. Correct this information and // fill the slots in with the specified values. @@ -2222,7 +2222,8 @@ static bool SetProto(JSContext* cx, HandleObject obj, return true; } -/* static */ bool JSObject::changeToSingleton(JSContext* cx, HandleObject obj) { +/* static */ +bool JSObject::changeToSingleton(JSContext* cx, HandleObject obj) { MOZ_ASSERT(!obj->isSingleton()); MarkObjectGroupUnknownProperties(cx, obj->group()); @@ -4120,9 +4121,9 @@ static JSAtom* displayAtomFromObjectGroup(ObjectGroup& group) { return script->function()->displayAtom(); } -/* static */ bool JSObject::constructorDisplayAtom(JSContext* cx, - js::HandleObject obj, - js::MutableHandleAtom name) { +/* static */ +bool JSObject::constructorDisplayAtom(JSContext* cx, js::HandleObject obj, + js::MutableHandleAtom name) { ObjectGroup* g = JSObject::getGroup(cx, obj); if (!g) { return false; @@ -4243,10 +4244,10 @@ bool js::Unbox(JSContext* cx, HandleObject obj, MutableHandleValue vp) { } #ifdef DEBUG -/* static */ void JSObject::debugCheckNewObject(ObjectGroup* group, - Shape* shape, - js::gc::AllocKind allocKind, - js::gc::InitialHeap heap) { +/* static */ +void JSObject::debugCheckNewObject(ObjectGroup* group, Shape* shape, + js::gc::AllocKind allocKind, + js::gc::InitialHeap heap) { const js::Class* clasp = group->clasp(); MOZ_ASSERT(clasp != &ArrayObject::class_); diff --git a/js/src/vm/JSScript.cpp b/js/src/vm/JSScript.cpp index 53ef19a49dbc..3facac92d099 100644 --- a/js/src/vm/JSScript.cpp +++ b/js/src/vm/JSScript.cpp @@ -544,10 +544,11 @@ static XDRResult XDRScope(XDRState* xdr, js::PrivateScriptData* data, } template -/* static */ XDRResult js::PrivateScriptData::XDR( - XDRState* xdr, HandleScript script, - HandleScriptSourceObject sourceObject, HandleScope scriptEnclosingScope, - HandleFunction fun) { +/* static */ +XDRResult js::PrivateScriptData::XDR(XDRState* xdr, HandleScript script, + HandleScriptSourceObject sourceObject, + HandleScope scriptEnclosingScope, + HandleFunction fun) { uint32_t nconsts = 0; uint32_t nobjects = 0; uint32_t nscopes = 0; @@ -673,8 +674,8 @@ template } template -/* static */ XDRResult SharedScriptData::XDR(XDRState* xdr, - HandleScript script) { +/* static */ +XDRResult SharedScriptData::XDR(XDRState* xdr, HandleScript script) { uint32_t natoms = 0; uint32_t codeLength = 0; uint32_t noteLength = 0; @@ -728,11 +729,13 @@ template } template - /* static */ XDRResult + /* static */ + XDRResult SharedScriptData::XDR(XDRState* xdr, HandleScript script); template - /* static */ XDRResult + /* static */ + XDRResult SharedScriptData::XDR(XDRState* xdr, HandleScript script); template @@ -1499,7 +1502,8 @@ ScriptSourceObject* ScriptSourceObject::unwrappedCanonical() const { return &UncheckedUnwrap(obj)->as(); } -/* static */ bool ScriptSourceObject::initFromOptions( +/* static */ +bool ScriptSourceObject::initFromOptions( JSContext* cx, HandleScriptSourceObject source, const ReadOnlyCompileOptions& options) { cx->releaseCheck(source); @@ -1542,9 +1546,11 @@ ScriptSourceObject* ScriptSourceObject::unwrappedCanonical() const { return true; } -/* static */ bool ScriptSourceObject::initElementProperties( - JSContext* cx, HandleScriptSourceObject source, HandleObject element, - HandleString elementAttrName) { +/* static */ +bool ScriptSourceObject::initElementProperties(JSContext* cx, + HandleScriptSourceObject source, + HandleObject element, + HandleString elementAttrName) { MOZ_ASSERT(source->isCanonical()); RootedValue elementValue(cx, ObjectOrNullValue(element)); @@ -1577,8 +1583,8 @@ void ScriptSourceObject::setPrivate(JSRuntime* rt, const Value& value) { rt->addRefScriptPrivate(value); } -/* static */ bool JSScript::loadSource(JSContext* cx, ScriptSource* ss, - bool* worked) { +/* static */ +bool JSScript::loadSource(JSContext* cx, ScriptSource* ss, bool* worked) { MOZ_ASSERT(!ss->hasSourceText()); *worked = false; if (!cx->runtime()->sourceHook.ref() || !ss->sourceRetrievable()) { @@ -1603,8 +1609,8 @@ void ScriptSourceObject::setPrivate(JSRuntime* rt, const Value& value) { return true; } -/* static */ JSFlatString* JSScript::sourceData(JSContext* cx, - HandleScript script) { +/* static */ +JSFlatString* JSScript::sourceData(JSContext* cx, HandleScript script) { MOZ_ASSERT(script->scriptSource()->hasSourceText()); return script->scriptSource()->substring(cx, script->sourceStart(), script->sourceEnd()); @@ -2445,9 +2451,10 @@ XDRResult ScriptSource::xdrUncompressedSource( } // namespace js template -/* static */ XDRResult ScriptSource::XDR( - XDRState* xdr, const mozilla::Maybe& options, - MutableHandle holder) { +/* static */ +XDRResult ScriptSource::XDR(XDRState* xdr, + const mozilla::Maybe& options, + MutableHandle holder) { JSContext* cx = xdr->cx(); ScriptSource* ss = nullptr; @@ -3022,9 +3029,11 @@ static void DefaultInitializeElements(void* arrayPtr, size_t length) { } } -/* static */ size_t PrivateScriptData::AllocationSize( - uint32_t nscopes, uint32_t nconsts, uint32_t nobjects, uint32_t ntrynotes, - uint32_t nscopenotes, uint32_t nresumeoffsets) { +/* static */ +size_t PrivateScriptData::AllocationSize(uint32_t nscopes, uint32_t nconsts, + uint32_t nobjects, uint32_t ntrynotes, + uint32_t nscopenotes, + uint32_t nresumeoffsets) { size_t size = sizeof(PrivateScriptData); if (nconsts) { @@ -3184,10 +3193,13 @@ PrivateScriptData::PrivateScriptData(uint32_t nscopes_, uint32_t nconsts, nresumeoffsets) == cursor); } -/* static */ PrivateScriptData* PrivateScriptData::new_( - JSContext* cx, uint32_t nscopes, uint32_t nconsts, uint32_t nobjects, - uint32_t ntrynotes, uint32_t nscopenotes, uint32_t nresumeoffsets, - uint32_t* dataSize) { +/* static */ +PrivateScriptData* PrivateScriptData::new_(JSContext* cx, uint32_t nscopes, + uint32_t nconsts, uint32_t nobjects, + uint32_t ntrynotes, + uint32_t nscopenotes, + uint32_t nresumeoffsets, + uint32_t* dataSize) { // Compute size including trailing arrays size_t size = AllocationSize(nscopes, nconsts, nobjects, ntrynotes, nscopenotes, nresumeoffsets); @@ -3246,11 +3258,10 @@ JSScript::JSScript(JS::Realm* realm, uint8_t* stubEntry, setSourceObject(sourceObject); } -/* static */ JSScript* JSScript::New(JSContext* cx, - HandleScriptSourceObject sourceObject, - uint32_t sourceStart, uint32_t sourceEnd, - uint32_t toStringStart, - uint32_t toStringEnd) { +/* static */ +JSScript* JSScript::New(JSContext* cx, HandleScriptSourceObject sourceObject, + uint32_t sourceStart, uint32_t sourceEnd, + uint32_t toStringStart, uint32_t toStringEnd) { void* script = Allocate(cx); if (!script) { return nullptr; @@ -3278,10 +3289,11 @@ static bool ShouldTrackRecordReplayProgress(JSScript* script) { mozilla::recordreplay::ShouldUpdateProgressCounter(script->filename()); } -/* static */ JSScript* JSScript::Create( - JSContext* cx, const ReadOnlyCompileOptions& options, - HandleScriptSourceObject sourceObject, uint32_t sourceStart, - uint32_t sourceEnd, uint32_t toStringStart, uint32_t toStringEnd) { +/* static */ +JSScript* JSScript::Create(JSContext* cx, const ReadOnlyCompileOptions& options, + HandleScriptSourceObject sourceObject, + uint32_t sourceStart, uint32_t sourceEnd, + uint32_t toStringStart, uint32_t toStringEnd) { RootedScript script(cx, JSScript::New(cx, sourceObject, sourceStart, sourceEnd, toStringStart, toStringEnd)); if (!script) { @@ -3364,10 +3376,12 @@ bool JSScript::initScriptName(JSContext* cx) { return true; } -/* static */ bool JSScript::createPrivateScriptData( - JSContext* cx, HandleScript script, uint32_t nscopes, uint32_t nconsts, - uint32_t nobjects, uint32_t ntrynotes, uint32_t nscopenotes, - uint32_t nresumeoffsets) { +/* static */ +bool JSScript::createPrivateScriptData(JSContext* cx, HandleScript script, + uint32_t nscopes, uint32_t nconsts, + uint32_t nobjects, uint32_t ntrynotes, + uint32_t nscopenotes, + uint32_t nresumeoffsets) { cx->check(script); uint32_t dataSize; @@ -3384,8 +3398,9 @@ bool JSScript::initScriptName(JSContext* cx) { return true; } -/* static */ bool JSScript::initFunctionPrototype( - JSContext* cx, HandleScript script, HandleFunction functionProto) { +/* static */ +bool JSScript::initFunctionPrototype(JSContext* cx, HandleScript script, + HandleFunction functionProto) { uint32_t numScopes = 1; uint32_t numConsts = 0; uint32_t numObjects = 0; @@ -3435,8 +3450,9 @@ static void InitAtomMap(frontend::AtomIndexMap& indices, GCPtrAtom* atoms) { } } -/* static */ void JSScript::initFromFunctionBox(HandleScript script, - frontend::FunctionBox* funbox) { +/* static */ +void JSScript::initFromFunctionBox(HandleScript script, + frontend::FunctionBox* funbox) { JSFunction* fun = funbox->function(); if (fun->isInterpretedLazy()) { fun->setUnlazifiedScript(script); @@ -3485,7 +3501,8 @@ static void InitAtomMap(frontend::AtomIndexMap& indices, GCPtrAtom* atoms) { (fun->needsCallObject() || fun->needsNamedLambdaEnvironment())); } -/* static */ void JSScript::initFromModuleContext(HandleScript script) { +/* static */ +void JSScript::initFromModuleContext(HandleScript script) { script->setFlag(ImmutableFlags::IsModule); // Since modules are only run once, mark the script so that initializers @@ -3494,8 +3511,9 @@ static void InitAtomMap(frontend::AtomIndexMap& indices, GCPtrAtom* atoms) { MOZ_ASSERT(!script->hasRunOnce()); } -/* static */ bool JSScript::fullyInitFromEmitter( - JSContext* cx, HandleScript script, frontend::BytecodeEmitter* bce) { +/* static */ +bool JSScript::fullyInitFromEmitter(JSContext* cx, HandleScript script, + frontend::BytecodeEmitter* bce) { /* The counts of indexed things must be checked during code generation. */ MOZ_ASSERT(bce->atomIndices->count() <= INDEX_LIMIT); MOZ_ASSERT(bce->objectList.length <= INDEX_LIMIT); @@ -4012,9 +4030,9 @@ static JSObject* CloneInnerInterpretedFunction( return clone; } -/* static */ bool PrivateScriptData::Clone( - JSContext* cx, HandleScript src, HandleScript dst, - MutableHandle> scopes) { +/* static */ +bool PrivateScriptData::Clone(JSContext* cx, HandleScript src, HandleScript dst, + MutableHandle> scopes) { PrivateScriptData* srcData = src->data_; uint32_t nscopes = srcData->scopes().size(); uint32_t nconsts = srcData->hasConsts() ? srcData->consts().size() : 0; @@ -4688,8 +4706,8 @@ void js::SetFrameArgumentsObject(JSContext* cx, AbstractFramePtr frame, } } -/* static */ bool JSScript::argumentsOptimizationFailed(JSContext* cx, - HandleScript script) { +/* static */ +bool JSScript::argumentsOptimizationFailed(JSContext* cx, HandleScript script) { MOZ_ASSERT(script->functionNonDelazifying()); MOZ_ASSERT(script->analyzedArgsUsage()); MOZ_ASSERT(script->argumentsHasVarBinding()); @@ -4845,10 +4863,12 @@ uint64_t LazyScript::packedFieldsForXDR() const { return packedFields; } -/* static */ LazyScript* LazyScript::CreateRaw( - JSContext* cx, HandleFunction fun, HandleScriptSourceObject sourceObject, - uint64_t packedFields, uint32_t sourceStart, uint32_t sourceEnd, - uint32_t toStringStart, uint32_t lineno, uint32_t column) { +/* static */ +LazyScript* LazyScript::CreateRaw(JSContext* cx, HandleFunction fun, + HandleScriptSourceObject sourceObject, + uint64_t packedFields, uint32_t sourceStart, + uint32_t sourceEnd, uint32_t toStringStart, + uint32_t lineno, uint32_t column) { cx->check(fun); MOZ_ASSERT(sourceObject); @@ -4885,12 +4905,14 @@ uint64_t LazyScript::packedFieldsForXDR() const { sourceEnd, toStringStart, lineno, column); } -/* static */ LazyScript* LazyScript::Create( - JSContext* cx, HandleFunction fun, HandleScriptSourceObject sourceObject, - const frontend::AtomVector& closedOverBindings, - Handle> innerFunctions, uint32_t sourceStart, - uint32_t sourceEnd, uint32_t toStringStart, uint32_t lineno, - uint32_t column, frontend::ParseGoal parseGoal) { +/* static */ +LazyScript* LazyScript::Create(JSContext* cx, HandleFunction fun, + HandleScriptSourceObject sourceObject, + const frontend::AtomVector& closedOverBindings, + Handle> innerFunctions, + uint32_t sourceStart, uint32_t sourceEnd, + uint32_t toStringStart, uint32_t lineno, + uint32_t column, frontend::ParseGoal parseGoal) { union { PackedView p; uint64_t packedFields; @@ -4937,7 +4959,8 @@ uint64_t LazyScript::packedFieldsForXDR() const { return res; } -/* static */ LazyScript* LazyScript::CreateForXDR( +/* static */ +LazyScript* LazyScript::CreateForXDR( JSContext* cx, HandleFunction fun, HandleScript script, HandleScope enclosingScope, HandleScriptSourceObject sourceObject, uint64_t packedFields, uint32_t sourceStart, uint32_t sourceEnd, diff --git a/js/src/vm/MemoryMetrics.cpp b/js/src/vm/MemoryMetrics.cpp index 39a7be785d8e..c3a47a7fc66d 100644 --- a/js/src/vm/MemoryMetrics.cpp +++ b/js/src/vm/MemoryMetrics.cpp @@ -58,8 +58,8 @@ static uint32_t HashStringChars(JSString* s) { return hash; } -/* static */ HashNumber InefficientNonFlatteningStringHashPolicy::hash( - const Lookup& l) { +/* static */ +HashNumber InefficientNonFlatteningStringHashPolicy::hash(const Lookup& l) { return l->hasLatin1Chars() ? HashStringChars(l) : HashStringChars(l); } @@ -98,8 +98,9 @@ static bool EqualStringsPure(JSString* s1, JSString* s2) { return EqualChars(c1, c2, s1->length()); } -/* static */ bool InefficientNonFlatteningStringHashPolicy::match( - const JSString* const& k, const Lookup& l) { +/* static */ +bool InefficientNonFlatteningStringHashPolicy::match(const JSString* const& k, + const Lookup& l) { // We can't use js::EqualStrings, because that flattens our strings. JSString* s1 = const_cast(k); if (k->hasLatin1Chars()) { diff --git a/js/src/vm/NativeObject.cpp b/js/src/vm/NativeObject.cpp index 5e7dec71b11e..750b218ce8e2 100644 --- a/js/src/vm/NativeObject.cpp +++ b/js/src/vm/NativeObject.cpp @@ -73,8 +73,9 @@ bool NativeObject::canHaveNonEmptyElements() { #endif // DEBUG -/* static */ void ObjectElements::ConvertElementsToDoubles( - JSContext* cx, uintptr_t elementsPtr) { +/* static */ +void ObjectElements::ConvertElementsToDoubles(JSContext* cx, + uintptr_t elementsPtr) { /* * This function has an otherwise unused JSContext argument so that it can * be called directly from Ion code. Only arrays can have their dense @@ -99,8 +100,8 @@ bool NativeObject::canHaveNonEmptyElements() { header->setShouldConvertDoubleElements(); } -/* static */ bool ObjectElements::MakeElementsCopyOnWrite(JSContext* cx, - NativeObject* obj) { +/* static */ +bool ObjectElements::MakeElementsCopyOnWrite(JSContext* cx, NativeObject* obj) { static_assert(sizeof(HeapSlot) >= sizeof(GCPtrObject), "there must be enough room for the owner object pointer at " "the end of the elements"); @@ -120,8 +121,8 @@ bool NativeObject::canHaveNonEmptyElements() { return true; } -/* static */ bool ObjectElements::PreventExtensions(JSContext* cx, - NativeObject* obj) { +/* static */ +bool ObjectElements::PreventExtensions(JSContext* cx, NativeObject* obj) { if (!obj->maybeCopyElementsForWrite(cx)) { return false; } @@ -137,8 +138,9 @@ bool NativeObject::canHaveNonEmptyElements() { return true; } -/* static */ void ObjectElements::FreezeOrSeal(JSContext* cx, NativeObject* obj, - IntegrityLevel level) { +/* static */ +void ObjectElements::FreezeOrSeal(JSContext* cx, NativeObject* obj, + IntegrityLevel level) { MOZ_ASSERT_IF(level == IntegrityLevel::Frozen && obj->is(), !obj->as().lengthIsWritable()); MOZ_ASSERT(!obj->denseElementsAreCopyOnWrite()); @@ -163,7 +165,8 @@ static mozilla::Atomic gShapeConsistencyChecksEnabled(false); -/* static */ void js::NativeObject::enableShapeConsistencyChecks() { +/* static */ +void js::NativeObject::enableShapeConsistencyChecks() { gShapeConsistencyChecksEnabled = true; } @@ -416,8 +419,9 @@ bool NativeObject::growSlots(JSContext* cx, uint32_t oldCount, return true; } -/* static */ bool NativeObject::growSlotsPure(JSContext* cx, NativeObject* obj, - uint32_t newCount) { +/* static */ +bool NativeObject::growSlotsPure(JSContext* cx, NativeObject* obj, + uint32_t newCount) { // IC code calls this directly. AutoUnsafeCallWithABI unsafe; @@ -428,8 +432,8 @@ bool NativeObject::growSlots(JSContext* cx, uint32_t oldCount, return true; } -/* static */ bool NativeObject::addDenseElementPure(JSContext* cx, - NativeObject* obj) { +/* static */ +bool NativeObject::addDenseElementPure(JSContext* cx, NativeObject* obj) { // IC code calls this directly. AutoUnsafeCallWithABI unsafe; @@ -516,7 +520,8 @@ bool NativeObject::willBeSparseElements(uint32_t requiredCapacity, return true; } -/* static */ DenseElementResult NativeObject::maybeDensifySparseElements( +/* static */ +DenseElementResult NativeObject::maybeDensifySparseElements( JSContext* cx, HandleNativeObject obj) { /* * Wait until after the object goes into dictionary mode, which must happen @@ -781,9 +786,11 @@ bool NativeObject::tryUnshiftDenseElements(uint32_t count) { // Note: the structure and behavior of this method follow along with // UnboxedArrayObject::chooseCapacityIndex. Changes to the allocation strategy // in one should generally be matched by the other. -/* static */ bool NativeObject::goodElementsAllocationAmount( - JSContext* cx, uint32_t reqCapacity, uint32_t length, - uint32_t* goodAmount) { +/* static */ +bool NativeObject::goodElementsAllocationAmount(JSContext* cx, + uint32_t reqCapacity, + uint32_t length, + uint32_t* goodAmount) { if (reqCapacity > MAX_DENSE_ELEMENTS_COUNT) { ReportOutOfMemory(cx); return false; @@ -1006,8 +1013,8 @@ void NativeObject::shrinkElements(JSContext* cx, uint32_t reqCapacity) { getElementsHeader()->capacity = newCapacity; } -/* static */ bool NativeObject::CopyElementsForWrite(JSContext* cx, - NativeObject* obj) { +/* static */ +bool NativeObject::CopyElementsForWrite(JSContext* cx, NativeObject* obj) { MOZ_ASSERT(obj->denseElementsAreCopyOnWrite()); MOZ_ASSERT(obj->isExtensible()); @@ -1046,9 +1053,9 @@ void NativeObject::shrinkElements(JSContext* cx, uint32_t reqCapacity) { return true; } -/* static */ bool NativeObject::allocDictionarySlot(JSContext* cx, - HandleNativeObject obj, - uint32_t* slotp) { +/* static */ +bool NativeObject::allocDictionarySlot(JSContext* cx, HandleNativeObject obj, + uint32_t* slotp) { MOZ_ASSERT(obj->inDictionaryMode()); uint32_t slot = obj->slotSpan(); @@ -1121,11 +1128,10 @@ void NativeObject::freeSlot(JSContext* cx, uint32_t slot) { setSlot(slot, UndefinedValue()); } -/* static */ Shape* NativeObject::addDataProperty(JSContext* cx, - HandleNativeObject obj, - HandlePropertyName name, - uint32_t slot, - unsigned attrs) { +/* static */ +Shape* NativeObject::addDataProperty(JSContext* cx, HandleNativeObject obj, + HandlePropertyName name, uint32_t slot, + unsigned attrs) { MOZ_ASSERT(!(attrs & (JSPROP_GETTER | JSPROP_SETTER))); RootedId id(cx, NameToId(name)); return addDataProperty(cx, obj, id, slot, attrs); @@ -1379,13 +1385,15 @@ static MOZ_ALWAYS_INLINE bool ReshapeForShadowedProp(JSContext* cx, return true; } -/* static */ bool NativeObject::reshapeForShadowedProp(JSContext* cx, - HandleNativeObject obj) { +/* static */ +bool NativeObject::reshapeForShadowedProp(JSContext* cx, + HandleNativeObject obj) { return generateOwnShape(cx, obj); } -/* static */ bool NativeObject::reshapeForProtoMutation( - JSContext* cx, HandleNativeObject obj) { +/* static */ +bool NativeObject::reshapeForProtoMutation(JSContext* cx, + HandleNativeObject obj) { return generateOwnShape(cx, obj); } diff --git a/js/src/vm/ObjectGroup.cpp b/js/src/vm/ObjectGroup.cpp index 5f94244c4f8b..414bd2a87036 100644 --- a/js/src/vm/ObjectGroup.cpp +++ b/js/src/vm/ObjectGroup.cpp @@ -109,7 +109,8 @@ void ObjectGroup::setAddendum(AddendumKind kind, void* addendum, addendum_ = addendum; } -/* static */ bool ObjectGroup::useSingletonForClone(JSFunction* fun) { +/* static */ +bool ObjectGroup::useSingletonForClone(JSFunction* fun) { if (!fun->isInterpreted()) { return false; } @@ -164,9 +165,9 @@ void ObjectGroup::setAddendum(AddendumKind kind, void* addendum, return end - begin <= 100; } -/* static */ bool ObjectGroup::useSingletonForNewObject(JSContext* cx, - JSScript* script, - jsbytecode* pc) { +/* static */ +bool ObjectGroup::useSingletonForNewObject(JSContext* cx, JSScript* script, + jsbytecode* pc) { /* * Make a heuristic guess at a use of JSOP_NEW that the constructed object * should have a fresh group. We do this when the NEW is immediately @@ -199,9 +200,10 @@ void ObjectGroup::setAddendum(AddendumKind kind, void* addendum, return false; } -/* static */ bool ObjectGroup::useSingletonForAllocationSite(JSScript* script, - jsbytecode* pc, - JSProtoKey key) { +/* static */ +bool ObjectGroup::useSingletonForAllocationSite(JSScript* script, + jsbytecode* pc, + JSProtoKey key) { /* * Objects created outside loops in global and eval scripts should have * singleton types. For now this is only done for plain objects, but not @@ -249,8 +251,9 @@ bool GlobalObject::shouldSplicePrototype() { return staticPrototype() == nullptr; } -/* static */ bool JSObject::splicePrototype(JSContext* cx, HandleObject obj, - Handle proto) { +/* static */ +bool JSObject::splicePrototype(JSContext* cx, HandleObject obj, + Handle proto) { MOZ_ASSERT(cx->compartment() == obj->compartment()); /* @@ -294,8 +297,8 @@ bool GlobalObject::shouldSplicePrototype() { return true; } -/* static */ ObjectGroup* JSObject::makeLazyGroup(JSContext* cx, - HandleObject obj) { +/* static */ +ObjectGroup* JSObject::makeLazyGroup(JSContext* cx, HandleObject obj) { MOZ_ASSERT(obj->hasLazyGroup()); MOZ_ASSERT(cx->compartment() == obj->compartment()); @@ -336,10 +339,10 @@ bool GlobalObject::shouldSplicePrototype() { return group; } -/* static */ bool JSObject::setNewGroupUnknown(JSContext* cx, - ObjectGroupRealm& realm, - const js::Class* clasp, - JS::HandleObject obj) { +/* static */ +bool JSObject::setNewGroupUnknown(JSContext* cx, ObjectGroupRealm& realm, + const js::Class* clasp, + JS::HandleObject obj) { ObjectGroup::setDefaultNewGroupUnknown(cx, realm, clasp, obj); return JSObject::setFlags(cx, obj, BaseShape::NEW_GROUP_UNKNOWN); } @@ -472,10 +475,10 @@ MOZ_ALWAYS_INLINE ObjectGroup* ObjectGroupRealm::DefaultNewGroupCache::lookup( return nullptr; } -/* static */ ObjectGroup* ObjectGroup::defaultNewGroup(JSContext* cx, - const Class* clasp, - TaggedProto proto, - JSObject* associated) { +/* static */ +ObjectGroup* ObjectGroup::defaultNewGroup(JSContext* cx, const Class* clasp, + TaggedProto proto, + JSObject* associated) { MOZ_ASSERT_IF(associated, proto.isObject()); MOZ_ASSERT_IF(proto.isObject(), cx->isInsideCurrentCompartment(proto.toObject())); @@ -628,10 +631,11 @@ MOZ_ALWAYS_INLINE ObjectGroup* ObjectGroupRealm::DefaultNewGroupCache::lookup( return group; } -/* static */ ObjectGroup* ObjectGroup::lazySingletonGroup(JSContext* cx, - ObjectGroup* oldGroup, - const Class* clasp, - TaggedProto proto) { +/* static */ +ObjectGroup* ObjectGroup::lazySingletonGroup(JSContext* cx, + ObjectGroup* oldGroup, + const Class* clasp, + TaggedProto proto) { ObjectGroupRealm& realm = oldGroup ? ObjectGroupRealm::get(oldGroup) : ObjectGroupRealm::getForNewObject(cx); @@ -674,9 +678,11 @@ MOZ_ALWAYS_INLINE ObjectGroup* ObjectGroupRealm::DefaultNewGroupCache::lookup( return group; } -/* static */ void ObjectGroup::setDefaultNewGroupUnknown( - JSContext* cx, ObjectGroupRealm& realm, const Class* clasp, - HandleObject obj) { +/* static */ +void ObjectGroup::setDefaultNewGroupUnknown(JSContext* cx, + ObjectGroupRealm& realm, + const Class* clasp, + HandleObject obj) { // If the object already has a new group, mark that group as unknown. ObjectGroupRealm::NewTable* table = realm.defaultNewTable; if (table) { @@ -691,9 +697,9 @@ MOZ_ALWAYS_INLINE ObjectGroup* ObjectGroupRealm::DefaultNewGroupCache::lookup( } #ifdef DEBUG -/* static */ bool ObjectGroup::hasDefaultNewGroup(JSObject* proto, - const Class* clasp, - ObjectGroup* group) { +/* static */ +bool ObjectGroup::hasDefaultNewGroup(JSObject* proto, const Class* clasp, + ObjectGroup* group) { ObjectGroupRealm::NewTable* table = ObjectGroupRealm::get(group).defaultNewTable; @@ -732,8 +738,8 @@ inline const Class* GetClassForProtoKey(JSProtoKey key) { } } -/* static */ ObjectGroup* ObjectGroup::defaultNewGroup(JSContext* cx, - JSProtoKey key) { +/* static */ +ObjectGroup* ObjectGroup::defaultNewGroup(JSContext* cx, JSProtoKey key) { JSObject* proto = nullptr; if (key != JSProto_Null) { proto = GlobalObject::getOrCreatePrototype(cx, key); @@ -797,11 +803,10 @@ static inline TypeSet::Type GetValueTypeForTable(const Value& v) { return type; } -/* static */ ArrayObject* ObjectGroup::newArrayObject(JSContext* cx, - const Value* vp, - size_t length, - NewObjectKind newKind, - NewArrayKind arrayKind) { +/* static */ +ArrayObject* ObjectGroup::newArrayObject(JSContext* cx, const Value* vp, + size_t length, NewObjectKind newKind, + NewArrayKind arrayKind) { MOZ_ASSERT(newKind != SingletonObject); // If we are making a copy on write array, don't try to adjust the group as @@ -1180,10 +1185,10 @@ PlainObject* js::NewPlainObjectWithProperties(JSContext* cx, return obj; } -/* static */ JSObject* ObjectGroup::newPlainObject(JSContext* cx, - IdValuePair* properties, - size_t nproperties, - NewObjectKind newKind) { +/* static */ +JSObject* ObjectGroup::newPlainObject(JSContext* cx, IdValuePair* properties, + size_t nproperties, + NewObjectKind newKind) { // Watch for simple cases where we don't try to reuse plain object groups. if (newKind == SingletonObject || nproperties == 0 || nproperties >= PropertyTree::MAX_HEIGHT) { @@ -1446,7 +1451,8 @@ class ObjectGroupRealm::AllocationSiteTable explicit AllocationSiteTable(Zone* zone) : Base(zone) {} }; -/* static */ ObjectGroup* ObjectGroup::allocationSiteGroup( +/* static */ +ObjectGroup* ObjectGroup::allocationSiteGroup( JSContext* cx, JSScript* scriptArg, jsbytecode* pc, JSProtoKey kind, HandleObject protoArg /* = nullptr */) { MOZ_ASSERT(!useSingletonForAllocationSite(scriptArg, pc, kind)); @@ -1543,8 +1549,10 @@ void ObjectGroupRealm::replaceAllocationSiteGroup(JSScript* script, } } -/* static */ ObjectGroup* ObjectGroup::callingAllocationSiteGroup( - JSContext* cx, JSProtoKey key, HandleObject proto) { +/* static */ +ObjectGroup* ObjectGroup::callingAllocationSiteGroup(JSContext* cx, + JSProtoKey key, + HandleObject proto) { MOZ_ASSERT_IF(proto, key == JSProto_Array); jsbytecode* pc; @@ -1558,11 +1566,11 @@ void ObjectGroupRealm::replaceAllocationSiteGroup(JSScript* script, return defaultNewGroup(cx, key); } -/* static */ bool ObjectGroup::setAllocationSiteObjectGroup(JSContext* cx, - HandleScript script, - jsbytecode* pc, - HandleObject obj, - bool singleton) { +/* static */ +bool ObjectGroup::setAllocationSiteObjectGroup(JSContext* cx, + HandleScript script, + jsbytecode* pc, HandleObject obj, + bool singleton) { JSProtoKey key = JSCLASS_CACHED_PROTO_KEY(obj->getClass()); MOZ_ASSERT(key != JSProto_Null); MOZ_ASSERT(singleton == useSingletonForAllocationSite(script, pc, key)); @@ -1587,8 +1595,10 @@ void ObjectGroupRealm::replaceAllocationSiteGroup(JSScript* script, return true; } -/* static */ ArrayObject* ObjectGroup::getOrFixupCopyOnWriteObject( - JSContext* cx, HandleScript script, jsbytecode* pc) { +/* static */ +ArrayObject* ObjectGroup::getOrFixupCopyOnWriteObject(JSContext* cx, + HandleScript script, + jsbytecode* pc) { // Make sure that the template object for script/pc has a type indicating // that the object and its copies have copy on write elements. RootedArrayObject obj( @@ -1624,8 +1634,9 @@ void ObjectGroupRealm::replaceAllocationSiteGroup(JSScript* script, return obj; } -/* static */ ArrayObject* ObjectGroup::getCopyOnWriteObject(JSScript* script, - jsbytecode* pc) { +/* static */ +ArrayObject* ObjectGroup::getCopyOnWriteObject(JSScript* script, + jsbytecode* pc) { // getOrFixupCopyOnWriteObject should already have been called for // script/pc, ensuring that the template object has a group with the // COPY_ON_WRITE flag. We don't assert this here, due to a corner case @@ -1638,10 +1649,9 @@ void ObjectGroupRealm::replaceAllocationSiteGroup(JSScript* script, return obj; } -/* static */ bool ObjectGroup::findAllocationSite(JSContext* cx, - const ObjectGroup* group, - JSScript** script, - uint32_t* offset) { +/* static */ +bool ObjectGroup::findAllocationSite(JSContext* cx, const ObjectGroup* group, + JSScript** script, uint32_t* offset) { *script = nullptr; *offset = 0; @@ -1813,7 +1823,8 @@ void ObjectGroupRealm::clearTables() { defaultNewGroupCache.purge(); } -/* static */ bool ObjectGroupRealm::PlainObjectTableSweepPolicy::needsSweep( +/* static */ +bool ObjectGroupRealm::PlainObjectTableSweepPolicy::needsSweep( PlainObjectKey* key, PlainObjectEntry* entry) { if (!(JS::GCPolicy::needsSweep(key) || entry->needsSweep(key->nproperties))) { diff --git a/js/src/vm/PIC.cpp b/js/src/vm/PIC.cpp index 6452a606df00..8186e81ab769 100644 --- a/js/src/vm/PIC.cpp +++ b/js/src/vm/PIC.cpp @@ -321,8 +321,9 @@ const Class ForOfPIC::class_ = { "ForOfPIC", JSCLASS_HAS_PRIVATE | JSCLASS_BACKGROUND_FINALIZE, &ForOfPICClassOps}; -/* static */ NativeObject* js::ForOfPIC::createForOfPICObject( - JSContext* cx, Handle global) { +/* static */ +NativeObject* js::ForOfPIC::createForOfPICObject(JSContext* cx, + Handle global) { cx->check(global); NativeObject* obj = NewNativeObjectWithGivenProto(cx, &ForOfPIC::class_, nullptr, TenuredObject); diff --git a/js/src/vm/ProxyObject.cpp b/js/src/vm/ProxyObject.cpp index a9ae0cd9e554..72dd47d70654 100644 --- a/js/src/vm/ProxyObject.cpp +++ b/js/src/vm/ProxyObject.cpp @@ -45,10 +45,10 @@ static gc::AllocKind GetProxyGCObjectKind(const Class* clasp, return kind; } -/* static */ ProxyObject* ProxyObject::New(JSContext* cx, - const BaseProxyHandler* handler, - HandleValue priv, TaggedProto proto_, - const ProxyOptions& options) { +/* static */ +ProxyObject* ProxyObject::New(JSContext* cx, const BaseProxyHandler* handler, + HandleValue priv, TaggedProto proto_, + const ProxyOptions& options) { Rooted proto(cx, proto_); const Class* clasp = options.clasp(); diff --git a/js/src/vm/RegExpObject.cpp b/js/src/vm/RegExpObject.cpp index 1cb1a1de0342..e4b7d366bf95 100644 --- a/js/src/vm/RegExpObject.cpp +++ b/js/src/vm/RegExpObject.cpp @@ -100,8 +100,9 @@ bool VectorMatchPairs::allocOrExpandArray(size_t pairCount) { /* RegExpObject */ -/* static */ RegExpShared* RegExpObject::getShared( - JSContext* cx, Handle regexp) { +/* static */ +RegExpShared* RegExpObject::getShared(JSContext* cx, + Handle regexp) { if (regexp->hasShared()) { return regexp->sharedRef(); } @@ -109,8 +110,8 @@ bool VectorMatchPairs::allocOrExpandArray(size_t pairCount) { return createShared(cx, regexp); } -/* static */ bool RegExpObject::isOriginalFlagGetter(JSNative native, - RegExpFlag* mask) { +/* static */ +bool RegExpObject::isOriginalFlagGetter(JSNative native, RegExpFlag* mask) { if (native == regexp_global) { *mask = GlobalFlag; return true; @@ -135,7 +136,8 @@ bool VectorMatchPairs::allocOrExpandArray(size_t pairCount) { return false; } -/* static */ void RegExpObject::trace(JSTracer* trc, JSObject* obj) { +/* static */ +void RegExpObject::trace(JSTracer* trc, JSObject* obj) { obj->as().trace(trc); } @@ -270,8 +272,9 @@ RegExpObject* RegExpObject::create(JSContext* cx, HandleAtom source, return regexp; } -/* static */ RegExpShared* RegExpObject::createShared( - JSContext* cx, Handle regexp) { +/* static */ +RegExpShared* RegExpObject::createShared(JSContext* cx, + Handle regexp) { MOZ_ASSERT(!regexp->hasShared()); RootedAtom source(cx, regexp->getSource()); RegExpShared* shared = @@ -514,10 +517,9 @@ JSFlatString* RegExpObject::toString(JSContext* cx) const { } #ifdef DEBUG -/* static */ bool RegExpShared::dumpBytecode(JSContext* cx, - MutableHandleRegExpShared re, - bool match_only, - HandleLinearString input) { +/* static */ +bool RegExpShared::dumpBytecode(JSContext* cx, MutableHandleRegExpShared re, + bool match_only, HandleLinearString input) { CompilationMode mode = match_only ? MatchOnly : Normal; if (!RegExpShared::compileIfNecessary(cx, re, input, mode, ForceByteCode)) { return false; @@ -827,10 +829,9 @@ JSFlatString* RegExpObject::toString(JSContext* cx) const { return true; } -/* static */ bool RegExpObject::dumpBytecode(JSContext* cx, - Handle regexp, - bool match_only, - HandleLinearString input) { +/* static */ +bool RegExpObject::dumpBytecode(JSContext* cx, Handle regexp, + bool match_only, HandleLinearString input) { RootedRegExpShared shared(cx, getShared(cx, regexp)); if (!shared) { return false; @@ -922,11 +923,10 @@ void RegExpShared::finalize(FreeOp* fop) { tables.~JitCodeTables(); } -/* static */ bool RegExpShared::compile(JSContext* cx, - MutableHandleRegExpShared re, - HandleLinearString input, - CompilationMode mode, - ForceByteCodeEnum force) { +/* static */ +bool RegExpShared::compile(JSContext* cx, MutableHandleRegExpShared re, + HandleLinearString input, CompilationMode mode, + ForceByteCodeEnum force) { TraceLoggerThread* logger = TraceLoggerForCurrentThread(cx); AutoTraceLog logCompile(logger, TraceLogger_IrregexpCompile); @@ -934,9 +934,10 @@ void RegExpShared::finalize(FreeOp* fop) { return compile(cx, re, pattern, input, mode, force); } -/* static */ bool RegExpShared::compile( - JSContext* cx, MutableHandleRegExpShared re, HandleAtom pattern, - HandleLinearString input, CompilationMode mode, ForceByteCodeEnum force) { +/* static */ +bool RegExpShared::compile(JSContext* cx, MutableHandleRegExpShared re, + HandleAtom pattern, HandleLinearString input, + CompilationMode mode, ForceByteCodeEnum force) { if (!re->ignoreCase() && !StringHasRegExpMetaChars(pattern)) { re->canStringMatch = true; } @@ -991,20 +992,24 @@ void RegExpShared::finalize(FreeOp* fop) { return true; } -/* static */ bool RegExpShared::compileIfNecessary(JSContext* cx, - MutableHandleRegExpShared re, - HandleLinearString input, - CompilationMode mode, - ForceByteCodeEnum force) { +/* static */ +bool RegExpShared::compileIfNecessary(JSContext* cx, + MutableHandleRegExpShared re, + HandleLinearString input, + CompilationMode mode, + ForceByteCodeEnum force) { if (re->isCompiled(mode, input->hasLatin1Chars(), force)) { return true; } return compile(cx, re, input, mode, force); } -/* static */ RegExpRunStatus RegExpShared::execute( - JSContext* cx, MutableHandleRegExpShared re, HandleLinearString input, - size_t start, VectorMatchPairs* matches, size_t* endIndex) { +/* static */ +RegExpRunStatus RegExpShared::execute(JSContext* cx, + MutableHandleRegExpShared re, + HandleLinearString input, size_t start, + VectorMatchPairs* matches, + size_t* endIndex) { MOZ_ASSERT_IF(matches, !endIndex); MOZ_ASSERT_IF(!matches, endIndex); TraceLoggerThread* logger = TraceLoggerForCurrentThread(cx); diff --git a/js/src/vm/Runtime.cpp b/js/src/vm/Runtime.cpp index 526166dd9b7d..06fdb472cd49 100644 --- a/js/src/vm/Runtime.cpp +++ b/js/src/vm/Runtime.cpp @@ -64,7 +64,8 @@ using mozilla::PodZero; using mozilla::PositiveInfinity; /* static */ MOZ_THREAD_LOCAL(JSContext*) js::TlsContext; -/* static */ Atomic JSRuntime::liveRuntimesCount; +/* static */ +Atomic JSRuntime::liveRuntimesCount; Atomic js::OnLargeAllocationFailure; namespace js { diff --git a/js/src/vm/SavedStacks.cpp b/js/src/vm/SavedStacks.cpp index 9585d76d0345..3a33c5d8d155 100644 --- a/js/src/vm/SavedStacks.cpp +++ b/js/src/vm/SavedStacks.cpp @@ -281,15 +281,18 @@ class MutableWrappedPtrOperations } }; -/* static */ bool SavedFrame::HashPolicy::hasHash(const Lookup& l) { +/* static */ +bool SavedFrame::HashPolicy::hasHash(const Lookup& l) { return SavedFramePtrHasher::hasHash(l.parent); } -/* static */ bool SavedFrame::HashPolicy::ensureHash(const Lookup& l) { +/* static */ +bool SavedFrame::HashPolicy::ensureHash(const Lookup& l) { return SavedFramePtrHasher::ensureHash(l.parent); } -/* static */ HashNumber SavedFrame::HashPolicy::hash(const Lookup& lookup) { +/* static */ +HashNumber SavedFrame::HashPolicy::hash(const Lookup& lookup) { JS::AutoCheckCannotGC nogc; // Assume that we can take line mod 2^32 without losing anything of // interest. If that assumption changes, we'll just need to start with 0 @@ -300,8 +303,8 @@ class MutableWrappedPtrOperations JSPrincipalsPtrHasher::hash(lookup.principals)); } -/* static */ bool SavedFrame::HashPolicy::match(SavedFrame* existing, - const Lookup& lookup) { +/* static */ +bool SavedFrame::HashPolicy::match(SavedFrame* existing, const Lookup& lookup) { MOZ_ASSERT(existing); if (existing->getLine() != lookup.line) { @@ -338,13 +341,14 @@ class MutableWrappedPtrOperations return true; } -/* static */ void SavedFrame::HashPolicy::rekey(Key& key, const Key& newKey) { +/* static */ +void SavedFrame::HashPolicy::rekey(Key& key, const Key& newKey) { key = newKey; } -/* static */ bool SavedFrame::finishSavedFrameInit(JSContext* cx, - HandleObject ctor, - HandleObject proto) { +/* static */ +bool SavedFrame::finishSavedFrameInit(JSContext* cx, HandleObject ctor, + HandleObject proto) { return FreezeObject(cx, proto); } @@ -400,7 +404,8 @@ const Class SavedFrame::protoClass_ = { JS_PSG("parent", SavedFrame::parentProperty, 0), JS_PS_END}; -/* static */ void SavedFrame::finalize(FreeOp* fop, JSObject* obj) { +/* static */ +void SavedFrame::finalize(FreeOp* fop, JSObject* obj) { MOZ_ASSERT(fop->onMainThread()); JSPrincipals* p = obj->as().getPrincipals(); if (p) { @@ -534,7 +539,8 @@ void SavedFrame::initFromLookup(JSContext* cx, initPrincipals(lookup.principals()); } -/* static */ SavedFrame* SavedFrame::create(JSContext* cx) { +/* static */ +SavedFrame* SavedFrame::create(JSContext* cx) { RootedGlobalObject global(cx, cx->global()); cx->check(global); @@ -575,8 +581,8 @@ uint32_t SavedFrame::wasmBytecodeOffset() { return getLine(); } -/* static */ bool SavedFrame::construct(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool SavedFrame::construct(JSContext* cx, unsigned argc, Value* vp) { JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_NO_CONSTRUCTOR, "SavedFrame"); return false; @@ -1092,8 +1098,8 @@ JS_PUBLIC_API bool IsUnwrappedSavedFrame(JSObject* obj) { namespace js { -/* static */ bool SavedFrame::sourceProperty(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool SavedFrame::sourceProperty(JSContext* cx, unsigned argc, Value* vp) { THIS_SAVEDFRAME(cx, argc, vp, "(get source)", args, frame); JSPrincipals* principals = cx->realm()->principals(); RootedString source(cx); @@ -1109,8 +1115,8 @@ namespace js { return true; } -/* static */ bool SavedFrame::sourceIdProperty(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool SavedFrame::sourceIdProperty(JSContext* cx, unsigned argc, Value* vp) { THIS_SAVEDFRAME(cx, argc, vp, "(get sourceId)", args, frame); JSPrincipals* principals = cx->realm()->principals(); uint32_t sourceId; @@ -1123,8 +1129,8 @@ namespace js { return true; } -/* static */ bool SavedFrame::lineProperty(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool SavedFrame::lineProperty(JSContext* cx, unsigned argc, Value* vp) { THIS_SAVEDFRAME(cx, argc, vp, "(get line)", args, frame); JSPrincipals* principals = cx->realm()->principals(); uint32_t line; @@ -1137,8 +1143,8 @@ namespace js { return true; } -/* static */ bool SavedFrame::columnProperty(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool SavedFrame::columnProperty(JSContext* cx, unsigned argc, Value* vp) { THIS_SAVEDFRAME(cx, argc, vp, "(get column)", args, frame); JSPrincipals* principals = cx->realm()->principals(); uint32_t column; @@ -1151,9 +1157,9 @@ namespace js { return true; } -/* static */ bool SavedFrame::functionDisplayNameProperty(JSContext* cx, - unsigned argc, - Value* vp) { +/* static */ +bool SavedFrame::functionDisplayNameProperty(JSContext* cx, unsigned argc, + Value* vp) { THIS_SAVEDFRAME(cx, argc, vp, "(get functionDisplayName)", args, frame); JSPrincipals* principals = cx->realm()->principals(); RootedString name(cx); @@ -1170,8 +1176,8 @@ namespace js { return true; } -/* static */ bool SavedFrame::asyncCauseProperty(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool SavedFrame::asyncCauseProperty(JSContext* cx, unsigned argc, Value* vp) { THIS_SAVEDFRAME(cx, argc, vp, "(get asyncCause)", args, frame); JSPrincipals* principals = cx->realm()->principals(); RootedString asyncCause(cx); @@ -1188,8 +1194,8 @@ namespace js { return true; } -/* static */ bool SavedFrame::asyncParentProperty(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool SavedFrame::asyncParentProperty(JSContext* cx, unsigned argc, Value* vp) { THIS_SAVEDFRAME(cx, argc, vp, "(get asyncParent)", args, frame); JSPrincipals* principals = cx->realm()->principals(); RootedObject asyncParent(cx); @@ -1201,8 +1207,8 @@ namespace js { return true; } -/* static */ bool SavedFrame::parentProperty(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool SavedFrame::parentProperty(JSContext* cx, unsigned argc, Value* vp) { THIS_SAVEDFRAME(cx, argc, vp, "(get parent)", args, frame); JSPrincipals* principals = cx->realm()->principals(); RootedObject parent(cx); @@ -1214,8 +1220,8 @@ namespace js { return true; } -/* static */ bool SavedFrame::toStringMethod(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool SavedFrame::toStringMethod(JSContext* cx, unsigned argc, Value* vp) { THIS_SAVEDFRAME(cx, argc, vp, "toString", args, frame); JSPrincipals* principals = cx->realm()->principals(); RootedString string(cx); @@ -1806,9 +1812,10 @@ JSObject* SavedStacks::MetadataBuilder::build( const SavedStacks::MetadataBuilder SavedStacks::metadataBuilder; -/* static */ ReconstructedSavedFramePrincipals - ReconstructedSavedFramePrincipals::IsSystem; -/* static */ ReconstructedSavedFramePrincipals +/* static */ +ReconstructedSavedFramePrincipals ReconstructedSavedFramePrincipals::IsSystem; +/* static */ +ReconstructedSavedFramePrincipals ReconstructedSavedFramePrincipals::IsNotSystem; UniqueChars BuildUTF8StackString(JSContext* cx, JSPrincipals* principals, diff --git a/js/src/vm/Scope.cpp b/js/src/vm/Scope.cpp index caaaf830862c..204fda20cb65 100644 --- a/js/src/vm/Scope.cpp +++ b/js/src/vm/Scope.cpp @@ -260,7 +260,8 @@ static void DeleteScopeData(ConcreteScopeData* data) { } template -/* static */ XDRResult Scope::XDRSizedBindingNames( +/* static */ +XDRResult Scope::XDRSizedBindingNames( XDRState* xdr, Handle scope, MutableHandle data) { MOZ_ASSERT(!data); @@ -301,8 +302,9 @@ template return Ok(); } -/* static */ Scope* Scope::create(JSContext* cx, ScopeKind kind, - HandleScope enclosing, HandleShape envShape) { +/* static */ +Scope* Scope::create(JSContext* cx, ScopeKind kind, HandleScope enclosing, + HandleShape envShape) { Scope* scope = Allocate(cx); if (scope) { new (scope) Scope(kind, enclosing, envShape); @@ -311,7 +313,8 @@ template } template -/* static */ ConcreteScope* Scope::create( +/* static */ +ConcreteScope* Scope::create( JSContext* cx, ScopeKind kind, HandleScope enclosing, HandleShape envShape, MutableHandle> data) { Scope* scope = create(cx, kind, enclosing, envShape); @@ -364,8 +367,8 @@ Shape* Scope::maybeCloneEnvironmentShape(JSContext* cx) { return environmentShape_; } -/* static */ Scope* Scope::clone(JSContext* cx, HandleScope scope, - HandleScope enclosing) { +/* static */ +Scope* Scope::clone(JSContext* cx, HandleScope scope, HandleScope enclosing) { RootedShape envShape(cx); if (scope->environmentShape()) { envShape = scope->maybeCloneEnvironmentShape(cx); @@ -493,7 +496,8 @@ uint32_t LexicalScope::firstFrameSlot() const { return 0; } -/* static */ uint32_t LexicalScope::nextFrameSlot(Scope* scope) { +/* static */ +uint32_t LexicalScope::nextFrameSlot(Scope* scope) { for (ScopeIter si(scope); si; si++) { switch (si.kind()) { case ScopeKind::Function: @@ -530,10 +534,10 @@ uint32_t LexicalScope::firstFrameSlot() const { MOZ_CRASH("Not an enclosing intra-frame Scope"); } -/* static */ LexicalScope* LexicalScope::create(JSContext* cx, ScopeKind kind, - Handle data, - uint32_t firstFrameSlot, - HandleScope enclosing) { +/* static */ +LexicalScope* LexicalScope::create(JSContext* cx, ScopeKind kind, + Handle data, uint32_t firstFrameSlot, + HandleScope enclosing) { MOZ_ASSERT(data, "LexicalScopes should not be created if there are no bindings."); @@ -547,9 +551,11 @@ uint32_t LexicalScope::firstFrameSlot() const { return createWithData(cx, kind, ©, firstFrameSlot, enclosing); } -/* static */ LexicalScope* LexicalScope::createWithData( - JSContext* cx, ScopeKind kind, MutableHandle> data, - uint32_t firstFrameSlot, HandleScope enclosing) { +/* static */ +LexicalScope* LexicalScope::createWithData(JSContext* cx, ScopeKind kind, + MutableHandle> data, + uint32_t firstFrameSlot, + HandleScope enclosing) { bool isNamedLambda = kind == ScopeKind::NamedLambda || kind == ScopeKind::StrictNamedLambda; @@ -574,16 +580,16 @@ uint32_t LexicalScope::firstFrameSlot() const { return scope; } -/* static */ Shape* LexicalScope::getEmptyExtensibleEnvironmentShape( - JSContext* cx) { +/* static */ +Shape* LexicalScope::getEmptyExtensibleEnvironmentShape(JSContext* cx) { const Class* cls = &LexicalEnvironmentObject::class_; return EmptyEnvironmentShape(cx, cls, JSSLOT_FREE(cls), BaseShape::DELEGATE); } template -/* static */ XDRResult LexicalScope::XDR(XDRState* xdr, ScopeKind kind, - HandleScope enclosing, - MutableHandleScope scope) { +/* static */ +XDRResult LexicalScope::XDR(XDRState* xdr, ScopeKind kind, + HandleScope enclosing, MutableHandleScope scope) { JSContext* cx = xdr->cx(); Rooted data(cx); @@ -624,12 +630,14 @@ template } template - /* static */ XDRResult + /* static */ + XDRResult LexicalScope::XDR(XDRState* xdr, ScopeKind kind, HandleScope enclosing, MutableHandleScope scope); template - /* static */ XDRResult + /* static */ + XDRResult LexicalScope::XDR(XDRState* xdr, ScopeKind kind, HandleScope enclosing, MutableHandleScope scope); @@ -644,9 +652,11 @@ Zone* FunctionScope::Data::zone() const { return canonicalFunction ? canonicalFunction->zone() : nullptr; } -/* static */ FunctionScope* FunctionScope::create( - JSContext* cx, Handle dataArg, bool hasParameterExprs, - bool needsEnvironment, HandleFunction fun, HandleScope enclosing) { +/* static */ +FunctionScope* FunctionScope::create(JSContext* cx, Handle dataArg, + bool hasParameterExprs, + bool needsEnvironment, HandleFunction fun, + HandleScope enclosing) { // The data that's passed in is from the frontend and is LifoAlloc'd. // Copy it now that we're creating a permanent VM scope. Rooted> data( @@ -660,7 +670,8 @@ Zone* FunctionScope::Data::zone() const { enclosing); } -/* static */ FunctionScope* FunctionScope::createWithData( +/* static */ +FunctionScope* FunctionScope::createWithData( JSContext* cx, MutableHandle> data, bool hasParameterExprs, bool needsEnvironment, HandleFunction fun, HandleScope enclosing) { MOZ_ASSERT(data); @@ -702,22 +713,23 @@ JSScript* FunctionScope::script() const { return canonicalFunction()->nonLazyScript(); } -/* static */ bool FunctionScope::isSpecialName(JSContext* cx, JSAtom* name) { +/* static */ +bool FunctionScope::isSpecialName(JSContext* cx, JSAtom* name) { return name == cx->names().arguments || name == cx->names().dotThis || name == cx->names().dotGenerator; } -/* static */ Shape* FunctionScope::getEmptyEnvironmentShape( - JSContext* cx, bool hasParameterExprs) { +/* static */ +Shape* FunctionScope::getEmptyEnvironmentShape(JSContext* cx, + bool hasParameterExprs) { const Class* cls = &CallObject::class_; uint32_t shapeFlags = FunctionScopeEnvShapeFlags(hasParameterExprs); return EmptyEnvironmentShape(cx, cls, JSSLOT_FREE(cls), shapeFlags); } -/* static */ FunctionScope* FunctionScope::clone(JSContext* cx, - Handle scope, - HandleFunction fun, - HandleScope enclosing) { +/* static */ +FunctionScope* FunctionScope::clone(JSContext* cx, Handle scope, + HandleFunction fun, HandleScope enclosing) { MOZ_ASSERT(fun != scope->canonicalFunction()); // FunctionScope::Data has GCManagedDeletePolicy because it contains a @@ -745,10 +757,9 @@ JSScript* FunctionScope::script() const { } template -/* static */ XDRResult FunctionScope::XDR(XDRState* xdr, - HandleFunction fun, - HandleScope enclosing, - MutableHandleScope scope) { +/* static */ +XDRResult FunctionScope::XDR(XDRState* xdr, HandleFunction fun, + HandleScope enclosing, MutableHandleScope scope) { JSContext* cx = xdr->cx(); Rooted data(cx); MOZ_TRY(XDRSizedBindingNames(xdr, scope.as(), @@ -797,12 +808,14 @@ template } template - /* static */ XDRResult + /* static */ + XDRResult FunctionScope::XDR(XDRState* xdr, HandleFunction fun, HandleScope enclosing, MutableHandleScope scope); template - /* static */ XDRResult + /* static */ + XDRResult FunctionScope::XDR(XDRState* xdr, HandleFunction fun, HandleScope enclosing, MutableHandleScope scope); @@ -819,11 +832,10 @@ static UniquePtr NewEmptyVarScopeData(JSContext* cx, return data; } -/* static */ VarScope* VarScope::create(JSContext* cx, ScopeKind kind, - Handle dataArg, - uint32_t firstFrameSlot, - bool needsEnvironment, - HandleScope enclosing) { +/* static */ +VarScope* VarScope::create(JSContext* cx, ScopeKind kind, Handle dataArg, + uint32_t firstFrameSlot, bool needsEnvironment, + HandleScope enclosing) { // The data that's passed in is from the frontend and is LifoAlloc'd. // Copy it now that we're creating a permanent VM scope. Rooted> data( @@ -837,9 +849,12 @@ static UniquePtr NewEmptyVarScopeData(JSContext* cx, enclosing); } -/* static */ VarScope* VarScope::createWithData( - JSContext* cx, ScopeKind kind, MutableHandle> data, - uint32_t firstFrameSlot, bool needsEnvironment, HandleScope enclosing) { +/* static */ +VarScope* VarScope::createWithData(JSContext* cx, ScopeKind kind, + MutableHandle> data, + uint32_t firstFrameSlot, + bool needsEnvironment, + HandleScope enclosing) { MOZ_ASSERT(data); RootedShape envShape(cx); @@ -863,7 +878,8 @@ static UniquePtr NewEmptyVarScopeData(JSContext* cx, return Scope::create(cx, kind, enclosing, envShape, data); } -/* static */ Shape* VarScope::getEmptyEnvironmentShape(JSContext* cx) { +/* static */ +Shape* VarScope::getEmptyEnvironmentShape(JSContext* cx) { const Class* cls = &VarEnvironmentObject::class_; return EmptyEnvironmentShape(cx, cls, JSSLOT_FREE(cls), VarScopeEnvShapeFlags); @@ -877,9 +893,9 @@ uint32_t VarScope::firstFrameSlot() const { } template -/* static */ XDRResult VarScope::XDR(XDRState* xdr, ScopeKind kind, - HandleScope enclosing, - MutableHandleScope scope) { +/* static */ +XDRResult VarScope::XDR(XDRState* xdr, ScopeKind kind, + HandleScope enclosing, MutableHandleScope scope) { JSContext* cx = xdr->cx(); Rooted data(cx); MOZ_TRY(XDRSizedBindingNames(xdr, scope.as(), &data)); @@ -922,17 +938,20 @@ template } template - /* static */ XDRResult + /* static */ + XDRResult VarScope::XDR(XDRState* xdr, ScopeKind kind, HandleScope enclosing, MutableHandleScope scope); template - /* static */ XDRResult + /* static */ + XDRResult VarScope::XDR(XDRState* xdr, ScopeKind kind, HandleScope enclosing, MutableHandleScope scope); -/* static */ GlobalScope* GlobalScope::create(JSContext* cx, ScopeKind kind, - Handle dataArg) { +/* static */ +GlobalScope* GlobalScope::create(JSContext* cx, ScopeKind kind, + Handle dataArg) { // The data that's passed in is from the frontend and is LifoAlloc'd. // Copy it now that we're creating a permanent VM scope. Rooted> data(cx, dataArg @@ -945,8 +964,9 @@ template return createWithData(cx, kind, &data); } -/* static */ GlobalScope* GlobalScope::createWithData( - JSContext* cx, ScopeKind kind, MutableHandle> data) { +/* static */ +GlobalScope* GlobalScope::createWithData(JSContext* cx, ScopeKind kind, + MutableHandle> data) { MOZ_ASSERT(data); // The global scope has no environment shape. Its environment is the @@ -956,9 +976,9 @@ template return Scope::create(cx, kind, nullptr, nullptr, data); } -/* static */ GlobalScope* GlobalScope::clone(JSContext* cx, - Handle scope, - ScopeKind kind) { +/* static */ +GlobalScope* GlobalScope::clone(JSContext* cx, Handle scope, + ScopeKind kind) { Rooted dataOriginal(cx, &scope->as().data()); Rooted> dataClone( cx, CopyScopeData(cx, dataOriginal)); @@ -970,8 +990,9 @@ template } template -/* static */ XDRResult GlobalScope::XDR(XDRState* xdr, ScopeKind kind, - MutableHandleScope scope) { +/* static */ +XDRResult GlobalScope::XDR(XDRState* xdr, ScopeKind kind, + MutableHandleScope scope) { MOZ_ASSERT((mode == XDR_DECODE) == !scope); JSContext* cx = xdr->cx(); @@ -1005,25 +1026,27 @@ template } template - /* static */ XDRResult + /* static */ + XDRResult GlobalScope::XDR(XDRState* xdr, ScopeKind kind, MutableHandleScope scope); template - /* static */ XDRResult + /* static */ + XDRResult GlobalScope::XDR(XDRState* xdr, ScopeKind kind, MutableHandleScope scope); -/* static */ WithScope* WithScope::create(JSContext* cx, - HandleScope enclosing) { +/* static */ +WithScope* WithScope::create(JSContext* cx, HandleScope enclosing) { Scope* scope = Scope::create(cx, ScopeKind::With, enclosing, nullptr); return static_cast(scope); } template -/* static */ XDRResult WithScope::XDR(XDRState* xdr, - HandleScope enclosing, - MutableHandleScope scope) { +/* static */ +XDRResult WithScope::XDR(XDRState* xdr, HandleScope enclosing, + MutableHandleScope scope) { JSContext* cx = xdr->cx(); if (mode == XDR_DECODE) { @@ -1037,21 +1060,23 @@ template } template - /* static */ XDRResult + /* static */ + XDRResult WithScope::XDR(XDRState* xdr, HandleScope enclosing, MutableHandleScope scope); template - /* static */ XDRResult + /* static */ + XDRResult WithScope::XDR(XDRState* xdr, HandleScope enclosing, MutableHandleScope scope); static const uint32_t EvalScopeEnvShapeFlags = BaseShape::QUALIFIED_VAROBJ | BaseShape::DELEGATE; -/* static */ EvalScope* EvalScope::create(JSContext* cx, ScopeKind scopeKind, - Handle dataArg, - HandleScope enclosing) { +/* static */ +EvalScope* EvalScope::create(JSContext* cx, ScopeKind scopeKind, + Handle dataArg, HandleScope enclosing) { // The data that's passed in is from the frontend and is LifoAlloc'd. // Copy it now that we're creating a permanent VM scope. Rooted> data(cx, dataArg @@ -1064,9 +1089,10 @@ static const uint32_t EvalScopeEnvShapeFlags = return createWithData(cx, scopeKind, &data, enclosing); } -/* static */ EvalScope* EvalScope::createWithData( - JSContext* cx, ScopeKind scopeKind, MutableHandle> data, - HandleScope enclosing) { +/* static */ +EvalScope* EvalScope::createWithData(JSContext* cx, ScopeKind scopeKind, + MutableHandle> data, + HandleScope enclosing) { MOZ_ASSERT(data); RootedShape envShape(cx); @@ -1091,7 +1117,8 @@ static const uint32_t EvalScopeEnvShapeFlags = return Scope::create(cx, scopeKind, enclosing, envShape, data); } -/* static */ Scope* EvalScope::nearestVarScopeForDirectEval(Scope* scope) { +/* static */ +Scope* EvalScope::nearestVarScopeForDirectEval(Scope* scope) { for (ScopeIter si(scope); si; si++) { switch (si.kind()) { case ScopeKind::Function: @@ -1107,16 +1134,17 @@ static const uint32_t EvalScopeEnvShapeFlags = return nullptr; } -/* static */ Shape* EvalScope::getEmptyEnvironmentShape(JSContext* cx) { +/* static */ +Shape* EvalScope::getEmptyEnvironmentShape(JSContext* cx) { const Class* cls = &VarEnvironmentObject::class_; return EmptyEnvironmentShape(cx, cls, JSSLOT_FREE(cls), EvalScopeEnvShapeFlags); } template -/* static */ XDRResult EvalScope::XDR(XDRState* xdr, ScopeKind kind, - HandleScope enclosing, - MutableHandleScope scope) { +/* static */ +XDRResult EvalScope::XDR(XDRState* xdr, ScopeKind kind, + HandleScope enclosing, MutableHandleScope scope) { JSContext* cx = xdr->cx(); Rooted data(cx); @@ -1144,12 +1172,14 @@ template } template - /* static */ XDRResult + /* static */ + XDRResult EvalScope::XDR(XDRState* xdr, ScopeKind kind, HandleScope enclosing, MutableHandleScope scope); template - /* static */ XDRResult + /* static */ + XDRResult EvalScope::XDR(XDRState* xdr, ScopeKind kind, HandleScope enclosing, MutableHandleScope scope); @@ -1161,10 +1191,10 @@ Zone* ModuleScope::Data::zone() const { return module ? module->zone() : nullptr; } -/* static */ ModuleScope* ModuleScope::create(JSContext* cx, - Handle dataArg, - HandleModuleObject module, - HandleScope enclosing) { +/* static */ +ModuleScope* ModuleScope::create(JSContext* cx, Handle dataArg, + HandleModuleObject module, + HandleScope enclosing) { Rooted> data(cx, dataArg ? CopyScopeData(cx, dataArg) : NewEmptyScopeData(cx)); @@ -1175,9 +1205,11 @@ Zone* ModuleScope::Data::zone() const { return createWithData(cx, &data, module, enclosing); } -/* static */ ModuleScope* ModuleScope::createWithData( - JSContext* cx, MutableHandle> data, - HandleModuleObject module, HandleScope enclosing) { +/* static */ +ModuleScope* ModuleScope::createWithData(JSContext* cx, + MutableHandle> data, + HandleModuleObject module, + HandleScope enclosing) { MOZ_ASSERT(data); MOZ_ASSERT(enclosing->is()); @@ -1208,7 +1240,8 @@ Zone* ModuleScope::Data::zone() const { data); } -/* static */ Shape* ModuleScope::getEmptyEnvironmentShape(JSContext* cx) { +/* static */ +Shape* ModuleScope::getEmptyEnvironmentShape(JSContext* cx) { const Class* cls = &ModuleEnvironmentObject::class_; return EmptyEnvironmentShape(cx, cls, JSSLOT_FREE(cls), ModuleScopeEnvShapeFlags); @@ -1245,8 +1278,9 @@ static void InitializeNextTrailingName(const Rooted>& data, data->length++; } -/* static */ WasmInstanceScope* WasmInstanceScope::create( - JSContext* cx, WasmInstanceObject* instance) { +/* static */ +WasmInstanceScope* WasmInstanceScope::create(JSContext* cx, + WasmInstanceObject* instance) { // WasmInstanceScope::Data has GCManagedDeletePolicy because it contains a // GCPtr. Destruction of |data| below may trigger calls into the GC. @@ -1295,7 +1329,8 @@ static void InitializeNextTrailingName(const Rooted>& data, /* envShape = */ nullptr, &data); } -/* static */ Shape* WasmInstanceScope::getEmptyEnvironmentShape(JSContext* cx) { +/* static */ +Shape* WasmInstanceScope::getEmptyEnvironmentShape(JSContext* cx) { const Class* cls = &WasmInstanceEnvironmentObject::class_; return EmptyEnvironmentShape(cx, cls, JSSLOT_FREE(cls), WasmInstanceEnvShapeFlags); @@ -1306,9 +1341,10 @@ static void InitializeNextTrailingName(const Rooted>& data, static const uint32_t WasmFunctionEnvShapeFlags = BaseShape::NOT_EXTENSIBLE | BaseShape::DELEGATE; -/* static */ WasmFunctionScope* WasmFunctionScope::create(JSContext* cx, - HandleScope enclosing, - uint32_t funcIndex) { +/* static */ +WasmFunctionScope* WasmFunctionScope::create(JSContext* cx, + HandleScope enclosing, + uint32_t funcIndex) { MOZ_ASSERT(enclosing->is()); Rooted wasmFunctionScope(cx); @@ -1348,7 +1384,8 @@ static const uint32_t WasmFunctionEnvShapeFlags = /* envShape = */ nullptr, &data); } -/* static */ Shape* WasmFunctionScope::getEmptyEnvironmentShape(JSContext* cx) { +/* static */ +Shape* WasmFunctionScope::getEmptyEnvironmentShape(JSContext* cx) { const Class* cls = &WasmFunctionCallObject::class_; return EmptyEnvironmentShape(cx, cls, JSSLOT_FREE(cls), WasmFunctionEnvShapeFlags); diff --git a/js/src/vm/Shape.cpp b/js/src/vm/Shape.cpp index 23570e3f8bac..3b079f443a62 100644 --- a/js/src/vm/Shape.cpp +++ b/js/src/vm/Shape.cpp @@ -154,7 +154,8 @@ void Shape::handoffTableTo(Shape* shape) { shape->base_ = nbase; } -/* static */ bool Shape::hashify(JSContext* cx, Shape* shape) { +/* static */ +bool Shape::hashify(JSContext* cx, Shape* shape) { MOZ_ASSERT(!shape->hasTable()); if (!shape->ensureOwnBaseShape(cx)) { @@ -175,7 +176,8 @@ void Shape::handoffTableTo(Shape* shape) { return true; } -/* static */ bool Shape::cachify(JSContext* cx, Shape* shape) { +/* static */ +bool Shape::cachify(JSContext* cx, Shape* shape) { MOZ_ASSERT(!shape->hasTable() && !shape->hasIC()); if (!shape->ensureOwnBaseShape(cx)) { @@ -316,10 +318,9 @@ void ShapeTable::checkAfterMovingGC() { #endif -/* static */ Shape* Shape::replaceLastProperty(JSContext* cx, - StackBaseShape& base, - TaggedProto proto, - HandleShape shape) { +/* static */ +Shape* Shape::replaceLastProperty(JSContext* cx, StackBaseShape& base, + TaggedProto proto, HandleShape shape) { MOZ_ASSERT(!shape->inDictionary()); if (!shape->parent) { @@ -446,8 +447,8 @@ void ShapeTable::checkAfterMovingGC() { return shape; } -/* static */ bool js::NativeObject::toDictionaryMode(JSContext* cx, - HandleNativeObject obj) { +/* static */ +bool js::NativeObject::toDictionaryMode(JSContext* cx, HandleNativeObject obj) { MOZ_ASSERT(!obj->inDictionaryMode()); MOZ_ASSERT(cx->isInsideCurrentCompartment(obj)); @@ -617,7 +618,8 @@ static void AssertValidPropertyOp(NativeObject* obj, GetterOp getter, #endif } -/* static */ Shape* NativeObject::addAccessorPropertyInternal( +/* static */ +Shape* NativeObject::addAccessorPropertyInternal( JSContext* cx, HandleNativeObject obj, HandleId id, GetterOp getter, SetterOp setter, unsigned attrs, ShapeTable* table, ShapeTable::Entry* entry, const AutoKeepShapeCaches& keep) { @@ -658,10 +660,13 @@ static void AssertValidPropertyOp(NativeObject* obj, GetterOp getter, return shape; } -/* static */ Shape* NativeObject::addDataPropertyInternal( - JSContext* cx, HandleNativeObject obj, HandleId id, uint32_t slot, - unsigned attrs, ShapeTable* table, ShapeTable::Entry* entry, - const AutoKeepShapeCaches& keep) { +/* static */ +Shape* NativeObject::addDataPropertyInternal(JSContext* cx, + HandleNativeObject obj, + HandleId id, uint32_t slot, + unsigned attrs, ShapeTable* table, + ShapeTable::Entry* entry, + const AutoKeepShapeCaches& keep) { AutoCheckShapeConsistency check(obj); // The slot, if any, must be a reserved slot. @@ -726,8 +731,10 @@ static MOZ_ALWAYS_INLINE Shape* PropertyTreeReadBarrier(Shape* parent, return nullptr; } -/* static */ Shape* NativeObject::addEnumerableDataProperty( - JSContext* cx, HandleNativeObject obj, HandleId id) { +/* static */ +Shape* NativeObject::addEnumerableDataProperty(JSContext* cx, + HandleNativeObject obj, + HandleId id) { // Like addProperty(Internal), but optimized for the common case of adding a // new enumerable data property. @@ -930,8 +937,10 @@ static void AssertValidArrayIndex(NativeObject* obj, jsid id) { #endif } -/* static */ bool NativeObject::maybeToDictionaryModeForPut( - JSContext* cx, HandleNativeObject obj, MutableHandleShape shape) { +/* static */ +bool NativeObject::maybeToDictionaryModeForPut(JSContext* cx, + HandleNativeObject obj, + MutableHandleShape shape) { // Overwriting a non-last property requires switching to dictionary mode. // The shape tree is shared immutable, and we can't removeProperty and then // addAccessorPropertyInternal because a failure under add would lose data. @@ -952,9 +961,9 @@ static void AssertValidArrayIndex(NativeObject* obj, jsid id) { return true; } -/* static */ Shape* NativeObject::putDataProperty(JSContext* cx, - HandleNativeObject obj, - HandleId id, unsigned attrs) { +/* static */ +Shape* NativeObject::putDataProperty(JSContext* cx, HandleNativeObject obj, + HandleId id, unsigned attrs) { MOZ_ASSERT(!JSID_IS_VOID(id)); AutoCheckShapeConsistency check(obj); @@ -1065,9 +1074,10 @@ static void AssertValidArrayIndex(NativeObject* obj, jsid id) { return shape; } -/* static */ Shape* NativeObject::putAccessorProperty( - JSContext* cx, HandleNativeObject obj, HandleId id, GetterOp getter, - SetterOp setter, unsigned attrs) { +/* static */ +Shape* NativeObject::putAccessorProperty(JSContext* cx, HandleNativeObject obj, + HandleId id, GetterOp getter, + SetterOp setter, unsigned attrs) { MOZ_ASSERT(!JSID_IS_VOID(id)); AutoCheckShapeConsistency check(obj); @@ -1184,9 +1194,10 @@ static void AssertValidArrayIndex(NativeObject* obj, jsid id) { return shape; } -/* static */ Shape* NativeObject::changeProperty( - JSContext* cx, HandleNativeObject obj, HandleShape shape, unsigned attrs, - GetterOp getter, SetterOp setter) { +/* static */ +Shape* NativeObject::changeProperty(JSContext* cx, HandleNativeObject obj, + HandleShape shape, unsigned attrs, + GetterOp getter, SetterOp setter) { MOZ_ASSERT(obj->containsPure(shape)); AutoCheckShapeConsistency check(obj); @@ -1210,9 +1221,9 @@ static void AssertValidArrayIndex(NativeObject* obj, jsid id) { return putAccessorProperty(cx, obj, propid, getter, setter, attrs); } -/* static */ bool NativeObject::removeProperty(JSContext* cx, - HandleNativeObject obj, - jsid id_) { +/* static */ +bool NativeObject::removeProperty(JSContext* cx, HandleNativeObject obj, + jsid id_) { RootedId id(cx, id_); AutoKeepShapeCaches keep(cx); @@ -1341,7 +1352,8 @@ static void AssertValidArrayIndex(NativeObject* obj, jsid id) { return true; } -/* static */ void NativeObject::clear(JSContext* cx, HandleNativeObject obj) { +/* static */ +void NativeObject::clear(JSContext* cx, HandleNativeObject obj) { Shape* shape = obj->lastProperty(); MOZ_ASSERT(obj->inDictionaryMode() == shape->inDictionary()); @@ -1360,9 +1372,9 @@ static void AssertValidArrayIndex(NativeObject* obj, jsid id) { obj->checkShapeConsistency(); } -/* static */ bool NativeObject::rollbackProperties(JSContext* cx, - HandleNativeObject obj, - uint32_t slotSpan) { +/* static */ +bool NativeObject::rollbackProperties(JSContext* cx, HandleNativeObject obj, + uint32_t slotSpan) { /* * Remove properties from this object until it has a matching slot span. * The object cannot have escaped in a way which would prevent safe @@ -1387,9 +1399,12 @@ static void AssertValidArrayIndex(NativeObject* obj, jsid id) { return true; } -/* static */ Shape* NativeObject::replaceWithNewEquivalentShape( - JSContext* cx, HandleNativeObject obj, Shape* oldShape, Shape* newShape, - bool accessorShape) { +/* static */ +Shape* NativeObject::replaceWithNewEquivalentShape(JSContext* cx, + HandleNativeObject obj, + Shape* oldShape, + Shape* newShape, + bool accessorShape) { MOZ_ASSERT(cx->isInsideCurrentZone(oldShape)); MOZ_ASSERT_IF(oldShape != obj->lastProperty(), obj->inDictionaryMode() && @@ -1447,9 +1462,9 @@ static void AssertValidArrayIndex(NativeObject* obj, jsid id) { return newShape; } -/* static */ bool JSObject::setFlags(JSContext* cx, HandleObject obj, - BaseShape::Flag flags, - GenerateShape generateShape) { +/* static */ +bool JSObject::setFlags(JSContext* cx, HandleObject obj, BaseShape::Flag flags, + GenerateShape generateShape) { MOZ_ASSERT(cx->compartment() == obj->compartment()); if (obj->hasAllFlags(flags)) { @@ -1491,8 +1506,9 @@ static void AssertValidArrayIndex(NativeObject* obj, jsid id) { return true; } -/* static */ bool NativeObject::clearFlag(JSContext* cx, HandleNativeObject obj, - BaseShape::Flag flag) { +/* static */ +bool NativeObject::clearFlag(JSContext* cx, HandleNativeObject obj, + BaseShape::Flag flag) { MOZ_ASSERT(obj->lastProperty()->getObjectFlags() & flag); if (!obj->inDictionaryMode()) { @@ -1512,8 +1528,9 @@ static void AssertValidArrayIndex(NativeObject* obj, jsid id) { return true; } -/* static */ Shape* Shape::setObjectFlags(JSContext* cx, BaseShape::Flag flags, - TaggedProto proto, Shape* last) { +/* static */ +Shape* Shape::setObjectFlags(JSContext* cx, BaseShape::Flag flags, + TaggedProto proto, Shape* last) { if ((last->getObjectFlags() & flags) == flags) { return last; } @@ -1528,8 +1545,8 @@ static void AssertValidArrayIndex(NativeObject* obj, jsid id) { inline BaseShape::BaseShape(const StackBaseShape& base) : clasp_(base.clasp), flags(base.flags), slotSpan_(0), unowned_(nullptr) {} -/* static */ void BaseShape::copyFromUnowned(BaseShape& dest, - UnownedBaseShape& src) { +/* static */ +void BaseShape::copyFromUnowned(BaseShape& dest, UnownedBaseShape& src) { dest.clasp_ = src.clasp_; dest.slotSpan_ = src.slotSpan_; dest.unowned_ = &src; @@ -1549,8 +1566,8 @@ inline void BaseShape::adoptUnowned(UnownedBaseShape* other) { assertConsistency(); } -/* static */ UnownedBaseShape* BaseShape::getUnowned(JSContext* cx, - StackBaseShape& base) { +/* static */ +UnownedBaseShape* BaseShape::getUnowned(JSContext* cx, StackBaseShape& base) { auto& table = cx->zone()->baseShapes(); auto p = MakeDependentAddPtr(cx, table, base); @@ -2108,11 +2125,10 @@ void Shape::dumpSubtree(int level, js::GenericPrinter& out) const { #endif -/* static */ Shape* EmptyShape::getInitialShape(JSContext* cx, - const Class* clasp, - TaggedProto proto, - size_t nfixed, - uint32_t objectFlags) { +/* static */ +Shape* EmptyShape::getInitialShape(JSContext* cx, const Class* clasp, + TaggedProto proto, size_t nfixed, + uint32_t objectFlags) { MOZ_ASSERT_IF(proto.isObject(), cx->isInsideCurrentCompartment(proto.toObject())); @@ -2146,11 +2162,10 @@ void Shape::dumpSubtree(int level, js::GenericPrinter& out) const { return shape; } -/* static */ Shape* EmptyShape::getInitialShape(JSContext* cx, - const Class* clasp, - TaggedProto proto, - gc::AllocKind kind, - uint32_t objectFlags) { +/* static */ +Shape* EmptyShape::getInitialShape(JSContext* cx, const Class* clasp, + TaggedProto proto, gc::AllocKind kind, + uint32_t objectFlags) { return getInitialShape(cx, clasp, proto, GetGCKindSlots(kind, clasp), objectFlags); } @@ -2188,9 +2203,9 @@ void NewObjectCache::invalidateEntriesForShape(JSContext* cx, HandleShape shape, } } -/* static */ void EmptyShape::insertInitialShape(JSContext* cx, - HandleShape shape, - HandleObject proto) { +/* static */ +void EmptyShape::insertInitialShape(JSContext* cx, HandleShape shape, + HandleObject proto) { using Lookup = InitialShapeEntry::Lookup; Lookup lookup(shape->getObjectClass(), TaggedProto(proto), shape->numFixedSlots(), shape->getObjectFlags()); diff --git a/js/src/vm/SharedArrayObject.cpp b/js/src/vm/SharedArrayObject.cpp index b0d5bc40d33d..8e0a671d0a17 100644 --- a/js/src/vm/SharedArrayObject.cpp +++ b/js/src/vm/SharedArrayObject.cpp @@ -296,7 +296,8 @@ uint32_t SharedArrayBufferObject::wasmBoundsCheckLimit() const { } #endif -/* static */ void SharedArrayBufferObject::addSizeOfExcludingThis( +/* static */ +void SharedArrayBufferObject::addSizeOfExcludingThis( JSObject* obj, mozilla::MallocSizeOf mallocSizeOf, JS::ClassInfo* info) { // Divide the buffer size by the refcount to get the fraction of the buffer // owned by this thread. It's conceivable that the refcount might change in @@ -309,7 +310,8 @@ uint32_t SharedArrayBufferObject::wasmBoundsCheckLimit() const { buf.byteLength() / buf.rawBufferObject()->refcount(); } -/* static */ void SharedArrayBufferObject::copyData( +/* static */ +void SharedArrayBufferObject::copyData( Handle toBuffer, uint32_t toIndex, Handle fromBuffer, uint32_t fromIndex, uint32_t count) { diff --git a/js/src/vm/StringType.cpp b/js/src/vm/StringType.cpp index 05d6e369b562..ef5a0ac7be9e 100644 --- a/js/src/vm/StringType.cpp +++ b/js/src/vm/StringType.cpp @@ -129,8 +129,8 @@ const char16_t JS::ubi::Concrete::concreteTypeName[] = u"JSString"; #if defined(DEBUG) || defined(JS_JITSPEW) template -/*static */ void JSString::dumpChars(const CharT* s, size_t n, - js::GenericPrinter& out) { +/*static */ +void JSString::dumpChars(const CharT* s, size_t n, js::GenericPrinter& out) { if (n == SIZE_MAX) { n = 0; while (s[n]) { @@ -1018,8 +1018,9 @@ bool js::StringEqualsAscii(JSLinearString* str, const char* asciiBytes) { } template -/* static */ bool JSFlatString::isIndexSlow(const CharT* s, size_t length, - uint32_t* indexp) { +/* static */ +bool JSFlatString::isIndexSlow(const CharT* s, size_t length, + uint32_t* indexp) { CharT ch = *s; if (!IsAsciiDigit(ch)) { @@ -1196,7 +1197,8 @@ void StaticStrings::trace(JSTracer* trc) { } template -/* static */ bool StaticStrings::isStatic(const CharT* chars, size_t length) { +/* static */ +bool StaticStrings::isStatic(const CharT* chars, size_t length) { switch (length) { case 1: { char16_t c = chars[0]; @@ -1218,7 +1220,8 @@ template } } -/* static */ bool StaticStrings::isStatic(JSAtom* atom) { +/* static */ +bool StaticStrings::isStatic(JSAtom* atom) { AutoCheckCannotGC nogc; return atom->hasLatin1Chars() ? isStatic(atom->latin1Chars(nogc), atom->length()) @@ -2017,8 +2020,8 @@ static bool FillWithRepresentatives(JSContext* cx, HandleArrayObject array, return true; } -/* static */ bool JSString::fillWithRepresentatives(JSContext* cx, - HandleArrayObject array) { +/* static */ +bool JSString::fillWithRepresentatives(JSContext* cx, HandleArrayObject array) { uint32_t index = 0; auto CheckTwoByte = [](JSString* str) { return str->hasTwoByteChars(); }; diff --git a/js/src/vm/TypeInference.cpp b/js/src/vm/TypeInference.cpp index 3624210d0df7..16ff74a28241 100644 --- a/js/src/vm/TypeInference.cpp +++ b/js/src/vm/TypeInference.cpp @@ -132,7 +132,8 @@ static UniqueChars MakeStringCopy(const char* s) { return UniqueChars(copy); } -/* static */ UniqueChars TypeSet::TypeString(const TypeSet::Type type) { +/* static */ +UniqueChars TypeSet::TypeString(const TypeSet::Type type) { if (type.isPrimitive() || type.isUnknown() || type.isAnyObject()) { return MakeStringCopy(NonObjectTypeString(type)); } @@ -151,7 +152,8 @@ static UniqueChars MakeStringCopy(const char* s) { return MakeStringCopy(buf); } -/* static */ UniqueChars TypeSet::ObjectGroupString(const ObjectGroup* group) { +/* static */ +UniqueChars TypeSet::ObjectGroupString(const ObjectGroup* group) { return TypeString(TypeSet::ObjectType(group)); } @@ -847,7 +849,8 @@ void TypeSet::print(FILE* fp) { } } -/* static */ void TypeSet::readBarrier(const TypeSet* types) { +/* static */ +void TypeSet::readBarrier(const TypeSet* types) { if (types->unknownObject()) { return; } @@ -863,7 +866,8 @@ void TypeSet::print(FILE* fp) { } } -/* static */ bool TypeSet::IsTypeMarked(JSRuntime* rt, TypeSet::Type* v) { +/* static */ +bool TypeSet::IsTypeMarked(JSRuntime* rt, TypeSet::Type* v) { bool rv; if (v->isSingletonUnchecked()) { JSObject* obj = v->singletonNoBarrier(); @@ -965,8 +969,8 @@ TemporaryTypeSet* TypeSet::cloneWithoutObjects(LifoAlloc* alloc) { return res; } -/* static */ TemporaryTypeSet* TypeSet::unionSets(TypeSet* a, TypeSet* b, - LifoAlloc* alloc) { +/* static */ +TemporaryTypeSet* TypeSet::unionSets(TypeSet* a, TypeSet* b, LifoAlloc* alloc) { TemporaryTypeSet* res = alloc->new_( a->baseFlags() | b->baseFlags(), static_cast(nullptr)); if (!res) { @@ -989,9 +993,10 @@ TemporaryTypeSet* TypeSet::cloneWithoutObjects(LifoAlloc* alloc) { return res; } -/* static */ TemporaryTypeSet* TypeSet::removeSet(TemporaryTypeSet* input, - TemporaryTypeSet* removal, - LifoAlloc* alloc) { +/* static */ +TemporaryTypeSet* TypeSet::removeSet(TemporaryTypeSet* input, + TemporaryTypeSet* removal, + LifoAlloc* alloc) { // Only allow removal of primitives and the "AnyObject" flag. MOZ_ASSERT(!removal->unknown()); MOZ_ASSERT_IF(!removal->unknownObject(), removal->getObjectCount() == 0); @@ -1019,9 +1024,10 @@ TemporaryTypeSet* TypeSet::cloneWithoutObjects(LifoAlloc* alloc) { return res; } -/* static */ TemporaryTypeSet* TypeSet::intersectSets(TemporaryTypeSet* a, - TemporaryTypeSet* b, - LifoAlloc* alloc) { +/* static */ +TemporaryTypeSet* TypeSet::intersectSets(TemporaryTypeSet* a, + TemporaryTypeSet* b, + LifoAlloc* alloc) { TemporaryTypeSet* res; res = alloc->new_(a->baseFlags() & b->baseFlags(), static_cast(nullptr)); @@ -1183,10 +1189,11 @@ CompilerConstraintList* js::NewCompilerConstraintList( return alloc.lifoAlloc()->new_(alloc); } -/* static */ bool TypeScript::FreezeTypeSets( - CompilerConstraintList* constraints, JSScript* script, - TemporaryTypeSet** pThisTypes, TemporaryTypeSet** pArgTypes, - TemporaryTypeSet** pBytecodeTypes) { +/* static */ +bool TypeScript::FreezeTypeSets(CompilerConstraintList* constraints, + JSScript* script, TemporaryTypeSet** pThisTypes, + TemporaryTypeSet** pArgTypes, + TemporaryTypeSet** pBytecodeTypes) { LifoAlloc* alloc = constraints->alloc(); AutoSweepTypeScript sweep(script); TypeScript* typeScript = script->types(); @@ -3655,8 +3662,9 @@ bool JSScript::makeTypes(JSContext* cx) { return true; } -/* static */ bool JSFunction::setTypeForScriptedFunction( - JSContext* cx, HandleFunction fun, bool singleton /* = false */) { +/* static */ +bool JSFunction::setTypeForScriptedFunction(JSContext* cx, HandleFunction fun, + bool singleton /* = false */) { if (singleton) { if (!setSingleton(cx, fun)) { return false; @@ -3758,7 +3766,8 @@ void PreliminaryObjectArrayWithTemplate::trace(JSTracer* trc) { TraceNullableEdge(trc, &shape_, "PreliminaryObjectArrayWithTemplate_shape"); } -/* static */ void PreliminaryObjectArrayWithTemplate::writeBarrierPre( +/* static */ +void PreliminaryObjectArrayWithTemplate::writeBarrierPre( PreliminaryObjectArrayWithTemplate* objects) { Shape* shape = objects->shape(); @@ -3865,8 +3874,8 @@ void PreliminaryObjectArrayWithTemplate::maybeAnalyze(JSContext* cx, // Make a TypeNewScript for |group|, and set it up to hold the preliminary // objects created with the group. -/* static */ bool TypeNewScript::make(JSContext* cx, ObjectGroup* group, - JSFunction* fun) { +/* static */ +bool TypeNewScript::make(JSContext* cx, ObjectGroup* group, JSFunction* fun) { AutoSweepObjectGroup sweep(group); MOZ_ASSERT(cx->zone()->types.activeAnalysis); MOZ_ASSERT(!group->newScript(sweep)); @@ -3902,8 +3911,10 @@ void PreliminaryObjectArrayWithTemplate::maybeAnalyze(JSContext* cx, // Make a TypeNewScript with the same initializer list as |newScript| but with // a new template object. -/* static */ TypeNewScript* TypeNewScript::makeNativeVersion( - JSContext* cx, TypeNewScript* newScript, PlainObject* templateObject) { +/* static */ +TypeNewScript* TypeNewScript::makeNativeVersion(JSContext* cx, + TypeNewScript* newScript, + PlainObject* templateObject) { MOZ_RELEASE_ASSERT(cx->zone()->types.activeAnalysis); auto nativeNewScript = cx->make_unique(); @@ -4352,7 +4363,8 @@ void TypeNewScript::trace(JSTracer* trc) { TraceNullableEdge(trc, &initializedGroup_, "TypeNewScript_initializedGroup"); } -/* static */ void TypeNewScript::writeBarrierPre(TypeNewScript* newScript) { +/* static */ +void TypeNewScript::writeBarrierPre(TypeNewScript* newScript) { if (JS::RuntimeHeapIsCollecting()) { return; } @@ -4690,8 +4702,8 @@ void ObjectGroup::sweep(const AutoSweepObjectGroup& sweep) { } } -/* static */ void TypeScript::sweepTypes(const js::AutoSweepTypeScript& sweep, - Zone* zone) { +/* static */ +void TypeScript::sweepTypes(const js::AutoSweepTypeScript& sweep, Zone* zone) { MOZ_ASSERT(typesGeneration() != zone->types.generation); setTypesGeneration(zone->types.generation); diff --git a/js/src/vm/TypedArrayObject.cpp b/js/src/vm/TypedArrayObject.cpp index 8a1f72ff85b0..4afd8b6cd878 100644 --- a/js/src/vm/TypedArrayObject.cpp +++ b/js/src/vm/TypedArrayObject.cpp @@ -67,12 +67,14 @@ using mozilla::IsAsciiDigit; * the subclasses. */ -/* static */ bool TypedArrayObject::is(HandleValue v) { +/* static */ +bool TypedArrayObject::is(HandleValue v) { return v.isObject() && v.toObject().is(); } -/* static */ bool TypedArrayObject::ensureHasBuffer( - JSContext* cx, Handle tarray) { +/* static */ +bool TypedArrayObject::ensureHasBuffer(JSContext* cx, + Handle tarray) { if (tarray->hasBuffer()) { return true; } @@ -141,8 +143,8 @@ void TypedArrayObject::finalize(FreeOp* fop, JSObject* obj) { } } -/* static */ size_t TypedArrayObject::objectMoved(JSObject* obj, - JSObject* old) { +/* static */ +size_t TypedArrayObject::objectMoved(JSObject* obj, JSObject* old) { TypedArrayObject* newObj = &obj->as(); const TypedArrayObject* oldObj = &old->as(); MOZ_ASSERT(newObj->elementsRaw() == oldObj->elementsRaw()); @@ -1435,9 +1437,10 @@ static bool GetTemplateObjectForNative(JSContext* cx, const CallArgs& args, return true; } -/* static */ bool TypedArrayObject::GetTemplateObjectForNative( - JSContext* cx, Native native, const CallArgs& args, - MutableHandleObject res) { +/* static */ +bool TypedArrayObject::GetTemplateObjectForNative(JSContext* cx, Native native, + const CallArgs& args, + MutableHandleObject res) { MOZ_ASSERT(!res); #define CHECK_TYPED_ARRAY_CONSTRUCTOR(T, N) \ if (native == &TypedArrayObjectTemplate::class_constructor) { \ @@ -1469,8 +1472,8 @@ bool BufferGetterImpl(JSContext* cx, const CallArgs& args) { return true; } -/*static*/ bool js::TypedArray_bufferGetter(JSContext* cx, unsigned argc, - Value* vp) { +/*static*/ +bool js::TypedArray_bufferGetter(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); } @@ -1550,8 +1553,8 @@ static inline bool SetFromNonTypedArray(JSContext* cx, // 22.2.3.23 %TypedArray%.prototype.set ( overloaded [ , offset ] ) // 22.2.3.23.1 %TypedArray%.prototype.set ( array [ , offset ] ) // 22.2.3.23.2 %TypedArray%.prototype.set( typedArray [ , offset ] ) -/* static */ bool TypedArrayObject::set_impl(JSContext* cx, - const CallArgs& args) { +/* static */ +bool TypedArrayObject::set_impl(JSContext* cx, const CallArgs& args) { MOZ_ASSERT(TypedArrayObject::is(args.thisv())); // Steps 1-5 (Validation performed as part of CallNonGenericMethod). @@ -1722,8 +1725,8 @@ static inline bool SetFromNonTypedArray(JSContext* cx, return true; } -/* static */ bool TypedArrayObject::set(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool TypedArrayObject::set(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod( cx, args); @@ -2032,11 +2035,13 @@ const Class TypedArrayObject::protoClasses[Scalar::MaxTypedArrayViewType] = { #undef IMPL_TYPED_ARRAY_PROTO_CLASS }; -/* static */ bool TypedArrayObject::isOriginalLengthGetter(Native native) { +/* static */ +bool TypedArrayObject::isOriginalLengthGetter(Native native) { return native == TypedArray_lengthGetter; } -/* static */ bool TypedArrayObject::isOriginalByteOffsetGetter(Native native) { +/* static */ +bool TypedArrayObject::isOriginalByteOffsetGetter(Native native) { return native == TypedArray_byteOffsetGetter; } diff --git a/js/src/vm/UnboxedObject.cpp b/js/src/vm/UnboxedObject.cpp index a40786865e4e..1b01de123c59 100644 --- a/js/src/vm/UnboxedObject.cpp +++ b/js/src/vm/UnboxedObject.cpp @@ -65,8 +65,9 @@ void UnboxedLayout::setNewScript(TypeNewScript* newScript, // be cleared. static const uintptr_t CLEAR_CONSTRUCTOR_CODE_TOKEN = 0x1; -/* static */ bool UnboxedLayout::makeConstructorCode(JSContext* cx, - HandleObjectGroup group) { +/* static */ +bool UnboxedLayout::makeConstructorCode(JSContext* cx, + HandleObjectGroup group) { gc::AutoSuppressGC suppress(cx); using namespace jit; @@ -499,7 +500,8 @@ void UnboxedPlainObject::trace(JSTracer* trc, JSObject* obj) { MOZ_ASSERT(*(list + 1) == -1); } -/* static */ UnboxedExpandoObject* UnboxedPlainObject::ensureExpando( +/* static */ +UnboxedExpandoObject* UnboxedPlainObject::ensureExpando( JSContext* cx, Handle obj) { if (obj->maybeExpando()) { return obj->maybeExpando(); @@ -590,8 +592,8 @@ static PlainObject* MakeReplacementTemplateObject(JSContext* cx, return obj; } -/* static */ bool UnboxedLayout::makeNativeGroup(JSContext* cx, - ObjectGroup* group) { +/* static */ +bool UnboxedLayout::makeNativeGroup(JSContext* cx, ObjectGroup* group) { MOZ_ASSERT(cx->realm() == group->realm()); AutoEnterAnalysis enter(cx); @@ -737,8 +739,9 @@ static PlainObject* MakeReplacementTemplateObject(JSContext* cx, return true; } -/* static */ NativeObject* UnboxedPlainObject::convertToNative(JSContext* cx, - JSObject* obj) { +/* static */ +NativeObject* UnboxedPlainObject::convertToNative(JSContext* cx, + JSObject* obj) { // This function returns the original object (instead of bool) to make sure // Ion's LConvertUnboxedObjectToNative works correctly. If we return bool // and use defineReuseInput, the object register is not preserved across the @@ -912,9 +915,11 @@ UnboxedPlainObject* UnboxedPlainObject::create(JSContext* cx, return uobj; } -/* static */ JSObject* UnboxedPlainObject::createWithProperties( - JSContext* cx, HandleObjectGroup group, NewObjectKind newKind, - IdValuePair* properties) { +/* static */ +JSObject* UnboxedPlainObject::createWithProperties(JSContext* cx, + HandleObjectGroup group, + NewObjectKind newKind, + IdValuePair* properties) { MOZ_ASSERT(newKind == GenericObject || newKind == TenuredObject); { @@ -978,7 +983,8 @@ UnboxedPlainObject* UnboxedPlainObject::create(JSContext* cx, return obj; } -/* static */ bool UnboxedPlainObject::obj_lookupProperty( +/* static */ +bool UnboxedPlainObject::obj_lookupProperty( JSContext* cx, HandleObject obj, HandleId id, MutableHandleObject objp, MutableHandle propp) { if (obj->as().containsUnboxedOrExpandoProperty(cx, id)) { @@ -997,9 +1003,11 @@ UnboxedPlainObject* UnboxedPlainObject::create(JSContext* cx, return LookupProperty(cx, proto, id, objp, propp); } -/* static */ bool UnboxedPlainObject::obj_defineProperty( - JSContext* cx, HandleObject obj, HandleId id, - Handle desc, ObjectOpResult& result) { +/* static */ +bool UnboxedPlainObject::obj_defineProperty(JSContext* cx, HandleObject obj, + HandleId id, + Handle desc, + ObjectOpResult& result) { const UnboxedLayout& layout = obj->as().layout(); if (const UnboxedLayout::Property* property = layout.lookup(id)) { @@ -1033,10 +1041,9 @@ UnboxedPlainObject* UnboxedPlainObject::create(JSContext* cx, return DefineProperty(cx, expando, id, desc, result); } -/* static */ bool UnboxedPlainObject::obj_hasProperty(JSContext* cx, - HandleObject obj, - HandleId id, - bool* foundp) { +/* static */ +bool UnboxedPlainObject::obj_hasProperty(JSContext* cx, HandleObject obj, + HandleId id, bool* foundp) { if (obj->as().containsUnboxedOrExpandoProperty(cx, id)) { *foundp = true; return true; @@ -1051,11 +1058,10 @@ UnboxedPlainObject* UnboxedPlainObject::create(JSContext* cx, return HasProperty(cx, proto, id, foundp); } -/* static */ bool UnboxedPlainObject::obj_getProperty(JSContext* cx, - HandleObject obj, - HandleValue receiver, - HandleId id, - MutableHandleValue vp) { +/* static */ +bool UnboxedPlainObject::obj_getProperty(JSContext* cx, HandleObject obj, + HandleValue receiver, HandleId id, + MutableHandleValue vp) { const UnboxedLayout& layout = obj->as().layout(); if (const UnboxedLayout::Property* property = layout.lookup(id)) { @@ -1080,9 +1086,11 @@ UnboxedPlainObject* UnboxedPlainObject::create(JSContext* cx, return GetProperty(cx, proto, receiver, id, vp); } -/* static */ bool UnboxedPlainObject::obj_setProperty( - JSContext* cx, HandleObject obj, HandleId id, HandleValue v, - HandleValue receiver, ObjectOpResult& result) { +/* static */ +bool UnboxedPlainObject::obj_setProperty(JSContext* cx, HandleObject obj, + HandleId id, HandleValue v, + HandleValue receiver, + ObjectOpResult& result) { const UnboxedLayout& layout = obj->as().layout(); if (const UnboxedLayout::Property* property = layout.lookup(id)) { @@ -1114,7 +1122,8 @@ UnboxedPlainObject* UnboxedPlainObject::create(JSContext* cx, return SetPropertyOnProto(cx, obj, id, v, receiver, result); } -/* static */ bool UnboxedPlainObject::obj_getOwnPropertyDescriptor( +/* static */ +bool UnboxedPlainObject::obj_getOwnPropertyDescriptor( JSContext* cx, HandleObject obj, HandleId id, MutableHandle desc) { const UnboxedLayout& layout = obj->as().layout(); @@ -1144,18 +1153,20 @@ UnboxedPlainObject* UnboxedPlainObject::create(JSContext* cx, return true; } -/* static */ bool UnboxedPlainObject::obj_deleteProperty( - JSContext* cx, HandleObject obj, HandleId id, ObjectOpResult& result) { +/* static */ +bool UnboxedPlainObject::obj_deleteProperty(JSContext* cx, HandleObject obj, + HandleId id, + ObjectOpResult& result) { if (!convertToNative(cx, obj)) { return false; } return DeleteProperty(cx, obj, id, result); } -/* static */ bool UnboxedPlainObject::newEnumerate(JSContext* cx, - HandleObject obj, - AutoIdVector& properties, - bool enumerableOnly) { +/* static */ +bool UnboxedPlainObject::newEnumerate(JSContext* cx, HandleObject obj, + AutoIdVector& properties, + bool enumerableOnly) { // Ignore expando properties here, they are special-cased by the property // enumeration code. diff --git a/js/src/wasm/WasmCode.cpp b/js/src/wasm/WasmCode.cpp index 835a1d4a5474..33c1b82a7f5b 100644 --- a/js/src/wasm/WasmCode.cpp +++ b/js/src/wasm/WasmCode.cpp @@ -108,8 +108,8 @@ static uint32_t RoundupCodeLength(uint32_t codeLength) { return JS_ROUNDUP(codeLength, ExecutableCodePageSize); } -/* static */ UniqueCodeBytes CodeSegment::AllocateCodeBytes( - uint32_t codeLength) { +/* static */ +UniqueCodeBytes CodeSegment::AllocateCodeBytes(uint32_t codeLength) { if (codeLength > MaxCodeBytesPerProcess) { return nullptr; } @@ -337,8 +337,9 @@ ModuleSegment::ModuleSegment(Tier tier, UniqueCodeBytes codeBytes, tier_(tier), trapCode_(base() + linkData.trapOffset) {} -/* static */ UniqueModuleSegment ModuleSegment::create( - Tier tier, MacroAssembler& masm, const LinkData& linkData) { +/* static */ +UniqueModuleSegment ModuleSegment::create(Tier tier, MacroAssembler& masm, + const LinkData& linkData) { uint32_t codeLength = masm.bytesNeeded(); UniqueCodeBytes codeBytes = AllocateCodeBytes(codeLength); @@ -353,8 +354,9 @@ ModuleSegment::ModuleSegment(Tier tier, UniqueCodeBytes codeBytes, linkData); } -/* static */ UniqueModuleSegment ModuleSegment::create( - Tier tier, const Bytes& unlinkedBytes, const LinkData& linkData) { +/* static */ +UniqueModuleSegment ModuleSegment::create(Tier tier, const Bytes& unlinkedBytes, + const LinkData& linkData) { uint32_t codeLength = unlinkedBytes.length(); UniqueCodeBytes codeBytes = AllocateCodeBytes(codeLength); diff --git a/js/src/wasm/WasmJS.cpp b/js/src/wasm/WasmJS.cpp index b28749686007..345898c9c8ba 100644 --- a/js/src/wasm/WasmJS.cpp +++ b/js/src/wasm/WasmJS.cpp @@ -674,7 +674,8 @@ const JSFunctionSpec WasmModuleObject::static_methods[] = { JSPROP_ENUMERATE), JS_FS_END}; -/* static */ void WasmModuleObject::finalize(FreeOp* fop, JSObject* obj) { +/* static */ +void WasmModuleObject::finalize(FreeOp* fop, JSObject* obj) { obj->as().module().Release(); } @@ -800,8 +801,8 @@ static JSString* UTF8CharsToString(JSContext* cx, const char* chars) { JS::ConstUTF8CharsZ(chars, strlen(chars))); } -/* static */ bool WasmModuleObject::imports(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool WasmModuleObject::imports(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); const Module* module; @@ -880,8 +881,8 @@ static JSString* UTF8CharsToString(JSContext* cx, const char* chars) { return true; } -/* static */ bool WasmModuleObject::exports(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool WasmModuleObject::exports(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); const Module* module; @@ -953,8 +954,8 @@ static JSString* UTF8CharsToString(JSContext* cx, const char* chars) { return true; } -/* static */ bool WasmModuleObject::customSections(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool WasmModuleObject::customSections(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); const Module* module; @@ -1013,9 +1014,9 @@ static JSString* UTF8CharsToString(JSContext* cx, const char* chars) { return true; } -/* static */ WasmModuleObject* WasmModuleObject::create(JSContext* cx, - const Module& module, - HandleObject proto) { +/* static */ +WasmModuleObject* WasmModuleObject::create(JSContext* cx, const Module& module, + HandleObject proto) { AutoSetNewObjectMetadata metadata(cx); auto* obj = NewObjectWithGivenProto(cx, proto); if (!obj) { @@ -1088,8 +1089,8 @@ static bool ReportCompileWarnings(JSContext* cx, return true; } -/* static */ bool WasmModuleObject::construct(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool WasmModuleObject::construct(JSContext* cx, unsigned argc, Value* vp) { CallArgs callArgs = CallArgsFromVp(argc, vp); Log(cx, "sync new Module() started"); @@ -1182,15 +1183,17 @@ static bool IsInstance(HandleValue v) { return v.isObject() && v.toObject().is(); } -/* static */ bool WasmInstanceObject::exportsGetterImpl(JSContext* cx, - const CallArgs& args) { +/* static */ +bool WasmInstanceObject::exportsGetterImpl(JSContext* cx, + const CallArgs& args) { args.rval().setObject( args.thisv().toObject().as().exportsObj()); return true; } -/* static */ bool WasmInstanceObject::exportsGetter(JSContext* cx, - unsigned argc, Value* vp) { +/* static */ +bool WasmInstanceObject::exportsGetter(JSContext* cx, unsigned argc, + Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); } @@ -1208,7 +1211,8 @@ bool WasmInstanceObject::isNewborn() const { return getReservedSlot(INSTANCE_SLOT).isUndefined(); } -/* static */ void WasmInstanceObject::finalize(FreeOp* fop, JSObject* obj) { +/* static */ +void WasmInstanceObject::finalize(FreeOp* fop, JSObject* obj) { fop->delete_(&obj->as().exports()); fop->delete_(&obj->as().scopes()); fop->delete_(&obj->as().indirectGlobals()); @@ -1217,7 +1221,8 @@ bool WasmInstanceObject::isNewborn() const { } } -/* static */ void WasmInstanceObject::trace(JSTracer* trc, JSObject* obj) { +/* static */ +void WasmInstanceObject::trace(JSTracer* trc, JSObject* obj) { WasmInstanceObject& instanceObj = obj->as(); instanceObj.exports().trace(trc); instanceObj.indirectGlobals().trace(trc); @@ -1226,7 +1231,8 @@ bool WasmInstanceObject::isNewborn() const { } } -/* static */ WasmInstanceObject* WasmInstanceObject::create( +/* static */ +WasmInstanceObject* WasmInstanceObject::create( JSContext* cx, SharedCode code, const DataSegmentVector& dataSegments, const ElemSegmentVector& elemSegments, UniqueTlsData tlsData, HandleWasmMemoryObject memory, SharedTableVector&& tables, @@ -1347,8 +1353,8 @@ static bool Instantiate(JSContext* cx, const Module& module, globalObjs.get(), instanceProto, instanceObj); } -/* static */ bool WasmInstanceObject::construct(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool WasmInstanceObject::construct(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); Log(cx, "sync new Instance() started"); @@ -1464,7 +1470,8 @@ static bool EnsureLazyEntryStub(const Instance& instance, return stubs2->createOne(funcExportIndex, codeTier); } -/* static */ bool WasmInstanceObject::getExportedFunction( +/* static */ +bool WasmInstanceObject::getExportedFunction( JSContext* cx, HandleWasmInstanceObject instanceObj, uint32_t funcIndex, MutableHandleFunction fun) { if (ExportMap::Ptr p = instanceObj->exports().lookup(funcIndex)) { @@ -1555,7 +1562,8 @@ const CodeRange& WasmInstanceObject::getExportedFunctionCodeRange( return metadata.codeRange(metadata.lookupFuncExport(funcIndex)); } -/* static */ WasmInstanceScope* WasmInstanceObject::getScope( +/* static */ +WasmInstanceScope* WasmInstanceObject::getScope( JSContext* cx, HandleWasmInstanceObject instanceObj) { if (!instanceObj->getReservedSlot(INSTANCE_SCOPE_SLOT).isUndefined()) { return (WasmInstanceScope*)instanceObj->getReservedSlot(INSTANCE_SCOPE_SLOT) @@ -1574,7 +1582,8 @@ const CodeRange& WasmInstanceObject::getExportedFunctionCodeRange( return instanceScope; } -/* static */ WasmFunctionScope* WasmInstanceObject::getFunctionScope( +/* static */ +WasmFunctionScope* WasmInstanceObject::getFunctionScope( JSContext* cx, HandleWasmInstanceObject instanceObj, uint32_t funcIndex) { if (ScopeMap::Ptr p = instanceObj->scopes().lookup(funcIndex)) { return p->value(); @@ -1656,14 +1665,16 @@ const Class WasmMemoryObject::class_ = { JSCLASS_FOREGROUND_FINALIZE, &WasmMemoryObject::classOps_}; -/* static */ void WasmMemoryObject::finalize(FreeOp* fop, JSObject* obj) { +/* static */ +void WasmMemoryObject::finalize(FreeOp* fop, JSObject* obj) { WasmMemoryObject& memory = obj->as(); if (memory.hasObservers()) { fop->delete_(&memory.observers()); } } -/* static */ WasmMemoryObject* WasmMemoryObject::create( +/* static */ +WasmMemoryObject* WasmMemoryObject::create( JSContext* cx, HandleArrayBufferObjectMaybeShared buffer, HandleObject proto) { AutoSetNewObjectMetadata metadata(cx); @@ -1677,8 +1688,8 @@ const Class WasmMemoryObject::class_ = { return obj; } -/* static */ bool WasmMemoryObject::construct(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool WasmMemoryObject::construct(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (!ThrowIfNotConstructing(cx, args, "Memory")) { @@ -1725,8 +1736,8 @@ static bool IsMemory(HandleValue v) { return v.isObject() && v.toObject().is(); } -/* static */ bool WasmMemoryObject::bufferGetterImpl(JSContext* cx, - const CallArgs& args) { +/* static */ +bool WasmMemoryObject::bufferGetterImpl(JSContext* cx, const CallArgs& args) { RootedWasmMemoryObject memoryObj( cx, &args.thisv().toObject().as()); RootedArrayBufferObjectMaybeShared buffer(cx, &memoryObj->buffer()); @@ -1758,8 +1769,8 @@ static bool IsMemory(HandleValue v) { return true; } -/* static */ bool WasmMemoryObject::bufferGetter(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool WasmMemoryObject::bufferGetter(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); } @@ -1768,8 +1779,8 @@ const JSPropertySpec WasmMemoryObject::properties[] = { JS_PSG("buffer", WasmMemoryObject::bufferGetter, JSPROP_ENUMERATE), JS_PS_END}; -/* static */ bool WasmMemoryObject::growImpl(JSContext* cx, - const CallArgs& args) { +/* static */ +bool WasmMemoryObject::growImpl(JSContext* cx, const CallArgs& args) { RootedWasmMemoryObject memory( cx, &args.thisv().toObject().as()); @@ -1794,8 +1805,8 @@ const JSPropertySpec WasmMemoryObject::properties[] = { return true; } -/* static */ bool WasmMemoryObject::grow(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool WasmMemoryObject::grow(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); } @@ -1878,8 +1889,9 @@ bool WasmMemoryObject::addMovingGrowObserver(JSContext* cx, return true; } -/* static */ uint32_t WasmMemoryObject::growShared( - HandleWasmMemoryObject memory, uint32_t delta) { +/* static */ +uint32_t WasmMemoryObject::growShared(HandleWasmMemoryObject memory, + uint32_t delta) { SharedArrayRawBuffer* rawBuf = memory->sharedArrayRawBuffer(); SharedArrayRawBuffer::Lock lock(rawBuf); @@ -1907,8 +1919,9 @@ bool WasmMemoryObject::addMovingGrowObserver(JSContext* cx, return oldNumPages; } -/* static */ uint32_t WasmMemoryObject::grow(HandleWasmMemoryObject memory, - uint32_t delta, JSContext* cx) { +/* static */ +uint32_t WasmMemoryObject::grow(HandleWasmMemoryObject memory, uint32_t delta, + JSContext* cx) { if (memory->isShared()) { return growShared(memory, delta); } @@ -2000,23 +2013,25 @@ bool WasmTableObject::isNewborn() const { return getReservedSlot(TABLE_SLOT).isUndefined(); } -/* static */ void WasmTableObject::finalize(FreeOp* fop, JSObject* obj) { +/* static */ +void WasmTableObject::finalize(FreeOp* fop, JSObject* obj) { WasmTableObject& tableObj = obj->as(); if (!tableObj.isNewborn()) { tableObj.table().Release(); } } -/* static */ void WasmTableObject::trace(JSTracer* trc, JSObject* obj) { +/* static */ +void WasmTableObject::trace(JSTracer* trc, JSObject* obj) { WasmTableObject& tableObj = obj->as(); if (!tableObj.isNewborn()) { tableObj.table().tracePrivate(trc); } } -/* static */ WasmTableObject* WasmTableObject::create(JSContext* cx, - const Limits& limits, - TableKind tableKind) { +/* static */ +WasmTableObject* WasmTableObject::create(JSContext* cx, const Limits& limits, + TableKind tableKind) { RootedObject proto(cx, &cx->global()->getPrototype(JSProto_WasmTable).toObject()); @@ -2042,8 +2057,8 @@ bool WasmTableObject::isNewborn() const { return obj; } -/* static */ bool WasmTableObject::construct(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool WasmTableObject::construct(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (!ThrowIfNotConstructing(cx, args, "Table")) { @@ -2128,15 +2143,15 @@ static bool IsTable(HandleValue v) { return v.isObject() && v.toObject().is(); } -/* static */ bool WasmTableObject::lengthGetterImpl(JSContext* cx, - const CallArgs& args) { +/* static */ +bool WasmTableObject::lengthGetterImpl(JSContext* cx, const CallArgs& args) { args.rval().setNumber( args.thisv().toObject().as().table().length()); return true; } -/* static */ bool WasmTableObject::lengthGetter(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool WasmTableObject::lengthGetter(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); } @@ -2160,8 +2175,8 @@ static bool ToTableIndex(JSContext* cx, HandleValue v, const Table& table, return true; } -/* static */ bool WasmTableObject::getImpl(JSContext* cx, - const CallArgs& args) { +/* static */ +bool WasmTableObject::getImpl(JSContext* cx, const CallArgs& args) { RootedWasmTableObject tableObj( cx, &args.thisv().toObject().as()); const Table& table = tableObj->table(); @@ -2205,8 +2220,8 @@ static bool ToTableIndex(JSContext* cx, HandleValue v, const Table& table, return true; } -/* static */ bool WasmTableObject::get(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool WasmTableObject::get(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); } @@ -2236,8 +2251,8 @@ static void TableFunctionFill(JSContext* cx, Table* table, HandleFunction value, } } -/* static */ bool WasmTableObject::setImpl(JSContext* cx, - const CallArgs& args) { +/* static */ +bool WasmTableObject::setImpl(JSContext* cx, const CallArgs& args) { RootedWasmTableObject tableObj( cx, &args.thisv().toObject().as()); Table& table = tableObj->table(); @@ -2288,14 +2303,14 @@ static void TableFunctionFill(JSContext* cx, Table* table, HandleFunction value, return true; } -/* static */ bool WasmTableObject::set(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool WasmTableObject::set(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); } -/* static */ bool WasmTableObject::growImpl(JSContext* cx, - const CallArgs& args) { +/* static */ +bool WasmTableObject::growImpl(JSContext* cx, const CallArgs& args) { RootedWasmTableObject table(cx, &args.thisv().toObject().as()); @@ -2373,8 +2388,8 @@ static void TableFunctionFill(JSContext* cx, Table* table, HandleFunction value, return true; } -/* static */ bool WasmTableObject::grow(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool WasmTableObject::grow(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); } @@ -2411,7 +2426,8 @@ const Class WasmGlobalObject::class_ = { JSCLASS_BACKGROUND_FINALIZE, &WasmGlobalObject::classOps_}; -/* static */ void WasmGlobalObject::trace(JSTracer* trc, JSObject* obj) { +/* static */ +void WasmGlobalObject::trace(JSTracer* trc, JSObject* obj) { WasmGlobalObject* global = reinterpret_cast(obj); if (global->isNewborn()) { // This can happen while we're allocating the object, in which case @@ -2442,16 +2458,17 @@ const Class WasmGlobalObject::class_ = { } } -/* static */ void WasmGlobalObject::finalize(FreeOp*, JSObject* obj) { +/* static */ +void WasmGlobalObject::finalize(FreeOp*, JSObject* obj) { WasmGlobalObject* global = reinterpret_cast(obj); if (!global->isNewborn()) { js_delete(global->cell()); } } -/* static */ WasmGlobalObject* WasmGlobalObject::create(JSContext* cx, - HandleVal hval, - bool isMutable) { +/* static */ +WasmGlobalObject* WasmGlobalObject::create(JSContext* cx, HandleVal hval, + bool isMutable) { RootedObject proto( cx, &cx->global()->getPrototype(JSProto_WasmGlobal).toObject()); @@ -2516,8 +2533,8 @@ const Class WasmGlobalObject::class_ = { return obj; } -/* static */ bool WasmGlobalObject::construct(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool WasmGlobalObject::construct(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (!ThrowIfNotConstructing(cx, args, "Global")) { @@ -2630,8 +2647,8 @@ static bool IsGlobal(HandleValue v) { return v.isObject() && v.toObject().is(); } -/* static */ bool WasmGlobalObject::valueGetterImpl(JSContext* cx, - const CallArgs& args) { +/* static */ +bool WasmGlobalObject::valueGetterImpl(JSContext* cx, const CallArgs& args) { switch (args.thisv().toObject().as().type().code()) { case ValType::I32: case ValType::F32: @@ -2651,14 +2668,14 @@ static bool IsGlobal(HandleValue v) { MOZ_CRASH(); } -/* static */ bool WasmGlobalObject::valueGetter(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool WasmGlobalObject::valueGetter(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); } -/* static */ bool WasmGlobalObject::valueSetterImpl(JSContext* cx, - const CallArgs& args) { +/* static */ +bool WasmGlobalObject::valueSetterImpl(JSContext* cx, const CallArgs& args) { if (!args.requireAtLeast(cx, "WebAssembly.Global setter", 1)) { return false; } @@ -2719,8 +2736,8 @@ static bool IsGlobal(HandleValue v) { return true; } -/* static */ bool WasmGlobalObject::valueSetter(JSContext* cx, unsigned argc, - Value* vp) { +/* static */ +bool WasmGlobalObject::valueSetter(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); } diff --git a/js/src/wasm/WasmModule.cpp b/js/src/wasm/WasmModule.cpp index 2d65051bf9a3..f1081b4627d8 100644 --- a/js/src/wasm/WasmModule.cpp +++ b/js/src/wasm/WasmModule.cpp @@ -181,7 +181,8 @@ void Module::testingBlockOnTier2Complete() const { } } -/* virtual */ size_t Module::serializedSize(const LinkData& linkData) const { +/* virtual */ +size_t Module::serializedSize(const LinkData& linkData) const { JS::BuildIdCharVector buildId; { AutoEnterOOMUnsafeRegion oom; @@ -197,8 +198,9 @@ void Module::testingBlockOnTier2Complete() const { SerializedVectorSize(customSections_) + code_->serializedSize(); } -/* virtual */ void Module::serialize(const LinkData& linkData, uint8_t* begin, - size_t size) const { +/* virtual */ +void Module::serialize(const LinkData& linkData, uint8_t* begin, + size_t size) const { MOZ_RELEASE_ASSERT(!metadata().debugEnabled); MOZ_RELEASE_ASSERT(code_->hasTier(Tier::Serialized)); @@ -222,9 +224,9 @@ void Module::testingBlockOnTier2Complete() const { MOZ_RELEASE_ASSERT(cursor == begin + size); } -/* static */ MutableModule Module::deserialize(const uint8_t* begin, - size_t size, - Metadata* maybeMetadata) { +/* static */ +MutableModule Module::deserialize(const uint8_t* begin, size_t size, + Metadata* maybeMetadata) { MutableMetadata metadata(maybeMetadata); if (!metadata) { metadata = js_new(); @@ -318,7 +320,8 @@ void Module::serialize(const LinkData& linkData, listener.storeOptimizedEncoding(bytes.begin(), bytes.length()); } -/* virtual */ JSObject* Module::createObject(JSContext* cx) { +/* virtual */ +JSObject* Module::createObject(JSContext* cx) { if (!GlobalObject::ensureConstructor(cx, cx->global(), JSProto_WebAssembly)) { return nullptr; } @@ -443,11 +446,12 @@ RefPtr wasm::DeserializeModule(PRFileDesc* bytecodeFile, return RefPtr(const_cast(module.get())); } -/* virtual */ void Module::addSizeOfMisc(MallocSizeOf mallocSizeOf, - Metadata::SeenSet* seenMetadata, - ShareableBytes::SeenSet* seenBytes, - Code::SeenSet* seenCode, size_t* code, - size_t* data) const { +/* virtual */ +void Module::addSizeOfMisc(MallocSizeOf mallocSizeOf, + Metadata::SeenSet* seenMetadata, + ShareableBytes::SeenSet* seenBytes, + Code::SeenSet* seenCode, size_t* code, + size_t* data) const { code_->addSizeOfMiscIfNotSeen(mallocSizeOf, seenMetadata, seenCode, code, data); *data += mallocSizeOf(this) + diff --git a/js/src/wasm/WasmTable.cpp b/js/src/wasm/WasmTable.cpp index f1d83c447918..36bb60866346 100644 --- a/js/src/wasm/WasmTable.cpp +++ b/js/src/wasm/WasmTable.cpp @@ -51,8 +51,9 @@ Table::Table(JSContext* cx, const TableDesc& desc, MOZ_ASSERT(kind_ == TableKind::AnyRef); } -/* static */ SharedTable Table::create(JSContext* cx, const TableDesc& desc, - HandleWasmTableObject maybeObject) { +/* static */ +SharedTable Table::create(JSContext* cx, const TableDesc& desc, + HandleWasmTableObject maybeObject) { switch (desc.kind) { case TableKind::AnyFunction: case TableKind::TypedFunction: { diff --git a/js/src/wasm/WasmTypes.cpp b/js/src/wasm/WasmTypes.cpp index 1d7c2ac5d6cb..91d65840f8f1 100644 --- a/js/src/wasm/WasmTypes.cpp +++ b/js/src/wasm/WasmTypes.cpp @@ -300,7 +300,8 @@ static unsigned EncodeImmediateType(ValType vt) { MOZ_CRASH("bad ValType"); } -/* static */ bool FuncTypeIdDesc::isGlobal(const FuncType& funcType) { +/* static */ +bool FuncTypeIdDesc::isGlobal(const FuncType& funcType) { unsigned numTypes = (funcType.ret() == ExprType::Void ? 0 : 1) + (funcType.args().length()); if (numTypes > sMaxTypes) { @@ -321,8 +322,9 @@ static unsigned EncodeImmediateType(ValType vt) { return false; } -/* static */ FuncTypeIdDesc FuncTypeIdDesc::global(const FuncType& funcType, - uint32_t globalDataOffset) { +/* static */ +FuncTypeIdDesc FuncTypeIdDesc::global(const FuncType& funcType, + uint32_t globalDataOffset) { MOZ_ASSERT(isGlobal(funcType)); return FuncTypeIdDesc(FuncTypeIdDescKind::Global, globalDataOffset); } @@ -333,8 +335,8 @@ static ImmediateType LengthToBits(uint32_t length) { return length; } -/* static */ FuncTypeIdDesc FuncTypeIdDesc::immediate( - const FuncType& funcType) { +/* static */ +FuncTypeIdDesc FuncTypeIdDesc::immediate(const FuncType& funcType) { ImmediateType immediate = ImmediateBit; uint32_t shift = sTagBits; @@ -620,7 +622,8 @@ size_t wasm::ComputeMappedSize(uint32_t maxSize) { #endif // WASM_HUGE_MEMORY -/* static */ DebugFrame* DebugFrame::from(Frame* fp) { +/* static */ +DebugFrame* DebugFrame::from(Frame* fp) { MOZ_ASSERT(fp->tls->instance->code().metadata().debugEnabled); auto* df = reinterpret_cast((uint8_t*)fp - DebugFrame::offsetOfFrame()); diff --git a/js/xpconnect/loader/ChromeScriptLoader.cpp b/js/xpconnect/loader/ChromeScriptLoader.cpp index f1190ef7b9ce..5accc44f12ee 100644 --- a/js/xpconnect/loader/ChromeScriptLoader.cpp +++ b/js/xpconnect/loader/ChromeScriptLoader.cpp @@ -249,7 +249,8 @@ AsyncScriptCompiler::OnStreamComplete(nsIIncrementalStreamLoader* aLoader, namespace mozilla { namespace dom { -/* static */ already_AddRefed ChromeUtils::CompileScript( +/* static */ +already_AddRefed ChromeUtils::CompileScript( GlobalObject& aGlobal, const nsAString& aURL, const CompileScriptOptionsDictionary& aOptions, ErrorResult& aRv) { nsCOMPtr global = do_QueryInterface(aGlobal.GetAsSupports()); diff --git a/js/xpconnect/loader/ScriptPreloader.cpp b/js/xpconnect/loader/ScriptPreloader.cpp index f8c5b7997be8..ee81be65f1f7 100644 --- a/js/xpconnect/loader/ScriptPreloader.cpp +++ b/js/xpconnect/loader/ScriptPreloader.cpp @@ -954,8 +954,9 @@ JSScript* ScriptPreloader::WaitForCachedScript(JSContext* cx, return script->GetJSScript(cx); } -/* static */ void ScriptPreloader::OffThreadDecodeCallback( - JS::OffThreadToken* token, void* context) { +/* static */ +void ScriptPreloader::OffThreadDecodeCallback(JS::OffThreadToken* token, + void* context) { auto cache = static_cast(context); cache->mMonitor.AssertNotCurrentThreadOwns(); diff --git a/js/xpconnect/loader/mozJSComponentLoader.cpp b/js/xpconnect/loader/mozJSComponentLoader.cpp index 872a5bd747e3..dd0ce289cbcf 100644 --- a/js/xpconnect/loader/mozJSComponentLoader.cpp +++ b/js/xpconnect/loader/mozJSComponentLoader.cpp @@ -1409,8 +1409,8 @@ size_t mozJSComponentLoader::ModuleEntry::SizeOfIncludingThis( return n; } -/* static */ already_AddRefed -mozJSComponentLoader::ModuleEntry::GetFactory( +/* static */ +already_AddRefed mozJSComponentLoader::ModuleEntry::GetFactory( const mozilla::Module& module, const mozilla::Module::CIDEntry& entry) { const ModuleEntry& self = static_cast(module); MOZ_ASSERT(self.getfactoryobj, "Handing out an uninitialized module?"); diff --git a/js/xpconnect/src/XPCJSContext.cpp b/js/xpconnect/src/XPCJSContext.cpp index 6cae25ff4128..b9805c707c82 100644 --- a/js/xpconnect/src/XPCJSContext.cpp +++ b/js/xpconnect/src/XPCJSContext.cpp @@ -994,7 +994,8 @@ XPCJSContext::XPCJSContext() gTlsContext.set(this); } -/* static */ XPCJSContext* XPCJSContext::Get() { return gTlsContext.get(); } +/* static */ +XPCJSContext* XPCJSContext::Get() { return gTlsContext.get(); } #ifdef XP_WIN static size_t GetWindowsStackSize() { diff --git a/js/xpconnect/src/XPCJSRuntime.cpp b/js/xpconnect/src/XPCJSRuntime.cpp index 371081db8b68..5584907ec071 100644 --- a/js/xpconnect/src/XPCJSRuntime.cpp +++ b/js/xpconnect/src/XPCJSRuntime.cpp @@ -221,8 +221,8 @@ RealmPrivate::RealmPrivate(JS::Realm* realm) : scriptability(realm) { mozilla::PodArrayZero(wrapperDenialWarnings); } -/* static */ void RealmPrivate::Init(HandleObject aGlobal, - const SiteIdentifier& aSite) { +/* static */ +void RealmPrivate::Init(HandleObject aGlobal, const SiteIdentifier& aSite) { MOZ_ASSERT(aGlobal); DebugOnly clasp = js::GetObjectClass(aGlobal); MOZ_ASSERT(clasp->flags & @@ -604,8 +604,9 @@ bool CompartmentOriginInfo::IsSameOrigin(nsIPrincipal* aOther) const { return mOrigin->FastEquals(aOther); } -/* static */ bool CompartmentOriginInfo::Subsumes(JS::Compartment* aCompA, - JS::Compartment* aCompB) { +/* static */ +bool CompartmentOriginInfo::Subsumes(JS::Compartment* aCompA, + JS::Compartment* aCompB) { CompartmentPrivate* apriv = CompartmentPrivate::Get(aCompA); CompartmentPrivate* bpriv = CompartmentPrivate::Get(aCompB); MOZ_ASSERT(apriv); @@ -613,8 +614,9 @@ bool CompartmentOriginInfo::IsSameOrigin(nsIPrincipal* aOther) const { return apriv->originInfo.mOrigin->FastSubsumes(bpriv->originInfo.mOrigin); } -/* static */ bool CompartmentOriginInfo::SubsumesIgnoringFPD( - JS::Compartment* aCompA, JS::Compartment* aCompB) { +/* static */ +bool CompartmentOriginInfo::SubsumesIgnoringFPD(JS::Compartment* aCompA, + JS::Compartment* aCompB) { CompartmentPrivate* apriv = CompartmentPrivate::Get(aCompA); CompartmentPrivate* bpriv = CompartmentPrivate::Get(aCompB); MOZ_ASSERT(apriv); @@ -815,9 +817,9 @@ void xpc_UnmarkSkippableJSHolders() { } } -/* static */ void XPCJSRuntime::GCSliceCallback(JSContext* cx, - JS::GCProgress progress, - const JS::GCDescription& desc) { +/* static */ +void XPCJSRuntime::GCSliceCallback(JSContext* cx, JS::GCProgress progress, + const JS::GCDescription& desc) { XPCJSRuntime* self = nsXPConnect::GetRuntimeInstance(); if (!self) { return; @@ -830,7 +832,8 @@ void xpc_UnmarkSkippableJSHolders() { } } -/* static */ void XPCJSRuntime::DoCycleCollectionCallback(JSContext* cx) { +/* static */ +void XPCJSRuntime::DoCycleCollectionCallback(JSContext* cx) { // The GC has detected that a CC at this point would collect a tremendous // amount of garbage that is being revivified unnecessarily. NS_DispatchToCurrentThread( @@ -854,9 +857,9 @@ void XPCJSRuntime::CustomGCCallback(JSGCStatus status) { } } -/* static */ void XPCJSRuntime::FinalizeCallback(JSFreeOp* fop, - JSFinalizeStatus status, - void* data) { +/* static */ +void XPCJSRuntime::FinalizeCallback(JSFreeOp* fop, JSFinalizeStatus status, + void* data) { XPCJSRuntime* self = nsXPConnect::GetRuntimeInstance(); if (!self) { return; @@ -959,8 +962,8 @@ void XPCJSRuntime::CustomGCCallback(JSGCStatus status) { } } -/* static */ void XPCJSRuntime::WeakPointerZonesCallback(JSContext* cx, - void* data) { +/* static */ +void XPCJSRuntime::WeakPointerZonesCallback(JSContext* cx, void* data) { // Called before each sweeping slice -- after processing any final marking // triggered by barriers -- to clear out any references to things that are // about to be finalized and update any pointers to moved GC things. @@ -972,8 +975,10 @@ void XPCJSRuntime::CustomGCCallback(JSGCStatus status) { XPCWrappedNativeScope::UpdateWeakPointersInAllScopesAfterGC(); } -/* static */ void XPCJSRuntime::WeakPointerCompartmentCallback( - JSContext* cx, JS::Compartment* comp, void* data) { +/* static */ +void XPCJSRuntime::WeakPointerCompartmentCallback(JSContext* cx, + JS::Compartment* comp, + void* data) { // Called immediately after the ZoneGroup weak pointer callback, but only // once for each compartment that is being swept. CompartmentPrivate* xpcComp = CompartmentPrivate::Get(comp); diff --git a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp index 2d816a39703f..182add5ba6e7 100644 --- a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp +++ b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp @@ -603,7 +603,8 @@ void XPC_WN_NoHelper_Finalize(js::FreeOp* fop, JSObject* obj) { * should mark any JS objects held by |wrapper| as members. */ -/* static */ void XPCWrappedNative::Trace(JSTracer* trc, JSObject* obj) { +/* static */ +void XPCWrappedNative::Trace(JSTracer* trc, JSObject* obj) { const js::Class* clazz = js::GetObjectClass(obj); if (clazz->flags & JSCLASS_DOM_GLOBAL) { mozilla::dom::TraceProtoAndIfaceCache(trc, obj); diff --git a/js/xpconnect/wrappers/WrapperFactory.cpp b/js/xpconnect/wrappers/WrapperFactory.cpp index cc97883cf151..b9a9bc9b4f66 100644 --- a/js/xpconnect/wrappers/WrapperFactory.cpp +++ b/js/xpconnect/wrappers/WrapperFactory.cpp @@ -243,13 +243,15 @@ JSObject* WrapperFactory::WaiveXray(JSContext* cx, JSObject* objArg) { return waiver; } -/* static */ bool WrapperFactory::AllowWaiver(JS::Compartment* target, - JS::Compartment* origin) { +/* static */ +bool WrapperFactory::AllowWaiver(JS::Compartment* target, + JS::Compartment* origin) { return CompartmentPrivate::Get(target)->allowWaivers && CompartmentOriginInfo::Subsumes(target, origin); } -/* static */ bool WrapperFactory::AllowWaiver(JSObject* wrapper) { +/* static */ +bool WrapperFactory::AllowWaiver(JSObject* wrapper) { MOZ_ASSERT(js::IsCrossCompartmentWrapper(wrapper)); return AllowWaiver(js::GetObjectCompartment(wrapper), js::GetObjectCompartment(js::UncheckedUnwrap(wrapper))); diff --git a/js/xpconnect/wrappers/XrayWrapper.cpp b/js/xpconnect/wrappers/XrayWrapper.cpp index 5c42b6ab4676..e3ea12082292 100644 --- a/js/xpconnect/wrappers/XrayWrapper.cpp +++ b/js/xpconnect/wrappers/XrayWrapper.cpp @@ -1476,7 +1476,8 @@ const JSClass* XrayTraits::getExpandoClass(JSContext* cx, static const size_t JSSLOT_XRAY_HOLDER = 0; -/* static */ JSObject* XrayTraits::getHolder(JSObject* wrapper) { +/* static */ +JSObject* XrayTraits::getHolder(JSObject* wrapper) { MOZ_ASSERT(WrapperFactory::IsXrayWrapper(wrapper)); js::Value v = js::GetProxyReservedSlot(wrapper, JSSLOT_XRAY_HOLDER); return v.isObject() ? &v.toObject() : nullptr;