From f5f6317d045b4340da587318966b25aa3d21539d Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Sat, 31 Aug 2013 06:19:15 -0700 Subject: [PATCH] Bug 910829 - SpiderMonkey: Put cpp-private classes in anonymous namespaces. r=waldo --- js/src/frontend/BytecodeEmitter.cpp | 4 ++ js/src/frontend/NameFunctions.cpp | 4 ++ js/src/frontend/ParseNode.cpp | 4 ++ js/src/jit/AsmJS.cpp | 8 +++- js/src/jsapi.cpp | 8 ++++ js/src/jsgc.cpp | 12 ++++++ js/src/jsinfer.cpp | 64 +++++++++++++++++++++++++++++ js/src/jsiter.cpp | 8 ++++ js/src/jsnum.cpp | 4 ++ js/src/json.cpp | 8 ++++ js/src/jsopcode.cpp | 4 ++ js/src/jsproxy.cpp | 4 ++ js/src/jsreflect.cpp | 4 ++ js/src/vm/Debugger.cpp | 4 ++ js/src/vm/OldDebugAPI.cpp | 4 ++ js/src/vm/ScopeObject.cpp | 4 ++ js/src/vm/StructuredClone.cpp | 4 ++ js/src/vm/ThreadPool.cpp | 2 +- js/src/vm/TypedArrayObject.cpp | 10 ++++- 19 files changed, 159 insertions(+), 5 deletions(-) diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp index ae1e6db268a2..bf3109cd9d0d 100644 --- a/js/src/frontend/BytecodeEmitter.cpp +++ b/js/src/frontend/BytecodeEmitter.cpp @@ -3621,6 +3621,8 @@ EmitSingletonInitialiser(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode * JS_STATIC_ASSERT(JSOP_NOP_LENGTH == 1); JS_STATIC_ASSERT(JSOP_POP_LENGTH == 1); +namespace { + class EmitLevelManager { BytecodeEmitter *bce; @@ -3629,6 +3631,8 @@ class EmitLevelManager ~EmitLevelManager() { bce->emitLevel--; } }; +} /* anonymous namespace */ + static bool EmitCatch(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) { diff --git a/js/src/frontend/NameFunctions.cpp b/js/src/frontend/NameFunctions.cpp index 100c774fac99..1258651e9ac2 100644 --- a/js/src/frontend/NameFunctions.cpp +++ b/js/src/frontend/NameFunctions.cpp @@ -20,6 +20,8 @@ using namespace js; using namespace js::frontend; +namespace { + class NameResolver { static const size_t MaxParents = 100; @@ -325,6 +327,8 @@ class NameResolver } }; +} /* anonymous namespace */ + bool frontend::NameFunctions(JSContext *cx, ParseNode *pn) { diff --git a/js/src/frontend/ParseNode.cpp b/js/src/frontend/ParseNode.cpp index 55a2c172aa78..1536a66268ad 100644 --- a/js/src/frontend/ParseNode.cpp +++ b/js/src/frontend/ParseNode.cpp @@ -70,6 +70,8 @@ ParseNodeAllocator::freeNode(ParseNode *pn) freelist = pn; } +namespace { + /* * A work pool of ParseNodes. The work pool is a stack, chained together * by nodes' pn_next fields. We use this to avoid creating deep C++ stacks @@ -104,6 +106,8 @@ class NodeStack { ParseNode *top; }; +} /* anonymous namespace */ + /* * Push the children of |pn| on |stack|. Return true if |pn| itself could be * safely recycled, or false if it must be cleaned later (pn_used and pn_defn diff --git a/js/src/jit/AsmJS.cpp b/js/src/jit/AsmJS.cpp index 33cd89ade4c5..09a072487645 100644 --- a/js/src/jit/AsmJS.cpp +++ b/js/src/jit/AsmJS.cpp @@ -623,6 +623,8 @@ operator<=(Type lhs, VarType rhs) static inline MIRType ToMIRType(MIRType t) { return t; } static inline MIRType ToMIRType(VarType t) { return t.toMIRType(); } +namespace { + template class ABIArgIter { @@ -683,6 +685,8 @@ class Signature RetType retType() const { return retType_; } }; +} /* namespace anonymous */ + static bool operator==(const Signature &lhs, const Signature &rhs) { @@ -907,11 +911,11 @@ TypedArrayStoreType(ArrayBufferView::ViewType viewType) /*****************************************************************************/ +namespace { + typedef Vector LabelVector; typedef Vector BlockVector; -namespace { - // ModuleCompiler encapsulates the compilation of an entire asm.js module. Over // the course of an ModuleCompiler object's lifetime, many FunctionCompiler // objects will be created and destroyed in sequence, one for each function in diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 631e6b44b87d..88b5aa9ad21d 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -2875,6 +2875,8 @@ JS_GetObjectId(JSContext *cx, JSObject *obj, jsid *idp) return true; } +namespace { + class AutoHoldZone { public: @@ -2895,6 +2897,8 @@ class AutoHoldZone MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER }; +} /* anonymous namespace */ + JS_PUBLIC_API(JSObject *) JS_NewGlobalObject(JSContext *cx, JSClass *clasp, JSPrincipals *principals, JS::OnNewGlobalHookOption hookOption, @@ -4713,6 +4717,8 @@ ReadCompleteFile(JSContext *cx, FILE *fp, FileContents &buffer) return true; } +namespace { + class AutoFile { FILE *fp_; @@ -4734,6 +4740,8 @@ class AutoFile } }; +} /* anonymous namespace */ + /* * Open a source file for reading. Supports "-" and NULL to mean stdin. The * return value must be fclosed unless it is stdin. diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index 1ce34ca7e465..2f1161d6097e 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -4023,6 +4023,8 @@ EndSweepPhase(JSRuntime *rt, JSGCInvocationKind gckind, bool lastGC) rt->gcLastGCTime = PRMJ_Now(); } +namespace { + /* ...while this class is to be used only for garbage collection. */ class AutoGCSession : AutoTraceSession { public: @@ -4030,6 +4032,8 @@ class AutoGCSession : AutoTraceSession { ~AutoGCSession(); }; +} /* anonymous namespace */ + /* Start a new heap session. */ AutoTraceSession::AutoTraceSession(JSRuntime *rt, js::HeapState heapState) : runtime(rt), @@ -4173,6 +4177,8 @@ ResetIncrementalGC(JSRuntime *rt, const char *reason) #endif } +namespace { + class AutoGCSlice { public: AutoGCSlice(JSRuntime *rt); @@ -4182,6 +4188,8 @@ class AutoGCSlice { JSRuntime *runtime; }; +} /* anonymous namespace */ + AutoGCSlice::AutoGCSlice(JSRuntime *rt) : runtime(rt) { @@ -4505,6 +4513,8 @@ ShouldCleanUpEverything(JSRuntime *rt, JS::gcreason::Reason reason, JSGCInvocati gckind == GC_SHRINK; } +namespace { + #ifdef JSGC_GENERATIONAL class AutoDisableStoreBuffer { @@ -4528,6 +4538,8 @@ struct AutoDisableStoreBuffer }; #endif +} /* anonymous namespace */ + static void Collect(JSRuntime *rt, bool incremental, int64_t budget, JSGCInvocationKind gckind, JS::gcreason::Reason reason) diff --git a/js/src/jsinfer.cpp b/js/src/jsinfer.cpp index c0f92d996bd3..4bc823750a28 100644 --- a/js/src/jsinfer.cpp +++ b/js/src/jsinfer.cpp @@ -568,6 +568,8 @@ TypeSet::unionSets(TypeSet *a, TypeSet *b, LifoAlloc *alloc) // TypeSet constraints ///////////////////////////////////////////////////////////////////// +namespace { + /* Standard subset constraint, propagate all types from one set to another. */ class TypeConstraintSubset : public TypeConstraint { @@ -589,6 +591,8 @@ class TypeConstraintSubset : public TypeConstraint } }; +} /* anonymous namespace */ + void StackTypeSet::addSubset(JSContext *cx, TypeSet *target) { @@ -602,6 +606,8 @@ HeapTypeSet::addSubset(JSContext *cx, TypeSet *target) add(cx, cx->typeLifoAlloc().new_(target)); } +namespace { + enum PropertyAccessKind { PROPERTY_WRITE, PROPERTY_READ, @@ -641,6 +647,8 @@ typedef TypeConstraintProp TypeConstraintSetProperty; typedef TypeConstraintProp TypeConstraintGetProperty; typedef TypeConstraintProp TypeConstraintGetPropertyExisting; +} /* anonymous namespace */ + void StackTypeSet::addGetProperty(JSContext *cx, JSScript *script, jsbytecode *pc, StackTypeSet *target, jsid id) @@ -669,6 +677,8 @@ HeapTypeSet::addGetProperty(JSContext *cx, JSScript *script, jsbytecode *pc, add(cx, cx->typeLifoAlloc().new_(script, pc, target, id)); } +namespace { + /* * Constraints for updating the 'this' types of callees on CALLPROP/CALLELEM. * These are derived from the types on the properties themselves, rather than @@ -701,6 +711,8 @@ class TypeConstraintCallProp : public TypeConstraint typedef TypeConstraintCallProp TypeConstraintCallProperty; typedef TypeConstraintCallProp TypeConstraintCallPropertyExisting; +} /* anonymous namespace */ + void HeapTypeSet::addCallProperty(JSContext *cx, JSScript *script, jsbytecode *pc, jsid id) { @@ -716,6 +728,8 @@ HeapTypeSet::addCallProperty(JSContext *cx, JSScript *script, jsbytecode *pc, js add(cx, cx->typeLifoAlloc().new_(script, callpc, id)); } +namespace { + /* * Constraints for generating 'set' property constraints on a SETELEM only if * the element type may be a number. For SETELEM we only account for integer @@ -745,6 +759,8 @@ class TypeConstraintSetElement : public TypeConstraint void newType(JSContext *cx, TypeSet *source, Type type); }; +} /* anonymous namespace */ + void StackTypeSet::addSetElement(JSContext *cx, JSScript *script, jsbytecode *pc, StackTypeSet *objectTypes, StackTypeSet *valueTypes) @@ -753,6 +769,8 @@ StackTypeSet::addSetElement(JSContext *cx, JSScript *script, jsbytecode *pc, valueTypes)); } +namespace { + /* * Constraints for watching call edges as they are discovered and invoking native * function handlers, adding constraints for arguments, receiver objects and the @@ -773,12 +791,16 @@ class TypeConstraintCall : public TypeConstraint void newType(JSContext *cx, TypeSet *source, Type type); }; +} /* anonymous namespace */ + void StackTypeSet::addCall(JSContext *cx, TypeCallsite *site) { add(cx, cx->analysisLifoAlloc().new_(site)); } +namespace { + /* Constraints for arithmetic operations. */ class TypeConstraintArith : public TypeConstraint { @@ -804,6 +826,8 @@ class TypeConstraintArith : public TypeConstraint void newType(JSContext *cx, TypeSet *source, Type type); }; +} /* anonymous namespace */ + void StackTypeSet::addArith(JSContext *cx, JSScript *script, jsbytecode *pc, TypeSet *target, TypeSet *other) @@ -811,6 +835,8 @@ StackTypeSet::addArith(JSContext *cx, JSScript *script, jsbytecode *pc, TypeSet add(cx, cx->analysisLifoAlloc().new_(script, pc, target, other)); } +namespace { + /* Subset constraint which transforms primitive values into appropriate objects. */ class TypeConstraintTransformThis : public TypeConstraint { @@ -828,12 +854,16 @@ class TypeConstraintTransformThis : public TypeConstraint void newType(JSContext *cx, TypeSet *source, Type type); }; +} /* anonymous namespace */ + void StackTypeSet::addTransformThis(JSContext *cx, JSScript *script, TypeSet *target) { add(cx, cx->analysisLifoAlloc().new_(script, target)); } +namespace { + /* * Constraint which adds a particular type to the 'this' types of all * discovered scripted functions. @@ -856,6 +886,8 @@ class TypeConstraintPropagateThis : public TypeConstraint void newType(JSContext *cx, TypeSet *source, Type type); }; +} /* anonymous namespace */ + void StackTypeSet::addPropagateThis(JSContext *cx, JSScript *script, jsbytecode *pc, Type type, StackTypeSet *types) @@ -863,6 +895,8 @@ StackTypeSet::addPropagateThis(JSContext *cx, JSScript *script, jsbytecode *pc, add(cx, cx->analysisLifoAlloc().new_(script, pc, type, types)); } +namespace { + /* Subset constraint which filters out primitive types. */ class TypeConstraintFilterPrimitive : public TypeConstraint { @@ -884,6 +918,8 @@ class TypeConstraintFilterPrimitive : public TypeConstraint } }; +} /* anonymous namespace */ + void HeapTypeSet::addFilterPrimitives(JSContext *cx, TypeSet *target) { @@ -994,6 +1030,8 @@ void ScriptAnalysis::breakTypeBarriersSSA(JSContext *cx, const SSAValue &v) breakTypeBarriers(cx, offset, true); } +namespace { + /* * Subset constraint for property reads and argument passing which can add type * barriers on the read instead of passing types along. @@ -1021,6 +1059,8 @@ class TypeConstraintSubsetBarrier : public TypeConstraint } }; +} /* anonymous namespace */ + void StackTypeSet::addSubsetBarrier(JSContext *cx, JSScript *script, jsbytecode *pc, TypeSet *target) { @@ -1634,6 +1674,8 @@ TypeConstraintTransformThis::newType(JSContext *cx, TypeSet *source, Type type) // Freeze constraints ///////////////////////////////////////////////////////////////////// +namespace { + /* Constraint which triggers recompilation of a script if any type is added to a type set. */ class TypeConstraintFreeze : public TypeConstraint { @@ -1659,6 +1701,8 @@ class TypeConstraintFreeze : public TypeConstraint } }; +} /* anonymous namespace */ + void HeapTypeSet::addFreeze(JSContext *cx) { @@ -1754,6 +1798,8 @@ StackTypeSet::mightBeType(JSValueType type) return baseFlags() & PrimitiveTypeFlag(type); } +namespace { + /* Constraint which triggers recompilation if an object acquires particular flags. */ class TypeConstraintFreezeObjectFlags : public TypeConstraint { @@ -1784,6 +1830,8 @@ class TypeConstraintFreezeObjectFlags : public TypeConstraint } }; +} /* anonymous namespace */ + bool StackTypeSet::hasObjectFlags(JSContext *cx, TypeObjectFlags flags) { @@ -1881,6 +1929,8 @@ HeapTypeSet::WatchObjectStateChange(JSContext *cx, TypeObject *obj) 0)); } +namespace { + class TypeConstraintFreezeOwnProperty : public TypeConstraint { public: @@ -1908,6 +1958,8 @@ class TypeConstraintFreezeOwnProperty : public TypeConstraint } }; +} /* anonymous namespace */ + static void CheckNewScriptProperties(JSContext *cx, HandleTypeObject type, HandleFunction fun); @@ -2217,6 +2269,8 @@ AddPendingRecompile(JSContext *cx, JSScript *script) cx->compartment()->types.addPendingRecompile(cx, script); } +namespace { + /* * As for TypeConstraintFreeze, but describes an implicit freeze constraint * added for stack types within a script. Applies to all compilations of the @@ -2243,6 +2297,8 @@ class TypeConstraintFreezeStack : public TypeConstraint } }; +} /* anonymous namespace */ + ///////////////////////////////////////////////////////////////////// // TypeCompartment ///////////////////////////////////////////////////////////////////// @@ -4745,6 +4801,8 @@ ScriptAnalysis::analyzeTypes(JSContext *cx) TypeScript::AddFreezeConstraints(cx, script_); } +namespace { + /* * Persistent constraint clearing out newScript and definite properties from * an object should a property on another object get a getter or setter. @@ -4777,6 +4835,8 @@ class TypeConstraintClearDefiniteGetterSetter : public TypeConstraint void newType(JSContext *cx, TypeSet *source, Type type) {} }; +} /* anonymous namespace */ + static bool AddClearDefiniteGetterSetterForPrototypeChain(JSContext *cx, TypeObject *type, jsid id) { @@ -4799,6 +4859,8 @@ AddClearDefiniteGetterSetterForPrototypeChain(JSContext *cx, TypeObject *type, j return true; } +namespace { + /* * Constraint which clears definite properties on an object should a type set * contain any types other than a single object. @@ -4835,6 +4897,8 @@ struct NewScriptPropertiesState {} }; +} /* anonymous namespace */ + static bool AnalyzePoppedThis(JSContext *cx, SSAUseChain *use, TypeObject *type, JSFunction *fun, NewScriptPropertiesState &state); diff --git a/js/src/jsiter.cpp b/js/src/jsiter.cpp index fa7eeeb711ea..1ead377f523f 100644 --- a/js/src/jsiter.cpp +++ b/js/src/jsiter.cpp @@ -1166,6 +1166,8 @@ SuppressDeletedPropertyHelper(JSContext *cx, HandleObject obj, StringPredicate p return true; } +namespace { + class SingleStringPredicate { Handle str; public: @@ -1175,6 +1177,8 @@ public: bool matchesAtMostOne() { return true; } }; +} /* anonymous namespace */ + bool js_SuppressDeletedProperty(JSContext *cx, HandleObject obj, jsid id) { @@ -1193,6 +1197,8 @@ js_SuppressDeletedElement(JSContext *cx, HandleObject obj, uint32_t index) return js_SuppressDeletedProperty(cx, obj, id); } +namespace { + class IndexRangePredicate { uint32_t begin, end; @@ -1207,6 +1213,8 @@ class IndexRangePredicate { bool matchesAtMostOne() { return false; } }; +} /* anonymous namespace */ + bool js_SuppressDeletedElements(JSContext *cx, HandleObject obj, uint32_t begin, uint32_t end) { diff --git a/js/src/jsnum.cpp b/js/src/jsnum.cpp index 227574b45b36..61a3dcb4d920 100644 --- a/js/src/jsnum.cpp +++ b/js/src/jsnum.cpp @@ -85,6 +85,8 @@ ComputeAccurateDecimalInteger(ThreadSafeContext *cx, return true; } +namespace { + class BinaryDigitReader { const int base; /* Base of number; must be a power of 2 */ @@ -122,6 +124,8 @@ class BinaryDigitReader } }; +} /* anonymous namespace */ + /* * The fast result might also have been inaccurate for power-of-two bases. This * happens if the addition in value * 2 + digit causes a round-down to an even diff --git a/js/src/json.cpp b/js/src/json.cpp index 176adc415b09..e5c4112a1b9a 100644 --- a/js/src/json.cpp +++ b/js/src/json.cpp @@ -115,6 +115,8 @@ Quote(JSContext *cx, StringBuffer &sb, JSString *str) return sb.append('"'); } +namespace { + class StringifyContext { public: @@ -134,6 +136,8 @@ class StringifyContext uint32_t depth; }; +} /* anonymous namespace */ + static bool Str(JSContext *cx, const Value &v, StringifyContext *scx); static bool @@ -151,6 +155,8 @@ WriteIndent(JSContext *cx, StringifyContext *scx, uint32_t limit) return true; } +namespace { + template class KeyStringifier { }; @@ -171,6 +177,8 @@ class KeyStringifier { } }; +} /* anonymous namespace */ + /* * ES5 15.12.3 Str, steps 2-4, extracted to enable preprocessing of property * values when stringifying objects in JO. diff --git a/js/src/jsopcode.cpp b/js/src/jsopcode.cpp index 8873c60741fc..be06e685a478 100644 --- a/js/src/jsopcode.cpp +++ b/js/src/jsopcode.cpp @@ -1087,6 +1087,8 @@ GetBlockChainAtPC(JSContext *cx, JSScript *script, jsbytecode *pc) return blockChain; } +namespace { + class PCStack { jsbytecode **stack; @@ -1100,6 +1102,8 @@ class PCStack jsbytecode *operator[](int i) const; }; +} /* anonymous namespace */ + PCStack::~PCStack() { js_free(stack); diff --git a/js/src/jsproxy.cpp b/js/src/jsproxy.cpp index 7a76debdfc36..f0a9df0d2d51 100644 --- a/js/src/jsproxy.cpp +++ b/js/src/jsproxy.cpp @@ -746,6 +746,8 @@ FunctionProxyObject::constructOrUndefined() const return getSlot(CONSTRUCT_SLOT); } +namespace { + /* Derived class for all scripted indirect proxy handlers. */ class ScriptedIndirectProxyHandler : public BaseProxyHandler { @@ -791,6 +793,8 @@ class ScriptedIndirectProxyHandler : public BaseProxyHandler static ScriptedIndirectProxyHandler singleton; }; +} /* anonymous namespace */ + static int sScriptedIndirectProxyHandlerFamily = 0; ScriptedIndirectProxyHandler::ScriptedIndirectProxyHandler() diff --git a/js/src/jsreflect.cpp b/js/src/jsreflect.cpp index dc33ff76f842..f69a039f4f28 100644 --- a/js/src/jsreflect.cpp +++ b/js/src/jsreflect.cpp @@ -120,6 +120,8 @@ typedef AutoValueVector NodeVector; return false; \ JS_END_MACRO +namespace { + /* * Builder class that constructs JavaScript AST node objects. See: * @@ -615,6 +617,8 @@ class NodeBuilder bool propertyPattern(HandleValue key, HandleValue patt, TokenPos *pos, MutableHandleValue dst); }; +} /* anonymous namespace */ + bool NodeBuilder::newNode(ASTType type, TokenPos *pos, MutableHandleObject dst) { diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index 62ad8986be79..bef3bcf9fa63 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -2979,6 +2979,8 @@ DebuggerScript_getOffsetLine(JSContext *cx, unsigned argc, Value *vp) return true; } +namespace { + class BytecodeRangeWithPosition : private BytecodeRange { public: @@ -3207,6 +3209,8 @@ class FlowGraphSummary { Vector entries_; }; +} /* anonymous namespace */ + static bool DebuggerScript_getAllOffsets(JSContext *cx, unsigned argc, Value *vp) { diff --git a/js/src/vm/OldDebugAPI.cpp b/js/src/vm/OldDebugAPI.cpp index 60c48d919799..b0fc2afbc93f 100644 --- a/js/src/vm/OldDebugAPI.cpp +++ b/js/src/vm/OldDebugAPI.cpp @@ -1004,6 +1004,8 @@ JS::FreeStackDescription(JSContext *cx, JS::StackDescription *desc) js_delete(desc); } +namespace { + class AutoPropertyDescArray { JSContext *cx_; @@ -1032,6 +1034,8 @@ class AutoPropertyDescArray } }; +} /* anonymous namespace */ + static const char * FormatValue(JSContext *cx, const Value &vArg, JSAutoByteString &bytes) { diff --git a/js/src/vm/ScopeObject.cpp b/js/src/vm/ScopeObject.cpp index 0d5f6f5d1bc4..bfcc5160d9a2 100644 --- a/js/src/vm/ScopeObject.cpp +++ b/js/src/vm/ScopeObject.cpp @@ -1138,6 +1138,8 @@ ScopeIterKey::match(ScopeIterKey si1, ScopeIterKey si2) /*****************************************************************************/ +namespace { + /* * DebugScopeProxy is the handler for DebugScopeObject proxy objects. Having a * custom handler (rather than trying to reuse js::Wrapper) gives us several @@ -1532,6 +1534,8 @@ class DebugScopeProxy : public BaseProxyHandler } }; +} /* anonymous namespace */ + int DebugScopeProxy::family = 0; DebugScopeProxy DebugScopeProxy::singleton; diff --git a/js/src/vm/StructuredClone.cpp b/js/src/vm/StructuredClone.cpp index fc7b84fbf1fc..76d48610f38e 100644 --- a/js/src/vm/StructuredClone.cpp +++ b/js/src/vm/StructuredClone.cpp @@ -966,6 +966,8 @@ JSStructuredCloneReader::checkDouble(double d) return true; } +namespace { + class Chars { JSContext *cx; jschar *p; @@ -987,6 +989,8 @@ class Chars { void forget() { p = NULL; } }; +} /* anonymous namespace */ + JSString * JSStructuredCloneReader::readString(uint32_t nchars) { diff --git a/js/src/vm/ThreadPool.cpp b/js/src/vm/ThreadPool.cpp index 15fa806a5fe0..07d4a5c3b4e2 100644 --- a/js/src/vm/ThreadPool.cpp +++ b/js/src/vm/ThreadPool.cpp @@ -24,7 +24,7 @@ using namespace js; // Once the worker's state is set to |TERMINATING|, the worker will // exit as soon as its queue is empty. -const size_t WORKER_THREAD_STACK_SIZE = 1*1024*1024; +static const size_t WORKER_THREAD_STACK_SIZE = 1*1024*1024; class js::ThreadPoolWorker : public Monitor { diff --git a/js/src/vm/TypedArrayObject.cpp b/js/src/vm/TypedArrayObject.cpp index 85d804480979..7067d2268ec2 100644 --- a/js/src/vm/TypedArrayObject.cpp +++ b/js/src/vm/TypedArrayObject.cpp @@ -1407,8 +1407,6 @@ template<> inline const bool ElementTypeMayBeDouble() { return true; } template<> inline const bool ElementTypeMayBeDouble() { return true; } template<> inline const bool ElementTypeMayBeDouble() { return true; } -template class TypedArrayObjectTemplate; - template static inline JSObject * NewArray(JSContext *cx, uint32_t nelements); @@ -1425,6 +1423,8 @@ InitArrayBufferViewDataPointer(JSObject *obj, ArrayBufferObject *buffer, size_t PostBarrierTypedArrayObject(obj); } +namespace { + template class TypedArrayObjectTemplate : public TypedArrayObject { @@ -2619,6 +2619,8 @@ class Uint8ClampedArrayObject : public TypedArrayObjectTemplate { static const JSFunctionSpec jsfuncs[]; }; +} /* anonymous namespace */ + template bool ArrayBufferObject::createTypedArrayFromBufferImpl(JSContext *cx, CallArgs args) @@ -2682,6 +2684,8 @@ TypedArrayObjectTemplate::copyIndexToValue(JSObject *tarray, uint32_ vp.setInt32(getIndex(tarray, index)); } +namespace { + // and we need to specialize for 32-bit integers and floats template<> void @@ -2739,6 +2743,8 @@ TypedArrayObjectTemplate::copyIndexToValue(JSObject *tarray, uint32_t in vp.setDouble(JS_CANONICALIZE_NAN(val)); } +} /* anonymous namespace */ + static NewObjectKind DataViewNewObjectKind(JSContext *cx, uint32_t byteLength, JSObject *proto) {