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
parent 690e22a9ec
commit 364708cb56
45 changed files with 305 additions and 592 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1068,8 +1068,6 @@ ScopeIterKey::match(ScopeIterKey si1, ScopeIterKey si2)
/*****************************************************************************/ /*****************************************************************************/
namespace js {
/* /*
* DebugScopeProxy is the handler for DebugScopeObject proxy objects. Having a * DebugScopeProxy is the handler for DebugScopeObject proxy objects. Having a
* custom handler (rather than trying to reuse js::Wrapper) gives us several * 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; int DebugScopeProxy::family = 0;
DebugScopeProxy DebugScopeProxy::singleton; DebugScopeProxy DebugScopeProxy::singleton;

View File

@ -6,8 +6,8 @@
*/ */
#include "Unicode.h" #include "Unicode.h"
namespace js { using namespace js;
namespace unicode { using namespace js::unicode;
/* /*
* So how does indexing work? * So how does indexing work?
@ -53,7 +53,7 @@ namespace unicode {
* increase shift * increase shift
* stop if you found the best shift * stop if you found the best shift
*/ */
const CharacterInfo js_charinfo[] = { const CharacterInfo unicode::js_charinfo[] = {
{0, 0, 0}, {0, 0, 0},
{0, 0, 1}, {0, 0, 1},
{0, 0, 4}, {0, 0, 4},
@ -197,7 +197,7 @@ const CharacterInfo js_charinfo[] = {
{58272, 0, 2}, {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, 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, 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, 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, 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, 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, 0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
}; };
} /* namespace unicode */
} /* namespace js */

View File

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

View File

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