Skip to content

Commit

Permalink
Bug 1603845 - Fix clang-format issues in js/ r=iain
Browse files Browse the repository at this point in the history
Differential Revision: https://phabricator.services.mozilla.com/D57163

--HG--
extra : moz-landing-system : lando
  • Loading branch information
moztcampbell committed Dec 13, 2019
1 parent e571733 commit 736ef5b
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 40 deletions.
3 changes: 2 additions & 1 deletion js/public/ContextOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ class JS_PUBLIC_API ContextOptions {
werror_(false),
strictMode_(false),
extraWarnings_(false),
fuzzing_(false) {}
fuzzing_(false) {
}

bool asmJS() const { return asmJS_; }
ContextOptions& setAsmJS(bool flag) {
Expand Down
2 changes: 1 addition & 1 deletion js/public/TracingAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ inline void TraceEdge(JSTracer* trc, JS::TenuredHeap<T>* thingp,
//
// Note that while |edgep| must never be null, it is fine for |*edgep| to be
// nullptr.
#define JS_DECLARE_UNSAFE_TRACE_ROOT(type) \
#define JS_DECLARE_UNSAFE_TRACE_ROOT(type) \
extern JS_PUBLIC_API void UnsafeTraceRoot(JSTracer* trc, type* edgep, \
const char* name);

Expand Down
6 changes: 3 additions & 3 deletions js/public/ValueArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

#include <stdint.h> // size_t

#include "js/CallArgs.h" // JS::CallArgs
#include "js/GCVector.h" // JS::RootedVector
#include "js/CallArgs.h" // JS::CallArgs
#include "js/GCVector.h" // JS::RootedVector
#include "js/RootingAPI.h" // JS::AutoGCRooter, JS::{,Mutable}Handle
#include "js/Value.h" // JS::Value
#include "js/Value.h" // JS::Value

namespace JS {

Expand Down
1 change: 0 additions & 1 deletion js/src/builtin/FinalizationGroupObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ class FinalizationRecordVectorObject : public NativeObject {
enum { RecordsSlot = 0, SlotCount };

public:

static const JSClass class_;

static FinalizationRecordVectorObject* create(JSContext* cx);
Expand Down
2 changes: 1 addition & 1 deletion js/src/builtin/Stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "builtin/streams/ReadableStreamDefaultControllerOperations.h" // js::ReadableStreamControllerClearAlgorithms
#include "builtin/streams/ReadableStreamInternals.h" // js::ReadableStream{AddReadOrReadIntoRequest,CloseInternal,CreateReadResult,ErrorInternal,FulfillReadOrReadIntoRequest,GetNumReadRequests,HasDefaultReader}
#include "builtin/streams/ReadableStreamReader.h" // js::ReadableStream{,Default}Reader, js::CreateReadableStreamDefaultReader, js::ReadableStreamReaderGeneric{Cancel,Initialize,Release}, js::ReadableStreamDefaultReaderRead
#include "js/ArrayBuffer.h" // JS::NewArrayBuffer
#include "js/ArrayBuffer.h" // JS::NewArrayBuffer
#include "js/PropertySpec.h"
#include "vm/Interpreter.h"
#include "vm/JSContext.h"
Expand Down
24 changes: 13 additions & 11 deletions js/src/builtin/WeakRefObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,19 @@ void WeakRefObject::finalize(JSFreeOp* fop, JSObject* obj) {
gc->unregisterWeakRef(cx, target, weakRef);
}

const JSClassOps WeakRefObject::classOps_ = {nullptr, /* addProperty */
nullptr, /* delProperty */
nullptr, /* enumerate */
nullptr, /* newEnumerate */
nullptr, /* resolve */
nullptr, /* mayResolve */
finalize,
nullptr, /* call */
nullptr, /* hasInstance */
nullptr, /* construct */
trace};
const JSClassOps WeakRefObject::classOps_ = {
nullptr, /* addProperty */
nullptr, /* delProperty */
nullptr, /* enumerate */
nullptr, /* newEnumerate */
nullptr, /* resolve */
nullptr, /* mayResolve */
finalize, /* finalize */
nullptr, /* call */
nullptr, /* hasInstance */
nullptr, /* construct */
trace /* trace */
};

const ClassSpec WeakRefObject::classSpec_ = {
GenericCreateConstructor<WeakRefObject::construct, 0,
Expand Down
4 changes: 2 additions & 2 deletions js/src/builtin/streams/ReadableStreamDefaultController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
#include "builtin/streams/ReadableStreamReader.h" // js::ReadableStream{,Default}Reader
#include "builtin/streams/StreamController.h" // js::StreamController
#include "builtin/streams/TeeState.h" // js::TeeState
#include "js/ArrayBuffer.h" // JS::NewArrayBuffer
#include "js/Class.h" // js::ClassSpec
#include "js/ArrayBuffer.h" // JS::NewArrayBuffer
#include "js/Class.h" // js::ClassSpec
#include "js/PropertySpec.h"
#include "vm/Interpreter.h"
#include "vm/JSContext.h"
Expand Down
24 changes: 12 additions & 12 deletions js/src/frontend/TokenStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,14 +711,14 @@ static MOZ_ALWAYS_INLINE void RetractPointerToCodePointBoundary(
}

// Otherwise rewind past trailing units to the start of the code point.
# ifdef DEBUG
#ifdef DEBUG
size_t retracted = 0;
# endif
#endif
while (MOZ_UNLIKELY(IsTrailingUnit((*ptr)[0]))) {
--*ptr;
# ifdef DEBUG
#ifdef DEBUG
retracted++;
# endif
#endif
}

MOZ_ASSERT(retracted < 4,
Expand Down Expand Up @@ -848,9 +848,9 @@ uint32_t TokenStreamAnyChars::computePartialColumn(
const Unit* const limit = sourceUnits.codeUnitPtrAt(offset);

auto RetractedOffsetOfChunk = [
# ifdef DEBUG
#ifdef DEBUG
this,
# endif
#endif
start, limit,
&sourceUnits](uint32_t index) {
MOZ_ASSERT(index < this->lastChunkVectorForLine_->length());
Expand All @@ -861,12 +861,12 @@ uint32_t TokenStreamAnyChars::computePartialColumn(
const Unit* actualPtr = naivePtr;
RetractPointerToCodePointBoundary(&actualPtr, limit);

# ifdef DEBUG
#ifdef DEBUG
if ((*this->lastChunkVectorForLine_)[index].unitsType() ==
UnitsType::GuaranteedSingleUnit) {
MOZ_ASSERT(naivePtr == actualPtr, "miscomputed unitsType value");
}
# endif
#endif

return naiveOffset - PointerRangeSize(actualPtr, naivePtr);
};
Expand Down Expand Up @@ -928,10 +928,10 @@ uint32_t TokenStreamAnyChars::computePartialColumn(
MOZ_ASSERT(begin < chunkLimit);
MOZ_ASSERT(chunkLimit <= limit);

static_assert(ColumnChunkLength >
SourceUnitTraits<Unit>::maxUnitsLength - 1,
"any retraction below is assumed to never underflow to the "
"preceding chunk, even for the longest code point");
static_assert(
ColumnChunkLength > SourceUnitTraits<Unit>::maxUnitsLength - 1,
"any retraction below is assumed to never underflow to the "
"preceding chunk, even for the longest code point");

// Prior tokenizing ensured that [begin, limit) is validly encoded, and
// |begin < chunkLimit|, so any retraction here can't underflow.
Expand Down
9 changes: 5 additions & 4 deletions js/src/gc/Marking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,10 +468,10 @@ DEFINE_TRACE_EXTERNAL_EDGE_FUNCTION(SavedFrame*)

#undef DEFINE_TRACE_EXTERNAL_EDGE_FUNCTION

#define DEFINE_UNSAFE_TRACE_ROOT_FUNCTION(type) \
#define DEFINE_UNSAFE_TRACE_ROOT_FUNCTION(type) \
JS_PUBLIC_API void JS::UnsafeTraceRoot(JSTracer* trc, type* thingp, \
const char* name) { \
UnsafeTraceRootHelper(trc, thingp, name); \
const char* name) { \
UnsafeTraceRootHelper(trc, thingp, name); \
}

// Define UnsafeTraceRoot for each public GC pointer type.
Expand Down Expand Up @@ -2622,7 +2622,8 @@ void GCMarker::enterWeakMarkingMode() {
for (SweepGroupZonesIter zone(runtime()); !zone.done(); zone.next()) {
for (auto r = zone->gcWeakKeys().all(); !r.empty(); r.popFront()) {
for (auto markable : r.front().value) {
MOZ_ASSERT(markable.weakmap->mapColor, "unmarked weakmaps in weak keys table");
MOZ_ASSERT(markable.weakmap->mapColor,
"unmarked weakmaps in weak keys table");
}
}
}
Expand Down
6 changes: 2 additions & 4 deletions js/src/gc/Verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,8 +549,7 @@ void js::gc::MarkingValidator::nonIncrementalMark(AutoGCSession& session) {
AutoEnterOOMUnsafeRegion oomUnsafe;
for (gc::WeakKeyTable::Range r = zone->gcWeakKeys().all(); !r.empty();
r.popFront()) {
if (!savedWeakKeys.put(r.front().key,
std::move(r.front().value))) {
if (!savedWeakKeys.put(r.front().key, std::move(r.front().value))) {
oomUnsafe.crash("saving weak keys table for validator");
}
}
Expand Down Expand Up @@ -651,8 +650,7 @@ void js::gc::MarkingValidator::nonIncrementalMark(AutoGCSession& session) {
r.popFront()) {
AutoEnterOOMUnsafeRegion oomUnsafe;
Zone* zone = gc::TenuredCell::fromPointer(r.front().key)->zone();
if (!zone->gcWeakKeys().put(r.front().key,
std::move(r.front().value))) {
if (!zone->gcWeakKeys().put(r.front().key, std::move(r.front().value))) {
oomUnsafe.crash("restoring weak keys table for validator");
}
}
Expand Down

0 comments on commit 736ef5b

Please sign in to comment.