Bug 812314 part 1 - Use fewer namespace js {...} blocks in .cpp files in js/src, js/src/builtin, js/src/vm. r=luke.

--HG--
rename : browser/components/privatebrowsing/test/browser/perwindow/browser_privatebrowsing_localStorage_before_after.js => browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_localStorage_before_after.js
rename : browser/components/privatebrowsing/test/browser/perwindow/browser_privatebrowsing_localStorage_before_after_page.html => browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_localStorage_before_after_page.html
rename : browser/components/privatebrowsing/test/browser/perwindow/browser_privatebrowsing_localStorage_before_after_page2.html => browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_localStorage_before_after_page2.html
rename : browser/components/privatebrowsing/test/browser/perwindow/browser_privatebrowsing_placestitle.js => browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_placestitle.js
rename : browser/components/privatebrowsing/test/browser/perwindow/title.sjs => browser/components/privatebrowsing/test/browser/global/title.sjs
extra : rebase_source : d1d1c39b490ae33fb9e8417ed72c2b77ee631416
This commit is contained in:
Jason Orendorff 2012-11-16 15:59:26 -06:00
Родитель 2b007959af
Коммит f6e498e705
45 изменённых файлов: 305 добавлений и 592 удалений

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

@ -12,6 +12,8 @@
#include <string.h>
#include <stdint.h>
using namespace js;
#ifndef TRACE_LOG_DIR
# if defined(_WIN32)
# define TRACE_LOG_DIR ""
@ -20,11 +22,9 @@
# endif
#endif
namespace js {
#if defined(__i386__)
static __inline__ uint64_t
rdtsc(void)
js::rdtsc(void)
{
uint64_t x;
__asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
@ -32,7 +32,7 @@ rdtsc(void)
}
#elif defined(__x86_64__)
static __inline__ uint64_t
rdtsc(void)
js::rdtsc(void)
{
unsigned hi, lo;
__asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
@ -40,7 +40,7 @@ rdtsc(void)
}
#elif defined(__powerpc__)
static __inline__ uint64_t
rdtsc(void)
js::rdtsc(void)
{
uint64_t result=0;
uint32_t upper, lower,tmp;
@ -242,19 +242,19 @@ TraceLogging::releaseDefaultLogger()
/* Helper functions for asm calls */
void
TraceLog(TraceLogging* logger, TraceLogging::Type type, JSScript* script)
js::TraceLog(TraceLogging* logger, TraceLogging::Type type, JSScript* script)
{
logger->log(type, script);
}
void
TraceLog(TraceLogging* logger, const char* log)
js::TraceLog(TraceLogging* logger, const char* log)
{
logger->log(log);
}
void
TraceLog(TraceLogging* logger, TraceLogging::Type type)
js::TraceLog(TraceLogging* logger, TraceLogging::Type type)
{
logger->log(type);
}
} /* namespace js */

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

@ -14,6 +14,7 @@
#include "jsprf.h"
#include "jswrapper.h"
#include "builtin/TestingFunctions.h"
#include "methodjit/MethodJIT.h"
#include "vm/Stack-inl.h"
@ -925,12 +926,8 @@ static JSFunctionSpecWithHelp TestingFunctions[] = {
JS_FS_HELP_END
};
namespace js {
bool
DefineTestingFunctions(JSContext *cx, HandleObject obj)
js::DefineTestingFunctions(JSContext *cx, HandleObject obj)
{
return JS_DefineFunctionsWithHelp(cx, obj, TestingFunctions);
}
} /* namespace js */

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

@ -8,7 +8,7 @@
#include "jsalloc.h"
#include "jscntxt.h"
namespace js {
using namespace js;
void *
TempAllocPolicy::onOutOfMemory(void *p, size_t nbytes)
@ -21,5 +21,3 @@ TempAllocPolicy::reportAllocOverflow() const
{
js_ReportAllocationOverflow(cx);
}
} /* namespace js */

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

@ -13,9 +13,8 @@
#include "jsobjinlines.h"
using mozilla::DebugOnly;
namespace js {
namespace analyze {
using namespace js;
using namespace js::analyze;
/////////////////////////////////////////////////////////////////////
// Bytecode
@ -23,7 +22,7 @@ namespace analyze {
#ifdef DEBUG
void
PrintBytecode(JSContext *cx, JSScript *scriptArg, jsbytecode *pc)
analyze::PrintBytecode(JSContext *cx, JSScript *scriptArg, jsbytecode *pc)
{
RootedScript script(cx, scriptArg);
@ -36,7 +35,7 @@ PrintBytecode(JSContext *cx, JSScript *scriptArg, jsbytecode *pc)
}
#endif
inline bool
static inline bool
IsJumpOpcode(JSOp op)
{
uint32_t type = JOF_TYPE(js_CodeSpec[op].format);
@ -2129,6 +2128,3 @@ ScriptAnalysis::assertMatchingDebugMode()
}
#endif /* DEBUG */
} /* namespace analyze */
} /* namespace js */

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

@ -680,49 +680,43 @@ static JSBool js_NewRuntimeWasCalled = JS_FALSE;
/*
* Thread Local Storage slot for storing the runtime for a thread.
*/
namespace js {
mozilla::ThreadLocal<PerThreadData *> TlsPerThreadData;
}
namespace JS {
mozilla::ThreadLocal<PerThreadData *> js::TlsPerThreadData;
#ifdef DEBUG
JS_FRIEND_API(void)
EnterAssertNoGCScope()
JS::EnterAssertNoGCScope()
{
++TlsPerThreadData.get()->gcAssertNoGCDepth;
}
JS_FRIEND_API(void)
LeaveAssertNoGCScope()
JS::LeaveAssertNoGCScope()
{
--TlsPerThreadData.get()->gcAssertNoGCDepth;
JS_ASSERT(TlsPerThreadData.get()->gcAssertNoGCDepth >= 0);
}
JS_FRIEND_API(bool)
InNoGCScope()
JS::InNoGCScope()
{
return TlsPerThreadData.get()->gcAssertNoGCDepth > 0;
}
JS_FRIEND_API(bool)
NeedRelaxedRootChecks()
JS::NeedRelaxedRootChecks()
{
return TlsPerThreadData.get()->gcRelaxRootChecks;
}
#else
JS_FRIEND_API(void) EnterAssertNoGCScope() {}
JS_FRIEND_API(void) LeaveAssertNoGCScope() {}
JS_FRIEND_API(bool) InNoGCScope() { return false; }
JS_FRIEND_API(bool) NeedRelaxedRootChecks() { return false; }
JS_FRIEND_API(void) JS::EnterAssertNoGCScope() {}
JS_FRIEND_API(void) JS::LeaveAssertNoGCScope() {}
JS_FRIEND_API(bool) JS::InNoGCScope() { return false; }
JS_FRIEND_API(bool) JS::NeedRelaxedRootChecks() { return false; }
#endif
} /* namespace JS */
static const JSSecurityCallbacks NullSecurityCallbacks = { };
js::PerThreadData::PerThreadData(JSRuntime *runtime)
PerThreadData::PerThreadData(JSRuntime *runtime)
: runtime_(runtime)
#ifdef DEBUG
, gcRelaxRootChecks(false)
@ -5770,10 +5764,8 @@ JS_CallFunctionValue(JSContext *cx, JSObject *objArg, jsval fval, unsigned argc,
return Invoke(cx, ObjectOrNullValue(obj), fval, argc, argv, rval);
}
namespace JS {
JS_PUBLIC_API(bool)
Call(JSContext *cx, jsval thisv, jsval fval, unsigned argc, jsval *argv, jsval *rval)
JS::Call(JSContext *cx, jsval thisv, jsval fval, unsigned argc, jsval *argv, jsval *rval)
{
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
@ -5783,8 +5775,6 @@ Call(JSContext *cx, jsval thisv, jsval fval, unsigned argc, jsval *argv, jsval *
return Invoke(cx, thisv, fval, argc, argv, rval);
}
} // namespace JS
JS_PUBLIC_API(JSObject *)
JS_New(JSContext *cx, JSObject *ctorArg, unsigned argc, jsval *argv)
{
@ -7106,8 +7096,6 @@ JS_CallOnce(JSCallOnceType *once, JSInitCallback func)
#endif
}
namespace JS {
AutoGCRooter::AutoGCRooter(JSContext *cx, ptrdiff_t tag)
: down(cx->runtime->autoGCRooters), tag(tag), stackTop(&cx->runtime->autoGCRooters)
{
@ -7117,7 +7105,7 @@ AutoGCRooter::AutoGCRooter(JSContext *cx, ptrdiff_t tag)
#ifdef DEBUG
JS_PUBLIC_API(void)
AssertArgumentsAreSane(JSContext *cx, const JS::Value &value)
JS::AssertArgumentsAreSane(JSContext *cx, const JS::Value &value)
{
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
@ -7125,8 +7113,6 @@ AssertArgumentsAreSane(JSContext *cx, const JS::Value &value)
}
#endif /* DEBUG */
} // namespace JS
JS_PUBLIC_API(void *)
JS_EncodeScript(JSContext *cx, JSRawScript scriptArg, uint32_t *lengthp)
{

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

@ -120,10 +120,8 @@ using mozilla::ArrayLength;
using mozilla::DebugOnly;
using mozilla::PointerRangeSize;
namespace js {
JSBool
GetLengthProperty(JSContext *cx, HandleObject obj, uint32_t *lengthp)
js::GetLengthProperty(JSContext *cx, HandleObject obj, uint32_t *lengthp)
{
if (obj->isArray()) {
*lengthp = obj->getArrayLength();
@ -170,7 +168,7 @@ GetLengthProperty(JSContext *cx, HandleObject obj, uint32_t *lengthp)
*
*/
JS_FRIEND_API(bool)
StringIsArrayIndex(JSLinearString *str, uint32_t *indexp)
js::StringIsArrayIndex(JSLinearString *str, uint32_t *indexp)
{
const jschar *s = str->chars();
uint32_t length = str->length();
@ -207,7 +205,7 @@ StringIsArrayIndex(JSLinearString *str, uint32_t *indexp)
}
Shape *
GetDenseArrayShape(JSContext *cx, HandleObject globalObj)
js::GetDenseArrayShape(JSContext *cx, HandleObject globalObj)
{
JS_ASSERT(globalObj);
@ -219,8 +217,6 @@ GetDenseArrayShape(JSContext *cx, HandleObject globalObj)
gc::FINALIZE_OBJECT0);
}
}
bool
JSObject::willBeSparseDenseArray(unsigned requiredCapacity, unsigned newElementsHint)
{
@ -364,8 +360,6 @@ GetElement(JSContext *cx, HandleObject obj, IndexType index, JSBool *hole, Mutab
return DoGetElement(cx, obj, index, hole, vp);
}
namespace js {
static bool
GetElementsSlow(JSContext *cx, HandleObject aobj, uint32_t length, Value *vp)
{
@ -378,7 +372,7 @@ GetElementsSlow(JSContext *cx, HandleObject aobj, uint32_t length, Value *vp)
}
bool
GetElements(JSContext *cx, HandleObject aobj, uint32_t length, Value *vp)
js::GetElements(JSContext *cx, HandleObject aobj, uint32_t length, Value *vp)
{
if (aobj->isDenseArray() && length <= aobj->getDenseArrayInitializedLength() &&
!js_PrototypeHasIndexedProperties(aobj)) {
@ -402,8 +396,6 @@ GetElements(JSContext *cx, HandleObject aobj, uint32_t length, Value *vp)
return GetElementsSlow(cx, aobj, length, vp);
}
}
/*
* Set the value of the property at the given index to v assuming v is rooted.
*/
@ -984,12 +976,10 @@ array_defineProperty(JSContext *cx, HandleObject obj, HandlePropertyName name, H
return array_defineGeneric(cx, obj, id, value, getter, setter, attrs);
}
namespace js {
/* non-static for direct definition of array elements within the engine */
JSBool
array_defineElement(JSContext *cx, HandleObject obj, uint32_t index, HandleValue value,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
js::array_defineElement(JSContext *cx, HandleObject obj, uint32_t index, HandleValue value,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
{
if (!obj->isDenseArray())
return baseops::DefineElement(cx, obj, index, value, getter, setter, attrs);
@ -1023,8 +1013,6 @@ array_defineElement(JSContext *cx, HandleObject obj, uint32_t index, HandleValue
return baseops::DefineElement(cx, obj, index, value, getter, setter, attrs);
}
} // namespace js
static JSBool
array_defineSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid, HandleValue value,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
@ -1108,12 +1096,10 @@ array_deleteProperty(JSContext *cx, HandleObject obj, HandlePropertyName name,
return true;
}
namespace js {
/* non-static for direct deletion of array elements within the engine */
JSBool
array_deleteElement(JSContext *cx, HandleObject obj, uint32_t index,
MutableHandleValue rval, JSBool strict)
js::array_deleteElement(JSContext *cx, HandleObject obj, uint32_t index, MutableHandleValue rval,
JSBool strict)
{
if (!obj->isDenseArray())
return baseops::DeleteElement(cx, obj, index, rval, strict);
@ -1130,8 +1116,6 @@ array_deleteElement(JSContext *cx, HandleObject obj, uint32_t index,
return true;
}
} // namespace js
static JSBool
array_deleteSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid,
MutableHandleValue rval, JSBool strict)
@ -3615,7 +3599,6 @@ js_InitArrayClass(JSContext *cx, HandleObject obj)
/*
* Array allocation functions.
*/
namespace js {
static inline bool
EnsureNewArrayElements(JSContext *cx, JSObject *obj, uint32_t length)
@ -3692,19 +3675,19 @@ NewArray(JSContext *cx, uint32_t length, RawObject protoArg)
}
JSObject * JS_FASTCALL
NewDenseEmptyArray(JSContext *cx, RawObject proto /* = NULL */)
js::NewDenseEmptyArray(JSContext *cx, RawObject proto /* = NULL */)
{
return NewArray<false>(cx, 0, proto);
}
JSObject * JS_FASTCALL
NewDenseAllocatedArray(JSContext *cx, uint32_t length, RawObject proto /* = NULL */)
js::NewDenseAllocatedArray(JSContext *cx, uint32_t length, RawObject proto /* = NULL */)
{
return NewArray<true>(cx, length, proto);
}
JSObject * JS_FASTCALL
NewDenseUnallocatedArray(JSContext *cx, uint32_t length, RawObject proto /* = NULL */)
js::NewDenseUnallocatedArray(JSContext *cx, uint32_t length, RawObject proto /* = NULL */)
{
return NewArray<false>(cx, length, proto);
}
@ -3722,7 +3705,8 @@ mjit::stubs::NewDenseUnallocatedArray(VMFrame &f, uint32_t length)
#endif
JSObject *
NewDenseCopiedArray(JSContext *cx, uint32_t length, HandleObject src, uint32_t elementOffset, RawObject proto /* = NULL */)
js::NewDenseCopiedArray(JSContext *cx, uint32_t length, HandleObject src, uint32_t elementOffset,
RawObject proto /* = NULL */)
{
JSObject* obj = NewArray<true>(cx, length, proto);
if (!obj)
@ -3741,7 +3725,8 @@ NewDenseCopiedArray(JSContext *cx, uint32_t length, HandleObject src, uint32_t e
// values must point at already-rooted Value objects
JSObject *
NewDenseCopiedArray(JSContext *cx, uint32_t length, const Value *values, RawObject proto /* = NULL */)
js::NewDenseCopiedArray(JSContext *cx, uint32_t length, const Value *values,
RawObject proto /* = NULL */)
{
JSObject* obj = NewArray<true>(cx, length, proto);
if (!obj)
@ -3758,7 +3743,7 @@ NewDenseCopiedArray(JSContext *cx, uint32_t length, const Value *values, RawObje
}
JSObject *
NewSlowEmptyArray(JSContext *cx)
js::NewSlowEmptyArray(JSContext *cx)
{
RootedObject obj(cx, NewBuiltinClassInstance(cx, &SlowArrayClass));
if (!obj || !AddLengthProperty(cx, obj))
@ -3768,8 +3753,6 @@ NewSlowEmptyArray(JSContext *cx)
return obj;
}
} // namespace js
#ifdef DEBUG
JSBool
js_ArrayInfo(JSContext *cx, unsigned argc, Value *vp)

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

@ -371,10 +371,8 @@ js::AtomizeChars(JSContext *cx, const jschar *chars, size_t length, InternBehavi
return AtomizeInline(cx, &chars, length, ib);
}
namespace js {
bool
IndexToIdSlow(JSContext *cx, uint32_t index, jsid *idp)
js::IndexToIdSlow(JSContext *cx, uint32_t index, jsid *idp)
{
JS_ASSERT(index > JSID_INT_MAX);
@ -390,8 +388,6 @@ IndexToIdSlow(JSContext *cx, uint32_t index, jsid *idp)
return true;
}
} /* namespace js */
bool
js::InternNonIntElementId(JSContext *cx, JSObject *obj, const Value &idval,
jsid *idp, MutableHandleValue vp)

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

@ -94,6 +94,9 @@ BackfillIndexInCharBuffer(uint32_t index, mozilla::RangedPtr<T> end)
return end;
}
bool
IndexToIdSlow(JSContext *cx, uint32_t index, jsid *idp);
inline bool
IndexToId(JSContext *cx, uint32_t index, jsid *idp)
{
@ -104,7 +107,6 @@ IndexToId(JSContext *cx, uint32_t index, jsid *idp)
return true;
}
extern bool IndexToIdSlow(JSContext *cx, uint32_t index, jsid *idp);
return IndexToIdSlow(cx, index, idp);
}

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

@ -26,6 +26,7 @@
#include "vm/GlobalObject.h"
#include "vm/StringBuffer.h"
#include "jsboolinlines.h"
#include "jsinferinlines.h"
#include "jsobjinlines.h"
@ -192,17 +193,15 @@ js_BooleanToString(JSContext *cx, JSBool b)
return b ? cx->runtime->atomState.true_ : cx->runtime->atomState.false_;
}
namespace js {
JS_PUBLIC_API(bool)
ToBooleanSlow(const Value &v)
js::ToBooleanSlow(const Value &v)
{
JS_ASSERT(v.isString());
return v.toString()->length() != 0;
}
bool
BooleanGetPrimitiveValueSlow(JSContext *cx, JSObject &obj, Value *vp)
js::BooleanGetPrimitiveValueSlow(JSContext *cx, JSObject &obj, Value *vp)
{
InvokeArgsGuard ag;
if (!cx->stack.pushInvokeArgs(cx, 0, &ag))
@ -214,7 +213,3 @@ BooleanGetPrimitiveValueSlow(JSContext *cx, JSObject &obj, Value *vp)
*vp = ag.rval();
return true;
}
} /* namespace js */

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

@ -13,6 +13,8 @@
namespace js {
bool BooleanGetPrimitiveValueSlow(JSContext *, JSObject &, Value *);
inline bool
BooleanGetPrimitiveValue(JSContext *cx, JSObject &obj, Value *vp)
{
@ -21,7 +23,6 @@ BooleanGetPrimitiveValue(JSContext *cx, JSObject &obj, Value *vp)
return true;
}
extern bool BooleanGetPrimitiveValueSlow(JSContext *, JSObject &, Value *);
return BooleanGetPrimitiveValueSlow(cx, obj, vp);
}

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

@ -120,12 +120,10 @@ SwapBytes(uint64_t u)
#endif
}
namespace js {
bool
WriteStructuredClone(JSContext *cx, const Value &v, uint64_t **bufp, size_t *nbytesp,
const JSStructuredCloneCallbacks *cb, void *cbClosure,
jsval transferable)
js::WriteStructuredClone(JSContext *cx, const Value &v, uint64_t **bufp, size_t *nbytesp,
const JSStructuredCloneCallbacks *cb, void *cbClosure,
jsval transferable)
{
SCOutput out(cx);
JSStructuredCloneWriter w(out, cb, cbClosure, transferable);
@ -133,8 +131,8 @@ WriteStructuredClone(JSContext *cx, const Value &v, uint64_t **bufp, size_t *nby
}
bool
ReadStructuredClone(JSContext *cx, uint64_t *data, size_t nbytes, Value *vp,
const JSStructuredCloneCallbacks *cb, void *cbClosure)
js::ReadStructuredClone(JSContext *cx, uint64_t *data, size_t nbytes, Value *vp,
const JSStructuredCloneCallbacks *cb, void *cbClosure)
{
SCInput in(cx, data, nbytes);
@ -146,7 +144,7 @@ ReadStructuredClone(JSContext *cx, uint64_t *data, size_t nbytes, Value *vp,
}
bool
ClearStructuredClone(const uint64_t *data, size_t nbytes)
js::ClearStructuredClone(const uint64_t *data, size_t nbytes)
{
const uint64_t *point = data;
const uint64_t *end = data + nbytes / 8;
@ -171,8 +169,7 @@ ClearStructuredClone(const uint64_t *data, size_t nbytes)
}
bool
StructuredCloneHasTransferObjects(const uint64_t *data, size_t nbytes,
bool *hasTransferable)
js::StructuredCloneHasTransferObjects(const uint64_t *data, size_t nbytes, bool *hasTransferable)
{
*hasTransferable = false;
@ -187,8 +184,6 @@ StructuredCloneHasTransferObjects(const uint64_t *data, size_t nbytes,
return true;
}
} /* namespace js */
static inline uint64_t
PairToUInt64(uint32_t tag, uint32_t data)
{

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

@ -541,8 +541,6 @@ js::DestroyContext(JSContext *cx, DestroyContextMode mode)
js_delete(cx);
}
namespace js {
bool
AutoResolving::alreadyStartedSlow() const
{
@ -556,8 +554,6 @@ AutoResolving::alreadyStartedSlow() const
return false;
}
} /* namespace js */
static void
ReportError(JSContext *cx, const char *message, JSErrorReport *reportp,
JSErrorCallback callback, void *userRef)
@ -754,11 +750,9 @@ js_ReportErrorVA(JSContext *cx, unsigned flags, const char *format, va_list ap)
return warning;
}
namespace js {
/* |callee| requires a usage string provided by JS_DefineFunctionsWithHelp. */
void
ReportUsageError(JSContext *cx, HandleObject callee, const char *msg)
js::ReportUsageError(JSContext *cx, HandleObject callee, const char *msg)
{
const char *usageStr = "usage";
PropertyName *usageAtom = Atomize(cx, usageStr, strlen(usageStr))->asPropertyName();
@ -784,8 +778,8 @@ ReportUsageError(JSContext *cx, HandleObject callee, const char *msg)
}
bool
PrintError(JSContext *cx, FILE *file, const char *message, JSErrorReport *report,
bool reportWarnings)
js::PrintError(JSContext *cx, FILE *file, const char *message, JSErrorReport *report,
bool reportWarnings)
{
if (!report) {
fprintf(file, "%s\n", message);
@ -855,8 +849,6 @@ PrintError(JSContext *cx, FILE *file, const char *message, JSErrorReport *report
return true;
}
} /* namespace js */
/*
* The arguments from ap need to be packaged up into an array and stored
* into the report struct.
@ -1610,8 +1602,6 @@ JSContext::mark(JSTracer *trc)
MarkValueRoot(trc, &iterValue, "iterValue");
}
namespace JS {
#if defined JS_THREADSAFE && defined DEBUG
AutoCheckRequestDepth::AutoCheckRequestDepth(JSContext *cx)
@ -1629,5 +1619,3 @@ AutoCheckRequestDepth::~AutoCheckRequestDepth()
}
#endif
} // namespace JS

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

@ -385,8 +385,6 @@ CallNativeImpl(JSContext *cx, NativeImpl impl, const CallArgs &args)
return ok;
}
extern JSBool CallOrConstructBoundFunction(JSContext *, unsigned, js::Value *);
STATIC_PRECONDITION(ubound(args.argv_) >= argc)
JS_ALWAYS_INLINE bool
CallJSNativeConstructor(JSContext *cx, Native native, const CallArgs &args)

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

@ -12,8 +12,8 @@
#include <time.h>
namespace js {
namespace crash {
using namespace js;
using namespace js::crash;
const static int stack_snapshot_max_size = 32768;
@ -139,6 +139,9 @@ GetStack(uint64_t *stack, uint64_t *stack_len, CrashRegisters *regs, char *buffe
#endif
namespace js {
namespace crash {
class Stack : private CrashStack
{
public:
@ -206,6 +209,9 @@ Ring::copyBytes(void *data, size_t size)
}
}
} /* namespace crash */
} /* namespace js */
static bool gInitialized;
static Stack gGCStack(JS_CRASH_STACK_GC);
@ -213,32 +219,26 @@ static Stack gErrorStack(JS_CRASH_STACK_ERROR);
static Ring gRingBuffer(JS_CRASH_RING);
void
SnapshotGCStack()
js::crash::SnapshotGCStack()
{
if (gInitialized)
gGCStack.snapshot();
}
void
SnapshotErrorStack()
js::crash::SnapshotErrorStack()
{
if (gInitialized)
gErrorStack.snapshot();
}
void
SaveCrashData(uint64_t tag, void *ptr, size_t size)
js::crash::SaveCrashData(uint64_t tag, void *ptr, size_t size)
{
if (gInitialized)
gRingBuffer.push(tag, ptr, size);
}
} /* namespace crash */
} /* namespace js */
using namespace js;
using namespace js::crash;
JS_PUBLIC_API(void)
JS_EnumerateDiagnosticMemoryRegions(JSEnumerateDiagnosticMemoryCallback callback)
{

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

@ -70,10 +70,8 @@ JS_SetRuntimeDebugMode(JSRuntime *rt, JSBool debug)
rt->debugMode = !!debug;
}
namespace js {
JSTrapStatus
ScriptDebugPrologue(JSContext *cx, StackFrame *fp)
js::ScriptDebugPrologue(JSContext *cx, StackFrame *fp)
{
JS_ASSERT(fp == cx->fp());
@ -106,7 +104,7 @@ ScriptDebugPrologue(JSContext *cx, StackFrame *fp)
}
bool
ScriptDebugEpilogue(JSContext *cx, StackFrame *fp, bool okArg)
js::ScriptDebugEpilogue(JSContext *cx, StackFrame *fp, bool okArg)
{
JS_ASSERT(fp == cx->fp());
JSBool ok = okArg;
@ -124,8 +122,6 @@ ScriptDebugEpilogue(JSContext *cx, StackFrame *fp, bool okArg)
return Debugger::onLeaveFrame(cx, ok);
}
} /* namespace js */
JS_FRIEND_API(JSBool)
JS_SetDebugModeForAllCompartments(JSContext *cx, JSBool debug)
{

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

@ -875,10 +875,8 @@ js_GetLocalizedErrorMessage(JSContext* cx, void *userRef, const char *locale,
return errorString;
}
namespace js {
JS_FRIEND_API(const jschar*)
GetErrorTypeName(JSContext* cx, int16_t exnType)
js::GetErrorTypeName(JSContext* cx, int16_t exnType)
{
/*
* JSEXN_INTERNALERR returns null to prevent that "InternalError: "
@ -893,8 +891,6 @@ GetErrorTypeName(JSContext* cx, int16_t exnType)
return ClassName(key, cx)->chars();
}
} /* namespace js */
#if defined ( DEBUG_mccabe ) && defined ( PRINTNAMES )
/* For use below... get character strings for error name and exception name */
static struct exnname { char *name; char *exception; } errortoexnname[] = {

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

@ -502,6 +502,7 @@ js::SetPreserveWrapperCallback(JSRuntime *rt, PreserveWrapperCallback callback)
* sufficient data has been harvested.
*/
// Defined in jsxml.cpp.
extern size_t sE4XObjectsCreated;
JS_FRIEND_API(size_t)
@ -511,6 +512,7 @@ JS_GetE4XObjectsCreated(JSContext *)
}
namespace js {
// Defined in vm/GlobalObject.cpp.
extern size_t sSetProtoCalled;
}
@ -520,6 +522,7 @@ JS_SetProtoCalled(JSContext *)
return sSetProtoCalled;
}
// Defined in jsiter.cpp.
extern size_t sCustomIteratorCount;
JS_FRIEND_API(size_t)
@ -717,29 +720,27 @@ js::DumpHeapComplete(JSRuntime *rt, FILE *fp)
fflush(dtrc.output);
}
namespace js {
JS_FRIEND_API(const JSStructuredCloneCallbacks *)
GetContextStructuredCloneCallbacks(JSContext *cx)
js::GetContextStructuredCloneCallbacks(JSContext *cx)
{
return cx->runtime->structuredCloneCallbacks;
}
JS_FRIEND_API(JSVersion)
VersionSetMoarXML(JSVersion version, bool enable)
js::VersionSetMoarXML(JSVersion version, bool enable)
{
return enable ? JSVersion(uint32_t(version) | VersionFlags::MOAR_XML)
: JSVersion(uint32_t(version) & ~VersionFlags::MOAR_XML);
}
JS_FRIEND_API(bool)
CanCallContextDebugHandler(JSContext *cx)
js::CanCallContextDebugHandler(JSContext *cx)
{
return !!cx->runtime->debugHooks.debuggerHandler;
}
JS_FRIEND_API(JSTrapStatus)
CallContextDebugHandler(JSContext *cx, JSScript *script, jsbytecode *bc, Value *rval)
js::CallContextDebugHandler(JSContext *cx, JSScript *script, jsbytecode *bc, Value *rval)
{
if (!cx->runtime->debugHooks.debuggerHandler)
return JSTRAP_RETURN;
@ -750,51 +751,51 @@ CallContextDebugHandler(JSContext *cx, JSScript *script, jsbytecode *bc, Value *
#ifdef JS_THREADSAFE
void *
GetOwnerThread(const JSContext *cx)
js::GetOwnerThread(const JSContext *cx)
{
return cx->runtime->ownerThread();
}
JS_FRIEND_API(bool)
ContextHasOutstandingRequests(const JSContext *cx)
js::ContextHasOutstandingRequests(const JSContext *cx)
{
return cx->outstandingRequests > 0;
}
#endif
JS_FRIEND_API(JSCompartment *)
GetContextCompartment(const JSContext *cx)
js::GetContextCompartment(const JSContext *cx)
{
return cx->compartment;
}
JS_FRIEND_API(bool)
HasUnrootedGlobal(const JSContext *cx)
js::HasUnrootedGlobal(const JSContext *cx)
{
return cx->hasRunOption(JSOPTION_UNROOTED_GLOBAL);
}
JS_FRIEND_API(void)
SetActivityCallback(JSRuntime *rt, ActivityCallback cb, void *arg)
js::SetActivityCallback(JSRuntime *rt, ActivityCallback cb, void *arg)
{
rt->activityCallback = cb;
rt->activityCallbackArg = arg;
}
JS_FRIEND_API(bool)
IsContextRunningJS(JSContext *cx)
js::IsContextRunningJS(JSContext *cx)
{
return !cx->stack.empty();
}
JS_FRIEND_API(const CompartmentVector&)
GetRuntimeCompartments(JSRuntime *rt)
js::GetRuntimeCompartments(JSRuntime *rt)
{
return rt->compartments;
}
JS_FRIEND_API(GCSliceCallback)
SetGCSliceCallback(JSRuntime *rt, GCSliceCallback callback)
js::SetGCSliceCallback(JSRuntime *rt, GCSliceCallback callback)
{
GCSliceCallback old = rt->gcSliceCallback;
rt->gcSliceCallback = callback;
@ -802,7 +803,7 @@ SetGCSliceCallback(JSRuntime *rt, GCSliceCallback callback)
}
JS_FRIEND_API(bool)
WasIncrementalGC(JSRuntime *rt)
js::WasIncrementalGC(JSRuntime *rt)
{
return rt->gcIsIncremental;
}
@ -820,7 +821,7 @@ GCDescription::formatJSON(JSRuntime *rt, uint64_t timestamp) const
}
JS_FRIEND_API(AnalysisPurgeCallback)
SetAnalysisPurgeCallback(JSRuntime *rt, AnalysisPurgeCallback callback)
js::SetAnalysisPurgeCallback(JSRuntime *rt, AnalysisPurgeCallback callback)
{
AnalysisPurgeCallback old = rt->analysisPurgeCallback;
rt->analysisPurgeCallback = callback;
@ -828,7 +829,7 @@ SetAnalysisPurgeCallback(JSRuntime *rt, AnalysisPurgeCallback callback)
}
JS_FRIEND_API(void)
NotifyDidPaint(JSRuntime *rt)
js::NotifyDidPaint(JSRuntime *rt)
{
if (rt->gcZeal() == gc::ZealFrameVerifierPreValue) {
gc::VerifyBarriers(rt, gc::PreBarrierVerifier);
@ -854,50 +855,50 @@ NotifyDidPaint(JSRuntime *rt)
rt->gcInterFrameGC = false;
}
extern JS_FRIEND_API(bool)
IsIncrementalGCEnabled(JSRuntime *rt)
JS_FRIEND_API(bool)
js::IsIncrementalGCEnabled(JSRuntime *rt)
{
return rt->gcIncrementalEnabled && rt->gcMode == JSGC_MODE_INCREMENTAL;
}
JS_FRIEND_API(bool)
IsIncrementalGCInProgress(JSRuntime *rt)
js::IsIncrementalGCInProgress(JSRuntime *rt)
{
return (rt->gcIncrementalState != gc::NO_INCREMENTAL && !rt->gcVerifyPreData);
}
extern JS_FRIEND_API(void)
DisableIncrementalGC(JSRuntime *rt)
JS_FRIEND_API(void)
js::DisableIncrementalGC(JSRuntime *rt)
{
rt->gcIncrementalEnabled = false;
}
JS_FRIEND_API(bool)
IsIncrementalBarrierNeeded(JSRuntime *rt)
js::IsIncrementalBarrierNeeded(JSRuntime *rt)
{
return (rt->gcIncrementalState == gc::MARK && !rt->isHeapBusy());
}
JS_FRIEND_API(bool)
IsIncrementalBarrierNeeded(JSContext *cx)
js::IsIncrementalBarrierNeeded(JSContext *cx)
{
return IsIncrementalBarrierNeeded(cx->runtime);
}
JS_FRIEND_API(bool)
IsIncrementalBarrierNeededOnObject(RawObject obj)
js::IsIncrementalBarrierNeededOnObject(RawObject obj)
{
return obj->compartment()->needsBarrier();
}
JS_FRIEND_API(bool)
IsIncrementalBarrierNeededOnScript(JSScript *script)
js::IsIncrementalBarrierNeededOnScript(JSScript *script)
{
return script->compartment()->needsBarrier();
}
extern JS_FRIEND_API(void)
IncrementalReferenceBarrier(void *ptr)
JS_FRIEND_API(void)
js::IncrementalReferenceBarrier(void *ptr)
{
if (!ptr)
return;
@ -924,20 +925,20 @@ IncrementalReferenceBarrier(void *ptr)
JS_NOT_REACHED("invalid trace kind");
}
extern JS_FRIEND_API(void)
IncrementalValueBarrier(const Value &v)
JS_FRIEND_API(void)
js::IncrementalValueBarrier(const Value &v)
{
HeapValue::writeBarrierPre(v);
}
extern JS_FRIEND_API(void)
PokeGC(JSRuntime *rt)
JS_FRIEND_API(void)
js::PokeGC(JSRuntime *rt)
{
rt->gcPoke = true;
}
JS_FRIEND_API(JSObject *)
GetTestingFunctions(JSContext *cx)
js::GetTestingFunctions(JSContext *cx)
{
RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
if (!obj)
@ -950,32 +951,31 @@ GetTestingFunctions(JSContext *cx)
}
JS_FRIEND_API(void)
SetRuntimeProfilingStack(JSRuntime *rt, ProfileEntry *stack, uint32_t *size,
uint32_t max)
js::SetRuntimeProfilingStack(JSRuntime *rt, ProfileEntry *stack, uint32_t *size, uint32_t max)
{
rt->spsProfiler.setProfilingStack(stack, size, max);
}
JS_FRIEND_API(void)
EnableRuntimeProfilingStack(JSRuntime *rt, bool enabled)
js::EnableRuntimeProfilingStack(JSRuntime *rt, bool enabled)
{
rt->spsProfiler.enable(enabled);
}
JS_FRIEND_API(jsbytecode*)
ProfilingGetPC(JSRuntime *rt, JSScript *script, void *ip)
js::ProfilingGetPC(JSRuntime *rt, JSScript *script, void *ip)
{
return rt->spsProfiler.ipToPC(script, size_t(ip));
}
JS_FRIEND_API(void)
SetDOMCallbacks(JSRuntime *rt, const DOMCallbacks *callbacks)
js::SetDOMCallbacks(JSRuntime *rt, const DOMCallbacks *callbacks)
{
rt->DOMcallbacks = callbacks;
}
JS_FRIEND_API(const DOMCallbacks *)
GetDOMCallbacks(JSRuntime *rt)
js::GetDOMCallbacks(JSRuntime *rt)
{
return rt->DOMcallbacks;
}
@ -984,22 +984,20 @@ static void *gListBaseHandlerFamily = NULL;
static uint32_t gListBaseExpandoSlot = 0;
JS_FRIEND_API(void)
SetListBaseInformation(void *listBaseHandlerFamily, uint32_t listBaseExpandoSlot)
js::SetListBaseInformation(void *listBaseHandlerFamily, uint32_t listBaseExpandoSlot)
{
gListBaseHandlerFamily = listBaseHandlerFamily;
gListBaseExpandoSlot = listBaseExpandoSlot;
}
void *
GetListBaseHandlerFamily()
js::GetListBaseHandlerFamily()
{
return gListBaseHandlerFamily;
}
uint32_t
GetListBaseExpandoSlot()
js::GetListBaseExpandoSlot()
{
return gListBaseExpandoSlot;
}
} // namespace js

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

@ -966,13 +966,6 @@ js_fun_apply(JSContext *cx, unsigned argc, Value *vp)
return true;
}
namespace js {
JSBool
CallOrConstructBoundFunction(JSContext *cx, unsigned argc, Value *vp);
}
static const uint32_t JSSLOT_BOUND_FUNCTION_THIS = 0;
static const uint32_t JSSLOT_BOUND_FUNCTION_ARGS_COUNT = 1;
@ -1046,11 +1039,9 @@ JSFunction::getBoundFunctionArgumentCount() const
return getSlot(JSSLOT_BOUND_FUNCTION_ARGS_COUNT).toPrivateUint32();
}
namespace js {
/* ES5 15.3.4.5.1 and 15.3.4.5.2. */
JSBool
CallOrConstructBoundFunction(JSContext *cx, unsigned argc, Value *vp)
js::CallOrConstructBoundFunction(JSContext *cx, unsigned argc, Value *vp)
{
JSFunction *fun = vp[0].toObject().toFunction();
JS_ASSERT(fun->isBoundFunction());
@ -1093,8 +1084,6 @@ CallOrConstructBoundFunction(JSContext *cx, unsigned argc, Value *vp)
return true;
}
}
#if JS_HAS_GENERATORS
static JSBool
fun_isGenerator(JSContext *cx, unsigned argc, Value *vp)
@ -1200,9 +1189,7 @@ OnBadFormal(JSContext *cx, TokenKind tt)
return false;
}
namespace js {
JSFunctionSpec function_methods[] = {
JSFunctionSpec js::function_methods[] = {
#if JS_HAS_TOSOURCE
JS_FN(js_toSource_str, fun_toSource, 0,0),
#endif
@ -1217,7 +1204,7 @@ JSFunctionSpec function_methods[] = {
};
JSBool
Function(JSContext *cx, unsigned argc, Value *vp)
js::Function(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
RootedString arg(cx); // used multiple times below
@ -1412,16 +1399,15 @@ Function(JSContext *cx, unsigned argc, Value *vp)
}
bool
IsBuiltinFunctionConstructor(JSFunction *fun)
js::IsBuiltinFunctionConstructor(JSFunction *fun)
{
return fun->maybeNative() == Function;
}
} /* namespace js */
JSFunction *
js_NewFunction(JSContext *cx, HandleObject funobjArg, Native native, unsigned nargs,
JSFunction::Flags flags, HandleObject parent, HandleAtom atom, js::gc::AllocKind kind)
JSFunction::Flags flags, HandleObject parent, HandleAtom atom,
js::gc::AllocKind kind)
{
JS_ASSERT(kind == JSFunction::FinalizeKind || kind == JSFunction::ExtendedFinalizeKind);
JS_ASSERT(sizeof(JSFunction) <= gc::Arena::thingSize(JSFunction::FinalizeKind));

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

@ -349,6 +349,11 @@ ReportIncompatibleMethod(JSContext *cx, CallReceiver call, Class *clasp);
extern void
ReportIncompatible(JSContext *cx, CallReceiver call);
JSBool
CallOrConstructBoundFunction(JSContext *, unsigned, js::Value *);
extern JSFunctionSpec function_methods[];
} /* namespace js */
extern JSBool

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

@ -206,8 +206,6 @@ GetFunctionNameBytes(JSContext *cx, JSFunction *fun, JSAutoByteString *bytes)
return js_anonymous_str;
}
extern JSFunctionSpec function_methods[];
extern JSBool
Function(JSContext *cx, unsigned argc, Value *vp);

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

@ -85,6 +85,7 @@
#include "ion/IonFrameIterator.h"
#endif
#include "jsgcinlines.h"
#include "jsinterpinlines.h"
#include "jsobjinlines.h"
@ -115,15 +116,11 @@ using mozilla::ArrayEnd;
using mozilla::DebugOnly;
using mozilla::Maybe;
namespace js {
namespace gc {
/* Perform a Full GC every 20 seconds if MaybeGC is called */
static const uint64_t GC_IDLE_FULL_SPAN = 20 * 1000 * 1000;
/* Increase the IGC marking slice time if we are in highFrequencyGC mode. */
const int IGC_MARK_SLICE_MULTIPLIER = 2;
static const int IGC_MARK_SLICE_MULTIPLIER = 2;
#ifdef JS_GC_ZEAL
static void
@ -138,12 +135,12 @@ StartVerifyPostBarriers(JSRuntime *rt);
static void
EndVerifyPostBarriers(JSRuntime *rt);
void
static void
FinishVerifier(JSRuntime *rt);
#endif
/* This array should be const, but that doesn't link right under GCC. */
AllocKind slotsToThingKind[] = {
AllocKind gc::slotsToThingKind[] = {
/* 0 */ FINALIZE_OBJECT0, FINALIZE_OBJECT2, FINALIZE_OBJECT2, FINALIZE_OBJECT4,
/* 4 */ FINALIZE_OBJECT4, FINALIZE_OBJECT8, FINALIZE_OBJECT8, FINALIZE_OBJECT8,
/* 8 */ FINALIZE_OBJECT8, FINALIZE_OBJECT12, FINALIZE_OBJECT12, FINALIZE_OBJECT12,
@ -417,7 +414,7 @@ void ArenaList::insert(ArenaHeader *a)
}
template<typename T>
inline bool
static inline bool
FinalizeTypedArenas(FreeOp *fop,
ArenaHeader **src,
ArenaList &dest,
@ -694,7 +691,7 @@ Chunk::init()
/* The rest of info fields are initialized in PickChunk. */
}
inline Chunk **
static inline Chunk **
GetAvailableChunkList(JSCompartment *comp)
{
JSRuntime *rt = comp->rt;
@ -864,9 +861,6 @@ Chunk::releaseArena(ArenaHeader *aheader)
}
}
} /* namespace gc */
} /* namespace js */
/* The caller must hold the GC lock. */
static Chunk *
PickChunk(JSCompartment *comp)
@ -937,9 +931,7 @@ js_InitGC(JSRuntime *rt, uint32_t maxbytes)
return true;
}
namespace js {
inline bool
static inline bool
InFreeList(ArenaHeader *aheader, uintptr_t addr)
{
if (!aheader->hasFreeThings())
@ -1030,7 +1022,7 @@ enum ConservativeGCTest
* Tests whether w is a (possibly dead) GC thing. Returns CGCT_VALID and
* details about the thing if so. On failure, returns the reason for rejection.
*/
inline ConservativeGCTest
static inline ConservativeGCTest
IsAddressableGCThing(JSRuntime *rt, uintptr_t w,
bool skipUncollectedCompartments,
gc::AllocKind *thingKindPtr,
@ -1108,7 +1100,7 @@ IsAddressableGCThing(JSRuntime *rt, uintptr_t w,
* Returns CGCT_VALID and mark it if the w can be a live GC thing and sets
* thingKind accordingly. Otherwise returns the reason for rejection.
*/
inline ConservativeGCTest
static inline ConservativeGCTest
MarkIfGCThingWord(JSTracer *trc, uintptr_t w)
{
void *thing;
@ -1244,7 +1236,7 @@ MarkConservativeStackRoots(JSTracer *trc, bool useSavedRoots)
#endif /* JSGC_USE_EXACT_ROOTING */
void
MarkStackRangeConservatively(JSTracer *trc, Value *beginv, Value *endv)
js::MarkStackRangeConservatively(JSTracer *trc, Value *beginv, Value *endv)
{
const uintptr_t *begin = beginv->payloadUIntPtr();
const uintptr_t *end = endv->payloadUIntPtr();
@ -1295,8 +1287,6 @@ RecordNativeStackTopForGC(JSRuntime *rt)
cgcd->recordStackTop();
}
} /* namespace js */
void
js_FinishGC(JSRuntime *rt)
{
@ -1450,9 +1440,6 @@ JSCompartment::reduceGCTriggerBytes(size_t amount)
gcTriggerBytes -= amount;
}
namespace js {
namespace gc {
inline void
ArenaLists::prepareForIncrementalGC(JSRuntime *rt)
{
@ -1809,9 +1796,6 @@ ArenaLists::refillFreeList(JSContext *cx, AllocKind thingKind)
return NULL;
}
} /* namespace gc */
} /* namespace js */
JSGCTraceKind
js_GetGCThingTraceKind(void *thing)
{
@ -1854,10 +1838,8 @@ js_UnlockGCThingRT(JSRuntime *rt, void *thing)
}
}
namespace js {
void
InitTracer(JSTracer *trc, JSRuntime *rt, JSTraceCallback callback)
js::InitTracer(JSTracer *trc, JSRuntime *rt, JSTraceCallback callback)
{
trc->runtime = rt;
trc->callback = callback;
@ -2178,24 +2160,18 @@ GCMarker::sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const
}
void
SetMarkStackLimit(JSRuntime *rt, size_t limit)
js::SetMarkStackLimit(JSRuntime *rt, size_t limit)
{
JS_ASSERT(!rt->isHeapBusy());
rt->gcMarker.setSizeLimit(limit);
}
} /* namespace js */
namespace js {
void
MarkCompartmentActive(StackFrame *fp)
js::MarkCompartmentActive(StackFrame *fp)
{
fp->script()->compartment()->active = true;
}
} /* namespace js */
void
AutoIdArray::trace(JSTracer *trc)
{
@ -2477,8 +2453,6 @@ HashableValue::AutoRooter::trace(JSTracer *trc)
MarkValueRoot(trc, reinterpret_cast<Value*>(&v->value), "HashableValue::AutoRooter");
}
namespace js {
static void
MarkRuntime(JSTracer *trc, bool useSavedRoots = false)
{
@ -2615,7 +2589,7 @@ TriggerOperationCallback(JSRuntime *rt, gcreason::Reason reason)
}
void
TriggerGC(JSRuntime *rt, gcreason::Reason reason)
js::TriggerGC(JSRuntime *rt, gcreason::Reason reason)
{
rt->assertValidThread();
@ -2627,7 +2601,7 @@ TriggerGC(JSRuntime *rt, gcreason::Reason reason)
}
void
TriggerCompartmentGC(JSCompartment *comp, gcreason::Reason reason)
js::TriggerCompartmentGC(JSCompartment *comp, gcreason::Reason reason)
{
JSRuntime *rt = comp->rt;
rt->assertValidThread();
@ -2651,7 +2625,7 @@ TriggerCompartmentGC(JSCompartment *comp, gcreason::Reason reason)
}
void
MaybeGC(JSContext *cx)
js::MaybeGC(JSContext *cx)
{
JSRuntime *rt = cx->runtime;
rt->assertValidThread();
@ -2874,7 +2848,7 @@ AssertBackgroundSweepingFinished(JSRuntime *rt)
}
unsigned
GetCPUCount()
js::GetCPUCount()
{
static unsigned ncpus = 0;
if (ncpus == 0) {
@ -3167,8 +3141,6 @@ GCHelperThread::doSweep()
}
#endif /* JS_THREADSAFE */
} /* namespace js */
static bool
ReleaseObservedTypes(JSRuntime *rt)
{
@ -4714,17 +4686,15 @@ Collect(JSRuntime *rt, bool incremental, int64_t budget,
} while (rt->gcPoke && rt->gcShouldCleanUpEverything);
}
namespace js {
void
GC(JSRuntime *rt, JSGCInvocationKind gckind, gcreason::Reason reason)
js::GC(JSRuntime *rt, JSGCInvocationKind gckind, gcreason::Reason reason)
{
AssertCanGC();
Collect(rt, false, SliceBudget::Unlimited, gckind, reason);
}
void
GCSlice(JSRuntime *rt, JSGCInvocationKind gckind, gcreason::Reason reason, int64_t millis)
js::GCSlice(JSRuntime *rt, JSGCInvocationKind gckind, gcreason::Reason reason, int64_t millis)
{
AssertCanGC();
int64_t sliceBudget;
@ -4739,14 +4709,14 @@ GCSlice(JSRuntime *rt, JSGCInvocationKind gckind, gcreason::Reason reason, int64
}
void
GCFinalSlice(JSRuntime *rt, JSGCInvocationKind gckind, gcreason::Reason reason)
js::GCFinalSlice(JSRuntime *rt, JSGCInvocationKind gckind, gcreason::Reason reason)
{
AssertCanGC();
Collect(rt, true, SliceBudget::Unlimited, gckind, reason);
}
void
GCDebugSlice(JSRuntime *rt, bool limit, int64_t objCount)
js::GCDebugSlice(JSRuntime *rt, bool limit, int64_t objCount)
{
AssertCanGC();
int64_t budget = limit ? SliceBudget::WorkBudget(objCount) : SliceBudget::Unlimited;
@ -4756,7 +4726,7 @@ GCDebugSlice(JSRuntime *rt, bool limit, int64_t objCount)
/* Schedule a full GC unless a compartment will already be collected. */
void
PrepareForDebugGC(JSRuntime *rt)
js::PrepareForDebugGC(JSRuntime *rt)
{
for (CompartmentsIter c(rt); !c.done(); c.next()) {
if (c->isGCScheduled())
@ -4767,7 +4737,7 @@ PrepareForDebugGC(JSRuntime *rt)
}
void
ShrinkGCBuffers(JSRuntime *rt)
js::ShrinkGCBuffers(JSRuntime *rt)
{
AutoLockGC lock(rt);
JS_ASSERT(!rt->isHeapBusy());
@ -4804,7 +4774,7 @@ struct AutoPrepareForTracing
};
void
TraceRuntime(JSTracer *trc)
js::TraceRuntime(JSTracer *trc)
{
JS_ASSERT(!IS_GC_MARKING_TRACER(trc));
@ -4842,10 +4812,10 @@ struct IterateCellCallbackOp
};
void
IterateCompartmentsArenasCells(JSRuntime *rt, void *data,
JSIterateCompartmentCallback compartmentCallback,
IterateArenaCallback arenaCallback,
IterateCellCallback cellCallback)
js::IterateCompartmentsArenasCells(JSRuntime *rt, void *data,
JSIterateCompartmentCallback compartmentCallback,
IterateArenaCallback arenaCallback,
IterateCellCallback cellCallback)
{
AutoPrepareForTracing prop(rt);
@ -4863,7 +4833,7 @@ IterateCompartmentsArenasCells(JSRuntime *rt, void *data,
}
void
IterateChunks(JSRuntime *rt, void *data, IterateChunkCallback chunkCallback)
js::IterateChunks(JSRuntime *rt, void *data, IterateChunkCallback chunkCallback)
{
AutoPrepareForTracing prep(rt);
@ -4872,8 +4842,8 @@ IterateChunks(JSRuntime *rt, void *data, IterateChunkCallback chunkCallback)
}
void
IterateCells(JSRuntime *rt, JSCompartment *compartment, AllocKind thingKind,
void *data, IterateCellCallback cellCallback)
js::IterateCells(JSRuntime *rt, JSCompartment *compartment, AllocKind thingKind,
void *data, IterateCellCallback cellCallback)
{
AutoPrepareForTracing prep(rt);
@ -4892,7 +4862,7 @@ IterateCells(JSRuntime *rt, JSCompartment *compartment, AllocKind thingKind,
}
void
IterateGrayObjects(JSCompartment *compartment, GCThingCallback *cellCallback, void *data)
js::IterateGrayObjects(JSCompartment *compartment, GCThingCallback *cellCallback, void *data)
{
JS_ASSERT(compartment);
AutoPrepareForTracing prep(compartment->rt);
@ -4906,10 +4876,8 @@ IterateGrayObjects(JSCompartment *compartment, GCThingCallback *cellCallback, vo
}
}
namespace gc {
JSCompartment *
NewCompartment(JSContext *cx, JSPrincipals *principals)
gc::NewCompartment(JSContext *cx, JSPrincipals *principals)
{
JSRuntime *rt = cx->runtime;
JS_AbortIfWrongThread(rt);
@ -4939,7 +4907,7 @@ NewCompartment(JSContext *cx, JSPrincipals *principals)
}
void
RunDebugGC(JSContext *cx)
gc::RunDebugGC(JSContext *cx)
{
#ifdef JS_GC_ZEAL
JSRuntime *rt = cx->runtime;
@ -4990,7 +4958,7 @@ RunDebugGC(JSContext *cx)
}
void
SetDeterministicGC(JSContext *cx, bool enabled)
gc::SetDeterministicGC(JSContext *cx, bool enabled)
{
#ifdef JS_GC_ZEAL
JSRuntime *rt = cx->runtime;
@ -4999,15 +4967,12 @@ SetDeterministicGC(JSContext *cx, bool enabled)
}
void
SetValidateGC(JSContext *cx, bool enabled)
gc::SetValidateGC(JSContext *cx, bool enabled)
{
JSRuntime *rt = cx->runtime;
rt->gcValidate = enabled;
}
} /* namespace gc */
} /* namespace js */
#if defined(DEBUG) && defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE)
JS_ALWAYS_INLINE bool
@ -5197,9 +5162,6 @@ JS::CheckStackRoots(JSContext *cx)
#endif /* DEBUG && JS_GC_ZEAL && JSGC_ROOT_ANALYSIS && !JS_THREADSAFE */
namespace js {
namespace gc {
#ifdef JS_GC_ZEAL
/*
@ -5324,8 +5286,7 @@ MakeNode(VerifyPreTracer *trc, void *thing, JSGCTraceKind kind)
return NULL;
}
static
VerifyNode *
static VerifyNode *
NextNode(VerifyNode *node)
{
if (node->count == 0)
@ -5700,7 +5661,7 @@ VerifyPostBarriers(JSRuntime *rt)
}
void
VerifyBarriers(JSRuntime *rt, VerifierType type)
gc::VerifyBarriers(JSRuntime *rt, VerifierType type)
{
if (type == PreBarrierVerifier)
VerifyPreBarriers(rt);
@ -5739,7 +5700,7 @@ MaybeVerifyPostBarriers(JSRuntime *rt, bool always)
}
void
MaybeVerifyBarriers(JSContext *cx, bool always)
gc::MaybeVerifyBarriers(JSContext *cx, bool always)
{
MaybeVerifyPreBarriers(cx->runtime, always);
MaybeVerifyPostBarriers(cx->runtime, always);
@ -5766,9 +5727,8 @@ FinishVerifier(JSRuntime *rt)
#endif /* JS_GC_ZEAL */
} /* namespace gc */
void ReleaseAllJITCode(FreeOp *fop)
void
js::ReleaseAllJITCode(FreeOp *fop)
{
#ifdef JS_METHODJIT
for (CompartmentsIter c(fop->runtime()); !c.done(); c.next()) {
@ -5828,7 +5788,7 @@ ReleaseScriptCounts(FreeOp *fop)
}
JS_FRIEND_API(void)
StartPCCountProfiling(JSContext *cx)
js::StartPCCountProfiling(JSContext *cx)
{
JSRuntime *rt = cx->runtime;
@ -5844,7 +5804,7 @@ StartPCCountProfiling(JSContext *cx)
}
JS_FRIEND_API(void)
StopPCCountProfiling(JSContext *cx)
js::StopPCCountProfiling(JSContext *cx)
{
JSRuntime *rt = cx->runtime;
@ -5876,7 +5836,7 @@ StopPCCountProfiling(JSContext *cx)
}
JS_FRIEND_API(void)
PurgePCCounts(JSContext *cx)
js::PurgePCCounts(JSContext *cx)
{
JSRuntime *rt = cx->runtime;
@ -5888,7 +5848,7 @@ PurgePCCounts(JSContext *cx)
}
void
PurgeJITCaches(JSCompartment *c)
js::PurgeJITCaches(JSCompartment *c)
{
#ifdef JS_METHODJIT
mjit::ClearAllFrames(c);
@ -5937,8 +5897,6 @@ AutoMaybeTouchDeadCompartments::~AutoMaybeTouchDeadCompartments()
runtime->gcManipulatingDeadCompartments = manipulatingDeadCompartments;
}
} /* namespace js */
JS_PUBLIC_API(void)
JS_IterateCompartments(JSRuntime *rt, void *data,
JSIterateCompartmentCallback compartmentCallback)

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

@ -545,10 +545,6 @@ GCDebugSlice(JSRuntime *rt, bool limit, int64_t objCount);
extern void
PrepareForDebugGC(JSRuntime *rt);
} /* namespace js */
namespace js {
void
InitTracer(JSTracer *trc, JSRuntime *rt, JSTraceCallback callback);

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

@ -64,12 +64,12 @@ GetGCThingTraceKind(const void *thing)
/* Capacity for slotsToThingKind */
const size_t SLOTS_TO_THING_KIND_LIMIT = 17;
extern AllocKind slotsToThingKind[];
/* Get the best kind to use when making an object with the given slot count. */
static inline AllocKind
GetGCObjectKind(size_t numSlots)
{
extern AllocKind slotsToThingKind[];
AutoAssertNoGC nogc;
if (numSlots >= SLOTS_TO_THING_KIND_LIMIT)
return FINALIZE_OBJECT16;

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

@ -5133,11 +5133,8 @@ ScriptAnalysis::printTypes(JSContext *cx)
// Interface functions
/////////////////////////////////////////////////////////////////////
namespace js {
namespace types {
void
MarkIteratorUnknownSlow(JSContext *cx)
types::MarkIteratorUnknownSlow(JSContext *cx)
{
/* Check whether we are actually at an ITER opcode. */
@ -5197,7 +5194,8 @@ MarkIteratorUnknownSlow(JSContext *cx)
}
void
TypeMonitorCallSlow(JSContext *cx, HandleObject callee, const CallArgs &args, bool constructing)
types::TypeMonitorCallSlow(JSContext *cx, HandleObject callee, const CallArgs &args,
bool constructing)
{
unsigned nargs = callee->toFunction()->nargs;
RootedScript script(cx, callee->toFunction()->script());
@ -5230,7 +5228,7 @@ IsAboutToBeFinalized(TypeObjectKey *key)
}
void
TypeDynamicResult(JSContext *cx, HandleScript script, jsbytecode *pc, Type type)
types::TypeDynamicResult(JSContext *cx, HandleScript script, jsbytecode *pc, Type type)
{
JS_ASSERT(cx->typeInferenceEnabled());
AutoEnterTypeInference enter(cx);
@ -5332,7 +5330,7 @@ TypeDynamicResult(JSContext *cx, HandleScript script, jsbytecode *pc, Type type)
}
void
TypeMonitorResult(JSContext *cx, HandleScript script, jsbytecode *pc, const js::Value &rval)
types::TypeMonitorResult(JSContext *cx, HandleScript script, jsbytecode *pc, const js::Value &rval)
{
/* Allow the non-TYPESET scenario to simplify stubs used in compound opcodes. */
if (!(js_CodeSpec[*pc].format & JOF_TYPESET))
@ -5355,8 +5353,6 @@ TypeMonitorResult(JSContext *cx, HandleScript script, jsbytecode *pc, const js::
types->addType(cx, type);
}
} } /* namespace js::types */
/////////////////////////////////////////////////////////////////////
// TypeScript
/////////////////////////////////////////////////////////////////////

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

@ -505,6 +505,8 @@ GetTypeCallerInitObject(JSContext *cx, JSProtoKey key)
return GetTypeNewObject(cx, key);
}
void MarkIteratorUnknownSlow(JSContext *cx);
/*
* When using a custom iterator within the initialization of a 'for in' loop,
* mark the iterator values as unknown.
@ -512,12 +514,13 @@ GetTypeCallerInitObject(JSContext *cx, JSProtoKey key)
inline void
MarkIteratorUnknown(JSContext *cx)
{
extern void MarkIteratorUnknownSlow(JSContext *cx);
if (cx->typeInferenceEnabled())
MarkIteratorUnknownSlow(cx);
}
void TypeMonitorCallSlow(JSContext *cx, HandleObject callee, const CallArgs &args,
bool constructing);
/*
* Monitor a javascript call, either on entry to the interpreter or made
* from within the interpreter.
@ -525,9 +528,6 @@ MarkIteratorUnknown(JSContext *cx)
inline bool
TypeMonitorCall(JSContext *cx, const js::CallArgs &args, bool constructing)
{
extern void TypeMonitorCallSlow(JSContext *cx, HandleObject callee,
const CallArgs &args, bool constructing);
js::RootedObject callee(cx, &args.callee());
if (callee->isFunction()) {
JSFunction *fun = callee->toFunction();

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

@ -517,18 +517,16 @@ VectorToKeyIterator(JSContext *cx, HandleObject obj, unsigned flags, AutoIdVecto
return true;
}
namespace js {
bool
VectorToKeyIterator(JSContext *cx, HandleObject obj, unsigned flags, AutoIdVector &props,
MutableHandleValue vp)
js::VectorToKeyIterator(JSContext *cx, HandleObject obj, unsigned flags, AutoIdVector &props,
MutableHandleValue vp)
{
return VectorToKeyIterator(cx, obj, flags, props, 0, 0, vp);
}
bool
VectorToValueIterator(JSContext *cx, HandleObject obj, unsigned flags, AutoIdVector &keys,
MutableHandleValue vp)
js::VectorToValueIterator(JSContext *cx, HandleObject obj, unsigned flags, AutoIdVector &keys,
MutableHandleValue vp)
{
JS_ASSERT(flags & JSITER_FOREACH);
@ -555,8 +553,8 @@ VectorToValueIterator(JSContext *cx, HandleObject obj, unsigned flags, AutoIdVec
}
bool
EnumeratedIdVectorToIterator(JSContext *cx, HandleObject obj, unsigned flags, AutoIdVector &props,
MutableHandleValue vp)
js::EnumeratedIdVectorToIterator(JSContext *cx, HandleObject obj, unsigned flags,
AutoIdVector &props, MutableHandleValue vp)
{
if (!(flags & JSITER_FOREACH))
return VectorToKeyIterator(cx, obj, flags, props, vp);
@ -573,7 +571,7 @@ UpdateNativeIterator(NativeIterator *ni, RawObject obj)
}
bool
GetIterator(JSContext *cx, HandleObject obj, unsigned flags, MutableHandleValue vp)
js::GetIterator(JSContext *cx, HandleObject obj, unsigned flags, MutableHandleValue vp)
{
if (flags == JSITER_FOR_OF) {
// for-of loop. The iterator is simply |obj.iterator()|.
@ -729,7 +727,7 @@ GetIterator(JSContext *cx, HandleObject obj, unsigned flags, MutableHandleValue
}
JSObject *
GetIteratorObject(JSContext *cx, HandleObject obj, uint32_t flags)
js::GetIteratorObject(JSContext *cx, HandleObject obj, uint32_t flags)
{
RootedValue value(cx);
if (!GetIterator(cx, obj, flags, &value))
@ -737,8 +735,6 @@ GetIteratorObject(JSContext *cx, HandleObject obj, uint32_t flags)
return &value.toObject();
}
} /* namespace js */
JSBool
js_ThrowStopIteration(JSContext *cx)
{

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

@ -22,6 +22,7 @@
# define JS_ATOMIC_SET(p,v) PR_ATOMIC_SET((int32_t *)(p), (int32_t)(v))
namespace js {
// Defined in jsgc.cpp.
unsigned GetCPUCount();
}

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

@ -22,21 +22,16 @@
#include "ion/IonCode.h"
#include "ion/Ion.h"
namespace js {
using namespace js;
size_t MemoryReportingSundriesThreshold()
JS_FRIEND_API(size_t)
js::MemoryReportingSundriesThreshold()
{
return 8 * 1024;
}
} // namespace js
#ifdef JS_THREADSAFE
namespace JS {
using namespace js;
typedef HashSet<ScriptSource *, DefaultHasher<ScriptSource *>, SystemAllocPolicy> SourceSet;
struct IteratorClosure
@ -275,7 +270,7 @@ StatsCellCallback(JSRuntime *rt, void *data, void *thing, JSGCTraceKind traceKin
}
JS_PUBLIC_API(bool)
CollectRuntimeStats(JSRuntime *rt, RuntimeStats *rtStats, ObjectPrivateVisitor *opv)
JS::CollectRuntimeStats(JSRuntime *rt, RuntimeStats *rtStats, ObjectPrivateVisitor *opv)
{
if (!rtStats->compartmentStatsVector.reserve(rt->compartments.length()))
return false;
@ -328,7 +323,7 @@ CollectRuntimeStats(JSRuntime *rt, RuntimeStats *rtStats, ObjectPrivateVisitor *
}
JS_PUBLIC_API(int64_t)
GetExplicitNonHeapForRuntime(JSRuntime *rt, JSMallocSizeOfFun mallocSizeOf)
JS::GetExplicitNonHeapForRuntime(JSRuntime *rt, JSMallocSizeOfFun mallocSizeOf)
{
// explicit/<compartment>/gc-heap/*
size_t n = size_t(JS_GetGCParameter(rt, JSGC_TOTAL_CHUNKS)) * gc::ChunkSize;
@ -343,7 +338,7 @@ GetExplicitNonHeapForRuntime(JSRuntime *rt, JSMallocSizeOfFun mallocSizeOf)
}
JS_PUBLIC_API(size_t)
SystemCompartmentCount(const JSRuntime *rt)
JS::SystemCompartmentCount(const JSRuntime *rt)
{
size_t n = 0;
for (size_t i = 0; i < rt->compartments.length(); i++) {
@ -354,7 +349,7 @@ SystemCompartmentCount(const JSRuntime *rt)
}
JS_PUBLIC_API(size_t)
UserCompartmentCount(const JSRuntime *rt)
JS::UserCompartmentCount(const JSRuntime *rt)
{
size_t n = 0;
for (size_t i = 0; i < rt->compartments.length(); i++) {
@ -364,6 +359,4 @@ UserCompartmentCount(const JSRuntime *rt)
return n;
}
} // namespace JS
#endif // JS_THREADSAFE

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

@ -28,12 +28,10 @@
#endif
namespace js {
#if defined(XP_WIN)
void *
GetNativeStackBaseImpl()
js::GetNativeStackBaseImpl()
{
# if defined(_M_IX86) && defined(_MSC_VER)
/*
@ -66,7 +64,7 @@ GetNativeStackBaseImpl()
JS_STATIC_ASSERT(JS_STACK_GROWTH_DIRECTION < 0);
void *
GetNativeStackBaseImpl()
js::GetNativeStackBaseImpl()
{
stack_t st;
stack_getbounds(&st);
@ -80,7 +78,7 @@ GetNativeStackBaseImpl()
JS_STATIC_ASSERT(JS_STACK_GROWTH_DIRECTION < 0);
void *
GetNativeStackBaseImpl()
js::GetNativeStackBaseImpl()
{
ucontext_t context;
getcontext(&context);
@ -91,7 +89,7 @@ GetNativeStackBaseImpl()
#elif defined(XP_OS2)
void *
GetNativeStackBaseImpl()
js::GetNativeStackBaseImpl()
{
PTIB ptib;
PPIB ppib;
@ -103,7 +101,7 @@ GetNativeStackBaseImpl()
#else /* XP_UNIX */
void *
GetNativeStackBaseImpl()
js::GetNativeStackBaseImpl()
{
pthread_t thread = pthread_self();
# if defined(XP_MACOSX) || defined(DARWIN)
@ -150,5 +148,3 @@ GetNativeStackBaseImpl()
}
#endif /* !XP_WIN */
} /* namespace js */

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

@ -180,11 +180,9 @@ ComputeAccurateBinaryBaseInteger(const jschar *start, const jschar *end, int bas
return value;
}
namespace js {
bool
GetPrefixInteger(JSContext *cx, const jschar *start, const jschar *end, int base,
const jschar **endp, double *dp)
js::GetPrefixInteger(JSContext *cx, const jschar *start, const jschar *end, int base,
const jschar **endp, double *dp)
{
JS_ASSERT(start <= end);
JS_ASSERT(2 <= base && base <= 36);
@ -227,8 +225,6 @@ GetPrefixInteger(JSContext *cx, const jschar *start, const jschar *end, int base
return true;
}
} // namespace js
static JSBool
num_isNaN(JSContext *cx, unsigned argc, Value *vp)
{
@ -1037,10 +1033,8 @@ inline void FIX_FPU() {
#endif
namespace js {
bool
InitRuntimeNumberState(JSRuntime *rt)
js::InitRuntimeNumberState(JSRuntime *rt)
{
FIX_FPU();
@ -1111,7 +1105,7 @@ InitRuntimeNumberState(JSRuntime *rt)
}
void
FinishRuntimeNumberState(JSRuntime *rt)
js::FinishRuntimeNumberState(JSRuntime *rt)
{
/*
* The free also releases the memory for decimalSeparator and numGrouping
@ -1121,8 +1115,6 @@ FinishRuntimeNumberState(JSRuntime *rt)
js_free(storage);
}
} /* namespace js */
JSObject *
js_InitNumberClass(JSContext *cx, HandleObject obj)
{
@ -1179,8 +1171,6 @@ js_InitNumberClass(JSContext *cx, HandleObject obj)
return numberProto;
}
namespace js {
static char *
FracNumberToCString(JSContext *cx, ToCStringBuf *cbuf, double d, int base = 10)
{
@ -1212,7 +1202,7 @@ FracNumberToCString(JSContext *cx, ToCStringBuf *cbuf, double d, int base = 10)
}
char *
NumberToCString(JSContext *cx, ToCStringBuf *cbuf, double d, int base/* = 10*/)
js::NumberToCString(JSContext *cx, ToCStringBuf *cbuf, double d, int base/* = 10*/)
{
int32_t i;
return MOZ_DOUBLE_IS_INT32(d, &i)
@ -1220,8 +1210,6 @@ NumberToCString(JSContext *cx, ToCStringBuf *cbuf, double d, int base/* = 10*/)
: FracNumberToCString(cx, cbuf, d, base);
}
}
static JSString * JS_FASTCALL
js_NumberToStringWithBase(JSContext *cx, double d, int base)
{
@ -1281,10 +1269,8 @@ js_NumberToString(JSContext *cx, double d)
return js_NumberToStringWithBase(cx, d, 10);
}
namespace js {
JSFlatString *
NumberToString(JSContext *cx, double d)
js::NumberToString(JSContext *cx, double d)
{
if (JSString *str = js_NumberToStringWithBase(cx, d, 10))
return &str->asFlat();
@ -1292,7 +1278,7 @@ NumberToString(JSContext *cx, double d)
}
JSFlatString *
IndexToString(JSContext *cx, uint32_t index)
js::IndexToString(JSContext *cx, uint32_t index)
{
if (StaticStrings::hasUint(index))
return cx->runtime->staticStrings.getUint(index);
@ -1319,7 +1305,7 @@ IndexToString(JSContext *cx, uint32_t index)
}
bool JS_FASTCALL
NumberValueToStringBuffer(JSContext *cx, const Value &v, StringBuffer &sb)
js::NumberValueToStringBuffer(JSContext *cx, const Value &v, StringBuffer &sb)
{
/* Convert to C-string. */
ToCStringBuf cbuf;
@ -1344,7 +1330,7 @@ NumberValueToStringBuffer(JSContext *cx, const Value &v, StringBuffer &sb)
}
JS_PUBLIC_API(bool)
ToNumberSlow(JSContext *cx, Value v, double *out)
js::ToNumberSlow(JSContext *cx, Value v, double *out)
{
AssertCanGC();
#ifdef DEBUG
@ -1407,7 +1393,7 @@ ToNumberSlow(JSContext *cx, Value v, double *out)
* conversion. Return converted value in *out on success, false on failure.
*/
JS_PUBLIC_API(bool)
ToInt64Slow(JSContext *cx, const Value &v, int64_t *out)
js::ToInt64Slow(JSContext *cx, const Value &v, int64_t *out)
{
JS_ASSERT(!v.isInt32());
double d;
@ -1426,7 +1412,7 @@ ToInt64Slow(JSContext *cx, const Value &v, int64_t *out)
* conversion. Return converted value in *out on success, false on failure.
*/
JS_PUBLIC_API(bool)
ToUint64Slow(JSContext *cx, const Value &v, uint64_t *out)
js::ToUint64Slow(JSContext *cx, const Value &v, uint64_t *out)
{
JS_ASSERT(!v.isInt32());
double d;
@ -1441,7 +1427,7 @@ ToUint64Slow(JSContext *cx, const Value &v, uint64_t *out)
}
JS_PUBLIC_API(bool)
ToInt32Slow(JSContext *cx, const Value &v, int32_t *out)
js::ToInt32Slow(JSContext *cx, const Value &v, int32_t *out)
{
JS_ASSERT(!v.isInt32());
double d;
@ -1456,7 +1442,7 @@ ToInt32Slow(JSContext *cx, const Value &v, int32_t *out)
}
JS_PUBLIC_API(bool)
ToUint32Slow(JSContext *cx, const Value &v, uint32_t *out)
js::ToUint32Slow(JSContext *cx, const Value &v, uint32_t *out)
{
JS_ASSERT(!v.isInt32());
double d;
@ -1471,7 +1457,7 @@ ToUint32Slow(JSContext *cx, const Value &v, uint32_t *out)
}
JS_PUBLIC_API(bool)
ToUint16Slow(JSContext *cx, const Value &v, uint16_t *out)
js::ToUint16Slow(JSContext *cx, const Value &v, uint16_t *out)
{
JS_ASSERT(!v.isInt32());
double d;
@ -1503,8 +1489,6 @@ ToUint16Slow(JSContext *cx, const Value &v, uint16_t *out)
return true;
}
} /* namespace js */
JSBool
js_strtod(JSContext *cx, const jschar *s, const jschar *send,
const jschar **ep, double *dp)

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

@ -289,10 +289,8 @@ obj_toSource(JSContext *cx, unsigned argc, Value *vp)
}
#endif /* JS_HAS_TOSOURCE */
namespace js {
JSString *
obj_toStringHelper(JSContext *cx, JSObject *obj)
js::obj_toStringHelper(JSContext *cx, JSObject *obj)
{
if (obj->isProxy())
return Proxy::obj_toString(cx, obj);
@ -308,7 +306,7 @@ obj_toStringHelper(JSContext *cx, JSObject *obj)
}
JSObject *
NonNullObject(JSContext *cx, const Value &v)
js::NonNullObject(JSContext *cx, const Value &v)
{
if (v.isPrimitive()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_NOT_NONNULL_OBJECT);
@ -318,7 +316,7 @@ NonNullObject(JSContext *cx, const Value &v)
}
const char *
InformalValueTypeName(const Value &v)
js::InformalValueTypeName(const Value &v)
{
if (v.isObject())
return v.toObject().getClass()->name;
@ -335,8 +333,6 @@ InformalValueTypeName(const Value &v)
return "value";
}
} /* namespace js */
/* ES5 15.2.4.2. Note steps 1 and 2 are errata. */
static JSBool
obj_toString(JSContext *cx, unsigned argc, Value *vp)
@ -802,10 +798,8 @@ obj_getPrototypeOf(JSContext *cx, unsigned argc, Value *vp)
return true;
}
namespace js {
bool
NewPropertyDescriptorObject(JSContext *cx, const PropertyDescriptor *desc, Value *vp)
js::NewPropertyDescriptorObject(JSContext *cx, const PropertyDescriptor *desc, Value *vp)
{
if (!desc->obj) {
vp->setUndefined();
@ -889,7 +883,8 @@ PropDesc::makeObject(JSContext *cx)
}
bool
GetOwnPropertyDescriptor(JSContext *cx, HandleObject obj, HandleId id, PropertyDescriptor *desc)
js::GetOwnPropertyDescriptor(JSContext *cx, HandleObject obj, HandleId id,
PropertyDescriptor *desc)
{
// FIXME: Call TrapGetOwnProperty directly once ScriptedIndirectProxies is removed
if (obj->isProxy())
@ -929,7 +924,7 @@ GetOwnPropertyDescriptor(JSContext *cx, HandleObject obj, HandleId id, PropertyD
}
bool
GetOwnPropertyDescriptor(JSContext *cx, HandleObject obj, HandleId id, Value *vp)
js::GetOwnPropertyDescriptor(JSContext *cx, HandleObject obj, HandleId id, Value *vp)
{
AutoPropertyDescriptorRooter desc(cx);
return GetOwnPropertyDescriptor(cx, obj, id, &desc) &&
@ -937,8 +932,8 @@ GetOwnPropertyDescriptor(JSContext *cx, HandleObject obj, HandleId id, Value *vp
}
bool
GetFirstArgumentAsObject(JSContext *cx, unsigned argc, Value *vp, const char *method,
MutableHandleObject objp)
js::GetFirstArgumentAsObject(JSContext *cx, unsigned argc, Value *vp, const char *method,
MutableHandleObject objp)
{
if (argc == 0) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_MORE_ARGS_NEEDED,
@ -961,8 +956,6 @@ GetFirstArgumentAsObject(JSContext *cx, unsigned argc, Value *vp, const char *me
return true;
}
} /* namespace js */
static JSBool
obj_getOwnPropertyDescriptor(JSContext *cx, unsigned argc, Value *vp)
{
@ -1165,10 +1158,8 @@ PropDesc::complete()
}
}
namespace js {
bool
Throw(JSContext *cx, jsid id, unsigned errorNumber)
js::Throw(JSContext *cx, jsid id, unsigned errorNumber)
{
JS_ASSERT(js_ErrorFormatString[errorNumber].argCount == 1);
@ -1183,7 +1174,7 @@ Throw(JSContext *cx, jsid id, unsigned errorNumber)
}
bool
Throw(JSContext *cx, JSObject *obj, unsigned errorNumber)
js::Throw(JSContext *cx, JSObject *obj, unsigned errorNumber)
{
if (js_ErrorFormatString[errorNumber].argCount == 1) {
RootedValue val(cx, ObjectValue(*obj));
@ -1197,8 +1188,6 @@ Throw(JSContext *cx, JSObject *obj, unsigned errorNumber)
return false;
}
} /* namespace js */
static JSBool
Reject(JSContext *cx, unsigned errorNumber, bool throwError, jsid id, bool *rval)
{
@ -1608,11 +1597,9 @@ DefinePropertyOnArray(JSContext *cx, HandleObject obj, HandleId id, const PropDe
return DefinePropertyOnObject(cx, obj, id, desc, throwError, rval);
}
namespace js {
bool
DefineProperty(JSContext *cx, HandleObject obj, HandleId id, const PropDesc &desc, bool throwError,
bool *rval)
js::DefineProperty(JSContext *cx, HandleObject obj, HandleId id, const PropDesc &desc,
bool throwError, bool *rval)
{
if (obj->isArray())
return DefinePropertyOnArray(cx, obj, id, desc, throwError, rval);
@ -1630,10 +1617,9 @@ DefineProperty(JSContext *cx, HandleObject obj, HandleId id, const PropDesc &des
return DefinePropertyOnObject(cx, obj, id, desc, throwError, rval);
}
} /* namespace js */
JSBool
js_DefineOwnProperty(JSContext *cx, HandleObject obj, HandleId id, const Value &descriptor, JSBool *bp)
js_DefineOwnProperty(JSContext *cx, HandleObject obj, HandleId id, const Value &descriptor,
JSBool *bp)
{
AutoPropDescArrayRooter descs(cx);
PropDesc *desc = descs.append();
@ -1669,11 +1655,9 @@ obj_defineProperty(JSContext *cx, unsigned argc, Value *vp)
return true;
}
namespace js {
bool
ReadPropertyDescriptors(JSContext *cx, HandleObject props, bool checkAccessors,
AutoIdVector *ids, AutoPropDescArrayRooter *descs)
js::ReadPropertyDescriptors(JSContext *cx, HandleObject props, bool checkAccessors,
AutoIdVector *ids, AutoPropDescArrayRooter *descs)
{
if (!GetPropertyNames(cx, props, JSITER_OWNONLY, ids))
return false;
@ -1693,8 +1677,6 @@ ReadPropertyDescriptors(JSContext *cx, HandleObject props, bool checkAccessors,
return true;
}
} /* namespace js */
static bool
DefineProperties(JSContext *cx, HandleObject obj, HandleObject props)
{
@ -2990,8 +2972,6 @@ DefineStandardSlot(JSContext *cx, HandleObject obj, JSProtoKey key, JSAtom *atom
return named;
}
namespace js {
static void
SetClassObject(JSObject *obj, JSProtoKey key, JSObject *cobj, JSObject *proto)
{
@ -3015,12 +2995,12 @@ ClearClassObject(JSObject *obj, JSProtoKey key)
}
JSObject *
DefineConstructorAndPrototype(JSContext *cx, HandleObject obj, JSProtoKey key, HandleAtom atom,
JSObject *protoProto, Class *clasp,
Native constructor, unsigned nargs,
JSPropertySpec *ps, JSFunctionSpec *fs,
JSPropertySpec *static_ps, JSFunctionSpec *static_fs,
JSObject **ctorp, AllocKind ctorKind)
js::DefineConstructorAndPrototype(JSContext *cx, HandleObject obj, JSProtoKey key, HandleAtom atom,
JSObject *protoProto, Class *clasp,
Native constructor, unsigned nargs,
JSPropertySpec *ps, JSFunctionSpec *fs,
JSPropertySpec *static_ps, JSFunctionSpec *static_fs,
JSObject **ctorp, AllocKind ctorKind)
{
/*
* Create a prototype object for this class.
@ -3166,7 +3146,7 @@ bad:
* whether a class is initialized by calling IsStandardClassResolved().
*/
bool
IsStandardClassResolved(JSObject *obj, js::Class *clasp)
js::IsStandardClassResolved(JSObject *obj, js::Class *clasp)
{
JSProtoKey key = JSCLASS_CACHED_PROTO_KEY(clasp);
@ -3175,7 +3155,7 @@ IsStandardClassResolved(JSObject *obj, js::Class *clasp)
}
void
MarkStandardClassInitializedNoProto(JSObject *obj, js::Class *clasp)
js::MarkStandardClassInitializedNoProto(JSObject *obj, js::Class *clasp)
{
JSProtoKey key = JSCLASS_CACHED_PROTO_KEY(clasp);
@ -3187,8 +3167,6 @@ MarkStandardClassInitializedNoProto(JSObject *obj, js::Class *clasp)
obj->setSlot(key, BooleanValue(true));
}
}
JSObject *
js_InitClass(JSContext *cx, HandleObject obj, JSObject *protoProto_,
Class *clasp, Native constructor, unsigned nargs,
@ -3523,10 +3501,8 @@ static JSClassInitializerOp lazy_prototype_init[JSProto_LIMIT] = {
#undef LAZY_PROTOTYPE_INIT
};
namespace js {
bool
SetProto(JSContext *cx, HandleObject obj, Handle<js::TaggedProto> proto, bool checkForCycles)
js::SetProto(JSContext *cx, HandleObject obj, Handle<js::TaggedProto> proto, bool checkForCycles)
{
JS_ASSERT_IF(!checkForCycles, obj.get() != proto.raw());
@ -3616,13 +3592,9 @@ SetProto(JSContext *cx, HandleObject obj, Handle<js::TaggedProto> proto, bool ch
return true;
}
}
bool
js_GetClassObject(JSContext *cx, RawObject obj, JSProtoKey key,
MutableHandleObject objp)
js_GetClassObject(JSContext *cx, RawObject obj, JSProtoKey key, MutableHandleObject objp)
{
RootedObject global(cx, &obj->global());
if (!global->isGlobal()) {
objp.set(NULL);
@ -3906,12 +3878,10 @@ CallAddPropertyHook(JSContext *cx, Class *clasp, HandleObject obj, HandleShape s
return true;
}
namespace js {
Shape *
DefineNativeProperty(JSContext *cx, HandleObject obj, HandleId id, HandleValue value,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs,
unsigned flags, int shortid, unsigned defineHow /* = 0 */)
js::DefineNativeProperty(JSContext *cx, HandleObject obj, HandleId id, HandleValue value,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs,
unsigned flags, int shortid, unsigned defineHow /* = 0 */)
{
JS_ASSERT((defineHow & ~(DNP_CACHE_RESULT | DNP_DONT_PURGE |
DNP_SKIP_TYPE)) == 0);
@ -4004,8 +3974,6 @@ DefineNativeProperty(JSContext *cx, HandleObject obj, HandleId id, HandleValue v
return shape;
}
} /* namespace js */
/*
* Call obj's resolve hook.
*
@ -4838,10 +4806,8 @@ baseops::DeleteSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid,
return baseops::DeleteGeneric(cx, obj, id, rval, strict);
}
namespace js {
bool
HasDataProperty(JSContext *cx, HandleObject obj, jsid id, Value *vp)
js::HasDataProperty(JSContext *cx, HandleObject obj, jsid id, Value *vp)
{
if (Shape *shape = obj->nativeLookup(cx, id)) {
if (shape->hasDefaultGetter() && shape->hasSlot()) {
@ -4874,7 +4840,7 @@ MaybeCallMethod(JSContext *cx, HandleObject obj, Handle<jsid> id, MutableHandleV
}
JSBool
DefaultValue(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue vp)
js::DefaultValue(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue vp)
{
JS_ASSERT(hint == JSTYPE_NUMBER || hint == JSTYPE_STRING || hint == JSTYPE_VOID);
#if JS_HAS_XML_SUPPORT
@ -4954,8 +4920,6 @@ DefaultValue(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue vp
return false;
}
} /* namespace js */
JS_FRIEND_API(JSBool)
JS_EnumerateState(JSContext *cx, JSHandleObject obj, JSIterateOp enum_op,
JSMutableHandleValue statep, JSMutableHandleId idp)
@ -4977,11 +4941,9 @@ JS_EnumerateState(JSContext *cx, JSHandleObject obj, JSIterateOp enum_op,
return true;
}
namespace js {
JSBool
CheckAccess(JSContext *cx, JSObject *obj_, HandleId id, JSAccessMode mode,
MutableHandleValue vp, unsigned *attrsp)
js::CheckAccess(JSContext *cx, JSObject *obj_, HandleId id, JSAccessMode mode,
MutableHandleValue vp, unsigned *attrsp)
{
JSBool writing;
RootedObject obj(cx, obj_), pobj(cx);
@ -5051,8 +5013,6 @@ CheckAccess(JSContext *cx, JSObject *obj_, HandleId id, JSAccessMode mode,
return !check || check(cx, pobj, id, mode, vp);
}
}
JSType
baseops::TypeOf(JSContext *cx, HandleObject obj)
{
@ -5156,11 +5116,9 @@ js_ValueToObjectOrNull(JSContext *cx, const Value &v, MutableHandleObject objp)
return true;
}
namespace js {
/* Callers must handle the already-object case . */
JSObject *
ToObjectSlow(JSContext *cx, HandleValue val, bool reportScanStack)
js::ToObjectSlow(JSContext *cx, HandleValue val, bool reportScanStack)
{
JS_ASSERT(!val.isMagic());
JS_ASSERT(!val.isObject());
@ -5178,8 +5136,6 @@ ToObjectSlow(JSContext *cx, HandleValue val, bool reportScanStack)
return PrimitiveToObject(cx, val);
}
}
JSObject *
js_ValueToNonNullObject(JSContext *cx, const Value &v)
{

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

@ -862,11 +862,9 @@ Revive(JSContext *cx, HandleValue reviver, MutableHandleValue vp)
return Walk(cx, obj, id, reviver, vp);
}
namespace js {
JSBool
ParseJSONWithReviver(JSContext *cx, StableCharPtr chars, size_t length, HandleValue reviver,
MutableHandleValue vp, DecodingMode decodingMode /* = STRICT */)
js::ParseJSONWithReviver(JSContext *cx, StableCharPtr chars, size_t length, HandleValue reviver,
MutableHandleValue vp, DecodingMode decodingMode /* = STRICT */)
{
/* 15.12.2 steps 2-3. */
JSONParser parser(cx, chars, length,
@ -880,8 +878,6 @@ ParseJSONWithReviver(JSContext *cx, StableCharPtr chars, size_t length, HandleVa
return true;
}
} /* namespace js */
#if JS_HAS_TOSOURCE
static JSBool
json_toSource(JSContext *cx, unsigned argc, Value *vp)

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

@ -6548,10 +6548,8 @@ ReconstructPCStack(JSContext *cx, JSScript *script, jsbytecode *target, jsbyteco
#undef LOCAL_ASSERT
#undef LOCAL_ASSERT_RV
namespace js {
bool
CallResultEscapes(jsbytecode *pc)
js::CallResultEscapes(jsbytecode *pc)
{
/*
* If we see any of these sequences, the result is unused:
@ -6577,7 +6575,7 @@ CallResultEscapes(jsbytecode *pc)
}
extern bool
IsValidBytecodeOffset(JSContext *cx, JSScript *script, size_t offset)
js::IsValidBytecodeOffset(JSContext *cx, JSScript *script, size_t offset)
{
// This could be faster (by following jump instructions if the target is <= offset).
for (BytecodeRange r(script); !r.empty(); r.popFront()) {
@ -6589,7 +6587,7 @@ IsValidBytecodeOffset(JSContext *cx, JSScript *script, size_t offset)
}
JS_FRIEND_API(size_t)
GetPCCountScriptCount(JSContext *cx)
js::GetPCCountScriptCount(JSContext *cx)
{
JSRuntime *rt = cx->runtime;
@ -6626,7 +6624,7 @@ AppendArrayJSONProperties(JSContext *cx, StringBuffer &buf,
}
JS_FRIEND_API(JSString *)
GetPCCountScriptSummary(JSContext *cx, size_t index)
js::GetPCCountScriptSummary(JSContext *cx, size_t index)
{
JSRuntime *rt = cx->runtime;
@ -6919,7 +6917,7 @@ GetPCCountJSON(JSContext *cx, const ScriptAndCounts &sac, StringBuffer &buf)
}
JS_FRIEND_API(JSString *)
GetPCCountScriptContents(JSContext *cx, size_t index)
js::GetPCCountScriptContents(JSContext *cx, size_t index)
{
JSRuntime *rt = cx->runtime;
@ -6944,5 +6942,3 @@ GetPCCountScriptContents(JSContext *cx, size_t index)
return buf.finishString();
}
} // namespace js

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

@ -37,9 +37,7 @@ using namespace js::frontend;
using mozilla::DebugOnly;
using mozilla::ArrayLength;
namespace js {
char const *aopNames[] = {
char const *js::aopNames[] = {
"=", /* AOP_ASSIGN */
"+=", /* AOP_PLUS */
"-=", /* AOP_MINUS */
@ -54,7 +52,7 @@ char const *aopNames[] = {
"&=" /* AOP_BITAND */
};
char const *binopNames[] = {
char const *js::binopNames[] = {
"==", /* BINOP_EQ */
"!=", /* BINOP_NE */
"===", /* BINOP_STRICTEQ */
@ -79,7 +77,7 @@ char const *binopNames[] = {
"..", /* BINOP_DBLDOT */
};
char const *unopNames[] = {
char const *js::unopNames[] = {
"delete", /* UNOP_DELETE */
"-", /* UNOP_NEG */
"+", /* UNOP_POS */
@ -89,14 +87,14 @@ char const *unopNames[] = {
"void" /* UNOP_VOID */
};
char const *nodeTypeNames[] = {
char const *js::nodeTypeNames[] = {
#define ASTDEF(ast, str, method) str,
#include "jsast.tbl"
#undef ASTDEF
NULL
};
char const *callbackNames[] = {
static char const *callbackNames[] = {
#define ASTDEF(ast, str, method) method,
#include "jsast.tbl"
#undef ASTDEF
@ -1685,13 +1683,11 @@ NodeBuilder::xmlPI(HandleValue target, HandleValue contents, TokenPos *pos, Muta
dst);
}
/*
* Serialization of parse nodes to JavaScript objects.
*
* All serialization methods take a non-nullable ParseNode pointer.
*/
class ASTSerializer
{
JSContext *cx;
@ -3386,8 +3382,6 @@ ASTSerializer::functionBody(ParseNode *pn, TokenPos *pos, MutableHandleValue dst
return builder.blockStatement(elts, pos, dst);
}
} /* namespace js */
static JSBool
reflect_parse(JSContext *cx, uint32_t argc, jsval *vp)
{
@ -3515,7 +3509,6 @@ static JSFunctionSpec static_methods[] = {
JS_FS_END
};
JS_PUBLIC_API(JSObject *)
JS_InitReflect(JSContext *cx, JSObject *objArg)
{

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

@ -98,5 +98,4 @@ extern char const *nodeTypeNames[];
} /* namespace js */
#endif /* jsreflect_h___ */

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

@ -1938,8 +1938,6 @@ JSScript::finalize(FreeOp *fop)
}
}
namespace js {
static const uint32_t GSN_CACHE_THRESHOLD = 100;
static const uint32_t GSN_CACHE_MAP_INIT_SIZE = 20;
@ -1951,8 +1949,6 @@ GSNCache::purge()
map.finish();
}
} /* namespace js */
jssrcnote *
js_GetSrcNote(JSContext *cx, RawScript script, jsbytecode *pc)
{
@ -2133,18 +2129,16 @@ js_GetScriptLineExtent(RawScript script)
return 1 + lineno - script->lineno;
}
namespace js {
unsigned
CurrentLine(JSContext *cx)
js::CurrentLine(JSContext *cx)
{
AutoAssertNoGC nogc;
return PCToLineNumber(cx->fp()->script().get(nogc), cx->regs().pc);
}
void
CurrentScriptFileLineOriginSlow(JSContext *cx, const char **file, unsigned *linenop,
JSPrincipals **origin)
js::CurrentScriptFileLineOriginSlow(JSContext *cx, const char **file, unsigned *linenop,
JSPrincipals **origin)
{
AutoAssertNoGC nogc;
NonBuiltinScriptFrameIter iter(cx);
@ -2162,8 +2156,6 @@ CurrentScriptFileLineOriginSlow(JSContext *cx, const char **file, unsigned *line
*origin = script->originPrincipals;
}
} /* namespace js */
template <class T>
static inline T *
Rebase(RawScript dst, RawScript src, T *srcp)

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

@ -3460,10 +3460,8 @@ js_ValueToSource(JSContext *cx, const Value &v)
return ToString(cx, rval);
}
namespace js {
bool
EqualStrings(JSContext *cx, JSString *str1, JSString *str2, bool *result)
js::EqualStrings(JSContext *cx, JSString *str1, JSString *str2, bool *result)
{
if (str1 == str2) {
*result = true;
@ -3488,7 +3486,7 @@ EqualStrings(JSContext *cx, JSString *str1, JSString *str2, bool *result)
}
bool
EqualStrings(JSLinearString *str1, JSLinearString *str2)
js::EqualStrings(JSLinearString *str1, JSLinearString *str2)
{
if (str1 == str2)
return true;
@ -3500,10 +3498,6 @@ EqualStrings(JSLinearString *str1, JSLinearString *str2)
return PodEqual(str1->chars(), str2->chars(), length1);
}
} /* namespace js */
namespace js {
static bool
CompareStringsImpl(JSContext *cx, JSString *str1, JSString *str2, int32_t *result)
{
@ -3527,17 +3521,13 @@ CompareStringsImpl(JSContext *cx, JSString *str1, JSString *str2, int32_t *resul
}
bool
CompareStrings(JSContext *cx, JSString *str1, JSString *str2, int32_t *result)
js::CompareStrings(JSContext *cx, JSString *str1, JSString *str2, int32_t *result)
{
return CompareStringsImpl(cx, str1, str2, result);
}
} /* namespace js */
namespace js {
bool
StringEqualsAscii(JSLinearString *str, const char *asciiBytes)
js::StringEqualsAscii(JSLinearString *str, const char *asciiBytes)
{
size_t length = strlen(asciiBytes);
#ifdef DEBUG
@ -3554,8 +3544,6 @@ StringEqualsAscii(JSLinearString *str, const char *asciiBytes)
return true;
}
} /* namespacejs */
size_t
js_strlen(const jschar *s)
{
@ -3600,10 +3588,8 @@ js_strchr_limit(const jschar *s, jschar c, const jschar *limit)
return NULL;
}
namespace js {
jschar *
InflateString(JSContext *cx, const char *bytes, size_t *lengthp)
js::InflateString(JSContext *cx, const char *bytes, size_t *lengthp)
{
AssertCanGC();
size_t nchars;
@ -3630,7 +3616,7 @@ InflateString(JSContext *cx, const char *bytes, size_t *lengthp)
}
jschar *
InflateUTF8String(JSContext *cx, const char *bytes, size_t *lengthp)
js::InflateUTF8String(JSContext *cx, const char *bytes, size_t *lengthp)
{
AssertCanGC();
size_t nchars;
@ -3663,7 +3649,7 @@ InflateUTF8String(JSContext *cx, const char *bytes, size_t *lengthp)
* May be called with null cx.
*/
char *
DeflateString(JSContext *maybecx, const jschar *chars, size_t nchars)
js::DeflateString(JSContext *maybecx, const jschar *chars, size_t nchars)
{
AutoAssertNoGC nogc;
size_t nbytes = nchars;
@ -3679,13 +3665,13 @@ DeflateString(JSContext *maybecx, const jschar *chars, size_t nchars)
}
size_t
GetDeflatedStringLength(JSContext *cx, const jschar *chars, size_t nchars)
js::GetDeflatedStringLength(JSContext *cx, const jschar *chars, size_t nchars)
{
return nchars;
}
bool
DeflateStringToBuffer(JSContext *maybecx, const jschar *src, size_t srclen,
js::DeflateStringToBuffer(JSContext *maybecx, const jschar *src, size_t srclen,
char *dst, size_t *dstlenp)
{
size_t dstlen = *dstlenp;
@ -3704,9 +3690,8 @@ DeflateStringToBuffer(JSContext *maybecx, const jschar *src, size_t srclen,
return JS_TRUE;
}
bool
InflateStringToBuffer(JSContext *maybecx, const char *src, size_t srclen,
js::InflateStringToBuffer(JSContext *maybecx, const char *src, size_t srclen,
jschar *dst, size_t *dstlenp)
{
if (dst) {
@ -3728,7 +3713,7 @@ InflateStringToBuffer(JSContext *maybecx, const char *src, size_t srclen,
}
bool
InflateUTF8StringToBuffer(JSContext *cx, const char *src, size_t srclen,
js::InflateUTF8StringToBuffer(JSContext *cx, const char *src, size_t srclen,
jschar *dst, size_t *dstlenp)
{
size_t dstlen, origDstlen, offset, j, n;
@ -3808,8 +3793,6 @@ bufferTooSmall:
return JS_FALSE;
}
} /* namepsace js */
const jschar js_uriReservedPlusPound_ucstr[] =
{';', '/', '?', ':', '@', '&', '=', '+', '$', ',', '#', 0};
const jschar js_uriUnescaped_ucstr[] =
@ -4184,10 +4167,9 @@ Utf8ToOneUcs4Char(const uint8_t *utf8Buffer, int utf8Length)
return ucs4Char;
}
namespace js {
size_t
PutEscapedStringImpl(char *buffer, size_t bufferSize, FILE *fp, JSLinearString *str, uint32_t quote)
js::PutEscapedStringImpl(char *buffer, size_t bufferSize, FILE *fp, JSLinearString *str,
uint32_t quote)
{
enum {
STOP, FIRST_QUOTE, LAST_QUOTE, CHARS, ESCAPE_START, ESCAPE_MORE
@ -4296,5 +4278,3 @@ PutEscapedStringImpl(char *buffer, size_t bufferSize, FILE *fp, JSLinearString *
buffer[n] = '\0';
return n;
}
} /* namespace js */

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

@ -21,8 +21,6 @@
using namespace js;
namespace js {
bool
WeakMapBase::markAllIteratively(JSTracer *tracer)
{
@ -89,8 +87,6 @@ WeakMapBase::restoreWeakMapList(JSRuntime *rt, WeakMapVector &vector)
}
}
} /* namespace js */
typedef WeakMap<EncapsulatedPtrObject, RelocatableValue> ObjectValueMap;
static ObjectValueMap *

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

@ -29,9 +29,7 @@
using namespace js;
using namespace js::gc;
namespace js {
int sWrapperFamily;
}
int js::sWrapperFamily;
void *
Wrapper::getWrapperFamily()
@ -825,8 +823,6 @@ SecurityWrapper<Base>::regexp_toShared(JSContext *cx, JSObject *obj, RegExpGuard
template class js::SecurityWrapper<Wrapper>;
template class js::SecurityWrapper<CrossCompartmentWrapper>;
namespace js {
DeadObjectProxy::DeadObjectProxy()
: BaseProxyHandler(&sDeadObjectFamily)
{
@ -969,8 +965,6 @@ DeadObjectProxy::getPrototypeOf(JSContext *cx, JSObject *proxy, JSObject **proto
DeadObjectProxy DeadObjectProxy::singleton;
int DeadObjectProxy::sDeadObjectFamily;
} // namespace js
JSObject *
js::NewDeadProxyObject(JSContext *cx, JSObject *parent)
{

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

@ -2833,10 +2833,8 @@ ReportBadXMLName(JSContext *cx, const Value &idval)
js_ReportValueError(cx, JSMSG_BAD_XML_NAME, JSDVG_IGNORE_STACK, val, NullPtr());
}
namespace js {
bool
GetLocalNameFromFunctionQName(JSObject *qn, JSAtom **namep, JSContext *cx)
js::GetLocalNameFromFunctionQName(JSObject *qn, JSAtom **namep, JSContext *cx)
{
JSAtom *atom = cx->names().functionNamespaceURI;
JSLinearString *uri = qn->getNameURI();
@ -2847,8 +2845,6 @@ GetLocalNameFromFunctionQName(JSObject *qn, JSAtom **namep, JSContext *cx)
return false;
}
} /* namespace js */
bool
js_GetLocalNameFromFunctionQName(JSObject *obj, jsid *funidp, JSContext *cx)
{
@ -7467,8 +7463,6 @@ js_InitXMLClasses(JSContext *cx, HandleObject obj)
return js_InitXMLClass(cx, obj);
}
namespace js {
bool
GlobalObject::getFunctionNamespace(JSContext *cx, Value *vp)
{
@ -7498,8 +7492,6 @@ GlobalObject::getFunctionNamespace(JSContext *cx, Value *vp)
return true;
}
} // namespace js
/*
* Note the asymmetry between js_GetDefaultXMLNamespace and js_SetDefaultXML-
* Namespace. Get searches fp->scopeChain for JS_DEFAULT_XML_NAMESPACE_ID,

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

@ -57,8 +57,6 @@ ThrowTypeError(JSContext *cx, unsigned argc, Value *vp)
return false;
}
namespace js {
static bool
TestProtoGetterThis(const Value &v)
{
@ -92,7 +90,9 @@ ProtoGetter(JSContext *cx, unsigned argc, Value *vp)
return CallNonGenericMethod(cx, TestProtoGetterThis, ProtoGetterImpl, args);
}
namespace js {
size_t sSetProtoCalled = 0;
} // namespace js
static bool
TestProtoSetterThis(const Value &v)
@ -533,7 +533,7 @@ GlobalObject::createBlankPrototypeInheriting(JSContext *cx, Class *clasp, JSObje
}
bool
LinkConstructorAndPrototype(JSContext *cx, JSObject *ctor_, JSObject *proto_)
js::LinkConstructorAndPrototype(JSContext *cx, JSObject *ctor_, JSObject *proto_)
{
RootedObject ctor(cx, ctor_), proto(cx, proto_);
@ -548,8 +548,8 @@ LinkConstructorAndPrototype(JSContext *cx, JSObject *ctor_, JSObject *proto_)
}
bool
DefinePropertiesAndBrand(JSContext *cx, JSObject *obj_,
const JSPropertySpec *ps, const JSFunctionSpec *fs)
js::DefinePropertiesAndBrand(JSContext *cx, JSObject *obj_,
const JSPropertySpec *ps, const JSFunctionSpec *fs)
{
RootedObject obj(cx, obj_);
@ -560,7 +560,7 @@ DefinePropertiesAndBrand(JSContext *cx, JSObject *obj_,
return true;
}
void
static void
GlobalDebuggees_finalize(FreeOp *fop, RawObject obj)
{
fop->delete_((GlobalObject::DebuggerVector *) obj->getPrivate());
@ -620,5 +620,3 @@ GlobalObject::addDebugger(JSContext *cx, Handle<GlobalObject*> global, Debugger
}
return true;
}
} // namespace js

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

@ -1068,8 +1068,6 @@ ScopeIterKey::match(ScopeIterKey si1, ScopeIterKey si2)
/*****************************************************************************/
namespace js {
/*
* DebugScopeProxy is the handler for DebugScopeObject proxy objects. Having a
* custom handler (rather than trying to reuse js::Wrapper) gives us several
@ -1461,8 +1459,6 @@ class DebugScopeProxy : public BaseProxyHandler
}
};
} /* namespace js */
int DebugScopeProxy::family = 0;
DebugScopeProxy DebugScopeProxy::singleton;

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

@ -6,8 +6,8 @@
*/
#include "Unicode.h"
namespace js {
namespace unicode {
using namespace js;
using namespace js::unicode;
/*
* So how does indexing work?
@ -53,7 +53,7 @@ namespace unicode {
* increase shift
* stop if you found the best shift
*/
const CharacterInfo js_charinfo[] = {
const CharacterInfo unicode::js_charinfo[] = {
{0, 0, 0},
{0, 0, 1},
{0, 0, 4},
@ -197,7 +197,7 @@ const CharacterInfo js_charinfo[] = {
{58272, 0, 2},
};
const uint8_t index1[] = {
const uint8_t unicode::index1[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
@ -257,7 +257,7 @@ const uint8_t index1[] = {
26, 26, 26, 26, 165, 166, 167, 168, 169, 170, 26, 171, 172, 173, 174, 175,
};
const uint8_t index2[] = {
const uint8_t unicode::index2[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2,
@ -886,6 +886,4 @@ const uint8_t index2[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
} /* namespace unicode */
} /* namespace js */

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

@ -28,8 +28,6 @@ using namespace js;
using mozilla::DebugOnly;
namespace js {
void
XDRBuffer::freeBuffer()
{
@ -167,8 +165,5 @@ XDRDecoder::XDRDecoder(JSContext *cx, const void *data, uint32_t length,
this->originPrincipals = JSScript::normalizeOriginPrincipals(principals, originPrincipals);
}
template class XDRState<XDR_ENCODE>;
template class XDRState<XDR_DECODE>;
} /* namespace js */
template class js::XDRState<XDR_ENCODE>;
template class js::XDRState<XDR_DECODE>;

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

@ -255,10 +255,10 @@ if (typeof reportCompare === "function")
data_file.write('/* Generated by make_unicode.py DO NOT MODIFY */\n')
data_file.write(public_domain)
data_file.write('#include "Unicode.h"\n\n')
data_file.write('namespace js {\n')
data_file.write('namespace unicode {\n')
data_file.write('using namespace js;\n')
data_file.write('using namespace js::unicode;\n')
data_file.write(comment)
data_file.write('const CharacterInfo js_charinfo[] = {\n')
data_file.write('const CharacterInfo unicode::js_charinfo[] = {\n')
for d in table:
data_file.write(' {')
data_file.write(', '.join((str(e) for e in d)))
@ -267,7 +267,7 @@ if (typeof reportCompare === "function")
data_file.write('\n')
def dump(data, name, file):
file.write('const uint8_t ' + name + '[] = {\n')
file.write('const uint8_t unicode::' + name + '[] = {\n')
line = pad = ' ' * 4
lines = []
@ -291,8 +291,6 @@ if (typeof reportCompare === "function")
dump(index2, 'index2', data_file)
data_file.write('\n')
data_file.write('} /* namespace unicode */\n')
data_file.write('} /* namespace js */\n')
data_file.write('\n')
def getsize(data):