import changes from rmottola/Arctic-Fox:

- change some pointer style, or patches do not apply (0de8fac13)
- Bug 1137523 - Unprefix most js_* functions. (16507a434)
This commit is contained in:
2019-01-29 10:29:22 +08:00
parent 8ea0072acd
commit 9f3e30f71b
154 changed files with 1181 additions and 1265 deletions
+1 -1
View File
@@ -425,7 +425,7 @@ InterfaceObjectToString(JSContext* cx, unsigned argc, JS::Value *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
if (!args.thisv().isObject()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx, js::GetErrorMessage, nullptr,
JSMSG_CANT_CONVERT_TO, "null", "object");
return false;
}
+1 -1
View File
@@ -10237,7 +10237,7 @@ class CGDOMJSProxyHandler_defineProperty(ClassMethod):
"if (hasUnforgeable) {\n"
" *defined = true;\n"
" bool unused;\n"
" return js_DefineOwnProperty(cx, ${holder}, id, desc, &unused);\n"
" return js::DefineOwnProperty(cx, ${holder}, id, desc, &unused);\n"
"}\n")
set += CallOnUnforgeableHolder(self.descriptor,
defineOnUnforgeable,
+2 -2
View File
@@ -201,7 +201,7 @@ DOMProxyHandler::defineProperty(JSContext* cx, JS::Handle<JSObject*> proxy, JS::
return JS_ReportErrorFlagsAndNumber(cx,
JSREPORT_WARNING | JSREPORT_STRICT |
JSREPORT_STRICT_MODE_ERROR,
js_GetErrorMessage, nullptr,
js::GetErrorMessage, nullptr,
JSMSG_GETTER_ONLY);
}
@@ -215,7 +215,7 @@ DOMProxyHandler::defineProperty(JSContext* cx, JS::Handle<JSObject*> proxy, JS::
}
bool dummy;
return js_DefineOwnProperty(cx, expando, id, desc, &dummy);
return js::DefineOwnProperty(cx, expando, id, desc, &dummy);
}
bool
+1 -1
View File
@@ -223,7 +223,7 @@ StructuredCloneWriteCallback(JSContext* aCx,
if (JS_GetClass(aObj) == IDBObjectStore::DummyPropClass()) {
MOZ_ASSERT(!cloneWriteInfo->mOffsetToKeyProp);
cloneWriteInfo->mOffsetToKeyProp = js_GetSCOffset(aWriter);
cloneWriteInfo->mOffsetToKeyProp = js::GetSCOffset(aWriter);
uint64_t value = 0;
// Omit endian swap
+1 -1
View File
@@ -1744,7 +1744,7 @@ NPObjWrapper_Convert(JSContext *cx, JS::Handle<JSObject*> obj, JSType hint, JS::
return true;
}
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
JS_ReportErrorNumber(cx, js::GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
JS_GetClass(obj)->name,
hint == JSTYPE_VOID
? "primitive type"
+2 -2
View File
@@ -803,7 +803,7 @@ JSObject *GetOrCreateObjectProperty(JSContext *cx, JS::Handle<JSObject*> aObject
return &val.toObject();
}
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx, js::GetErrorMessage, nullptr,
JSMSG_UNEXPECTED_TYPE, aProperty, "not an object");
return nullptr;
}
@@ -840,7 +840,7 @@ bool DefineOSFileConstants(JSContext *cx, JS::Handle<JSObject*> global)
// |gInitialized == true| but |gPaths == nullptr|. We cannot
// |MOZ_ASSERT| this, as this would kill precompile_cache.js,
// so we simply return an error.
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx, js::GetErrorMessage, nullptr,
JSMSG_CANT_OPEN, "OSFileConstants", "initialization has failed");
return false;
}
+1 -1
View File
@@ -457,7 +457,7 @@ ServiceWorkerGlobalScope::Clients()
bool
GetterOnlyJSNative(JSContext* aCx, unsigned aArgc, JS::Value* aVp)
{
JS_ReportErrorNumber(aCx, js_GetErrorMessage, nullptr, JSMSG_GETTER_ONLY);
JS_ReportErrorNumber(aCx, js::GetErrorMessage, nullptr, JSMSG_GETTER_ONLY);
return false;
}
+1 -1
View File
@@ -106,7 +106,7 @@ class Logging
obj = shared->objects_.find(id);
if (obj) {
JSAutoCompartment ac(cx, obj);
objDesc = js_ObjectClassName(cx, obj);
objDesc = js::ObjectClassName(cx, obj);
} else {
objDesc = "<dead object>";
}
+3 -3
View File
@@ -180,7 +180,7 @@ WrapperAnswer::RecvDefineProperty(const ObjectId& objId, const JSIDVariant& idVa
return fail(cx, rs);
bool ignored;
if (!js_DefineOwnProperty(cx, obj, id, desc, &ignored))
if (!js::DefineOwnProperty(cx, obj, id, desc, &ignored))
return fail(cx, rs);
return ok(rs);
@@ -513,7 +513,7 @@ WrapperAnswer::RecvObjectClassIs(const ObjectId& objId, const uint32_t& classVal
LOG("%s.objectClassIs()", ReceiverObj(objId));
*result = js_ObjectClassIs(cx, obj, (js::ESClassValue)classValue);
*result = js::ObjectClassIs(cx, obj, (js::ESClassValue)classValue);
return true;
}
@@ -533,7 +533,7 @@ WrapperAnswer::RecvClassName(const ObjectId& objId, nsString* name)
LOG("%s.className()", ReceiverObj(objId));
*name = NS_ConvertASCIItoUTF16(js_ObjectClassName(cx, obj));
*name = NS_ConvertASCIItoUTF16(js::ObjectClassName(cx, obj));
return true;
}
+3 -3
View File
@@ -675,9 +675,9 @@ inline void assertEnteredPolicy(JSContext* cx, JSObject* obj, jsid id,
{}
#endif
extern JS_FRIEND_API(JSObject*)
InitProxyClass(JSContext *cx, JS::HandleObject obj);
} /* namespace js */
extern JS_FRIEND_API(JSObject*)
js_InitProxyClass(JSContext* cx, JS::HandleObject obj);
#endif /* js_Proxy_h */
+4 -4
View File
@@ -73,7 +73,7 @@ CloneModule(JSContext* cx, MutableHandle<AsmJSModuleObject*> moduleObj)
static bool
LinkFail(JSContext* cx, const char* str)
{
JS_ReportErrorFlagsAndNumber(cx, JSREPORT_WARNING, js_GetErrorMessage,
JS_ReportErrorFlagsAndNumber(cx, JSREPORT_WARNING, GetErrorMessage,
nullptr, JSMSG_USE_ASM_LINK_FAIL, str);
return false;
}
@@ -252,7 +252,7 @@ ValidateByteLength(JSContext* cx, HandleValue globalVal)
RootedFunction fun(cx, &v.toObject().as<JSFunction>());
RootedValue boundTarget(cx, ObjectValue(*fun->getBoundFunctionTarget()));
if (!IsNativeFunction(boundTarget, js_fun_call))
if (!IsNativeFunction(boundTarget, fun_call))
return LinkFail(cx, "bound target of byteLength must be Function.prototype.call");
RootedValue boundThis(cx, fun->getBoundFunctionThis());
@@ -736,7 +736,7 @@ CallAsmJS(JSContext* cx, unsigned argc, Value* vp)
// since these can technically pop out anywhere and the full fix may
// actually OOM when trying to allocate the PROT_NONE memory.
if (module.hasDetachedHeap()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_OUT_OF_MEMORY);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_OUT_OF_MEMORY);
return false;
}
@@ -1235,7 +1235,7 @@ js::IsAsmJSModuleLoadedFromCache(JSContext* cx, unsigned argc, Value* vp)
JSFunction* fun;
if (!args.hasDefined(0) || !IsMaybeWrappedNativeFunction(args[0], LinkAsmJS, &fun)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_USE_ASM_TYPE_FAIL,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_USE_ASM_TYPE_FAIL,
"argument passed to isAsmJSModuleLoadedFromCache is not a "
"validated asm.js module");
return false;
+6 -6
View File
@@ -65,7 +65,7 @@ AllocateExecutableMemory(ExclusiveContext* cx, size_t bytes)
#endif
void* p = AllocateExecutableMemory(nullptr, bytes, permissions, "asm-js-code", AsmJSPageSize);
if (!p)
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return (uint8_t*)p;
}
@@ -455,7 +455,7 @@ static void
AsmJSReportOverRecursed()
{
JSContext* cx = JSRuntime::innermostAsmJSActivation()->cx();
js_ReportOverRecursed(cx);
ReportOverRecursed(cx);
}
static void
@@ -463,14 +463,14 @@ OnDetached()
{
// See hasDetachedHeap comment in LinkAsmJS.
JSContext* cx = JSRuntime::innermostAsmJSActivation()->cx();
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_OUT_OF_MEMORY);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_OUT_OF_MEMORY);
}
static void
OnOutOfBounds()
{
JSContext* cx = JSRuntime::innermostAsmJSActivation()->cx();
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_INDEX);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_INDEX);
}
static bool
@@ -1669,7 +1669,7 @@ AsmJSModule::setProfilingEnabled(JSContext* cx, bool enabled)
// we cannot malloc.
if (enabled) {
if (!profilingLabels_.resize(names_.length())) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return false;
}
const char* filename = scriptSource_->filename();
@@ -1684,7 +1684,7 @@ AsmJSModule::setProfilingEnabled(JSContext* cx, bool enabled)
? JS_smprintf("%s (%s:%u)", name->latin1Chars(nogc), filename, lineno)
: JS_smprintf("%hs (%s:%u)", name->twoByteChars(nogc), filename, lineno));
if (!label) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return false;
}
profilingLabels_[cr.functionNameIndex()].reset(label.get());
+1 -1
View File
@@ -1482,7 +1482,7 @@ class MOZ_STACK_CLASS ModuleCompiler
errorString_.get());
}
if (errorOverRecursed_)
js_ReportOverRecursed(cx_);
ReportOverRecursed(cx_);
}
bool init() {
+4 -4
View File
@@ -154,7 +154,7 @@ const Class AtomicsObject::class_ = {
static bool
ReportBadArrayType(JSContext* cx)
{
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_ATOMICS_BAD_ARRAY);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_ATOMICS_BAD_ARRAY);
return false;
}
@@ -1080,7 +1080,7 @@ js::FutexRuntime::wait(JSContext* cx, double timeout_ms, AtomicsObject::FutexWai
// See explanation below.
if (state_ == WaitingInterrupted) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_ATOMICS_WAIT_NOT_ALLOWED);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_ATOMICS_WAIT_NOT_ALLOWED);
return false;
}
@@ -1089,7 +1089,7 @@ js::FutexRuntime::wait(JSContext* cx, double timeout_ms, AtomicsObject::FutexWai
// Reject the timeout if it is not exactly representable. 2e50 ms = 2e53 us = 6e39 years.
if (timed && timeout_ms > 2e50) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_ATOMICS_TOO_LONG);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_ATOMICS_TOO_LONG);
return false;
}
@@ -1262,7 +1262,7 @@ AtomicsObject::initClass(JSContext* cx, Handle<GlobalObject*> global)
}
JSObject*
js_InitAtomicsClass(JSContext* cx, HandleObject obj)
js::InitAtomicsClass(JSContext* cx, HandleObject obj)
{
MOZ_ASSERT(obj->is<GlobalObject>());
Rooted<GlobalObject*> global(cx, &obj->as<GlobalObject>());
+3 -3
View File
@@ -123,9 +123,9 @@ public:
#endif
};
JSObject*
InitAtomicsClass(JSContext* cx, HandleObject obj);
} /* namespace js */
JSObject*
js_InitAtomicsClass(JSContext* cx, js::HandleObject obj);
#endif /* builtin_AtomicsObject_h */
+2 -2
View File
@@ -234,7 +234,7 @@ EvalKernel(JSContext* cx, const CallArgs& args, EvalType evalType, AbstractFrame
Rooted<GlobalObject*> scopeObjGlobal(cx, &scopeobj->global());
if (!GlobalObject::isRuntimeCodeGenEnabled(cx, scopeObjGlobal)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CSP_BLOCKED_EVAL);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CSP_BLOCKED_EVAL);
return false;
}
@@ -358,7 +358,7 @@ js::DirectEvalStringFromIon(JSContext* cx,
Rooted<GlobalObject*> scopeObjGlobal(cx, &scopeobj->global());
if (!GlobalObject::isRuntimeCodeGenEnabled(cx, scopeObjGlobal)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CSP_BLOCKED_EVAL);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CSP_BLOCKED_EVAL);
return false;
}
+20 -20
View File
@@ -769,14 +769,14 @@ js::intl_availableCollations(JSContext* cx, unsigned argc, Value* vp)
UErrorCode status = U_ZERO_ERROR;
UEnumeration* values = ucol_getKeywordValuesForLocale("co", locale.ptr(), false, &status);
if (U_FAILURE(status)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
return false;
}
ScopedICUObject<UEnumeration> toClose(values, uenum_close);
uint32_t count = uenum_count(values, &status);
if (U_FAILURE(status)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
return false;
}
@@ -788,7 +788,7 @@ js::intl_availableCollations(JSContext* cx, unsigned argc, Value* vp)
for (uint32_t i = 0; i < count; i++) {
const char* collation = uenum_next(values, nullptr, &status);
if (U_FAILURE(status)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
return false;
}
@@ -938,7 +938,7 @@ NewUCollator(JSContext* cx, HandleObject collator)
UErrorCode status = U_ZERO_ERROR;
UCollator* coll = ucol_open(icuLocale(locale.ptr()), &status);
if (U_FAILURE(status)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
return nullptr;
}
@@ -950,7 +950,7 @@ NewUCollator(JSContext* cx, HandleObject collator)
ucol_setAttribute(coll, UCOL_CASE_FIRST, uCaseFirst, &status);
if (U_FAILURE(status)) {
ucol_close(coll);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
return nullptr;
}
@@ -1266,7 +1266,7 @@ js::intl_numberingSystem(JSContext* cx, unsigned argc, Value* vp)
UErrorCode status = U_ZERO_ERROR;
NumberingSystem* numbers = NumberingSystem::createInstance(ulocale, status);
if (U_FAILURE(status)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
return false;
}
const char* name = numbers->getName();
@@ -1397,7 +1397,7 @@ NewUNumberFormat(JSContext* cx, HandleObject numberFormat)
UErrorCode status = U_ZERO_ERROR;
UNumberFormat* nf = unum_open(uStyle, nullptr, 0, icuLocale(locale.ptr()), nullptr, &status);
if (U_FAILURE(status)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
return nullptr;
}
ScopedICUObject<UNumberFormat> toClose(nf, unum_close);
@@ -1405,7 +1405,7 @@ NewUNumberFormat(JSContext* cx, HandleObject numberFormat)
if (uCurrency) {
unum_setTextAttribute(nf, UNUM_CURRENCY_CODE, uCurrency, 3, &status);
if (U_FAILURE(status)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
return nullptr;
}
}
@@ -1444,7 +1444,7 @@ intl_FormatNumber(JSContext* cx, UNumberFormat* nf, double x, MutableHandleValue
unum_formatDouble(nf, x, Char16ToUChar(chars.begin()), size, nullptr, &status);
}
if (U_FAILURE(status)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
return false;
}
@@ -1743,7 +1743,7 @@ js::intl_availableCalendars(JSContext* cx, unsigned argc, Value* vp)
UCalendar* cal = ucal_open(nullptr, 0, locale.ptr(), UCAL_DEFAULT, &status);
const char* calendar = ucal_getType(cal, &status);
if (U_FAILURE(status)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
return false;
}
ucal_close(cal);
@@ -1757,21 +1757,21 @@ js::intl_availableCalendars(JSContext* cx, unsigned argc, Value* vp)
// Now get the calendars that "would make a difference", i.e., not the default.
UEnumeration* values = ucal_getKeywordValuesForLocale("ca", locale.ptr(), false, &status);
if (U_FAILURE(status)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
return false;
}
ScopedICUObject<UEnumeration> toClose(values, uenum_close);
uint32_t count = uenum_count(values, &status);
if (U_FAILURE(status)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
return false;
}
for (; count > 0; count--) {
calendar = uenum_next(values, nullptr, &status);
if (U_FAILURE(status)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
return false;
}
@@ -1813,7 +1813,7 @@ js::intl_patternForSkeleton(JSContext* cx, unsigned argc, Value* vp)
UErrorCode status = U_ZERO_ERROR;
UDateTimePatternGenerator* gen = udatpg_open(icuLocale(locale.ptr()), &status);
if (U_FAILURE(status)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
return false;
}
ScopedICUObject<UDateTimePatternGenerator> toClose(gen, udatpg_close);
@@ -1821,7 +1821,7 @@ js::intl_patternForSkeleton(JSContext* cx, unsigned argc, Value* vp)
int32_t size = udatpg_getBestPattern(gen, Char16ToUChar(skeletonChars.start().get()),
skeletonLen, nullptr, 0, &status);
if (U_FAILURE(status) && status != U_BUFFER_OVERFLOW_ERROR) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
return false;
}
ScopedJSFreePtr<UChar> pattern(cx->pod_malloc<UChar>(size + 1));
@@ -1832,7 +1832,7 @@ js::intl_patternForSkeleton(JSContext* cx, unsigned argc, Value* vp)
udatpg_getBestPattern(gen, Char16ToUChar(skeletonChars.start().get()),
skeletonLen, pattern, size, &status);
if (U_FAILURE(status)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
return false;
}
@@ -1912,7 +1912,7 @@ NewUDateFormat(JSContext* cx, HandleObject dateTimeFormat)
udat_open(UDAT_PATTERN, UDAT_PATTERN, icuLocale(locale.ptr()), uTimeZone, uTimeZoneLength,
uPattern, uPatternLength, &status);
if (U_FAILURE(status)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
return nullptr;
}
@@ -1930,7 +1930,7 @@ static bool
intl_FormatDateTime(JSContext* cx, UDateFormat* df, double x, MutableHandleValue result)
{
if (!IsFinite(x)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DATE_NOT_FINITE);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DATE_NOT_FINITE);
return false;
}
@@ -1947,7 +1947,7 @@ intl_FormatDateTime(JSContext* cx, UDateFormat* df, double x, MutableHandleValue
udat_format(df, x, Char16ToUChar(chars.begin()), size, nullptr, &status);
}
if (U_FAILURE(status)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
return false;
}
@@ -2032,7 +2032,7 @@ static const JSFunctionSpec intl_static_methods[] = {
* Spec: ECMAScript Internationalization API Specification, 8.0, 8.1
*/
JSObject*
js_InitIntlClass(JSContext* cx, HandleObject obj)
js::InitIntlClass(JSContext *cx, HandleObject obj)
{
MOZ_ASSERT(obj->is<GlobalObject>());
Rooted<GlobalObject*> global(cx, &obj->as<GlobalObject>());
+5 -5
View File
@@ -10,6 +10,8 @@
#include "NamespaceImports.h"
#include "unicode/utypes.h"
namespace js {
/*
* The Intl module specified by standard ECMA-402,
* ECMAScript Internationalization API Specification.
@@ -20,9 +22,7 @@
* Spec: ECMAScript Internationalization API Specification, 8.0, 8.1
*/
extern JSObject*
js_InitIntlClass(JSContext* cx, js::HandleObject obj);
namespace js {
InitIntlClass(JSContext *cx, HandleObject obj);
/*
* The following functions are for use by self-hosted code.
@@ -39,7 +39,7 @@ namespace js {
* Usage: collator = intl_Collator(locales, options)
*/
extern bool
intl_Collator(JSContext* cx, unsigned argc, Value* vp);
intl_Collator(JSContext *cx, unsigned argc, Value *vp);
/**
* Returns an object indicating the supported locales for collation
@@ -50,7 +50,7 @@ intl_Collator(JSContext* cx, unsigned argc, Value* vp);
* Usage: availableLocales = intl_Collator_availableLocales()
*/
extern bool
intl_Collator_availableLocales(JSContext* cx, unsigned argc, Value* vp);
intl_Collator_availableLocales(JSContext *cx, unsigned argc, Value* vp);
/**
* Returns an array with the collation type identifiers per Unicode
+15 -15
View File
@@ -1194,7 +1194,7 @@ MapObject::set(JSContext* cx, HandleObject obj, HandleValue k, HandleValue v)
RelocatableValue rval(v);
if (!map->put(key, rval)) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return false;
}
WriteBarrierPost(cx->runtime(), map, key.get());
@@ -1211,7 +1211,7 @@ MapObject::create(JSContext* cx)
ValueMap* map = cx->new_<ValueMap>(cx->runtime());
if (!map || !map->init()) {
js_delete(map);
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return nullptr;
}
@@ -1266,7 +1266,7 @@ MapObject::construct(JSContext* cx, unsigned argc, Value* vp)
if (done)
break;
if (!pairVal.isObject()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
JSMSG_INVALID_MAP_ITERABLE, "Map");
return false;
}
@@ -1289,7 +1289,7 @@ MapObject::construct(JSContext* cx, unsigned argc, Value* vp)
RelocatableValue rval(val);
if (!map->put(hkey, rval)) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return false;
}
WriteBarrierPost(cx->runtime(), map, key);
@@ -1446,7 +1446,7 @@ MapObject::set_impl(JSContext* cx, const CallArgs& args)
ARG0_KEY(cx, args, key);
RelocatableValue rval(args.get(1));
if (!map.put(key, rval)) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return false;
}
WriteBarrierPost(cx->runtime(), &map, key.get());
@@ -1479,7 +1479,7 @@ MapObject::delete_impl(JSContext* cx, const CallArgs& args)
ARG0_KEY(cx, args, key);
bool found;
if (!map.remove(key, &found)) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return false;
}
args.rval().setBoolean(found);
@@ -1570,14 +1570,14 @@ MapObject::clear(JSContext* cx, HandleObject obj)
MOZ_ASSERT(MapObject::is(obj));
ValueMap& map = extract(obj);
if (!map.clear()) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return false;
}
return true;
}
JSObject*
js_InitMapClass(JSContext* cx, HandleObject obj)
js::InitMapClass(JSContext* cx, HandleObject obj)
{
return MapObject::initClass(cx, obj);
}
@@ -1836,7 +1836,7 @@ SetObject::add(JSContext* cx, HandleObject obj, HandleValue k)
return false;
if (!set->put(key)) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return false;
}
WriteBarrierPost(cx->runtime(), set, key.get());
@@ -1853,7 +1853,7 @@ SetObject::create(JSContext* cx)
ValueSet* set = cx->new_<ValueSet>(cx->runtime());
if (!set || !set->init()) {
js_delete(set);
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return nullptr;
}
obj->setPrivate(set);
@@ -1921,7 +1921,7 @@ SetObject::construct(JSContext* cx, unsigned argc, Value* vp)
if (!key.setValue(cx, keyVal))
return false;
if (!set->put(key)) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return false;
}
WriteBarrierPost(cx->runtime(), set, keyVal);
@@ -2002,7 +2002,7 @@ SetObject::add_impl(JSContext* cx, const CallArgs& args)
ValueSet& set = extract(args);
ARG0_KEY(cx, args, key);
if (!set.put(key)) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return false;
}
WriteBarrierPost(cx->runtime(), &set, key.get());
@@ -2026,7 +2026,7 @@ SetObject::delete_impl(JSContext* cx, const CallArgs& args)
ARG0_KEY(cx, args, key);
bool found;
if (!set.remove(key, &found)) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return false;
}
args.rval().setBoolean(found);
@@ -2083,7 +2083,7 @@ SetObject::clear_impl(JSContext* cx, const CallArgs& args)
{
Rooted<SetObject*> setobj(cx, &args.thisv().toObject().as<SetObject>());
if (!setobj->getData()->clear()) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return false;
}
args.rval().setUndefined();
@@ -2098,7 +2098,7 @@ SetObject::clear(JSContext* cx, unsigned argc, Value* vp)
}
JSObject*
js_InitSetClass(JSContext* cx, HandleObject obj)
js::InitSetClass(JSContext* cx, HandleObject obj)
{
return SetObject::initClass(cx, obj);
}
+6 -6
View File
@@ -182,12 +182,12 @@ class SetObject : public NativeObject {
extern bool
InitSelfHostingCollectionIteratorFunctions(JSContext* cx, js::HandleObject obj);
extern JSObject*
InitMapClass(JSContext* cx, HandleObject obj);
extern JSObject*
InitSetClass(JSContext* cx, HandleObject obj);
} /* namespace js */
extern JSObject*
js_InitMapClass(JSContext* cx, js::HandleObject obj);
extern JSObject*
js_InitSetClass(JSContext* cx, js::HandleObject obj);
#endif /* builtin_MapObject_h */
+10 -10
View File
@@ -235,7 +235,7 @@ js::ObjectToSource(JSContext* cx, HandleObject obj)
? !IsIdentifier(JSID_TO_ATOM(id))
: JSID_TO_INT(id) < 0)
{
idstr = js_QuoteString(cx, idstr, char16_t('\''));
idstr = QuoteString(cx, idstr, char16_t('\''));
if (!idstr)
return nullptr;
}
@@ -419,21 +419,21 @@ obj_setPrototypeOf(JSContext* cx, unsigned argc, Value* vp)
return false;
if (args.length() < 2) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
"Object.setPrototypeOf", "1", "");
return false;
}
/* Step 1-2. */
if (args[0].isNullOrUndefined()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
args[0].isNull() ? "null" : "undefined", "object");
return false;
}
/* Step 3. */
if (!args[1].isObjectOrNull()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_EXPECTED_TYPE,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_EXPECTED_TYPE,
"Object.setPrototypeOf", "an object or null", InformalValueTypeName(args[1]));
return false;
}
@@ -458,7 +458,7 @@ obj_setPrototypeOf(JSContext* cx, unsigned argc, Value* vp)
args[0], NullPtr()));
if (!bytes)
return false;
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_SETPROTOTYPEOF_FAIL,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_SETPROTOTYPEOF_FAIL,
bytes.get());
return false;
}
@@ -505,7 +505,7 @@ obj_watch(JSContext* cx, unsigned argc, Value* vp)
return false;
if (args.length() <= 1) {
js_ReportMissingArg(cx, args.calleev(), 1);
ReportMissingArg(cx, args.calleev(), 1);
return false;
}
@@ -667,7 +667,7 @@ js::obj_create(JSContext* cx, unsigned argc, Value* vp)
// Step 1.
if (args.length() == 0) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
"Object.create", "0", "s");
return false;
}
@@ -677,7 +677,7 @@ js::obj_create(JSContext* cx, unsigned argc, Value* vp)
char* bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, v, NullPtr());
if (!bytes)
return false;
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_UNEXPECTED_TYPE,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_UNEXPECTED_TYPE,
bytes, "not an object or null");
js_free(bytes);
return false;
@@ -855,7 +855,7 @@ obj_defineProperties(JSContext* cx, unsigned argc, Value* vp)
/* Step 2. */
if (args.length() < 2) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
"Object.defineProperties", "0", "s");
return false;
}
@@ -907,7 +907,7 @@ obj_preventExtensions(JSContext* cx, unsigned argc, Value* vp)
// Step 4.
if (!status) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CHANGE_EXTENSIBILITY);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_CHANGE_EXTENSIBILITY);
return false;
}
+2 -2
View File
@@ -168,7 +168,7 @@ CompileRegExpObject(JSContext* cx, RegExpObjectBuilder& builder,
* the second argument must be undefined. Otherwise, throw a TypeError.
*/
if (args.hasDefined(1) && creationMode == CreateForCompile) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NEWREGEXP_FLAGGED);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NEWREGEXP_FLAGGED);
return false;
}
@@ -565,7 +565,7 @@ static const JSPropertySpec regexp_static_props[] = {
};
JSObject*
js_InitRegExpClass(JSContext* cx, HandleObject obj)
js::InitRegExpClass(JSContext *cx, HandleObject obj)
{
MOZ_ASSERT(obj->isNative());
+6 -6
View File
@@ -9,12 +9,6 @@
#include "vm/RegExpObject.h"
JSObject*
js_InitRegExpClass(JSContext* cx, js::HandleObject obj);
bool
regexp_flags(JSContext* cx, unsigned argc, JS::Value* vp);
/*
* The following builtin natives are extern'd for pointer comparison in
* other parts of the engine.
@@ -22,6 +16,12 @@ regexp_flags(JSContext* cx, unsigned argc, JS::Value* vp);
namespace js {
bool
regexp_flags(JSContext *cx, unsigned argc, JS::Value *vp);
JSObject *
InitRegExpClass(JSContext *cx, HandleObject obj);
// Whether RegExp statics should be updated with the input and results of a
// regular expression execution.
enum RegExpStaticsUpdate { UpdateRegExpStatics, DontUpdateRegExpStatics };
+7 -7
View File
@@ -74,7 +74,7 @@ js::ToSimdConstant(JSContext* cx, HandleValue v, jit::SimdConstant* out)
{
typedef typename V::Elem Elem;
if (!IsVectorObject<V>(v)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_SIMD_NOT_A_VECTOR);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_SIMD_NOT_A_VECTOR);
return false;
}
@@ -101,7 +101,7 @@ static bool GetSimdLane(JSContext* cx, unsigned argc, Value* vp)
CallArgs args = CallArgsFromVp(argc, vp);
if (!IsVectorObject<SimdType>(args.thisv())) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
SimdTypeDescr::class_.name, laneNames[lane],
InformalValueTypeName(args.thisv()));
return false;
@@ -138,7 +138,7 @@ static bool SignMask(JSContext* cx, unsigned argc, Value* vp)
CallArgs args = CallArgsFromVp(argc, vp);
if (!args.thisv().isObject() || !args.thisv().toObject().is<TypedObject>()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
SimdTypeDescr::class_.name, "signMask",
InformalValueTypeName(args.thisv()));
return false;
@@ -147,7 +147,7 @@ static bool SignMask(JSContext* cx, unsigned argc, Value* vp)
TypedObject& typedObj = args.thisv().toObject().as<TypedObject>();
TypeDescr& descr = typedObj.typeDescr();
if (descr.kind() != type::Simd || descr.as<SimdTypeDescr>().type() != SimdType::type) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
SimdTypeDescr::class_.name, "signMask",
InformalValueTypeName(args.thisv()));
return false;
@@ -486,7 +486,7 @@ SIMDObject::initClass(JSContext* cx, Handle<GlobalObject*> global)
}
JSObject*
js_InitSIMDClass(JSContext* cx, HandleObject obj)
js::InitSIMDClass(JSContext *cx, HandleObject obj)
{
MOZ_ASSERT(obj->is<GlobalObject>());
Rooted<GlobalObject*> global(cx, &obj->as<GlobalObject>());
@@ -644,7 +644,7 @@ struct ShiftRightLogical {
static inline bool
ErrorBadArgs(JSContext* cx)
{
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_TYPED_ARRAY_BAD_ARGS);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_TYPED_ARRAY_BAD_ARGS);
return false;
}
@@ -1037,7 +1037,7 @@ TypedArrayFromArgs(JSContext* cx, const CallArgs& args,
(uint32_t(*byteStart) + NumElem * sizeof(VElem)) > AnyTypedArrayByteLength(typedArray))
{
// Keep in sync with AsmJS OnOutOfBounds function.
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_INDEX);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_INDEX);
return false;
}
+3 -3
View File
@@ -360,9 +360,9 @@ simd_int32x4_##Name(JSContext* cx, unsigned argc, Value* vp);
INT32X4_FUNCTION_LIST(DECLARE_SIMD_INT32x4_FUNCTION)
#undef DECLARE_SIMD_INT32x4_FUNCTION
JSObject*
InitSIMDClass(JSContext *cx, HandleObject obj);
} /* namespace js */
JSObject*
js_InitSIMDClass(JSContext* cx, js::HandleObject obj);
#endif /* builtin_SIMD_h */
+2 -2
View File
@@ -103,7 +103,7 @@ SymbolObject::construct(JSContext* cx, unsigned argc, Value* vp)
// yet, so just throw a TypeError.
CallArgs args = CallArgsFromVp(argc, vp);
if (args.isConstructing()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_CONSTRUCTOR, "Symbol");
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_CONSTRUCTOR, "Symbol");
return false;
}
@@ -230,7 +230,7 @@ SymbolObject::valueOf(JSContext* cx, unsigned argc, Value* vp)
}
JSObject*
js_InitSymbolClass(JSContext* cx, HandleObject obj)
js::InitSymbolClass(JSContext* cx, HandleObject obj)
{
return SymbolObject::initClass(cx, obj);
}
+3 -3
View File
@@ -58,9 +58,9 @@ class SymbolObject : public NativeObject
static const JSFunctionSpec staticMethods[];
};
extern JSObject*
InitSymbolClass(JSContext* cx, HandleObject obj);
} /* namespace js */
extern JSObject*
js_InitSymbolClass(JSContext* cx, js::HandleObject obj);
#endif /* builtin_SymbolObject_h */
+3 -3
View File
@@ -747,7 +747,7 @@ NondeterministicGetWeakMapKeys(JSContext* cx, unsigned argc, jsval* vp)
return false;
}
if (!args[0].isObject()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_EXPECTED_TYPE,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_EXPECTED_TYPE,
"nondeterministicGetWeakMapKeys", "WeakMap",
InformalValueTypeName(args[0]));
return false;
@@ -757,7 +757,7 @@ NondeterministicGetWeakMapKeys(JSContext* cx, unsigned argc, jsval* vp)
if (!JS_NondeterministicGetWeakMapKeys(cx, mapObj, &arr))
return false;
if (!arr) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_EXPECTED_TYPE,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_EXPECTED_TYPE,
"nondeterministicGetWeakMapKeys", "WeakMap",
args[0].toObject().getClass()->name);
return false;
@@ -2114,7 +2114,7 @@ FindPath(JSContext* cx, unsigned argc, jsval* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
if (argc < 2) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_MORE_ARGS_NEEDED,
JS_ReportErrorNumber(cx, GetErrorMessage, NULL, JSMSG_MORE_ARGS_NEEDED,
"findPath", "1", "");
return false;
}
+40 -52
View File
@@ -48,7 +48,7 @@ static const JSFunctionSpec TypedObjectMethods[] = {
static void
ReportCannotConvertTo(JSContext* cx, HandleValue fromValue, const char* toType)
{
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
InformalValueTypeName(fromValue), toType);
}
@@ -185,7 +185,7 @@ GetPrototype(JSContext* cx, HandleObject obj)
return nullptr;
}
if (!prototypeVal.isObject()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
JSMSG_INVALID_PROTOTYPE);
return nullptr;
}
@@ -268,7 +268,7 @@ ScalarTypeDescr::call(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
if (args.length() < 1) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
args.callee().getClass()->name, "0", "s");
return false;
}
@@ -372,7 +372,7 @@ js::ReferenceTypeDescr::call(JSContext* cx, unsigned argc, Value* vp)
Rooted<ReferenceTypeDescr*> descr(cx, &args.callee().as<ReferenceTypeDescr>());
if (args.length() < 1) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
JSMSG_MORE_ARGS_NEEDED,
descr->typeName(), "0", "s");
return false;
@@ -644,7 +644,7 @@ ArrayMetaTypeDescr::construct(JSContext* cx, unsigned argc, Value* vp)
CallArgs args = CallArgsFromVp(argc, vp);
if (!args.isConstructing()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
JSMSG_NOT_FUNCTION, "ArrayType");
return false;
}
@@ -653,7 +653,7 @@ ArrayMetaTypeDescr::construct(JSContext* cx, unsigned argc, Value* vp)
// Expect two arguments. The first is a type object, the second is a length.
if (args.length() < 2) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
"ArrayType", "1", "");
return false;
}
@@ -675,7 +675,7 @@ ArrayMetaTypeDescr::construct(JSContext* cx, unsigned argc, Value* vp)
// Compute the byte size.
CheckedInt32 size = CheckedInt32(elementType->size()) * length;
if (!size.isValid()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
JSMSG_TYPEDOBJECT_TOO_BIG);
return false;
}
@@ -787,7 +787,7 @@ StructMetaTypeDescr::create(JSContext* cx,
return nullptr;
if (!stringBuffer.append("new StructType({")) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return nullptr;
}
@@ -818,11 +818,11 @@ StructMetaTypeDescr::create(JSContext* cx,
// Collect field name and type object
RootedValue fieldName(cx, IdToValue(id));
if (!fieldNames.append(fieldName)) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return nullptr;
}
if (!fieldTypeObjs.append(ObjectValue(*fieldType))) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return nullptr;
}
@@ -835,19 +835,19 @@ StructMetaTypeDescr::create(JSContext* cx,
// Append "f:Type" to the string repr
if (i > 0 && !stringBuffer.append(", ")) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return nullptr;
}
if (!stringBuffer.append(JSID_TO_ATOM(id))) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return nullptr;
}
if (!stringBuffer.append(": ")) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return nullptr;
}
if (!stringBuffer.append(&fieldType->stringRepr())) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return nullptr;
}
@@ -855,13 +855,13 @@ StructMetaTypeDescr::create(JSContext* cx,
// the field's alignment.
CheckedInt32 offset = roundUpToAlignment(sizeSoFar, fieldType->alignment());
if (!offset.isValid()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
JSMSG_TYPEDOBJECT_TOO_BIG);
return nullptr;
}
MOZ_ASSERT(offset.value() >= 0);
if (!fieldOffsets.append(Int32Value(offset.value()))) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return nullptr;
}
@@ -876,7 +876,7 @@ StructMetaTypeDescr::create(JSContext* cx,
// Add space for this field to the total struct size.
sizeSoFar = offset + fieldType->size();
if (!sizeSoFar.isValid()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
JSMSG_TYPEDOBJECT_TOO_BIG);
return nullptr;
}
@@ -891,7 +891,7 @@ StructMetaTypeDescr::create(JSContext* cx,
// Complete string representation.
if (!stringBuffer.append("})")) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return nullptr;
}
RootedAtom stringRepr(cx, stringBuffer.finishAtom());
@@ -901,7 +901,7 @@ StructMetaTypeDescr::create(JSContext* cx,
// Adjust the total size to be a multiple of the final alignment.
CheckedInt32 totalSize = roundUpToAlignment(sizeSoFar, alignment);
if (!totalSize.isValid()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
JSMSG_TYPEDOBJECT_TOO_BIG);
return nullptr;
}
@@ -1002,7 +1002,7 @@ StructMetaTypeDescr::construct(JSContext* cx, unsigned int argc, Value* vp)
CallArgs args = CallArgsFromVp(argc, vp);
if (!args.isConstructing()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
JSMSG_NOT_FUNCTION, "StructType");
return false;
}
@@ -1017,7 +1017,7 @@ StructMetaTypeDescr::construct(JSContext* cx, unsigned int argc, Value* vp)
return true;
}
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
JSMSG_TYPEDOBJECT_STRUCTTYPE_BAD_ARGS);
return false;
}
@@ -1333,25 +1333,13 @@ GlobalObject::initTypedObjectModule(JSContext* cx, Handle<GlobalObject*> global)
}
JSObject*
js_InitTypedObjectModuleObject(JSContext* cx, HandleObject obj)
js::InitTypedObjectModuleObject(JSContext* cx, HandleObject obj)
{
MOZ_ASSERT(obj->is<GlobalObject>());
Rooted<GlobalObject*> global(cx, &obj->as<GlobalObject>());
return global->getOrCreateTypedObjectModule(cx);
}
JSObject*
js_InitTypedObjectDummy(JSContext* cx, HandleObject obj)
{
/*
* This function is entered into the jsprototypes.h table
* as the initializer for `TypedObject`. It should not
* be executed via the `standard_class_atoms` mechanism.
*/
MOZ_CRASH("shouldn't be initializing TypedObject via the JSProtoKey initializer mechanism");
}
/******************************************************************************
* Typed objects
*/
@@ -1633,7 +1621,7 @@ ReportTypedObjTypeError(JSContext* cx,
if (!typeReprStr)
return false;
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
errorNumber, typeReprStr);
JS_free(cx, (void*) typeReprStr);
@@ -1700,7 +1688,7 @@ TypedObject::obj_lookupProperty(JSContext* cx, HandleObject obj, HandleId id,
case type::Array:
{
uint32_t index;
if (js_IdIsIndex(id, &index))
if (IdIsIndex(id, &index))
return obj_lookupElement(cx, obj, index, objp, propp);
if (JSID_IS_ATOM(id, cx->names().length)) {
@@ -1758,7 +1746,7 @@ ReportPropertyError(JSContext* cx,
if (!propName)
return false;
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
errorNumber, propName);
JS_free(cx, propName);
@@ -1790,7 +1778,7 @@ TypedObject::obj_hasProperty(JSContext* cx, HandleObject obj, HandleId id, bool*
}
uint32_t index;
// Elements are not inherited from the prototype.
if (js_IdIsIndex(id, &index)) {
if (IdIsIndex(id, &index)) {
*foundp = (index < uint32_t(typedObj->length()));
return true;
}
@@ -1822,7 +1810,7 @@ TypedObject::obj_getProperty(JSContext* cx, HandleObject obj, HandleObject recei
// Dispatch elements to obj_getElement:
uint32_t index;
if (js_IdIsIndex(id, &index))
if (IdIsIndex(id, &index))
return obj_getElement(cx, obj, receiver, index, vp);
// Handle everything else here:
@@ -1839,7 +1827,7 @@ TypedObject::obj_getProperty(JSContext* cx, HandleObject obj, HandleObject recei
if (JSID_IS_ATOM(id, cx->names().length)) {
if (!typedObj->isAttached()) {
JS_ReportErrorNumber(
cx, js_GetErrorMessage,
cx, GetErrorMessage,
nullptr, JSMSG_TYPEDOBJECT_HANDLE_UNATTACHED);
return false;
}
@@ -1934,7 +1922,7 @@ TypedObject::obj_setProperty(JSContext* cx, HandleObject obj, HandleObject recei
case type::Array: {
if (JSID_IS_ATOM(id, cx->names().length)) {
if (obj == receiver) {
JS_ReportErrorNumber(cx, js_GetErrorMessage,
JS_ReportErrorNumber(cx, GetErrorMessage,
nullptr, JSMSG_CANT_REDEFINE_ARRAY_LENGTH);
return false;
}
@@ -1942,12 +1930,12 @@ TypedObject::obj_setProperty(JSContext* cx, HandleObject obj, HandleObject recei
}
uint32_t index;
if (js_IdIsIndex(id, &index)) {
if (IdIsIndex(id, &index)) {
if (obj != receiver)
return SetPropertyByDefining(cx, obj, receiver, id, vp, strict, false);
if (index >= uint32_t(typedObj->length())) {
JS_ReportErrorNumber(cx, js_GetErrorMessage,
JS_ReportErrorNumber(cx, GetErrorMessage,
nullptr, JSMSG_TYPEDOBJECT_BINARYARRAY_BAD_INDEX);
return false;
}
@@ -1986,7 +1974,7 @@ TypedObject::obj_getOwnPropertyDescriptor(JSContext* cx, HandleObject obj, Handl
{
Rooted<TypedObject*> typedObj(cx, &obj->as<TypedObject>());
if (!typedObj->isAttached()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_TYPEDOBJECT_HANDLE_UNATTACHED);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_TYPEDOBJECT_HANDLE_UNATTACHED);
return false;
}
@@ -2000,7 +1988,7 @@ TypedObject::obj_getOwnPropertyDescriptor(JSContext* cx, HandleObject obj, Handl
case type::Array:
{
uint32_t index;
if (js_IdIsIndex(id, &index)) {
if (IdIsIndex(id, &index)) {
if (!obj_getArrayElement(cx, typedObj, descr, index, desc.value()))
return false;
desc.setAttributes(JSPROP_ENUMERATE | JSPROP_PERMANENT);
@@ -2052,7 +2040,7 @@ IsOwnId(JSContext* cx, HandleObject obj, HandleId id)
return false;
case type::Array:
return js_IdIsIndex(id, &index) || JSID_IS_ATOM(id, cx->names().length);
return IdIsIndex(id, &index) || JSID_IS_ATOM(id, cx->names().length);
case type::Struct:
size_t index;
@@ -2274,7 +2262,7 @@ LazyArrayBufferTable::addBuffer(JSContext* cx, InlineTransparentTypedObject* obj
{
MOZ_ASSERT(!map.has(obj));
if (!map.put(obj, buffer)) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return false;
}
@@ -2428,7 +2416,7 @@ TypedObject::construct(JSContext* cx, unsigned int argc, Value* vp)
buffer = &args[0].toObject().as<ArrayBufferObject>();
if (callee->opaque() || buffer->isNeutered()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage,
JS_ReportErrorNumber(cx, GetErrorMessage,
nullptr, JSMSG_TYPEDOBJECT_BAD_ARGS);
return false;
}
@@ -2436,7 +2424,7 @@ TypedObject::construct(JSContext* cx, unsigned int argc, Value* vp)
int32_t offset;
if (args.length() >= 2 && !args[1].isUndefined()) {
if (!args[1].isInt32()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage,
JS_ReportErrorNumber(cx, GetErrorMessage,
nullptr, JSMSG_TYPEDOBJECT_BAD_ARGS);
return false;
}
@@ -2447,7 +2435,7 @@ TypedObject::construct(JSContext* cx, unsigned int argc, Value* vp)
}
if (args.length() >= 3 && !args[2].isUndefined()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage,
JS_ReportErrorNumber(cx, GetErrorMessage,
nullptr, JSMSG_TYPEDOBJECT_BAD_ARGS);
return false;
}
@@ -2455,7 +2443,7 @@ TypedObject::construct(JSContext* cx, unsigned int argc, Value* vp)
if (!CheckOffset(offset, callee->size(), callee->alignment(),
buffer->byteLength()))
{
JS_ReportErrorNumber(cx, js_GetErrorMessage,
JS_ReportErrorNumber(cx, GetErrorMessage,
nullptr, JSMSG_TYPEDOBJECT_BAD_ARGS);
return false;
}
@@ -2486,7 +2474,7 @@ TypedObject::construct(JSContext* cx, unsigned int argc, Value* vp)
}
// Something bogus.
JS_ReportErrorNumber(cx, js_GetErrorMessage,
JS_ReportErrorNumber(cx, GetErrorMessage,
nullptr, JSMSG_TYPEDOBJECT_BAD_ARGS);
return false;
}
+4 -4
View File
@@ -39,7 +39,7 @@
* Currently, all "globals" related to typed objects are packaged
* within a single "module" object `TypedObject`. This module has its
* own js::Class and when that class is initialized, we also create
* and define all other values (in `js_InitTypedObjectModuleClass()`).
* and define all other values (in `js::InitTypedObjectModuleClass()`).
*
* - Type objects, meta type objects, and type representations:
*
@@ -1042,10 +1042,10 @@ class LazyArrayBufferTable
size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf);
};
} // namespace js
JSObject*
js_InitTypedObjectModuleObject(JSContext* cx, JS::HandleObject obj);
InitTypedObjectModuleObject(JSContext* cx, JS::HandleObject obj);
} // namespace js
template <>
inline bool
+3 -3
View File
@@ -86,7 +86,7 @@ WeakSetObject::construct(JSContext* cx, unsigned argc, Value* vp)
CallArgs args = CallArgsFromVp(argc, vp);
if (!args.isConstructing()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_FUNCTION, "WeakSet");
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_FUNCTION, "WeakSet");
return false;
}
@@ -126,7 +126,7 @@ WeakSetObject::construct(JSContext* cx, unsigned argc, Value* vp)
char *bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, keyVal, NullPtr());
if (!bytes)
return false;
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, bytes);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, bytes);
return false;
}
@@ -153,7 +153,7 @@ WeakSetObject::construct(JSContext* cx, unsigned argc, Value* vp)
JSObject*
js_InitWeakSetClass(JSContext* cx, HandleObject obj)
js::InitWeakSetClass(JSContext* cx, HandleObject obj)
{
return WeakSetObject::initClass(cx, obj);
}
+3 -3
View File
@@ -27,9 +27,9 @@ class WeakSetObject : public NativeObject
static bool construct(JSContext* cx, unsigned argc, Value* vp);
};
extern JSObject*
InitWeakSetClass(JSContext* cx, HandleObject obj);
} // namespace js
extern JSObject*
js_InitWeakSetClass(JSContext* cx, js::HandleObject obj);
#endif /* builtin_WeakSetObject_h */
+5 -5
View File
@@ -89,7 +89,7 @@ GetDeflatedUTF8StringLength(JSContext* maybecx, const CharT* chars,
if (maybecx) {
js::gc::AutoSuppressGC suppress(maybecx);
JS_snprintf(buffer, 10, "0x%x", c);
JS_ReportErrorFlagsAndNumber(maybecx, JSREPORT_ERROR, js_GetErrorMessage,
JS_ReportErrorFlagsAndNumber(maybecx, JSREPORT_ERROR, GetErrorMessage,
nullptr, JSMSG_BAD_SURROGATE_CHAR, buffer);
}
return (size_t) -1;
@@ -151,7 +151,7 @@ DeflateStringToUTF8Buffer(JSContext* maybecx, const CharT* src, size_t srclen,
*dst++ = (char) v;
utf8Len = 1;
} else {
utf8Len = js_OneUcs4ToUtf8Char(utf8buf, v);
utf8Len = js::OneUcs4ToUtf8Char(utf8buf, v);
if (utf8Len > dstlen)
goto bufferTooSmall;
for (i = 0; i < utf8Len; i++)
@@ -173,7 +173,7 @@ bufferTooSmall:
*dstlenp = (origDstlen - dstlen);
if (maybecx) {
js::gc::AutoSuppressGC suppress(maybecx);
JS_ReportErrorNumber(maybecx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(maybecx, GetErrorMessage, nullptr,
JSMSG_BUFFER_TOO_SMALL);
}
return false;
@@ -749,8 +749,8 @@ static const JSPropertySpec sFunctionProps[] = {
};
static const JSFunctionSpec sFunctionInstanceFunctions[] = {
JS_FN("call", js_fun_call, 1, CDATAFN_FLAGS),
JS_FN("apply", js_fun_apply, 2, CDATAFN_FLAGS),
JS_FN("call", js::fun_call, 1, CDATAFN_FLAGS),
JS_FN("apply", js::fun_apply, 2, CDATAFN_FLAGS),
JS_FS_END
};
+1 -1
View File
@@ -34,7 +34,7 @@ CheckLength(ExclusiveContext* cx, SourceBufferHolder& srcBuf)
// is using size_t internally already.
if (srcBuf.length() > UINT32_MAX) {
if (cx->isJSContext())
JS_ReportErrorNumber(cx->asJSContext(), js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx->asJSContext(), GetErrorMessage, nullptr,
JSMSG_SOURCE_TOO_LONG);
return false;
}
+4 -4
View File
@@ -209,7 +209,7 @@ EmitCheck(ExclusiveContext* cx, BytecodeEmitter* bce, ptrdiff_t delta)
jsbytecode dummy = 0;
if (!bce->code().appendN(dummy, delta)) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return -1;
}
return offset;
@@ -2821,7 +2821,7 @@ EmitSwitch(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn)
intmap_bitlen = JS_BIT(16);
intmap = cx->pod_malloc<jsbitmap>(JS_BIT(16) / JS_BITMAP_NBITS);
if (!intmap) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return false;
}
}
@@ -7410,7 +7410,7 @@ AllocSrcNote(ExclusiveContext* cx, SrcNotesVector& notes)
jssrcnote dummy = 0;
if (!notes.append(dummy)) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return -1;
}
return notes.length() - 1;
@@ -7544,7 +7544,7 @@ SetSrcNoteOffset(ExclusiveContext* cx, BytecodeEmitter* bce, unsigned index, uns
!(sn = notes.insert(sn, dummy)) ||
!(sn = notes.insert(sn, dummy)))
{
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return false;
}
}
+1 -1
View File
@@ -48,7 +48,7 @@ class NameResolver
return buf->append('.') && buf->append(name);
/* Quote the string as needed. */
JSString* source = js_QuoteString(cx, name, '"');
JSString* source = QuoteString(cx, name, '"');
return source && buf->append('[') && buf->append(source) && buf->append(']');
}
+1 -1
View File
@@ -62,7 +62,7 @@ DefinitionList::allocNode(ExclusiveContext* cx, LifoAlloc& alloc, uintptr_t head
{
Node* result = alloc.new_<Node>(head, tail);
if (!result)
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return result;
}
+1 -1
View File
@@ -571,7 +571,7 @@ ParseNodeAllocator::allocNode()
void* p = alloc.alloc(sizeof (ParseNode));
if (!p)
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return p;
}
+3 -3
View File
@@ -398,7 +398,7 @@ ParseContext<ParseHandler>::generateFunctionBindings(ExclusiveContext* cx, Token
uint32_t count = args_.length() + vars_.length() + bodyLevelLexicals_.length();
Binding* packedBindings = alloc.newArrayUninitialized<Binding>(count);
if (!packedBindings) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return false;
}
@@ -579,7 +579,7 @@ Parser<ParseHandler>::newObjectBox(NativeObject* obj)
ObjectBox* objbox = alloc.new_<ObjectBox>(obj, traceListHead);
if (!objbox) {
js_ReportOutOfMemory(context);
ReportOutOfMemory(context);
return nullptr;
}
@@ -676,7 +676,7 @@ Parser<ParseHandler>::newFunctionBox(Node fn, JSFunction* fun, ParseContext<Pars
inheritedDirectives, options().extraWarningsOption,
generatorKind);
if (!funbox) {
js_ReportOutOfMemory(context);
ReportOutOfMemory(context);
return nullptr;
}
+3 -3
View File
@@ -580,7 +580,7 @@ CompileError::throwError(JSContext* cx)
// as the non-top-level "load", "eval", or "compile" native function
// returns false, the top-level reporter will eventually receive the
// uncaught exception report.
if (!js_ErrorToException(cx, message, &report, nullptr, nullptr))
if (!ErrorToException(cx, message, &report, nullptr, nullptr))
CallErrorReporter(cx, message, &report);
}
@@ -648,8 +648,8 @@ TokenStream::reportCompileErrorNumberVA(uint32_t offset, unsigned flags, unsigne
err.argumentsType = (flags & JSREPORT_UC) ? ArgumentsAreUnicode : ArgumentsAreASCII;
if (!js_ExpandErrorArguments(cx, js_GetErrorMessage, nullptr, errorNumber, &err.message,
&err.report, err.argumentsType, args))
if (!ExpandErrorArguments(cx, GetErrorMessage, nullptr, errorNumber, &err.message,
&err.report, err.argumentsType, args))
{
return false;
}
+1 -1
View File
@@ -924,7 +924,7 @@ gc::MarkObjectSlots(JSTracer* trc, NativeObject* obj, uint32_t start, uint32_t n
{
MOZ_ASSERT(obj->isNative());
for (uint32_t i = start; i < (start + nslots); ++i) {
trc->setTracingDetails(js_GetObjectSlotName, obj, i);
trc->setTracingDetails(GetObjectSlotName, obj, i);
MarkValueInternal(trc, obj->getSlotRef(i).unsafeGet());
}
}
+1 -1
View File
@@ -136,7 +136,7 @@ struct Zone : public JS::shadow::Zone,
void* onOutOfMemory(void* p, size_t nbytes) {
return runtimeFromMainThread()->onOutOfMemory(p, nbytes);
}
void reportAllocationOverflow() { js_ReportAllocationOverflow(nullptr); }
void reportAllocationOverflow() { js::ReportAllocationOverflow(nullptr); }
void beginSweepTypes(js::FreeOp* fop, bool releaseTypes);
+2 -2
View File
@@ -49,7 +49,7 @@ class MOZ_STACK_CLASS RegExpStackCursor
bool init() {
if (!stack.init()) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return false;
}
cursor = base();
@@ -61,7 +61,7 @@ class MOZ_STACK_CLASS RegExpStackCursor
if (cursor >= stack.limit()) {
int32_t pos = position();
if (!stack.grow()) {
js_ReportOverRecursed(cx);
ReportOverRecursed(cx);
return false;
}
setPosition(pos);
+15 -15
View File
@@ -1093,7 +1093,7 @@ ICTypeMonitor_Fallback::addMonitorStubForValue(JSContext* cx, JSScript* script,
ICStub* stub = existingStub ? compiler.updateStub()
: compiler.getStub(compiler.getStubSpace(script));
if (!stub) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return false;
}
@@ -1120,7 +1120,7 @@ ICTypeMonitor_Fallback::addMonitorStubForValue(JSContext* cx, JSScript* script,
ICTypeMonitor_SingleObject::Compiler compiler(cx, obj);
ICStub* stub = compiler.getStub(compiler.getStubSpace(script));
if (!stub) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return false;
}
@@ -1144,7 +1144,7 @@ ICTypeMonitor_Fallback::addMonitorStubForValue(JSContext* cx, JSScript* script,
ICTypeMonitor_ObjectGroup::Compiler compiler(cx, group);
ICStub* stub = compiler.getStub(compiler.getStubSpace(script));
if (!stub) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return false;
}
@@ -9110,7 +9110,7 @@ GetTemplateObjectForNative(JSContext* cx, HandleScript script, jsbytecode* pc,
// Check for natives to which template objects can be attached. This is
// done to provide templates to Ion for inlining these natives later on.
if (native == js_Array) {
if (native == ArrayConstructor) {
// Note: the template array won't be used if its length is inaccurately
// computed here. (We allocate here because compilation may occur on a
// separate thread where allocation is impossible.)
@@ -9167,7 +9167,7 @@ GetTemplateObjectForNative(JSContext* cx, HandleScript script, jsbytecode* pc,
return true;
}
if (native == js_String) {
if (native == StringConstructor) {
RootedString emptyString(cx, cx->runtime()->emptyString);
res.set(StringObject::create(cx, emptyString, TenuredObject));
return !!res;
@@ -9416,7 +9416,7 @@ TryAttachCallStub(JSContext* cx, ICCall_Fallback* stub, HandleScript script, jsb
// Check for JSOP_FUNAPPLY
if (op == JSOP_FUNAPPLY) {
if (fun->native() == js_fun_apply)
if (fun->native() == fun_apply)
return TryAttachFunApplyStub(cx, stub, script, pc, thisv, argc, vp + 2, handled);
// Don't try to attach a "regular" optimized call stubs for FUNAPPLY ops,
@@ -9424,7 +9424,7 @@ TryAttachCallStub(JSContext* cx, ICCall_Fallback* stub, HandleScript script, jsb
return true;
}
if (op == JSOP_FUNCALL && fun->native() == js_fun_call) {
if (op == JSOP_FUNCALL && fun->native() == fun_call) {
if (!TryAttachFunCallStub(cx, stub, script, pc, thisv, handled))
return false;
if (*handled)
@@ -9853,7 +9853,7 @@ ICCallStubCompiler::guardFunApply(MacroAssembler& masm, GeneralRegisterSet regs,
// Stack now confirmed to be like:
// [..., CalleeV, ThisV, Arg0V, MagicValue(Arguments), <MaybeReturnAddr>]
// Load the callee, ensure that it's js_fun_apply
// Load the callee, ensure that it's fun_apply
ValueOperand val = regs.takeAnyValue();
Address calleeSlot(BaselineStackReg, ICStackValueOffset + (3 * sizeof(Value)));
masm.loadValue(calleeSlot, val);
@@ -9865,7 +9865,7 @@ ICCallStubCompiler::guardFunApply(MacroAssembler& masm, GeneralRegisterSet regs,
failure);
masm.loadPtr(Address(callee, JSFunction::offsetOfNativeOrScript()), callee);
masm.branchPtr(Assembler::NotEqual, callee, ImmPtr(js_fun_apply), failure);
masm.branchPtr(Assembler::NotEqual, callee, ImmPtr(fun_apply), failure);
// Load the |thisv|, ensure that it's a scripted function with a valid baseline or ion
// script, or a native function.
@@ -10693,7 +10693,7 @@ ICCall_ScriptedApplyArray::Compiler::generateStubCode(MacroAssembler& masm)
// Stack now looks like:
// BaselineFrameReg -------------------.
// v
// [..., js_fun_apply, TargetV, TargetThisV, ArgsArrayV, StubFrameHeader]
// [..., fun_apply, TargetV, TargetThisV, ArgsArrayV, StubFrameHeader]
// Push all array elements onto the stack:
Address arrayVal(BaselineFrameReg, STUB_FRAME_SIZE);
@@ -10702,7 +10702,7 @@ ICCall_ScriptedApplyArray::Compiler::generateStubCode(MacroAssembler& masm)
// Stack now looks like:
// BaselineFrameReg -------------------.
// v
// [..., js_fun_apply, TargetV, TargetThisV, ArgsArrayV, StubFrameHeader,
// [..., fun_apply, TargetV, TargetThisV, ArgsArrayV, StubFrameHeader,
// PushedArgN, ..., PushedArg0]
// Can't fail after this, so it's ok to clobber argcReg.
@@ -10793,7 +10793,7 @@ ICCall_ScriptedApplyArguments::Compiler::generateStubCode(MacroAssembler& masm)
//
// Stack now looks like:
// [..., js_fun_apply, TargetV, TargetThisV, MagicArgsV, StubFrameHeader]
// [..., fun_apply, TargetV, TargetThisV, MagicArgsV, StubFrameHeader]
// Push all arguments supplied to caller function onto the stack.
pushCallerArguments(masm, regs);
@@ -10801,7 +10801,7 @@ ICCall_ScriptedApplyArguments::Compiler::generateStubCode(MacroAssembler& masm)
// Stack now looks like:
// BaselineFrameReg -------------------.
// v
// [..., js_fun_apply, TargetV, TargetThisV, MagicArgsV, StubFrameHeader,
// [..., fun_apply, TargetV, TargetThisV, MagicArgsV, StubFrameHeader,
// PushedArgN, ..., PushedArg0]
// Can't fail after this, so it's ok to clobber argcReg.
@@ -10874,14 +10874,14 @@ ICCall_ScriptedFunCall::Compiler::generateStubCode(MacroAssembler& masm)
masm.loadValue(calleeSlot, R1);
regs.take(R1);
// Ensure callee is js_fun_call.
// Ensure callee is fun_call.
masm.branchTestObject(Assembler::NotEqual, R1, &failure);
Register callee = masm.extractObject(R1, ExtractTemp0);
masm.branchTestObjClass(Assembler::NotEqual, callee, regs.getAny(), &JSFunction::class_,
&failure);
masm.loadPtr(Address(callee, JSFunction::offsetOfNativeOrScript()), callee);
masm.branchPtr(Assembler::NotEqual, callee, ImmPtr(js_fun_call), &failure);
masm.branchPtr(Assembler::NotEqual, callee, ImmPtr(fun_call), &failure);
// Ensure |this| is a scripted function with JIT code.
BaseIndex thisSlot(BaselineStackReg, argcReg, TimesEight, ICStackValueOffset);
+2 -2
View File
@@ -747,7 +747,7 @@ IonScript::New(JSContext* cx, RecompileInfo recompileInfo,
if (snapshotsListSize >= MAX_BUFFER_SIZE ||
(bailoutEntries >= MAX_BUFFER_SIZE / sizeof(uint32_t)))
{
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return nullptr;
}
@@ -2115,7 +2115,7 @@ Compile(JSContext* cx, HandleScript script, BaselineFrame* osrFrame, jsbytecode*
return Method_CantCompile;
if (reason == AbortReason_Alloc) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return Method_Error;
}
+1 -1
View File
@@ -3287,7 +3287,7 @@ jit::AnalyzeNewScriptDefiniteProperties(JSContext* cx, JSFunction* fun,
CompilerConstraintList* constraints = NewCompilerConstraintList(temp);
if (!constraints) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return false;
}
+2 -2
View File
@@ -5715,7 +5715,7 @@ IonBuilder::jsop_funcall(uint32_t argc)
// If |Function.prototype.call| may be overridden, don't optimize callsite.
TemporaryTypeSet* calleeTypes = current->peek(calleeDepth)->resultTypeSet();
JSFunction* native = getSingleCallTarget(calleeTypes);
if (!native || !native->isNative() || native->native() != &js_fun_call) {
if (!native || !native->isNative() || native->native() != &fun_call) {
CallInfo callInfo(alloc(), false);
if (!callInfo.init(current, argc))
return false;
@@ -5798,7 +5798,7 @@ IonBuilder::jsop_funapply(uint32_t argc)
}
if ((!native || !native->isNative() ||
native->native() != js_fun_apply) &&
native->native() != fun_apply) &&
info().analysisMode() != Analysis_DefiniteProperties)
{
return abort("fun.apply speculation failed");
+1 -1
View File
@@ -896,7 +896,7 @@ HandleException(ResumeFromException* rfe)
if (overrecursed) {
// We hit an overrecursion error during bailout. Report it now.
js_ReportOverRecursed(cx);
ReportOverRecursed(cx);
}
}
+2 -2
View File
@@ -23,8 +23,8 @@ class Linker
{
MacroAssembler& masm;
JitCode* fail(JSContext* cx) {
js_ReportOutOfMemory(cx);
JitCode *fail(JSContext *cx) {
ReportOutOfMemory(cx);
return nullptr;
}
+8 -8
View File
@@ -64,7 +64,7 @@ IonBuilder::inlineNativeCall(CallInfo& callInfo, JSFunction* target)
}
// Array natives.
if (native == js_Array)
if (native == ArrayConstructor)
return inlineArray(callInfo);
if (native == js::array_pop)
return inlineArrayPopShift(callInfo, MArrayPopShift::Pop);
@@ -150,15 +150,15 @@ IonBuilder::inlineNativeCall(CallInfo& callInfo, JSFunction* target)
return inlineMathFunction(callInfo, MMathFunction::Cbrt);
// String natives.
if (native == js_String)
if (native == StringConstructor)
return inlineStringObject(callInfo);
if (native == js::str_split)
if (native == str_split)
return inlineStringSplit(callInfo);
if (native == js_str_charCodeAt)
if (native == str_charCodeAt)
return inlineStrCharCodeAt(callInfo);
if (native == js::str_fromCharCode)
if (native == str_fromCharCode)
return inlineStrFromCharCode(callInfo);
if (native == js_str_charAt)
if (native == str_charAt)
return inlineStrCharAt(callInfo);
if (native == str_replace)
return inlineStrReplace(callInfo);
@@ -448,7 +448,7 @@ IonBuilder::inlineArray(CallInfo& callInfo)
uint32_t initLength = 0;
AllocatingBehaviour allocating = NewArray_Unallocating;
JSObject* templateObject = inspector->getTemplateObjectForNative(pc, js_Array);
JSObject* templateObject = inspector->getTemplateObjectForNative(pc, ArrayConstructor);
if (!templateObject) {
trackOptimizationOutcome(TrackedOutcome::CantInlineNativeNoTemplateObj);
return InliningStatus_NotInlined;
@@ -1425,7 +1425,7 @@ IonBuilder::inlineStringObject(CallInfo& callInfo)
if (callInfo.getArg(0)->mightBeType(MIRType_Object))
return InliningStatus_NotInlined;
JSObject* templateObj = inspector->getTemplateObjectForNative(pc, js_String);
JSObject* templateObj = inspector->getTemplateObjectForNative(pc, StringConstructor);
if (!templateObj)
return InliningStatus_NotInlined;
MOZ_ASSERT(templateObj->is<StringObject>());
+3 -3
View File
@@ -1372,9 +1372,9 @@ MacroAssembler::linkExitFrame()
}
static void
ReportOverRecursed(JSContext* cx)
BailoutReportOverRecursed(JSContext* cx)
{
js_ReportOverRecursed(cx);
ReportOverRecursed(cx);
}
void
@@ -1400,7 +1400,7 @@ MacroAssembler::generateBailoutTail(Register scratch, Register bailoutInfo)
loadJSContext(ReturnReg);
setupUnalignedABICall(1, scratch);
passABIArg(ReturnReg);
callWithABI(JS_FUNC_TO_DATA_PTR(void*, ReportOverRecursed));
callWithABI(JS_FUNC_TO_DATA_PTR(void*, BailoutReportOverRecursed));
jump(exceptionLabel());
}
+1 -1
View File
@@ -433,7 +433,7 @@ class Simulator
#define JS_CHECK_SIMULATOR_RECURSION_WITH_EXTRA(cx, extra, onerror) \
JS_BEGIN_MACRO \
if (cx->runtime()->simulator()->overRecursedWithExtra(extra)) { \
js_ReportOverRecursed(cx); \
js::ReportOverRecursed(cx); \
onerror; \
} \
JS_END_MACRO
+1 -1
View File
@@ -408,7 +408,7 @@ class Simulator {
#define JS_CHECK_SIMULATOR_RECURSION_WITH_EXTRA(cx, extra, onerror) \
JS_BEGIN_MACRO \
if (cx->mainThread().simulator()->overRecursedWithExtra(extra)) { \
js_ReportOverRecursed(cx); \
js::ReportOverRecursed(cx); \
onerror; \
} \
JS_END_MACRO
+1 -1
View File
@@ -19,5 +19,5 @@ TempAllocPolicy::onOutOfMemory(void* p, size_t nbytes)
void
TempAllocPolicy::reportAllocOverflow() const
{
js_ReportAllocationOverflow(static_cast<ExclusiveContext*>(cx_));
ReportAllocationOverflow(static_cast<ExclusiveContext*>(cx_));
}
+36 -36
View File
@@ -121,7 +121,7 @@ JS::CallArgs::requireAtLeast(JSContext* cx, const char* fnname, unsigned require
if (length() < required) {
char numArgsStr[40];
JS_snprintf(numArgsStr, sizeof numArgsStr, "%u", required - 1);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
fnname, numArgsStr, required == 2 ? "" : "s");
return false;
}
@@ -269,7 +269,7 @@ JS_ConvertArgumentsVA(JSContext *cx, const CallArgs &args, const char *format, v
JS_snprintf(numBuf, sizeof numBuf, "%u", args.length());
JSAutoByteString funNameBytes;
if (const char *name = GetFunctionNameBytes(cx, fun, &funNameBytes)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
JSMSG_MORE_ARGS_NEEDED,
name, numBuf, (args.length() == 1) ? "" : "s");
}
@@ -336,7 +336,7 @@ JS_ConvertArgumentsVA(JSContext *cx, const CallArgs &args, const char *format, v
case '*':
break;
default:
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_CHAR, format);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_CHAR, format);
return false;
}
}
@@ -391,7 +391,7 @@ JS_ConvertValue(JSContext *cx, HandleValue value, JSType type, MutableHandleValu
default: {
char numBuf[12];
JS_snprintf(numBuf, sizeof numBuf, "%d", (int)type);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_TYPE, numBuf);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_TYPE, numBuf);
ok = false;
break;
}
@@ -1801,8 +1801,8 @@ JS_InitClass(JSContext* cx, HandleObject obj, HandleObject parent_proto,
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
assertSameCompartment(cx, obj, parent_proto);
return js_InitClass(cx, obj, parent_proto, Valueify(clasp), constructor,
nargs, ps, fs, static_ps, static_fs);
return InitClass(cx, obj, parent_proto, Valueify(clasp), constructor,
nargs, ps, fs, static_ps, static_fs);
}
JS_PUBLIC_API(bool)
@@ -1934,7 +1934,7 @@ JS_GetConstructor(JSContext* cx, HandleObject proto)
if (!GetProperty(cx, proto, proto, cx->names().constructor, &cval))
return nullptr;
if (!IsFunctionObject(cval)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NO_CONSTRUCTOR,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NO_CONSTRUCTOR,
proto->getClass()->name);
return nullptr;
}
@@ -3335,17 +3335,17 @@ CloneFunctionObject(JSContext* cx, HandleObject funobj, HandleObject dynamicScop
}
if (!IsFunctionCloneable(fun, dynamicScope)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_CLONE_FUNOBJ_SCOPE);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_CLONE_FUNOBJ_SCOPE);
return nullptr;
}
if (fun->isBoundFunction()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CLONE_OBJECT);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_CLONE_OBJECT);
return nullptr;
}
if (fun->isNative() && IsAsmJSModuleNative(fun->native())) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CLONE_OBJECT);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_CLONE_OBJECT);
return nullptr;
}
@@ -3438,7 +3438,7 @@ JS_PUBLIC_API(JSObject*)
JS_BindCallable(JSContext* cx, HandleObject target, HandleObject newThis)
{
RootedValue thisArg(cx, ObjectValue(*newThis));
return js_fun_bind(cx, target, thisArg, nullptr, 0);
return fun_bind(cx, target, thisArg, nullptr, 0);
}
static bool
@@ -3451,7 +3451,7 @@ js_generic_native_method_dispatcher(JSContext* cx, unsigned argc, Value* vp)
MOZ_ASSERT((fs->flags & JSFUN_GENERIC_NATIVE) != 0);
if (argc < 1) {
js_ReportMissingArg(cx, args.calleev(), 0);
ReportMissingArg(cx, args.calleev(), 0);
return false;
}
@@ -3612,7 +3612,7 @@ struct AutoLastFrameCheck
if (cx->isExceptionPending() &&
!JS_IsRunning(cx) &&
(!cx->options().dontReportUncaught() && !cx->options().autoJSAPIOwnsErrorReporting())) {
js_ReportUncaughtException(cx);
ReportUncaughtException(cx);
}
}
@@ -3697,7 +3697,7 @@ AutoFile::open(JSContext* cx, const char* filename)
} else {
fp_ = fopen(filename, "r");
if (!fp_) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_OPEN,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_OPEN,
filename, "No such file or directory");
return false;
}
@@ -4455,8 +4455,8 @@ JS_NewHelper(JSContext* cx, HandleObject ctor, const JS::HandleValueArray& input
* API is asking for an object, so we report an error.
*/
JSAutoByteString bytes;
if (js_ValueToPrintable(cx, args.rval(), &bytes)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_NEW_RESULT,
if (ValueToPrintable(cx, args.rval(), &bytes)) {
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_NEW_RESULT,
bytes.ptr());
}
return nullptr;
@@ -4849,7 +4849,7 @@ JS_DecodeBytes(JSContext* cx, const char* src, size_t srclen, char16_t* dst, siz
CopyAndInflateChars(dst, src, dstlen);
AutoSuppressGC suppress(cx);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BUFFER_TOO_SMALL);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BUFFER_TOO_SMALL);
return false;
}
@@ -5031,7 +5031,7 @@ JS_Stringify(JSContext* cx, MutableHandleValue vp, HandleObject replacer,
StringBuffer sb(cx);
if (!sb.ensureTwoByteChars())
return false;
if (!js_Stringify(cx, vp, replacer, space, sb))
if (!Stringify(cx, vp, replacer, space, sb))
return false;
if (sb.empty() && !sb.append(cx->names().null))
return false;
@@ -5085,7 +5085,7 @@ JS_ReportError(JSContext* cx, const char* format, ...)
AssertHeapIsIdle(cx);
va_start(ap, format);
js_ReportErrorVA(cx, JSREPORT_ERROR, format, ap);
ReportErrorVA(cx, JSREPORT_ERROR, format, ap);
va_end(ap);
}
@@ -5105,8 +5105,8 @@ JS_ReportErrorNumberVA(JSContext* cx, JSErrorCallback errorCallback,
va_list ap)
{
AssertHeapIsIdle(cx);
js_ReportErrorNumberVA(cx, JSREPORT_ERROR, errorCallback, userRef,
errorNumber, ArgumentsAreASCII, ap);
ReportErrorNumberVA(cx, JSREPORT_ERROR, errorCallback, userRef,
errorNumber, ArgumentsAreASCII, ap);
}
JS_PUBLIC_API(void)
@@ -5117,8 +5117,8 @@ JS_ReportErrorNumberUC(JSContext* cx, JSErrorCallback errorCallback,
AssertHeapIsIdle(cx);
va_start(ap, errorNumber);
js_ReportErrorNumberVA(cx, JSREPORT_ERROR, errorCallback, userRef,
errorNumber, ArgumentsAreUnicode, ap);
ReportErrorNumberVA(cx, JSREPORT_ERROR, errorCallback, userRef,
errorNumber, ArgumentsAreUnicode, ap);
va_end(ap);
}
@@ -5128,8 +5128,8 @@ JS_ReportErrorNumberUCArray(JSContext* cx, JSErrorCallback errorCallback,
const char16_t** args)
{
AssertHeapIsIdle(cx);
js_ReportErrorNumberUCArray(cx, JSREPORT_ERROR, errorCallback, userRef,
errorNumber, args);
ReportErrorNumberUCArray(cx, JSREPORT_ERROR, errorCallback, userRef,
errorNumber, args);
}
JS_PUBLIC_API(bool)
@@ -5140,7 +5140,7 @@ JS_ReportWarning(JSContext* cx, const char* format, ...)
AssertHeapIsIdle(cx);
va_start(ap, format);
ok = js_ReportErrorVA(cx, JSREPORT_WARNING, format, ap);
ok = ReportErrorVA(cx, JSREPORT_WARNING, format, ap);
va_end(ap);
return ok;
}
@@ -5155,8 +5155,8 @@ JS_ReportErrorFlagsAndNumber(JSContext* cx, unsigned flags,
AssertHeapIsIdle(cx);
va_start(ap, errorNumber);
ok = js_ReportErrorNumberVA(cx, flags, errorCallback, userRef,
errorNumber, ArgumentsAreASCII, ap);
ok = ReportErrorNumberVA(cx, flags, errorCallback, userRef,
errorNumber, ArgumentsAreASCII, ap);
va_end(ap);
return ok;
}
@@ -5171,8 +5171,8 @@ JS_ReportErrorFlagsAndNumberUC(JSContext* cx, unsigned flags,
AssertHeapIsIdle(cx);
va_start(ap, errorNumber);
ok = js_ReportErrorNumberVA(cx, flags, errorCallback, userRef,
errorNumber, ArgumentsAreUnicode, ap);
ok = ReportErrorNumberVA(cx, flags, errorCallback, userRef,
errorNumber, ArgumentsAreUnicode, ap);
va_end(ap);
return ok;
}
@@ -5180,13 +5180,13 @@ JS_ReportErrorFlagsAndNumberUC(JSContext* cx, unsigned flags,
JS_PUBLIC_API(void)
JS_ReportOutOfMemory(JSContext* cx)
{
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
}
JS_PUBLIC_API(void)
JS_ReportAllocationOverflow(JSContext* cx)
{
js_ReportAllocationOverflow(cx);
ReportAllocationOverflow(cx);
}
JS_PUBLIC_API(JSErrorReporter)
@@ -5215,7 +5215,7 @@ JS_NewDateObject(JSContext* cx, int year, int mon, int mday, int hour, int min,
{
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
return js_NewDateObject(cx, year, mon, mday, hour, min, sec);
return NewDateObject(cx, year, mon, mday, hour, min, sec);
}
JS_PUBLIC_API(JSObject*)
@@ -5223,7 +5223,7 @@ JS_NewDateObjectMsec(JSContext* cx, double msec)
{
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
return js_NewDateObjectMsec(cx, msec);
return NewDateObjectMsec(cx, msec);
}
JS_PUBLIC_API(bool)
@@ -5467,7 +5467,7 @@ JS_ReportPendingException(JSContext* cx)
CHECK_REQUEST(cx);
// This can only fail due to oom.
bool ok = js_ReportUncaughtException(cx);
bool ok = ReportUncaughtException(cx);
MOZ_ASSERT(!cx->isExceptionPending());
return ok;
}
@@ -5561,7 +5561,7 @@ JS_ErrorFromException(JSContext* cx, HandleObject obj)
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
assertSameCompartment(cx, obj);
return js_ErrorFromException(cx, obj);
return ErrorFromException(cx, obj);
}
JS_PUBLIC_API(bool)
+17 -17
View File
@@ -340,7 +340,7 @@ SetArrayElement(JSContext* cx, HandleObject obj, double index, HandleValue v)
break;
uint32_t idx = uint32_t(index);
if (idx >= arr->length() && !arr->lengthIsWritable()) {
JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, nullptr,
JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, GetErrorMessage, nullptr,
JSMSG_CANT_REDEFINE_ARRAY_LENGTH);
return false;
}
@@ -499,7 +499,7 @@ js::CanonicalizeArrayLengthValue(JSContext* cx, HandleValue v, uint32_t* newLen)
if (d == *newLen)
return true;
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_ARRAY_LENGTH);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_ARRAY_LENGTH);
return false;
}
@@ -553,7 +553,7 @@ js::ArraySetLength(JSContext* cx, Handle<ArrayObject*> arr, HandleId id,
return true;
if (setterIsStrict) {
return JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, nullptr,
return JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, GetErrorMessage, nullptr,
JSMSG_CANT_REDEFINE_ARRAY_LENGTH);
}
@@ -659,7 +659,7 @@ js::ArraySetLength(JSContext* cx, Handle<ArrayObject*> arr, HandleId id,
return false;
uint32_t index;
if (!js_IdIsIndex(props[i], &index))
if (!IdIsIndex(props[i], &index))
continue;
if (index >= newLen && index < oldLen) {
@@ -783,7 +783,7 @@ js::WouldDefinePastNonwritableLength(ExclusiveContext* cx,
return true;
// XXX include the index and maybe array length in the error message
return JS_ReportErrorFlagsAndNumber(ncx, flags, js_GetErrorMessage, nullptr,
return JS_ReportErrorFlagsAndNumber(ncx, flags, GetErrorMessage, nullptr,
JSMSG_CANT_DEFINE_PAST_ARRAY_LENGTH);
}
@@ -793,7 +793,7 @@ array_addProperty(JSContext* cx, HandleObject obj, HandleId id, MutableHandleVal
Rooted<ArrayObject*> arr(cx, &obj->as<ArrayObject>());
uint32_t index;
if (!js_IdIsIndex(id, &index))
if (!IdIsIndex(id, &index))
return true;
uint32_t length = arr->length();
@@ -1073,7 +1073,7 @@ js::ArrayJoin(JSContext* cx, HandleObject obj, HandleLinearString sepstr, uint32
size_t seplen = sepstr->length();
CheckedInt<uint32_t> res = CheckedInt<uint32_t>(seplen) * (length - 1);
if (length > 0 && !res.isValid()) {
js_ReportAllocationOverflow(cx);
ReportAllocationOverflow(cx);
return nullptr;
}
@@ -1873,7 +1873,7 @@ js::array_sort(JSContext* cx, unsigned argc, Value* vp)
if (args.hasDefined(0)) {
if (args[0].isPrimitive()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_SORT_ARG);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_SORT_ARG);
return false;
}
fval = args[0]; /* non-default compare function */
@@ -1902,7 +1902,7 @@ js::array_sort(JSContext* cx, unsigned argc, Value* vp)
*/
#if JS_BITS_PER_WORD == 32
if (size_t(len) > size_t(-1) / (2 * sizeof(Value))) {
js_ReportAllocationOverflow(cx);
ReportAllocationOverflow(cx);
return false;
}
#endif
@@ -2973,7 +2973,7 @@ array_filter(JSContext* cx, unsigned argc, Value* vp)
/* Step 4. */
if (args.length() == 0) {
js_ReportMissingArg(cx, args.calleev(), 0);
ReportMissingArg(cx, args.calleev(), 0);
return false;
}
RootedObject callable(cx, ValueToCallable(cx, args[0], args.length() - 1));
@@ -3061,7 +3061,7 @@ IsArrayConstructor(const Value& v)
return v.isObject() &&
v.toObject().is<JSFunction>() &&
v.toObject().as<JSFunction>().isNative() &&
v.toObject().as<JSFunction>().native() == js_Array;
v.toObject().as<JSFunction>().native() == ArrayConstructor;
}
static bool
@@ -3189,7 +3189,7 @@ static const JSFunctionSpec array_static_methods[] = {
/* ES5 15.4.2 */
bool
js_Array(JSContext* cx, unsigned argc, Value* vp)
js::ArrayConstructor(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
RootedObjectGroup group(cx, ObjectGroup::callingAllocationSiteGroup(cx, JSProto_Array));
@@ -3203,7 +3203,7 @@ js_Array(JSContext* cx, unsigned argc, Value* vp)
if (args[0].isInt32()) {
int32_t i = args[0].toInt32();
if (i < 0) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_ARRAY_LENGTH);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_ARRAY_LENGTH);
return false;
}
length = uint32_t(i);
@@ -3211,7 +3211,7 @@ js_Array(JSContext* cx, unsigned argc, Value* vp)
double d = args[0].toDouble();
length = ToUint32(d);
if (d != double(length)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_ARRAY_LENGTH);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_ARRAY_LENGTH);
return false;
}
}
@@ -3235,7 +3235,7 @@ ArrayObject*
js::ArrayConstructorOneArg(JSContext* cx, HandleObjectGroup group, int32_t lengthInt)
{
if (lengthInt < 0) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_ARRAY_LENGTH);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_ARRAY_LENGTH);
return nullptr;
}
@@ -3333,7 +3333,7 @@ const Class ArrayObject::class_ = {
nullptr, /* construct */
nullptr, /* trace */
{
GenericCreateConstructor<js_Array, 1, JSFunction::FinalizeKind>,
GenericCreateConstructor<ArrayConstructor, 1, JSFunction::FinalizeKind>,
CreateArrayPrototype,
array_static_methods,
array_methods,
@@ -3610,7 +3610,7 @@ js::NewDenseCopyOnWriteArray(JSContext* cx, HandleArrayObject templateObject, gc
#ifdef DEBUG
bool
js_ArrayInfo(JSContext* cx, unsigned argc, Value* vp)
js::ArrayInfo(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
JSObject* obj;
+8 -11
View File
@@ -15,10 +15,9 @@
namespace js {
/* 2^32-2, inclusive */
const uint32_t MAX_ARRAY_INDEX = 4294967294u;
}
inline bool
js_IdIsIndex(jsid id, uint32_t* indexp)
IdIsIndex(jsid id, uint32_t* indexp)
{
if (JSID_IS_INT(id)) {
int32_t i = JSID_TO_INT(id);
@@ -33,10 +32,8 @@ js_IdIsIndex(jsid id, uint32_t* indexp)
return js::StringIsArrayIndex(JSID_TO_ATOM(id), indexp);
}
extern bool
js_InitContextBusyArrayTable(JSContext* cx);
namespace js {
extern JSObject *
InitArrayClass(JSContext *cx, js::HandleObject obj);
class ArrayObject;
@@ -128,7 +125,7 @@ ObjectMayHaveExtraIndexedProperties(JSObject* obj);
* Copy 'length' elements from aobj to vp.
*
* This function assumes 'length' is effectively the result of calling
* js_GetLengthProperty on aobj. vp must point to rooted memory.
* GetLengthProperty on aobj. vp must point to rooted memory.
*/
extern bool
GetElements(JSContext* cx, HandleObject aobj, uint32_t length, js::Value* vp);
@@ -192,15 +189,15 @@ NewbornArrayPush(JSContext* cx, HandleObject obj, const Value& v);
extern ArrayObject*
ArrayConstructorOneArg(JSContext* cx, HandleObjectGroup group, int32_t lengthInt);
} /* namespace js */
#ifdef DEBUG
extern bool
js_ArrayInfo(JSContext* cx, unsigned argc, js::Value* vp);
ArrayInfo(JSContext* cx, unsigned argc, Value* vp);
#endif
/* Array constructor native. Exposed only so the JIT can know its address. */
bool
js_Array(JSContext* cx, unsigned argc, js::Value* vp);
ArrayConstructor(JSContext* cx, unsigned argc, Value* vp);
} /* namespace js */
#endif /* jsarray_h */
+4 -4
View File
@@ -39,7 +39,7 @@ using mozilla::RangedPtr;
const char*
js::AtomToPrintableString(ExclusiveContext* cx, JSAtom* atom, JSAutoByteString* bytes)
{
JSString* str = js_QuoteString(cx, atom, 0);
JSString* str = QuoteString(cx, atom, 0);
if (!str)
return nullptr;
return bytes->encodeLatin1(cx, str);
@@ -161,7 +161,7 @@ JSRuntime::initializeAtoms(JSContext* cx)
for (size_t i = 0; i < JS::WellKnownSymbolLimit; i++) {
JS::Symbol* symbol = JS::Symbol::new_(cx, JS::SymbolCode(i), descriptions[i]);
if (!symbol) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return false;
}
symbols[i].init(symbol);
@@ -341,7 +341,7 @@ AtomizeAndCopyChars(ExclusiveContext* cx, const CharT* tbchars, size_t length, I
// Grudgingly forgo last-ditch GC. The alternative would be to release
// the lock, manually GC here, and retry from the top. If you fix this,
// please also fix or comment the similar case in Symbol::new_.
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return nullptr;
}
@@ -351,7 +351,7 @@ AtomizeAndCopyChars(ExclusiveContext* cx, const CharT* tbchars, size_t length, I
// since then can't GC; therefore the atoms table has not been modified and
// p is still valid.
if (!atoms.add(p, AtomStateEntry(atom, bool(ib)))) {
js_ReportOutOfMemory(cx); /* SystemAllocPolicy does not report OOM. */
ReportOutOfMemory(cx); /* SystemAllocPolicy does not report OOM. */
return nullptr;
}
+3 -3
View File
@@ -70,7 +70,7 @@ bool_toString_impl(JSContext* cx, const CallArgs& args)
MOZ_ASSERT(IsBoolean(thisv));
bool b = thisv.isBoolean() ? thisv.toBoolean() : thisv.toObject().as<BooleanObject>().unbox();
args.rval().setString(js_BooleanToString(cx, b));
args.rval().setString(BooleanToString(cx, b));
return true;
}
@@ -127,7 +127,7 @@ Boolean(JSContext* cx, unsigned argc, Value* vp)
}
JSObject*
js_InitBooleanClass(JSContext* cx, HandleObject obj)
js::InitBooleanClass(JSContext* cx, HandleObject obj)
{
MOZ_ASSERT(obj->isNative());
@@ -155,7 +155,7 @@ js_InitBooleanClass(JSContext* cx, HandleObject obj)
}
JSString*
js_BooleanToString(ExclusiveContext* cx, bool b)
js::BooleanToString(ExclusiveContext* cx, bool b)
{
return b ? cx->names().true_ : cx->names().false_;
}
+6 -2
View File
@@ -13,10 +13,14 @@
#include "NamespaceImports.h"
namespace js {
extern JSObject*
js_InitBooleanClass(JSContext* cx, js::HandleObject obj);
InitBooleanClass(JSContext* cx, js::HandleObject obj);
extern JSString*
js_BooleanToString(js::ExclusiveContext* cx, bool b);
BooleanToString(js::ExclusiveContext* cx, bool b);
}
#endif /* jsbool_h */
+40 -41
View File
@@ -219,14 +219,14 @@ ReportError(JSContext* cx, const char* message, JSErrorReport* reportp,
* on the error report, and exception-aware hosts should ignore it.
*/
MOZ_ASSERT(reportp);
if ((!callback || callback == js_GetErrorMessage) &&
if ((!callback || callback == GetErrorMessage) &&
reportp->errorNumber == JSMSG_UNCAUGHT_EXCEPTION)
{
reportp->flags |= JSREPORT_EXCEPTION;
}
if (cx->options().autoJSAPIOwnsErrorReporting() || JS_IsRunning(cx)) {
if (js_ErrorToException(cx, message, reportp, callback, userRef)) {
if (ErrorToException(cx, message, reportp, callback, userRef)) {
return;
}
@@ -242,9 +242,8 @@ ReportError(JSContext* cx, const char* message, JSErrorReport* reportp,
/*
* Call the error reporter only if an exception wasn't raised.
*/
if (message) {
if (message)
CallErrorReporter(cx, message, reportp);
}
}
/*
@@ -273,11 +272,11 @@ PopulateReportBlame(JSContext* cx, JSErrorReport* report)
* throw the static atom "out of memory". If code is not running, call the
* error reporter directly.
*
* Furthermore, callers of js_ReportOutOfMemory (viz., malloc) assume a GC does
* Furthermore, callers of ReportOutOfMemory (viz., malloc) assume a GC does
* not occur, so GC must be avoided or suppressed.
*/
void
js_ReportOutOfMemory(ExclusiveContext* cxArg)
js::ReportOutOfMemory(ExclusiveContext* cxArg)
{
#ifdef JS_MORE_DETERMINISTIC
/*
@@ -285,7 +284,7 @@ js_ReportOutOfMemory(ExclusiveContext* cxArg)
* (e.g. interpreter vs JIT). In more-deterministic builds, print to stderr
* so that the fuzzers can detect this.
*/
fprintf(stderr, "js_ReportOutOfMemory called\n");
fprintf(stderr, "ReportOutOfMemory called\n");
#endif
if (!cxArg->isJSContext())
@@ -306,7 +305,7 @@ js_ReportOutOfMemory(ExclusiveContext* cxArg)
}
/* Get the message for this error, but we don't expand any arguments. */
const JSErrorFormatString* efs = js_GetErrorMessage(nullptr, JSMSG_OUT_OF_MEMORY);
const JSErrorFormatString* efs = GetErrorMessage(nullptr, JSMSG_OUT_OF_MEMORY);
const char* msg = efs ? efs->format : "Out of memory";
/* Fill out the report, but don't do anything that requires allocation. */
@@ -334,7 +333,7 @@ js_ReportOutOfMemory(ExclusiveContext* cxArg)
}
JS_FRIEND_API(void)
js_ReportOverRecursed(JSContext* maybecx)
js::ReportOverRecursed(JSContext* maybecx)
{
#ifdef JS_MORE_DETERMINISTIC
/*
@@ -345,25 +344,25 @@ js_ReportOverRecursed(JSContext* maybecx)
* stack depth which is useful for external testing programs
* like fuzzers.
*/
fprintf(stderr, "js_ReportOverRecursed called\n");
fprintf(stderr, "ReportOverRecursed called\n");
#endif
if (maybecx) {
JS_ReportErrorNumber(maybecx, js_GetErrorMessage, nullptr, JSMSG_OVER_RECURSED);
JS_ReportErrorNumber(maybecx, GetErrorMessage, nullptr, JSMSG_OVER_RECURSED);
maybecx->overRecursed_ = true;
}
}
void
js_ReportOverRecursed(ExclusiveContext* cx)
js::ReportOverRecursed(ExclusiveContext* cx)
{
if (cx->isJSContext())
js_ReportOverRecursed(cx->asJSContext());
ReportOverRecursed(cx->asJSContext());
else
cx->addPendingOverRecursed();
}
void
js_ReportAllocationOverflow(ExclusiveContext* cxArg)
js::ReportAllocationOverflow(ExclusiveContext* cxArg)
{
if (!cxArg)
return;
@@ -373,7 +372,7 @@ js_ReportAllocationOverflow(ExclusiveContext* cxArg)
JSContext* cx = cxArg->asJSContext();
AutoSuppressGC suppressGC(cx);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_ALLOC_OVERFLOW);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_ALLOC_OVERFLOW);
}
/*
@@ -413,7 +412,7 @@ checkReportFlags(JSContext* cx, unsigned* flags)
}
bool
js_ReportErrorVA(JSContext* cx, unsigned flags, const char* format, va_list ap)
js::ReportErrorVA(JSContext* cx, unsigned flags, const char* format, va_list ap)
{
char* message;
char16_t* ucmessage;
@@ -556,10 +555,10 @@ js::PrintError(JSContext* cx, FILE* file, const char* message, JSErrorReport* re
* Returns true if the expansion succeeds (can fail if out of memory).
*/
bool
js_ExpandErrorArguments(ExclusiveContext* cx, JSErrorCallback callback,
void* userRef, const unsigned errorNumber,
char** messagep, JSErrorReport* reportp,
ErrorArgumentsType argumentsType, va_list ap)
js::ExpandErrorArguments(ExclusiveContext* cx, JSErrorCallback callback,
void* userRef, const unsigned errorNumber,
char** messagep, JSErrorReport* reportp,
ErrorArgumentsType argumentsType, va_list ap)
{
const JSErrorFormatString* efs;
int i;
@@ -569,7 +568,7 @@ js_ExpandErrorArguments(ExclusiveContext* cx, JSErrorCallback callback,
*messagep = nullptr;
if (!callback)
callback = js_GetErrorMessage;
callback = GetErrorMessage;
{
AutoSuppressGC suppressGC(cx);
@@ -721,9 +720,9 @@ error:
}
bool
js_ReportErrorNumberVA(JSContext* cx, unsigned flags, JSErrorCallback callback,
void* userRef, const unsigned errorNumber,
ErrorArgumentsType argumentsType, va_list ap)
js::ReportErrorNumberVA(JSContext* cx, unsigned flags, JSErrorCallback callback,
void* userRef, const unsigned errorNumber,
ErrorArgumentsType argumentsType, va_list ap)
{
JSErrorReport report;
char* message;
@@ -737,8 +736,8 @@ js_ReportErrorNumberVA(JSContext* cx, unsigned flags, JSErrorCallback callback,
report.errorNumber = errorNumber;
PopulateReportBlame(cx, &report);
if (!js_ExpandErrorArguments(cx, callback, userRef, errorNumber,
&message, &report, argumentsType, ap)) {
if (!ExpandErrorArguments(cx, callback, userRef, errorNumber,
&message, &report, argumentsType, ap)) {
return false;
}
@@ -763,9 +762,9 @@ js_ReportErrorNumberVA(JSContext* cx, unsigned flags, JSErrorCallback callback,
}
bool
js_ReportErrorNumberUCArray(JSContext* cx, unsigned flags, JSErrorCallback callback,
void* userRef, const unsigned errorNumber,
const char16_t** args)
js::ReportErrorNumberUCArray(JSContext* cx, unsigned flags, JSErrorCallback callback,
void* userRef, const unsigned errorNumber,
const char16_t** args)
{
if (checkReportFlags(cx, &flags))
return true;
@@ -779,8 +778,8 @@ js_ReportErrorNumberUCArray(JSContext* cx, unsigned flags, JSErrorCallback callb
char* message;
va_list dummy;
if (!js_ExpandErrorArguments(cx, callback, userRef, errorNumber,
&message, &report, ArgumentsAreUnicode, dummy)) {
if (!ExpandErrorArguments(cx, callback, userRef, errorNumber,
&message, &report, ArgumentsAreUnicode, dummy)) {
return false;
}
@@ -803,13 +802,13 @@ js::CallErrorReporter(JSContext* cx, const char* message, JSErrorReport* reportp
}
void
js_ReportIsNotDefined(JSContext* cx, const char* name)
js::ReportIsNotDefined(JSContext* cx, const char* name)
{
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_DEFINED, name);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_DEFINED, name);
}
bool
js_ReportIsNullOrUndefined(JSContext* cx, int spindex, HandleValue v,
js::ReportIsNullOrUndefined(JSContext* cx, int spindex, HandleValue v,
HandleString fallback)
{
char* bytes;
@@ -822,18 +821,18 @@ js_ReportIsNullOrUndefined(JSContext* cx, int spindex, HandleValue v,
if (strcmp(bytes, js_undefined_str) == 0 ||
strcmp(bytes, js_null_str) == 0) {
ok = JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR,
js_GetErrorMessage, nullptr,
GetErrorMessage, nullptr,
JSMSG_NO_PROPERTIES, bytes,
nullptr, nullptr);
} else if (v.isUndefined()) {
ok = JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR,
js_GetErrorMessage, nullptr,
GetErrorMessage, nullptr,
JSMSG_UNEXPECTED_TYPE, bytes,
js_undefined_str, nullptr);
} else {
MOZ_ASSERT(v.isNull());
ok = JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR,
js_GetErrorMessage, nullptr,
GetErrorMessage, nullptr,
JSMSG_UNEXPECTED_TYPE, bytes,
js_null_str, nullptr);
}
@@ -843,7 +842,7 @@ js_ReportIsNullOrUndefined(JSContext* cx, int spindex, HandleValue v,
}
void
js_ReportMissingArg(JSContext* cx, HandleValue v, unsigned arg)
js::ReportMissingArg(JSContext* cx, HandleValue v, unsigned arg)
{
char argbuf[11];
char* bytes;
@@ -858,7 +857,7 @@ js_ReportMissingArg(JSContext* cx, HandleValue v, unsigned arg)
if (!bytes)
return;
}
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
JSMSG_MISSING_FUN_ARG, argbuf,
bytes ? bytes : "");
js_free(bytes);
@@ -878,7 +877,7 @@ js::ReportValueErrorFlags(JSContext* cx, unsigned flags, const unsigned errorNum
if (!bytes)
return false;
ok = JS_ReportErrorFlagsAndNumber(cx, flags, js_GetErrorMessage,
ok = JS_ReportErrorFlagsAndNumber(cx, flags, GetErrorMessage,
nullptr, errorNumber, bytes, arg1, arg2);
js_free(bytes);
@@ -893,7 +892,7 @@ const JSErrorFormatString js_ErrorFormatString[JSErr_Limit] = {
};
JS_FRIEND_API(const JSErrorFormatString*)
js_GetErrorMessage(void* userRef, const unsigned errorNumber)
js::GetErrorMessage(void* userRef, const unsigned errorNumber)
{
if (errorNumber > 0 && errorNumber < JSErr_Limit)
return &js_ErrorFormatString[errorNumber];
+17 -26
View File
@@ -177,7 +177,7 @@ class ExclusiveContext : public ContextFriendFields,
}
void reportAllocationOverflow() {
js_ReportAllocationOverflow(this);
js::ReportAllocationOverflow(this);
}
// Accessors for immutable runtime data.
@@ -298,7 +298,7 @@ struct JSContext : public js::ExclusiveContext,
friend class js::ExclusiveContext;
friend class JS::AutoSaveExceptionState;
friend class js::jit::DebugModeOSRVolatileJitFrameIterator;
friend void js_ReportOverRecursed(JSContext*);
friend void js::ReportOverRecursed(JSContext*);
private:
/* Exception state -- the exception member is a GC root by definition. */
@@ -309,7 +309,7 @@ struct JSContext : public js::ExclusiveContext,
JS::ContextOptions options_;
// True if the exception currently being thrown is by result of
// js_ReportOverRecursed. See Debugger::slowPathOnExceptionUnwind.
// ReportOverRecursed. See Debugger::slowPathOnExceptionUnwind.
bool overRecursed_;
// True if propagating a forced return from an interrupt handler during
@@ -564,30 +564,26 @@ enum ErrorArgumentsType {
JSFunction*
SelfHostedFunction(JSContext* cx, HandlePropertyName propName);
} /* namespace js */
#ifdef va_start
extern bool
js_ReportErrorVA(JSContext* cx, unsigned flags, const char* format, va_list ap);
ReportErrorVA(JSContext* cx, unsigned flags, const char* format, va_list ap);
extern bool
js_ReportErrorNumberVA(JSContext* cx, unsigned flags, JSErrorCallback callback,
void* userRef, const unsigned errorNumber,
js::ErrorArgumentsType argumentsType, va_list ap);
ReportErrorNumberVA(JSContext* cx, unsigned flags, JSErrorCallback callback,
void* userRef, const unsigned errorNumber,
ErrorArgumentsType argumentsType, va_list ap);
extern bool
js_ReportErrorNumberUCArray(JSContext* cx, unsigned flags, JSErrorCallback callback,
void* userRef, const unsigned errorNumber,
const char16_t** args);
ReportErrorNumberUCArray(JSContext* cx, unsigned flags, JSErrorCallback callback,
void* userRef, const unsigned errorNumber,
const char16_t** args);
#endif
extern bool
js_ExpandErrorArguments(js::ExclusiveContext* cx, JSErrorCallback callback,
void* userRef, const unsigned errorNumber,
char** message, JSErrorReport* reportp,
js::ErrorArgumentsType argumentsType, va_list ap);
namespace js {
ExpandErrorArguments(ExclusiveContext* cx, JSErrorCallback callback,
void* userRef, const unsigned errorNumber,
char** message, JSErrorReport* reportp,
ErrorArgumentsType argumentsType, va_list ap);
/* |callee| requires a usage string provided by JS_DefineFunctionsWithHelp. */
extern void
@@ -609,22 +605,17 @@ PrintError(JSContext* cx, FILE* file, const char* message, JSErrorReport* report
void
CallErrorReporter(JSContext* cx, const char* message, JSErrorReport* report);
} /* namespace js */
extern void
js_ReportIsNotDefined(JSContext* cx, const char* name);
ReportIsNotDefined(JSContext* cx, const char* name);
/*
* Report an attempt to access the property of a null or undefined value (v).
*/
extern bool
js_ReportIsNullOrUndefined(JSContext* cx, int spindex, js::HandleValue v,
js::HandleString fallback);
ReportIsNullOrUndefined(JSContext* cx, int spindex, HandleValue v, HandleString fallback);
extern void
js_ReportMissingArg(JSContext* cx, js::HandleValue v, unsigned arg);
namespace js {
ReportMissingArg(JSContext* cx, js::HandleValue v, unsigned arg);
/*
* Report error using js_DecompileValueGenerator(cx, spindex, v, fallback) as
+2 -2
View File
@@ -338,7 +338,7 @@ CallSetter(JSContext* cx, HandleObject obj, HandleId id, StrictPropertyOp op, un
}
if (attrs & JSPROP_GETTER)
return js_ReportGetterOnlyAssignment(cx, strict);
return ReportGetterOnlyAssignment(cx, strict);
if (!op)
return true;
@@ -373,7 +373,7 @@ inline void
JSContext::setPendingException(js::Value v)
{
MOZ_ASSERT(!IsPoisonedValue(v));
// overRecursed_ is set after the fact by js_ReportOverRecursed.
// overRecursed_ is set after the fact by ReportOverRecursed.
this->overRecursed_ = false;
this->throwing = true;
this->unwrappedException_ = v;
+9 -9
View File
@@ -2428,7 +2428,7 @@ date_toISOString_impl(JSContext* cx, const CallArgs& args)
{
double utctime = args.thisv().toObject().as<DateObject>().UTCTime().toNumber();
if (!IsFinite(utctime)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INVALID_DATE);
JS_ReportErrorNumber(cx, js::GetErrorMessage, nullptr, JSMSG_INVALID_DATE);
return false;
}
@@ -2483,7 +2483,7 @@ date_toJSON(JSContext* cx, unsigned argc, Value* vp)
/* Step 5. */
if (!IsCallable(toISO)) {
JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, nullptr,
JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js::GetErrorMessage, nullptr,
JSMSG_BAD_TOISOSTRING_PROP);
return false;
}
@@ -2956,7 +2956,7 @@ static const JSFunctionSpec date_methods[] = {
};
bool
js_Date(JSContext* cx, unsigned argc, Value* vp)
js::DateConstructor(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
@@ -3008,7 +3008,7 @@ js_Date(JSContext* cx, unsigned argc, Value* vp)
d = msec_time;
}
JSObject* obj = js_NewDateObjectMsec(cx, d);
JSObject* obj = NewDateObjectMsec(cx, d);
if (!obj)
return false;
@@ -3050,7 +3050,7 @@ const Class DateObject::class_ = {
nullptr, /* construct */
nullptr, /* trace */
{
GenericCreateConstructor<js_Date, MAXARGS, JSFunction::FinalizeKind>,
GenericCreateConstructor<DateConstructor, MAXARGS, JSFunction::FinalizeKind>,
GenericCreatePrototype,
date_static_methods,
date_methods,
@@ -3060,7 +3060,7 @@ const Class DateObject::class_ = {
};
JS_FRIEND_API(JSObject*)
js_NewDateObjectMsec(JSContext* cx, double msec_time)
js::NewDateObjectMsec(JSContext *cx, double msec_time)
{
JSObject* obj = NewBuiltinClassInstance(cx, &DateObject::class_);
if (!obj)
@@ -3070,12 +3070,12 @@ js_NewDateObjectMsec(JSContext* cx, double msec_time)
}
JS_FRIEND_API(JSObject*)
js_NewDateObject(JSContext* cx, int year, int mon, int mday,
int hour, int min, int sec)
js::NewDateObject(JSContext *cx, int year, int mon, int mday,
int hour, int min, int sec)
{
MOZ_ASSERT(mon < 12);
double msec_time = date_msecFromDate(year, mon, mday, hour, min, sec, 0);
return js_NewDateObjectMsec(cx, UTC(msec_time, &cx->runtime()->dateTimeInfo));
return NewDateObjectMsec(cx, UTC(msec_time, &cx->runtime()->dateTimeInfo));
}
JS_FRIEND_API(bool)
+5 -5
View File
@@ -16,6 +16,8 @@
#include "js/RootingAPI.h"
#include "js/TypeDecls.h"
namespace js {
/*
* These functions provide a C interface to the date/time object
*/
@@ -25,7 +27,7 @@
* since the epoch.
*/
extern JS_FRIEND_API(JSObject*)
js_NewDateObjectMsec(JSContext* cx, double msec_time);
NewDateObjectMsec(JSContext *cx, double msec_time);
/*
* Construct a new Date Object from an exploded local time value.
@@ -35,14 +37,12 @@ js_NewDateObjectMsec(JSContext* cx, double msec_time);
* in 1995).
*/
extern JS_FRIEND_API(JSObject*)
js_NewDateObject(JSContext* cx, int year, int mon, int mday,
NewDateObject(JSContext *cx, int year, int mon, int mday,
int hour, int min, int sec);
/* Date constructor native. Exposed only so the JIT can know its address. */
bool
js_Date(JSContext* cx, unsigned argc, JS::Value* vp);
namespace js {
DateConstructor(JSContext *cx, unsigned argc, JS::Value* vp);
/* Date methods exposed so they can be installed in the self-hosting global. */
bool
+2 -2
View File
@@ -499,13 +499,13 @@ js_dtobasestr(DtoaState* state, int base, double dinput)
}
DtoaState*
js_NewDtoaState()
js::NewDtoaState()
{
return newdtoa();
}
void
js_DestroyDtoaState(DtoaState* state)
js::DestroyDtoaState(DtoaState* state)
{
destroydtoa(state);
}
+8 -4
View File
@@ -16,11 +16,15 @@
struct DtoaState;
DtoaState*
js_NewDtoaState();
namespace js {
void
js_DestroyDtoaState(DtoaState* state);
extern DtoaState*
NewDtoaState();
extern void
DestroyDtoaState(DtoaState* state);
} // namespace js
/*
* js_strtod_harder() returns as a double-precision floating-point number the
+13 -13
View File
@@ -336,7 +336,7 @@ exn_finalize(FreeOp* fop, JSObject* obj)
}
JSErrorReport*
js_ErrorFromException(JSContext* cx, HandleObject objArg)
js::ErrorFromException(JSContext* cx, HandleObject objArg)
{
// It's ok to UncheckedUnwrap here, since all we do is get the
// JSErrorReport, and consumers are careful with the information they get
@@ -543,8 +543,8 @@ js::GetErrorTypeName(JSRuntime* rt, int16_t exnType)
}
bool
js_ErrorToException(JSContext* cx, const char* message, JSErrorReport* reportp,
JSErrorCallback callback, void* userRef)
js::ErrorToException(JSContext* cx, const char* message, JSErrorReport* reportp,
JSErrorCallback callback, void* userRef)
{
// Tell our caller to report immediately if this report is just a warning.
MOZ_ASSERT(reportp);
@@ -554,7 +554,7 @@ js_ErrorToException(JSContext* cx, const char* message, JSErrorReport* reportp,
// Find the exception index associated with this error.
JSErrNum errorNumber = static_cast<JSErrNum>(reportp->errorNumber);
if (!callback)
callback = js_GetErrorMessage;
callback = GetErrorMessage;
const JSErrorFormatString* errorString = callback(userRef, errorNumber);
JSExnType exnType = errorString ? static_cast<JSExnType>(errorString->exnType) : JSEXN_NONE;
MOZ_ASSERT(exnType < JSEXN_LIMIT);
@@ -652,7 +652,7 @@ js::ErrorReportToString(JSContext* cx, JSErrorReport* reportp)
}
bool
js_ReportUncaughtException(JSContext* cx)
js::ReportUncaughtException(JSContext* cx)
{
if (!cx->isExceptionPending())
return true;
@@ -693,7 +693,7 @@ ErrorReport::~ErrorReport()
js_free(ownedMessage);
if (ownedReport.messageArgs) {
/*
* js_ExpandErrorArguments owns its messageArgs only if it had to
* ExpandErrorArguments owns its messageArgs only if it had to
* inflate the arguments (from regular |char*|s), which is always in
* our case.
*/
@@ -716,7 +716,7 @@ ErrorReport::init(JSContext* cx, HandleValue exn)
*/
if (exn.isObject()) {
exnObject = &exn.toObject();
reportp = js_ErrorFromException(cx, exnObject);
reportp = ErrorFromException(cx, exnObject);
JSCompartment* comp = exnObject->compartment();
JSAddonId* addonId = comp->addonId;
@@ -746,7 +746,7 @@ ErrorReport::init(JSContext* cx, HandleValue exn)
if (!str)
cx->clearPendingException();
// If js_ErrorFromException didn't get us a JSErrorReport, then the object
// If ErrorFromException didn't get us a JSErrorReport, then the object
// was not an ErrorObject, security-wrapped or otherwise. However, it might
// still quack like one. Give duck-typing a chance. We start by looking for
// "filename" (all lowercase), since that's where DOMExceptions store their
@@ -848,7 +848,7 @@ ErrorReport::init(JSContext* cx, HandleValue exn)
if (!reportp) {
// This is basically an inlined version of
//
// JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
// JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
// JSMSG_UNCAUGHT_EXCEPTION, message_);
//
// but without the reporting bits. Instead it just puts all
@@ -892,9 +892,9 @@ ErrorReport::populateUncaughtExceptionReportVA(JSContext* cx, va_list ap)
ownedReport.isMuted = iter.mutedErrors();
}
if (!js_ExpandErrorArguments(cx, js_GetErrorMessage, nullptr,
JSMSG_UNCAUGHT_EXCEPTION, &ownedMessage,
&ownedReport, ArgumentsAreASCII, ap)) {
if (!ExpandErrorArguments(cx, GetErrorMessage, nullptr,
JSMSG_UNCAUGHT_EXCEPTION, &ownedMessage,
&ownedReport, ArgumentsAreASCII, ap)) {
return false;
}
@@ -905,7 +905,7 @@ ErrorReport::populateUncaughtExceptionReportVA(JSContext* cx, va_list ap)
}
JSObject*
js_CopyErrorObject(JSContext* cx, Handle<ErrorObject*> err)
js::CopyErrorObject(JSContext* cx, Handle<ErrorObject*> err)
{
js::ScopedJSFreePtr<JSErrorReport> copyReport;
if (JSErrorReport* errorReport = err->getErrorReport()) {
+7 -6
View File
@@ -22,7 +22,6 @@ CopyErrorReport(JSContext* cx, JSErrorReport* report);
JSString*
ComputeStackString(JSContext* cx);
}
/*
* Given a JSErrorReport, check to see if there is an exception associated with
@@ -51,8 +50,8 @@ ComputeStackString(JSContext* cx);
* unless the caller decides to call CallErrorReporter explicitly.
*/
extern bool
js_ErrorToException(JSContext* cx, const char* message, JSErrorReport* reportp,
JSErrorCallback callback, void* userRef);
ErrorToException(JSContext* cx, const char* message, JSErrorReport* reportp,
JSErrorCallback callback, void* userRef);
/*
* Called if a JS API call to js_Execute or js_InternalCall fails; calls the
@@ -71,10 +70,10 @@ js_ErrorToException(JSContext* cx, const char* message, JSErrorReport* reportp,
* this flag.
*/
extern bool
js_ReportUncaughtException(JSContext* cx);
ReportUncaughtException(JSContext* cx);
extern JSErrorReport*
js_ErrorFromException(JSContext* cx, js::HandleObject obj);
ErrorFromException(JSContext* cx, HandleObject obj);
/*
* Make a copy of errobj parented to cx's compartment's global.
@@ -84,7 +83,7 @@ js_ErrorFromException(JSContext* cx, js::HandleObject obj);
* prototype objects (errobj->getPrivate() must not be nullptr).
*/
extern JSObject*
js_CopyErrorObject(JSContext* cx, JS::Handle<js::ErrorObject*> errobj);
CopyErrorObject(JSContext* cx, JS::Handle<ErrorObject*> errobj);
static_assert(JSEXN_ERR == 0 &&
JSProto_Error + JSEXN_INTERNALERR == JSProto_InternalError &&
@@ -130,4 +129,6 @@ class AutoClearPendingException
}
};
} // namespace js
#endif /* jsexn_h */
+7 -7
View File
@@ -252,13 +252,13 @@ JS_DefineFunctionsWithHelp(JSContext* cx, HandleObject obj, const JSFunctionSpec
}
JS_FRIEND_API(bool)
js_ObjectClassIs(JSContext* cx, HandleObject obj, ESClassValue classValue)
js::ObjectClassIs(JSContext* cx, HandleObject obj, ESClassValue classValue)
{
return ObjectClassIs(obj, classValue, cx);
}
JS_FRIEND_API(const char*)
js_ObjectClassName(JSContext* cx, HandleObject obj)
js::ObjectClassName(JSContext* cx, HandleObject obj)
{
return GetObjectClassName(cx, obj);
}
@@ -1168,12 +1168,12 @@ js::GetObjectMetadata(JSObject* obj)
}
JS_FRIEND_API(bool)
js_DefineOwnProperty(JSContext* cx, JSObject* objArg, jsid idArg,
JS::Handle<js::PropertyDescriptor> descriptor, bool* bp)
js::DefineOwnProperty(JSContext* cx, JSObject* objArg, jsid idArg,
JS::Handle<js::PropertyDescriptor> descriptor, bool* bp)
{
RootedObject obj(cx, objArg);
RootedId id(cx, idArg);
js::AssertHeapIsIdle(cx);
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
assertSameCompartment(cx, obj, id, descriptor.value());
if (descriptor.hasGetterObject())
@@ -1185,9 +1185,9 @@ js_DefineOwnProperty(JSContext* cx, JSObject* objArg, jsid idArg,
}
JS_FRIEND_API(bool)
js_ReportIsNotFunction(JSContext* cx, JS::HandleValue v)
js::ReportIsNotFunction(JSContext* cx, HandleValue v)
{
return ReportIsNotFunction(cx, v);
return ReportIsNotFunction(cx, v, -1);
}
JS_FRIEND_API(void)
+19 -24
View File
@@ -121,16 +121,16 @@ JS_CloneObject(JSContext* cx, JS::HandleObject obj, JS::HandleObject proto,
extern JS_FRIEND_API(JSString*)
JS_BasicObjectToString(JSContext* cx, JS::HandleObject obj);
JS_FRIEND_API(void)
js_ReportOverRecursed(JSContext* maybecx);
namespace js {
JS_FRIEND_API(bool)
js_ObjectClassIs(JSContext* cx, JS::HandleObject obj, js::ESClassValue classValue);
ObjectClassIs(JSContext* cx, JS::HandleObject obj, ESClassValue classValue);
JS_FRIEND_API(const char*)
js_ObjectClassName(JSContext* cx, JS::HandleObject obj);
ObjectClassName(JSContext* cx, JS::HandleObject obj);
namespace js {
JS_FRIEND_API(void)
ReportOverRecursed(JSContext* maybecx);
JS_FRIEND_API(bool)
AddRawValueRoot(JSContext* cx, JS::Value* vp, const char* name);
@@ -952,7 +952,7 @@ GetNativeStackLimit(JSContext* cx, int extraAllowance = 0)
JS_BEGIN_MACRO \
int stackDummy_; \
if (!JS_CHECK_STACK_SIZE(limit, &stackDummy_)) { \
js_ReportOverRecursed(cx); \
js::ReportOverRecursed(cx); \
onerror; \
} \
JS_END_MACRO
@@ -978,7 +978,7 @@ GetNativeStackLimit(JSContext* cx, int extraAllowance = 0)
#define JS_CHECK_RECURSION_WITH_SP(cx, sp, onerror) \
JS_BEGIN_MACRO \
if (!JS_CHECK_STACK_SIZE(js::GetNativeStackLimit(cx), sp)) { \
js_ReportOverRecursed(cx); \
js::ReportOverRecursed(cx); \
onerror; \
} \
JS_END_MACRO
@@ -1210,11 +1210,11 @@ typedef enum JSErrNum {
JSErr_Limit
} JSErrNum;
extern JS_FRIEND_API(const JSErrorFormatString*)
js_GetErrorMessage(void* userRef, const unsigned errorNumber);
namespace js {
extern JS_FRIEND_API(const JSErrorFormatString*)
GetErrorMessage(void* userRef, const unsigned errorNumber);
// AutoStableStringChars is here so we can use it in ErrorReport. It
// should get moved out of here if we can manage it. See bug 1040316.
@@ -1350,15 +1350,10 @@ struct MOZ_STACK_CLASS JS_FRIEND_API(ErrorReport)
bool ownsMessageAndReport;
};
} /* namespace js */
/* Implemented in jsclone.cpp. */
/* Implemented in vm/StructuredClone.cpp. */
extern JS_FRIEND_API(uint64_t)
js_GetSCOffset(JSStructuredCloneWriter* writer);
GetSCOffset(JSStructuredCloneWriter *writer);
namespace js {
namespace Scalar {
/* Scalar types which can appear in typed arrays and typed objects. The enum
@@ -2615,15 +2610,15 @@ GetSavedFramePrincipals(JS::HandleObject savedFrame);
extern JS_FRIEND_API(JSObject*)
GetFirstSubsumedSavedFrame(JSContext* cx, JS::HandleObject savedFrame);
extern JS_FRIEND_API(bool)
ReportIsNotFunction(JSContext* cx, JS::HandleValue v);
extern JS_FRIEND_API(bool)
DefineOwnProperty(JSContext* cx, JSObject* objArg, jsid idArg,
JS::Handle<JSPropertyDescriptor> descriptor, bool* bp);
} /* namespace js */
extern JS_FRIEND_API(bool)
js_DefineOwnProperty(JSContext* cx, JSObject* objArg, jsid idArg,
JS::Handle<JSPropertyDescriptor> descriptor, bool* bp);
extern JS_FRIEND_API(bool)
js_ReportIsNotFunction(JSContext* cx, JS::HandleValue v);
extern JS_FRIEND_API(void)
JS_StoreObjectPostBarrierCallback(JSContext* cx,
void (*callback)(JSTracer* trc, JSObject* key, void* data),
+26 -26
View File
@@ -104,7 +104,7 @@ AdvanceToActiveCallLinear(JSContext* cx, NonBuiltinScriptFrameIter& iter, Handle
static void
ThrowTypeErrorBehavior(JSContext* cx)
{
JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, nullptr,
JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, GetErrorMessage, nullptr,
JSMSG_THROW_TYPE_ERROR);
}
@@ -130,7 +130,7 @@ ArgumentsRestrictions(JSContext* cx, HandleFunction fun)
// Otherwise emit a strict warning about |f.arguments| to discourage use of
// this non-standard, performance-harmful feature.
if (!JS_ReportErrorFlagsAndNumber(cx, JSREPORT_WARNING | JSREPORT_STRICT, js_GetErrorMessage,
if (!JS_ReportErrorFlagsAndNumber(cx, JSREPORT_WARNING | JSREPORT_STRICT, GetErrorMessage,
nullptr, JSMSG_DEPRECATED_USAGE, js_arguments_str))
{
return false;
@@ -219,7 +219,7 @@ CallerRestrictions(JSContext* cx, HandleFunction fun)
// Otherwise emit a strict warning about |f.caller| to discourage use of
// this non-standard, performance-harmful feature.
if (!JS_ReportErrorFlagsAndNumber(cx, JSREPORT_WARNING | JSREPORT_STRICT, js_GetErrorMessage,
if (!JS_ReportErrorFlagsAndNumber(cx, JSREPORT_WARNING | JSREPORT_STRICT, GetErrorMessage,
nullptr, JSMSG_DEPRECATED_USAGE, js_caller_str))
{
return false;
@@ -272,7 +272,7 @@ CallerGetterImpl(JSContext* cx, const CallArgs& args)
MOZ_ASSERT(!callerFun->isBuiltin(), "non-builtin iterator returned a builtin?");
if (callerFun->strict()) {
JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, nullptr,
JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, GetErrorMessage, nullptr,
JSMSG_CALLER_IS_STRICT);
return false;
}
@@ -334,7 +334,7 @@ CallerSetterImpl(JSContext* cx, const CallArgs& args)
MOZ_ASSERT(!callerFun->isBuiltin(), "non-builtin iterator returned a builtin?");
if (callerFun->strict()) {
JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, nullptr,
JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, GetErrorMessage, nullptr,
JSMSG_CALLER_IS_STRICT);
return false;
}
@@ -532,7 +532,7 @@ js::XDRInterpretedFunction(XDRState<mode>* xdr, HandleObject enclosingScope, Han
if (!fun->isInterpreted()) {
JSAutoByteString funNameBytes;
if (const char* name = GetFunctionNameBytes(cx, fun, &funNameBytes)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
JSMSG_NOT_SCRIPTED_FUNCTION, name);
}
return false;
@@ -965,7 +965,7 @@ CreateFunctionPrototype(JSContext* cx, JSProtoKey key)
if (!throwTypeError || !PreventExtensions(cx, throwTypeError, &succeeded))
return nullptr;
if (!succeeded) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CHANGE_EXTENSIBILITY);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_CHANGE_EXTENSIBILITY);
return nullptr;
}
@@ -1264,7 +1264,7 @@ fun_toStringHelper(JSContext* cx, HandleObject obj, unsigned indent)
if (!obj->is<JSFunction>()) {
if (obj->is<ProxyObject>())
return Proxy::fun_toString(cx, obj, indent);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
JSMSG_INCOMPATIBLE_PROTO,
js_Function_str, js_toString_str,
"object");
@@ -1323,7 +1323,7 @@ fun_toSource(JSContext* cx, unsigned argc, Value* vp)
#endif
bool
js_fun_call(JSContext* cx, unsigned argc, Value* vp)
js::fun_call(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
@@ -1347,7 +1347,7 @@ js_fun_call(JSContext* cx, unsigned argc, Value* vp)
// ES5 15.3.4.3
bool
js_fun_apply(JSContext* cx, unsigned argc, Value* vp)
js::fun_apply(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
@@ -1360,7 +1360,7 @@ js_fun_apply(JSContext* cx, unsigned argc, Value* vp)
// Step 2.
if (args.length() < 2 || args[1].isNullOrUndefined())
return js_fun_call(cx, (args.length() > 0) ? 1 : 0, vp);
return fun_call(cx, (args.length() > 0) ? 1 : 0, vp);
InvokeArgs args2(cx);
@@ -1383,7 +1383,7 @@ js_fun_apply(JSContext* cx, unsigned argc, Value* vp)
} else {
// Step 3.
if (!args[1].isObject()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
JSMSG_BAD_APPLY_ARGS, js_apply_str);
return false;
}
@@ -1397,7 +1397,7 @@ js_fun_apply(JSContext* cx, unsigned argc, Value* vp)
// Step 6.
if (length > ARGS_LENGTH_MAX) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_TOO_MANY_FUN_APPLY_ARGS);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_TOO_MANY_FUN_APPLY_ARGS);
return false;
}
@@ -1665,7 +1665,7 @@ js::CallOrConstructBoundFunction(JSContext* cx, unsigned argc, Value* vp)
unsigned argslen = fun->getBoundFunctionArgumentCount();
if (args.length() + argslen > ARGS_LENGTH_MAX) {
js_ReportAllocationOverflow(cx);
ReportAllocationOverflow(cx);
return false;
}
@@ -1738,7 +1738,7 @@ js::fun_bind(JSContext* cx, unsigned argc, Value* vp)
// Steps 4-14.
RootedValue thisArg(cx, args.length() >= 1 ? args[0] : UndefinedValue());
RootedObject target(cx, &thisv.toObject());
JSObject* boundFunction = js_fun_bind(cx, target, thisArg, boundArgs, argslen);
JSObject* boundFunction = fun_bind(cx, target, thisArg, boundArgs, argslen);
if (!boundFunction)
return false;
@@ -1748,8 +1748,8 @@ js::fun_bind(JSContext* cx, unsigned argc, Value* vp)
}
JSObject*
js_fun_bind(JSContext* cx, HandleObject target, HandleValue thisArg,
Value* boundArgs, unsigned argslen)
js::fun_bind(JSContext* cx, HandleObject target, HandleValue thisArg,
Value* boundArgs, unsigned argslen)
{
double length = 0.0;
// Try to avoid invoking the resolve hook.
@@ -1835,7 +1835,7 @@ js_fun_bind(JSContext* cx, HandleObject target, HandleValue thisArg,
static bool
OnBadFormal(JSContext* cx)
{
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_FORMAL);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_FORMAL);
return false;
}
@@ -1844,8 +1844,8 @@ const JSFunctionSpec js::function_methods[] = {
JS_FN(js_toSource_str, fun_toSource, 0,0),
#endif
JS_FN(js_toString_str, fun_toString, 0,0),
JS_FN(js_apply_str, js_fun_apply, 2,0),
JS_FN(js_call_str, js_fun_call, 1,0),
JS_FN(js_apply_str, fun_apply, 2,0),
JS_FN(js_call_str, fun_call, 1,0),
JS_FN("bind", fun_bind, 1,0),
JS_FN("isGenerator", fun_isGenerator,0,0),
JS_FS_END
@@ -1860,7 +1860,7 @@ FunctionConstructor(JSContext* cx, unsigned argc, Value* vp, GeneratorKind gener
/* Block this call if security callbacks forbid it. */
Rooted<GlobalObject*> global(cx, &args.callee().global());
if (!GlobalObject::isRuntimeCodeGenEnabled(cx, global)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CSP_BLOCKED_FUNCTION);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CSP_BLOCKED_FUNCTION);
return false;
}
@@ -1922,7 +1922,7 @@ FunctionConstructor(JSContext* cx, unsigned argc, Value* vp, GeneratorKind gener
size_t old_args_length = args_length;
args_length = old_args_length + arg->length();
if (args_length < old_args_length) {
js_ReportAllocationOverflow(cx);
ReportAllocationOverflow(cx);
return false;
}
}
@@ -1932,7 +1932,7 @@ FunctionConstructor(JSContext* cx, unsigned argc, Value* vp, GeneratorKind gener
args_length = old_args_length + n - 1;
if (args_length < old_args_length ||
args_length >= ~(size_t)0 / sizeof(char16_t)) {
js_ReportAllocationOverflow(cx);
ReportAllocationOverflow(cx);
return false;
}
@@ -1944,7 +1944,7 @@ FunctionConstructor(JSContext* cx, unsigned argc, Value* vp, GeneratorKind gener
LifoAllocScope las(&cx->tempLifoAlloc());
char16_t* cp = cx->tempLifoAlloc().newArray<char16_t>(args_length + 1);
if (!cp) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return false;
}
ConstTwoByteChars collected_args(cp, args_length + 1);
@@ -2362,7 +2362,7 @@ js::ReportIncompatibleMethod(JSContext* cx, CallReceiver call, const Class* clas
if (JSFunction* fun = ReportIfNotFunction(cx, call.calleev())) {
JSAutoByteString funNameBytes;
if (const char* funName = GetFunctionNameBytes(cx, fun, &funNameBytes)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
clasp->name, funName, InformalValueTypeName(thisv));
}
}
@@ -2374,7 +2374,7 @@ js::ReportIncompatible(JSContext* cx, CallReceiver call)
if (JSFunction* fun = ReportIfNotFunction(cx, call.calleev())) {
JSAutoByteString funNameBytes;
if (const char* funName = GetFunctionNameBytes(cx, fun, &funNameBytes)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_METHOD,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_METHOD,
funName, "method", InformalValueTypeName(call.thisv()));
}
}
+7 -7
View File
@@ -696,17 +696,17 @@ CallOrConstructBoundFunction(JSContext*, unsigned, js::Value*);
extern const JSFunctionSpec function_methods[];
} /* namespace js */
extern bool
fun_apply(JSContext* cx, unsigned argc, Value* vp);
extern bool
js_fun_apply(JSContext* cx, unsigned argc, js::Value* vp);
extern bool
js_fun_call(JSContext* cx, unsigned argc, js::Value* vp);
fun_call(JSContext* cx, unsigned argc, Value* vp);
extern JSObject*
js_fun_bind(JSContext* cx, js::HandleObject target, js::HandleValue thisArg,
js::Value* boundArgs, unsigned argslen);
fun_bind(JSContext* cx, HandleObject target, HandleValue thisArg,
Value* boundArgs, unsigned argslen);
} /* namespace js */
#ifdef DEBUG
namespace JS {
+4 -4
View File
@@ -2986,7 +2986,7 @@ GCRuntime::refillFreeListFromMainThread(JSContext* cx, AllocKind thingKind)
// We are really just totally out of memory.
MOZ_ASSERT(allowGC, "A fallible allocation must not report OOM on failure.");
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return nullptr;
}
@@ -3010,7 +3010,7 @@ GCRuntime::refillFreeListOffMainThread(ExclusiveContext* cx, AllocKind thingKind
if (thing)
return thing;
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return nullptr;
}
@@ -6512,12 +6512,12 @@ js::NewCompartment(JSContext* cx, Zone* zone, JSPrincipals* principals,
AutoLockGC lock(rt);
if (!zone->compartments.append(compartment.get())) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return nullptr;
}
if (zoneHolder && !rt->gc.zones.append(zone)) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return nullptr;
}
+3 -11
View File
@@ -853,15 +853,11 @@ const size_t MAX_EMPTY_CHUNK_AGE = 4;
} /* namespace gc */
} /* namespace js */
extern bool
js_InitGC(JSRuntime* rt, uint32_t maxbytes);
InitGC(JSRuntime* rt, uint32_t maxbytes);
extern void
js_FinishGC(JSRuntime* rt);
namespace js {
FinishGC(JSRuntime* rt);
class InterpreterFrame;
@@ -1111,12 +1107,8 @@ extern void
IterateScripts(JSRuntime* rt, JSCompartment* compartment,
void* data, IterateScriptCallback scriptCallback);
} /* namespace js */
extern void
js_FinalizeStringRT(JSRuntime* rt, JSString* str);
namespace js {
FinalizeStringRT(JSRuntime* rt, JSString* str);
JSCompartment*
NewCompartment(JSContext* cx, JS::Zone* zone, JSPrincipals* principals,
+20 -20
View File
@@ -474,7 +474,7 @@ CheckAllocatorState(ExclusiveContext* cx, AllocKind kind)
// For testing out of memory conditions
if (!PossiblyFail()) {
js_ReportOutOfMemory(ncx);
ReportOutOfMemory(ncx);
return false;
}
@@ -676,25 +676,25 @@ NewGCAccessorShape(ExclusiveContext* cx)
return gc::AllocateNonObject<AccessorShape, CanGC>(cx);
}
inline JSScript*
NewGCScript(ExclusiveContext* cx)
{
return gc::AllocateNonObject<JSScript, js::CanGC>(cx);
}
inline LazyScript*
NewGCLazyScript(ExclusiveContext* cx)
{
return gc::AllocateNonObject<LazyScript, CanGC>(cx);
}
template <AllowGC allowGC>
inline BaseShape*
NewGCBaseShape(ExclusiveContext* cx)
{
return gc::AllocateNonObject<js::BaseShape, allowGC>(cx);
}
} /* namespace js */
inline JSScript*
js_NewGCScript(js::ExclusiveContext* cx)
{
return js::gc::AllocateNonObject<JSScript, js::CanGC>(cx);
}
inline js::LazyScript*
js_NewGCLazyScript(js::ExclusiveContext* cx)
{
return js::gc::AllocateNonObject<js::LazyScript, js::CanGC>(cx);
}
template <js::AllowGC allowGC>
inline js::BaseShape*
js_NewGCBaseShape(js::ExclusiveContext* cx)
{
return js::gc::AllocateNonObject<js::BaseShape, allowGC>(cx);
}
#endif /* jsgcinlines_h */
+7 -7
View File
@@ -140,8 +140,8 @@ static bool
SortComparatorIntegerIds(jsid a, jsid b, bool* lessOrEqualp)
{
uint32_t indexA, indexB;
MOZ_ALWAYS_TRUE(js_IdIsIndex(a, &indexA));
MOZ_ALWAYS_TRUE(js_IdIsIndex(b, &indexB));
MOZ_ALWAYS_TRUE(IdIsIndex(a, &indexA));
MOZ_ALWAYS_TRUE(IdIsIndex(b, &indexB));
*lessOrEqualp = (indexA <= indexB);
return true;
}
@@ -186,7 +186,7 @@ EnumerateNativeProperties(JSContext* cx, HandleNativeObject pobj, unsigned flags
Shape& shape = r.front();
jsid id = shape.propid();
uint32_t dummy;
if (js_IdIsIndex(id, &dummy)) {
if (IdIsIndex(id, &dummy)) {
if (!Enumerate(cx, pobj, id, shape.enumerable(), flags, ht, props))
return false;
}
@@ -223,7 +223,7 @@ EnumerateNativeProperties(JSContext* cx, HandleNativeObject pobj, unsigned flags
}
uint32_t dummy;
if (isIndexed && js_IdIsIndex(id, &dummy))
if (isIndexed && IdIsIndex(id, &dummy))
continue;
if (!Enumerate(cx, pobj, id, shape.enumerable(), flags, ht, props))
@@ -928,7 +928,7 @@ js::IteratorConstructor(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
if (args.length() == 0) {
js_ReportMissingArg(cx, args.calleev(), 0);
ReportMissingArg(cx, args.calleev(), 0);
return false;
}
@@ -1498,7 +1498,7 @@ GlobalObject::initStringIteratorProto(JSContext* cx, Handle<GlobalObject*> globa
}
JSObject*
js_InitLegacyIteratorClass(JSContext* cx, HandleObject obj)
js::InitLegacyIteratorClass(JSContext* cx, HandleObject obj)
{
Handle<GlobalObject*> global = obj.as<GlobalObject>();
@@ -1536,7 +1536,7 @@ js_InitLegacyIteratorClass(JSContext* cx, HandleObject obj)
}
JSObject*
js_InitStopIterationClass(JSContext* cx, HandleObject obj)
js::InitStopIterationClass(JSContext* cx, HandleObject obj)
{
Handle<GlobalObject*> global = obj.as<GlobalObject>();
if (!global->getPrototype(JSProto_StopIteration).isObject()) {
+6 -6
View File
@@ -212,12 +212,12 @@ ThrowStopIteration(JSContext* cx);
extern JSObject*
CreateItrResultObject(JSContext* cx, HandleValue value, bool done);
extern JSObject*
InitLegacyIteratorClass(JSContext* cx, HandleObject obj);
extern JSObject*
InitStopIterationClass(JSContext* cx, HandleObject obj);
} /* namespace js */
extern JSObject*
js_InitLegacyIteratorClass(JSContext* cx, js::HandleObject obj);
extern JSObject*
js_InitStopIterationClass(JSContext* cx, js::HandleObject obj);
#endif /* jsiter_h */
+1 -1
View File
@@ -1607,7 +1607,7 @@ static const JSFunctionSpec math_static_methods[] = {
};
JSObject*
js_InitMathClass(JSContext* cx, HandleObject obj)
js::InitMathClass(JSContext* cx, HandleObject obj)
{
RootedObject proto(cx, obj->as<GlobalObject>().getOrCreateObjectPrototype(cx));
if (!proto)
+1 -5
View File
@@ -83,16 +83,12 @@ class MathCache
size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf);
};
} /* namespace js */
/*
* JS math functions.
*/
extern JSObject*
js_InitMathClass(JSContext* cx, js::HandleObject obj);
namespace js {
InitMathClass(JSContext* cx, HandleObject obj);
extern void
random_initState(uint64_t* rngState);
+20 -20
View File
@@ -81,7 +81,7 @@ ComputeAccurateDecimalInteger(ExclusiveContext* cx, const CharT* start, const Ch
int err = 0;
*dp = js_strtod_harder(cx->dtoaState(), cstr, &estr, &err);
if (err == JS_DTOA_ENOMEM) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return false;
}
@@ -681,8 +681,8 @@ Int32ToCString(ToCStringBuf* cbuf, int32_t i, size_t* len, int base = 10)
}
template <AllowGC allowGC>
static JSString * JS_FASTCALL
js_NumberToStringWithBase(ExclusiveContext* cx, double d, int base);
static JSString *
NumberToStringWithBase(ExclusiveContext* cx, double d, int base);
MOZ_ALWAYS_INLINE bool
num_toString_impl(JSContext* cx, const CallArgs& args)
@@ -698,13 +698,13 @@ num_toString_impl(JSContext* cx, const CallArgs& args)
return false;
if (d2 < 2 || d2 > 36) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_RADIX);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_RADIX);
return false;
}
base = int32_t(d2);
}
JSString* str = js_NumberToStringWithBase<CanGC>(cx, d, base);
JSString* str = NumberToStringWithBase<CanGC>(cx, d, base);
if (!str) {
JS_ReportOutOfMemory(cx);
return false;
@@ -714,7 +714,7 @@ num_toString_impl(JSContext* cx, const CallArgs& args)
}
bool
js_num_toString(JSContext* cx, unsigned argc, Value* vp)
js::num_toString(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod<IsNumber, num_toString_impl>(cx, args);
@@ -728,7 +728,7 @@ num_toLocaleString_impl(JSContext* cx, const CallArgs& args)
double d = Extract(args.thisv());
Rooted<JSString*> str(cx, js_NumberToStringWithBase<CanGC>(cx, d, 10));
RootedString str(cx, NumberToStringWithBase<CanGC>(cx, d, 10));
if (!str) {
JS_ReportOutOfMemory(cx);
return false;
@@ -864,7 +864,7 @@ num_valueOf_impl(JSContext* cx, const CallArgs& args)
}
bool
js_num_valueOf(JSContext* cx, unsigned argc, Value* vp)
js::num_valueOf(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod<IsNumber, num_valueOf_impl>(cx, args);
@@ -886,7 +886,7 @@ ComputePrecisionInRange(JSContext* cx, int minPrecision, int maxPrecision, Handl
ToCStringBuf cbuf;
if (char* numStr = NumberToCString(cx, &cbuf, prec, 10))
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_PRECISION_RANGE, numStr);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_PRECISION_RANGE, numStr);
return false;
}
@@ -967,7 +967,7 @@ num_toPrecision_impl(JSContext* cx, const CallArgs& args)
double d = Extract(args.thisv());
if (!args.hasDefined(0)) {
JSString* str = js_NumberToStringWithBase<CanGC>(cx, d, 10);
JSString* str = NumberToStringWithBase<CanGC>(cx, d, 10);
if (!str) {
JS_ReportOutOfMemory(cx);
return false;
@@ -994,13 +994,13 @@ static const JSFunctionSpec number_methods[] = {
#if JS_HAS_TOSOURCE
JS_FN(js_toSource_str, num_toSource, 0, 0),
#endif
JS_FN(js_toString_str, js_num_toString, 1, 0),
JS_FN(js_toString_str, num_toString, 1, 0),
#if EXPOSE_INTL_API
JS_SELF_HOSTED_FN(js_toLocaleString_str, "Number_toLocaleString", 0,0),
#else
JS_FN(js_toLocaleString_str, num_toLocaleString, 0,0),
#endif
JS_FN(js_valueOf_str, js_num_valueOf, 0, 0),
JS_FN(js_valueOf_str, num_valueOf, 0, 0),
JS_FN("toFixed", num_toFixed, 1, 0),
JS_FN("toExponential", num_toExponential, 1, 0),
JS_FN("toPrecision", num_toPrecision, 1, 0),
@@ -1166,7 +1166,7 @@ js::FinishRuntimeNumberState(JSRuntime* rt)
#endif
JSObject*
js_InitNumberClass(JSContext* cx, HandleObject obj)
js::InitNumberClass(JSContext* cx, HandleObject obj)
{
MOZ_ASSERT(obj->isNative());
@@ -1260,8 +1260,8 @@ js::NumberToCString(JSContext* cx, ToCStringBuf* cbuf, double d, int base/* = 10
}
template <AllowGC allowGC>
static JSString * JS_FASTCALL
js_NumberToStringWithBase(ExclusiveContext* cx, double d, int base)
static JSString *
NumberToStringWithBase(ExclusiveContext* cx, double d, int base)
{
ToCStringBuf cbuf;
char* numStr;
@@ -1300,7 +1300,7 @@ js_NumberToStringWithBase(ExclusiveContext* cx, double d, int base)
numStr = FracNumberToCString(cx, &cbuf, d, base);
if (!numStr) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return nullptr;
}
MOZ_ASSERT_IF(base == 10,
@@ -1319,7 +1319,7 @@ template <AllowGC allowGC>
JSString*
js::NumberToString(ExclusiveContext* cx, double d)
{
return js_NumberToStringWithBase<allowGC>(cx, d, 10);
return NumberToStringWithBase<allowGC>(cx, d, 10);
}
template JSString*
@@ -1341,7 +1341,7 @@ js::NumberToAtom(ExclusiveContext* cx, double d)
ToCStringBuf cbuf;
char* numStr = FracNumberToCString(cx, &cbuf, d);
if (!numStr) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return nullptr;
}
MOZ_ASSERT(!cbuf.dbuf && numStr >= cbuf.sbuf && numStr < cbuf.sbuf + cbuf.sbufSize);
@@ -1359,7 +1359,7 @@ js::NumberToAtom(ExclusiveContext* cx, double d)
JSFlatString*
js::NumberToString(JSContext* cx, double d)
{
if (JSString* str = js_NumberToStringWithBase<CanGC>(cx, d, 10))
if (JSString* str = NumberToStringWithBase<CanGC>(cx, d, 10))
return &str->asFlat();
return nullptr;
}
@@ -1523,7 +1523,7 @@ js::ToNumberSlow(ExclusiveContext* cx, Value v, double* out)
}
if (v.isSymbol()) {
if (cx->isJSContext()) {
JS_ReportErrorNumber(cx->asJSContext(), js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx->asJSContext(), GetErrorMessage, nullptr,
JSMSG_SYMBOL_TO_NUMBER);
}
return false;
+10 -10
View File
@@ -41,11 +41,11 @@ extern void
FinishRuntimeNumberState(JSRuntime* rt);
#endif
} /* namespace js */
/* Initialize the Number class, returning its prototype object. */
extern JSObject*
js_InitNumberClass(JSContext* cx, js::HandleObject obj);
InitNumberClass(JSContext* cx, HandleObject obj);
} /* namespace js */
/*
* String constants for global function names, used in jsapi.c and jsnum.c.
@@ -116,7 +116,7 @@ struct ToCStringBuf
* Convert a number to a C string. When base==10, this function implements
* ToString() as specified by ECMA-262-5 section 9.8.1. It handles integral
* values cheaply. Return nullptr if we ran out of memory. See also
* js_NumberToCString().
* NumberToCString().
*/
extern char*
NumberToCString(JSContext* cx, ToCStringBuf* cbuf, double d, int base = 10);
@@ -202,14 +202,14 @@ extern bool
js_strtod(js::ExclusiveContext* cx, const CharT* begin, const CharT* end,
const CharT** dEnd, double* d);
extern bool
js_num_toString(JSContext* cx, unsigned argc, js::Value* vp);
extern bool
js_num_valueOf(JSContext* cx, unsigned argc, js::Value* vp);
namespace js {
extern bool
num_toString(JSContext* cx, unsigned argc, Value* vp);
extern bool
num_valueOf(JSContext* cx, unsigned argc, Value* vp);
static MOZ_ALWAYS_INLINE bool
ValueFitsInInt32(const Value& v, int32_t* pi)
{
+33 -33
View File
@@ -75,7 +75,7 @@ JS_FRIEND_API(JSObject*)
JS_ObjectToInnerObject(JSContext* cx, HandleObject obj)
{
if (!obj) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INACTIVE);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INACTIVE);
return nullptr;
}
return GetInnerObject(obj);
@@ -96,7 +96,7 @@ js::NonNullObject(JSContext* cx, const Value& v)
char *bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, value, NullPtr());
if (!bytes)
return nullptr;
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, bytes);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, bytes);
return nullptr;
}
return &v.toObject();
@@ -241,7 +241,7 @@ js::GetFirstArgumentAsObject(JSContext* cx, const CallArgs& args, const char* me
MutableHandleObject objp)
{
if (args.length() == 0) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
method, "0", "s");
return false;
}
@@ -251,7 +251,7 @@ js::GetFirstArgumentAsObject(JSContext* cx, const CallArgs& args, const char* me
char* bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, v, NullPtr());
if (!bytes)
return false;
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_UNEXPECTED_TYPE,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_UNEXPECTED_TYPE,
bytes, "not an object");
js_free(bytes);
return false;
@@ -287,7 +287,7 @@ PropDesc::initialize(JSContext* cx, const Value& origval, bool checkAccessors)
char *bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, v, NullPtr());
if (!bytes)
return false;
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, bytes);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, bytes);
return false;
}
RootedObject desc(cx, &v.toObject());
@@ -370,7 +370,7 @@ PropDesc::initialize(JSContext* cx, const Value& origval, bool checkAccessors)
/* 8.10.7 step 9 */
if ((hasGet() || hasSet()) && (hasValue() || hasWritable())) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INVALID_DESCRIPTOR);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INVALID_DESCRIPTOR);
return false;
}
@@ -425,7 +425,7 @@ js::Throw(JSContext* cx, jsid id, unsigned errorNumber)
JSAutoByteString bytes(cx, idstr);
if (!bytes)
return false;
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, errorNumber, bytes.ptr());
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, errorNumber, bytes.ptr());
return false;
}
@@ -439,7 +439,7 @@ js::Throw(JSContext* cx, JSObject* obj, unsigned errorNumber)
nullptr, nullptr);
} else {
MOZ_ASSERT(js_ErrorFormatString[errorNumber].argCount == 0);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, errorNumber);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, errorNumber);
}
return false;
}
@@ -824,7 +824,7 @@ DefinePropertyOnArray(JSContext* cx, Handle<ArrayObject*> arr, HandleId id, cons
/* Step 3. */
uint32_t index;
if (js_IdIsIndex(id, &index)) {
if (IdIsIndex(id, &index)) {
/* Step 3b. */
uint32_t oldLen = arr->length();
@@ -993,7 +993,7 @@ js::SetIntegrityLevel(JSContext* cx, HandleObject obj, IntegrityLevel level)
if (!PreventExtensions(cx, obj, &status))
return false;
if (!status) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CHANGE_EXTENSIBILITY);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_CHANGE_EXTENSIBILITY);
return false;
}
@@ -1776,7 +1776,7 @@ JSObject*
js::CloneObject(JSContext* cx, HandleObject obj, Handle<js::TaggedProto> proto, HandleObject parent)
{
if (!obj->isNative() && !obj->is<ProxyObject>()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
JSMSG_CANT_CLONE_OBJECT);
return nullptr;
}
@@ -1788,7 +1788,7 @@ js::CloneObject(JSContext* cx, HandleObject obj, Handle<js::TaggedProto> proto,
return nullptr;
if (clone->is<JSFunction>() && (obj->compartment() != clone->compartment())) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
JSMSG_CANT_CLONE_OBJECT);
return nullptr;
}
@@ -2433,7 +2433,7 @@ DefineConstructorAndPrototype(JSContext* cx, HandleObject obj, JSProtoKey key, H
* passed null for proto; and
*
* 2. NewObject tolerating no default prototype (null proto slot value)
* due to this js_InitClass call coming from js_InitFunctionClass on an
* due to this js::InitClass call coming from js::InitFunctionClass on an
* otherwise-uninitialized global.
*
* 3. NewObject allocating a JSFunction-sized GC-thing when clasp is
@@ -2546,11 +2546,11 @@ bad:
}
NativeObject*
js_InitClass(JSContext* cx, HandleObject obj, HandleObject protoProto_,
const Class* clasp, Native constructor, unsigned nargs,
const JSPropertySpec* ps, const JSFunctionSpec* fs,
const JSPropertySpec* static_ps, const JSFunctionSpec* static_fs,
NativeObject** ctorp, AllocKind ctorKind)
js::InitClass(JSContext *cx, HandleObject obj, HandleObject protoProto_,
const Class* clasp, Native constructor, unsigned nargs,
const JSPropertySpec *ps, const JSFunctionSpec *fs,
const JSPropertySpec *static_ps, const JSFunctionSpec *static_fs,
NativeObject **ctorp, AllocKind ctorKind)
{
RootedObject protoProto(cx, protoProto_);
@@ -2570,7 +2570,7 @@ js_InitClass(JSContext* cx, HandleObject obj, HandleObject protoProto_,
*
* When initializing a standard class (other than Object), if protoProto is
* null, default to Object.prototype. The engine's internal uses of
* js_InitClass depend on this nicety.
* js::InitClass depend on this nicety.
*/
JSProtoKey key = JSCLASS_CACHED_PROTO_KEY(clasp);
if (key != JSProto_Null &&
@@ -3080,7 +3080,7 @@ js::SetPrototype(JSContext* cx, HandleObject obj, HandleObject proto, bool* succ
* have a mutable [[Prototype]].
*/
if (obj->is<ArrayBufferObject>()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_SETPROTOTYPEOF_FAIL,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_SETPROTOTYPEOF_FAIL,
"incompatible ArrayBuffer");
return false;
}
@@ -3089,7 +3089,7 @@ js::SetPrototype(JSContext* cx, HandleObject obj, HandleObject proto, bool* succ
* Disallow mutating the [[Prototype]] on Typed Objects, per the spec.
*/
if (obj->is<TypedObject>()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_SETPROTOTYPEOF_FAIL,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_SETPROTOTYPEOF_FAIL,
"incompatible TypedObject");
return false;
}
@@ -3099,7 +3099,7 @@ js::SetPrototype(JSContext* cx, HandleObject obj, HandleObject proto, bool* succ
* for flash-related security reasons.
*/
if (!strcmp(obj->getClass()->name, "Location")) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_SETPROTOTYPEOF_FAIL,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_SETPROTOTYPEOF_FAIL,
"incompatible Location object");
return false;
}
@@ -3313,7 +3313,7 @@ js::WatchGuts(JSContext* cx, JS::HandleObject origObj, JS::HandleId id, JS::Hand
if (!wpmap) {
wpmap = cx->runtime()->new_<WatchpointMap>();
if (!wpmap || !wpmap->init()) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return false;
}
cx->compartment()->watchpointMap = wpmap;
@@ -3340,7 +3340,7 @@ js::WatchProperty(JSContext* cx, HandleObject obj, HandleId id, HandleObject cal
return op(cx, obj, id, callable);
if (!obj->isNative() || IsAnyTypedArray(obj)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_WATCH,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_WATCH,
obj->getClass()->name);
return false;
}
@@ -3433,7 +3433,7 @@ JS::OrdinaryToPrimitive(JSContext* cx, HandleObject obj, JSType hint, MutableHan
/* Optimize (new String(...)).toString(). */
if (clasp == &StringObject::class_) {
StringObject* nobj = &obj->as<StringObject>();
if (ClassMethodIsNative(cx, nobj, &StringObject::class_, id, js_str_toString)) {
if (ClassMethodIsNative(cx, nobj, &StringObject::class_, id, str_toString)) {
vp.setString(nobj->unbox());
return true;
}
@@ -3455,7 +3455,7 @@ JS::OrdinaryToPrimitive(JSContext* cx, HandleObject obj, JSType hint, MutableHan
if (clasp == &StringObject::class_) {
id = NameToId(cx->names().valueOf);
StringObject* nobj = &obj->as<StringObject>();
if (ClassMethodIsNative(cx, nobj, &StringObject::class_, id, js_str_toString)) {
if (ClassMethodIsNative(cx, nobj, &StringObject::class_, id, str_toString)) {
vp.setString(nobj->unbox());
return true;
}
@@ -3465,7 +3465,7 @@ JS::OrdinaryToPrimitive(JSContext* cx, HandleObject obj, JSType hint, MutableHan
if (clasp == &NumberObject::class_) {
id = NameToId(cx->names().valueOf);
NumberObject* nobj = &obj->as<NumberObject>();
if (ClassMethodIsNative(cx, nobj, &NumberObject::class_, id, js_num_valueOf)) {
if (ClassMethodIsNative(cx, nobj, &NumberObject::class_, id, num_valueOf)) {
vp.setNumber(nobj->unbox());
return true;
}
@@ -3576,9 +3576,9 @@ js::ToObjectSlow(JSContext* cx, JS::HandleValue val, bool reportScanStack)
if (val.isNullOrUndefined()) {
if (reportScanStack) {
js_ReportIsNullOrUndefined(cx, JSDVG_SEARCH_STACK, val, NullPtr());
ReportIsNullOrUndefined(cx, JSDVG_SEARCH_STACK, val, NullPtr());
} else {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
val.isNull() ? "null" : "undefined", "object");
}
return nullptr;
@@ -3588,9 +3588,9 @@ js::ToObjectSlow(JSContext* cx, JS::HandleValue val, bool reportScanStack)
}
void
js_GetObjectSlotName(JSTracer* trc, char* buf, size_t bufsize)
js::GetObjectSlotName(JSTracer *trc, char *buf, size_t bufsize)
{
MOZ_ASSERT(trc->debugPrinter() == js_GetObjectSlotName);
MOZ_ASSERT(trc->debugPrinter() == GetObjectSlotName);
JSObject* obj = (JSObject*)trc->debugPrintArg();
uint32_t slot = uint32_t(trc->debugPrintIndex());
@@ -3656,13 +3656,13 @@ js_GetObjectSlotName(JSTracer* trc, char* buf, size_t bufsize)
}
bool
js_ReportGetterOnlyAssignment(JSContext* cx, bool strict)
js::ReportGetterOnlyAssignment(JSContext* cx, bool strict)
{
return JS_ReportErrorFlagsAndNumber(cx,
strict
? JSREPORT_ERROR
: JSREPORT_WARNING | JSREPORT_STRICT,
js_GetErrorMessage, nullptr,
GetErrorMessage, nullptr,
JSMSG_GETTER_ONLY);
}
+5 -10
View File
@@ -1190,12 +1190,12 @@ LookupNameUnqualified(JSContext* cx, HandlePropertyName name, HandleObject scope
}
extern JSObject*
js_FindVariableScope(JSContext* cx, JSFunction** funp);
namespace js {
extern JSObject*
FindVariableScope(JSContext* cx, JSFunction** funp);
bool
LookupPropertyPure(ExclusiveContext* cx, JSObject* obj, jsid id, JSObject** objp,
Shape** propp);
@@ -1245,16 +1245,11 @@ XDRObjectLiteral(XDRState<mode>* xdr, MutableHandleNativeObject obj);
extern JSObject*
CloneObjectLiteral(JSContext* cx, HandleObject parent, HandleObject srcObj);
} /* namespace js */
extern void
js_GetObjectSlotName(JSTracer* trc, char* buf, size_t bufsize);
GetObjectSlotName(JSTracer* trc, char* buf, size_t bufsize);
extern bool
js_ReportGetterOnlyAssignment(JSContext* cx, bool strict);
namespace js {
ReportGetterOnlyAssignment(JSContext* cx, bool strict);
extern JSObject*
NonNullObject(JSContext* cx, const Value& v);
+10 -9
View File
@@ -413,7 +413,7 @@ ToPrimitive(JSContext* cx, MutableHandleValue vp)
if (obj->is<StringObject>()) {
jsid id = NameToId(cx->names().valueOf);
StringObject* nobj = &obj->as<StringObject>();
if (ClassMethodIsNative(cx, nobj, &StringObject::class_, id, js_str_toString)) {
if (ClassMethodIsNative(cx, nobj, &StringObject::class_, id, str_toString)) {
vp.setString(nobj->unbox());
return true;
}
@@ -423,7 +423,7 @@ ToPrimitive(JSContext* cx, MutableHandleValue vp)
if (obj->is<NumberObject>()) {
jsid id = NameToId(cx->names().valueOf);
NumberObject* nobj = &obj->as<NumberObject>();
if (ClassMethodIsNative(cx, nobj, &NumberObject::class_, id, js_num_valueOf)) {
if (ClassMethodIsNative(cx, nobj, &NumberObject::class_, id, num_valueOf)) {
vp.setNumber(nobj->unbox());
return true;
}
@@ -785,14 +785,15 @@ ApplyAttributes(unsigned attrs, bool enumerable, bool writable, bool configurabl
return attrs;
}
} /* namespace js */
extern js::NativeObject*
js_InitClass(JSContext* cx, js::HandleObject obj, js::HandleObject parent_proto,
const js::Class* clasp, JSNative constructor, unsigned nargs,
const JSPropertySpec* ps, const JSFunctionSpec* fs,
const JSPropertySpec* static_ps, const JSFunctionSpec* static_fs,
js::NativeObject** ctorp = nullptr,
js::gc::AllocKind ctorKind = JSFunction::FinalizeKind);
InitClass(JSContext* cx, js::HandleObject obj, HandleObject parent_proto,
const Class* clasp, JSNative constructor, unsigned nargs,
const JSPropertySpec* ps, const JSFunctionSpec* fs,
const JSPropertySpec* static_ps, const JSFunctionSpec* static_fs,
NativeObject** ctorp = nullptr,
gc::AllocKind ctorKind = JSFunction::FinalizeKind);
} /* namespace js */
#endif /* jsobjinlines_h */
+6 -6
View File
@@ -309,7 +309,7 @@ JO(JSContext* cx, HandleObject obj, StringifyContext* scx)
if (!detect.init())
return false;
if (detect.foundCycle()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_JSON_CYCLIC_VALUE,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_JSON_CYCLIC_VALUE,
js_object_str);
return false;
}
@@ -400,7 +400,7 @@ JA(JSContext* cx, HandleObject obj, StringifyContext* scx)
if (!detect.init())
return false;
if (detect.foundCycle()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_JSON_CYCLIC_VALUE,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_JSON_CYCLIC_VALUE,
js_object_str);
return false;
}
@@ -517,8 +517,8 @@ Str(JSContext* cx, const Value& v, StringifyContext* scx)
/* ES5 15.12.3. */
bool
js_Stringify(JSContext* cx, MutableHandleValue vp, JSObject* replacer_, Value space_,
StringBuffer& sb)
js::Stringify(JSContext* cx, MutableHandleValue vp, JSObject* replacer_, Value space_,
StringBuffer& sb)
{
RootedObject replacer(cx, replacer_);
RootedValue space(cx, space_);
@@ -861,7 +861,7 @@ json_stringify(JSContext* cx, unsigned argc, Value* vp)
RootedValue space(cx, args.get(2));
StringBuffer sb(cx);
if (!js_Stringify(cx, &value, replacer, space, sb))
if (!Stringify(cx, &value, replacer, space, sb))
return false;
// XXX This can never happen to nsJSON.cpp, but the JSON object
@@ -889,7 +889,7 @@ static const JSFunctionSpec json_static_methods[] = {
};
JSObject*
js_InitJSONClass(JSContext* cx, HandleObject obj)
js::InitJSONClass(JSContext* cx, HandleObject obj)
{
Rooted<GlobalObject*> global(cx, &obj->as<GlobalObject>());
+3 -6
View File
@@ -15,16 +15,13 @@
namespace js {
class StringBuffer;
}
extern JSObject*
js_InitJSONClass(JSContext* cx, js::HandleObject obj);
InitJSONClass(JSContext* cx, HandleObject obj);
extern bool
js_Stringify(JSContext* cx, js::MutableHandleValue vp, JSObject* replacer,
js::Value space, js::StringBuffer& sb);
namespace js {
Stringify(JSContext* cx, js::MutableHandleValue vp, JSObject* replacer,
Value space, StringBuffer& sb);
template <typename CharT>
extern bool
+23 -70
View File
@@ -73,7 +73,7 @@ static const char * const CodeToken[] = {
};
/*
* Array of JS bytecode names used by PC count JSON, DEBUG-only js_Disassemble
* Array of JS bytecode names used by PC count JSON, DEBUG-only Disassemble
* and JIT debug spew.
*/
const char * const js_CodeName[] = {
@@ -87,7 +87,7 @@ const char * const js_CodeName[] = {
#define COUNTS_LEN 16
size_t
js_GetVariableBytecodeLength(jsbytecode* pc)
js::GetVariableBytecodeLength(jsbytecode* pc)
{
JSOp op = JSOp(*pc);
MOZ_ASSERT(js_CodeSpec[op].length == -1);
@@ -235,7 +235,7 @@ js::DumpIonScriptCounts(Sprinter* sp, jit::IonScriptCounts* ionCounts)
}
void
js_DumpPCCounts(JSContext* cx, HandleScript script, js::Sprinter* sp)
js::DumpPCCounts(JSContext* cx, HandleScript script, Sprinter* sp)
{
MOZ_ASSERT(script->hasScriptCounts());
@@ -245,7 +245,7 @@ js_DumpPCCounts(JSContext* cx, HandleScript script, js::Sprinter* sp)
JSOp op = JSOp(*pc);
jsbytecode* next = GetNextPc(pc);
if (!js_Disassemble1(cx, script, pc, script->pcToOffset(pc), true, sp))
if (!Disassemble1(cx, script, pc, script->pcToOffset(pc), true, sp))
return;
size_t total = PCCounts::numCounts(op);
@@ -290,7 +290,7 @@ js::DumpCompartmentPCCounts(JSContext* cx)
return;
fprintf(stdout, "--- SCRIPT %s:%d ---\n", script->filename(), (int) script->lineno());
js_DumpPCCounts(cx, script, &sprinter);
DumpPCCounts(cx, script, &sprinter);
fputs(sprinter.string(), stdout);
fprintf(stdout, "--- END SCRIPT %s:%d ---\n", script->filename(), (int) script->lineno());
}
@@ -425,7 +425,7 @@ class BytecodeParser
void reportOOM() {
allocScope_.releaseEarly();
js_ReportOutOfMemory(cx_);
ReportOutOfMemory(cx_);
}
uint32_t numSlots() {
@@ -717,9 +717,9 @@ js::ReconstructStackDepth(JSContext* cx, JSScript* script, jsbytecode* pc, uint3
* current line. If showAll is true, include the source note type and the
* entry stack depth.
*/
JS_FRIEND_API(bool)
js_DisassembleAtPC(JSContext* cx, JSScript* scriptArg, bool lines,
jsbytecode* pc, bool showAll, Sprinter* sp)
static bool
DisassembleAtPC(JSContext* cx, JSScript* scriptArg, bool lines,
jsbytecode* pc, bool showAll, Sprinter* sp)
{
RootedScript script(cx, scriptArg);
BytecodeParser parser(cx, script);
@@ -763,7 +763,7 @@ js_DisassembleAtPC(JSContext* cx, JSScript* scriptArg, bool lines,
sp->put(" ");
}
if (showAll) {
jssrcnote* sn = js_GetSrcNote(cx, script, next);
jssrcnote* sn = GetSrcNote(cx, script, next);
if (sn) {
MOZ_ASSERT(!SN_IS_TERMINATOR(sn));
jssrcnote* next = SN_NEXT(sn);
@@ -781,7 +781,7 @@ js_DisassembleAtPC(JSContext* cx, JSScript* scriptArg, bool lines,
else
Sprint(sp, " ");
}
len = js_Disassemble1(cx, script, next, script->pcToOffset(next), lines, sp);
len = Disassemble1(cx, script, next, script->pcToOffset(next), lines, sp);
if (!len)
return false;
next += len;
@@ -790,56 +790,9 @@ js_DisassembleAtPC(JSContext* cx, JSScript* scriptArg, bool lines,
}
bool
js_Disassemble(JSContext* cx, HandleScript script, bool lines, Sprinter* sp)
js::Disassemble(JSContext* cx, HandleScript script, bool lines, Sprinter* sp)
{
return js_DisassembleAtPC(cx, script, lines, nullptr, false, sp);
}
JS_FRIEND_API(bool)
js_DumpPC(JSContext* cx)
{
js::gc::AutoSuppressGC suppressGC(cx);
Sprinter sprinter(cx);
if (!sprinter.init())
return false;
ScriptFrameIter iter(cx);
if (iter.done()) {
fprintf(stdout, "Empty stack.\n");
return true;
}
RootedScript script(cx, iter.script());
bool ok = js_DisassembleAtPC(cx, script, true, iter.pc(), false, &sprinter);
fprintf(stdout, "%s", sprinter.string());
return ok;
}
JS_FRIEND_API(bool)
js_DumpScript(JSContext* cx, JSScript* scriptArg)
{
js::gc::AutoSuppressGC suppressGC(cx);
Sprinter sprinter(cx);
if (!sprinter.init())
return false;
RootedScript script(cx, scriptArg);
bool ok = js_Disassemble(cx, script, true, &sprinter);
fprintf(stdout, "%s", sprinter.string());
return ok;
}
/*
* Useful to debug ReconstructPCStack.
*/
JS_FRIEND_API(bool)
js_DumpScriptDepth(JSContext* cx, JSScript* scriptArg, jsbytecode* pc)
{
js::gc::AutoSuppressGC suppressGC(cx);
Sprinter sprinter(cx);
if (!sprinter.init())
return false;
RootedScript script(cx, scriptArg);
bool ok = js_DisassembleAtPC(cx, script, true, pc, true, &sprinter);
fprintf(stdout, "%s", sprinter.string());
return ok;
return DisassembleAtPC(cx, script, lines, nullptr, false, sp);
}
static char*
@@ -923,19 +876,19 @@ ToDisassemblySource(JSContext* cx, HandleValue v, JSAutoByteString* bytes)
}
}
return !!js_ValueToPrintable(cx, v, bytes, true);
return !!ValueToPrintable(cx, v, bytes, true);
}
unsigned
js_Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc,
unsigned loc, bool lines, Sprinter* sp)
js::Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc,
unsigned loc, bool lines, Sprinter* sp)
{
JSOp op = (JSOp)*pc;
if (op >= JSOP_LIMIT) {
char numBuf1[12], numBuf2[12];
JS_snprintf(numBuf1, sizeof numBuf1, "%d", op);
JS_snprintf(numBuf2, sizeof numBuf2, "%d", JSOP_LIMIT);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
JSMSG_BYTECODE_TOO_BIG, numBuf1, numBuf2);
return 0;
}
@@ -1089,7 +1042,7 @@ js_Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc,
default: {
char numBuf[12];
JS_snprintf(numBuf, sizeof numBuf, "%lx", (unsigned long) cs->format);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
JSMSG_UNKNOWN_FORMAT, numBuf);
return 0;
}
@@ -1295,7 +1248,7 @@ Sprinter::reportOutOfMemory()
if (reportedOOM)
return;
if (context)
js_ReportOutOfMemory(context);
ReportOutOfMemory(context);
reportedOOM = true;
}
@@ -1417,7 +1370,7 @@ QuoteString(Sprinter* sp, JSString* str, char16_t quote)
}
JSString*
js_QuoteString(ExclusiveContext* cx, JSString* str, char16_t quote)
js::QuoteString(ExclusiveContext* cx, JSString* str, char16_t quote)
{
Sprinter sprinter(cx);
if (!sprinter.init())
@@ -1509,7 +1462,7 @@ ExpressionDecompiler::decompilePC(jsbytecode* pc)
// Handle simple cases of binary and unary operators.
switch (js_CodeSpec[op].nuses) {
case 2: {
jssrcnote* sn = js_GetSrcNote(cx, script, pc);
jssrcnote* sn = GetSrcNote(cx, script, pc);
if (!sn || SN_TYPE(sn) != SRC_ASSIGNOP)
return write("(") &&
decompilePCForStackOperand(pc, -2) &&
@@ -2145,7 +2098,7 @@ js::GetPCCountScriptSummary(JSContext* cx, size_t index)
JSRuntime* rt = cx->runtime();
if (!rt->scriptAndCountsVector || index >= rt->scriptAndCountsVector->length()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BUFFER_TOO_SMALL);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BUFFER_TOO_SMALL);
return nullptr;
}
@@ -2398,7 +2351,7 @@ js::GetPCCountScriptContents(JSContext* cx, size_t index)
JSRuntime* rt = cx->runtime();
if (!rt->scriptAndCountsVector || index >= rt->scriptAndCountsVector->length()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BUFFER_TOO_SMALL);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BUFFER_TOO_SMALL);
return nullptr;
}
+11 -14
View File
@@ -392,15 +392,15 @@ JOF_OPTYPE(JSOp op)
#pragma warning(disable:4100)
#endif
namespace js {
/*
* Return a GC'ed string containing the chars in str, with any non-printing
* chars or quotes (' or " as specified by the quote argument) escaped, and
* with the quote character at the beginning and end of the result string.
*/
extern JSString*
js_QuoteString(js::ExclusiveContext* cx, JSString* str, char16_t quote);
namespace js {
QuoteString(ExclusiveContext* cx, JSString* str, char16_t quote);
static inline bool
IsJumpOpcode(JSOp op)
@@ -535,13 +535,13 @@ ReconstructStackDepth(JSContext* cx, JSScript* script, jsbytecode* pc, uint32_t*
#define JSDVG_IGNORE_STACK 0
#define JSDVG_SEARCH_STACK 1
namespace js {
/*
* Get the length of variable-length bytecode like JSOP_TABLESWITCH.
*/
extern size_t
js_GetVariableBytecodeLength(jsbytecode* pc);
namespace js {
GetVariableBytecodeLength(jsbytecode* pc);
/*
* Find the source expression that resulted in v, and return a newly allocated
@@ -676,7 +676,7 @@ GetBytecodeLength(jsbytecode* pc)
if (js_CodeSpec[op].length != -1)
return js_CodeSpec[op].length;
return js_GetVariableBytecodeLength(pc);
return GetVariableBytecodeLength(pc);
}
static inline bool
@@ -985,25 +985,22 @@ GetNextPc(jsbytecode* pc)
return pc + GetBytecodeLength(pc);
}
} /* namespace js */
#if defined(DEBUG)
/*
* Disassemblers, for debugging only.
*/
bool
js_Disassemble(JSContext* cx, JS::Handle<JSScript*> script, bool lines, js::Sprinter* sp);
Disassemble(JSContext* cx, JS::Handle<JSScript*> script, bool lines, Sprinter* sp);
unsigned
js_Disassemble1(JSContext* cx, JS::Handle<JSScript*> script, jsbytecode* pc, unsigned loc,
bool lines, js::Sprinter* sp);
Disassemble1(JSContext* cx, JS::Handle<JSScript*> script, jsbytecode* pc, unsigned loc,
bool lines, Sprinter* sp);
#endif
void
js_DumpPCCounts(JSContext* cx, JS::Handle<JSScript*> script, js::Sprinter* sp);
DumpPCCounts(JSContext* cx, JS::Handle<JSScript*> script, Sprinter* sp);
namespace js {
namespace jit { struct IonScriptCounts; }
void
DumpIonScriptCounts(js::Sprinter* sp, jit::IonScriptCounts* ionCounts);
+2 -2
View File
@@ -73,7 +73,7 @@ PropertyTree::insertChild(ExclusiveContext* cx, Shape* parent, Shape* child)
KidsHash* hash = HashChildren(shape, child);
if (!hash) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return false;
}
kidp->setHash(hash);
@@ -82,7 +82,7 @@ PropertyTree::insertChild(ExclusiveContext* cx, Shape* parent, Shape* child)
}
if (!kidp->toHash()->putNew(StackShape(child), child)) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return false;
}
+54 -54
View File
@@ -57,60 +57,60 @@
#endif
#define JS_FOR_PROTOTYPES(real,imaginary) \
imaginary(Null, 0, js_InitNullClass, dummy) \
real(Object, 1, js_InitViaClassSpec, OCLASP(Plain)) \
real(Function, 2, js_InitViaClassSpec, &JSFunction::class_) \
real(Array, 3, js_InitViaClassSpec, OCLASP(Array)) \
real(Boolean, 4, js_InitBooleanClass, OCLASP(Boolean)) \
real(JSON, 5, js_InitJSONClass, CLASP(JSON)) \
real(Date, 6, js_InitViaClassSpec, OCLASP(Date)) \
real(Math, 7, js_InitMathClass, CLASP(Math)) \
real(Number, 8, js_InitNumberClass, OCLASP(Number)) \
real(String, 9, js_InitStringClass, OCLASP(String)) \
real(RegExp, 10, js_InitRegExpClass, OCLASP(RegExp)) \
real(Error, 11, js_InitViaClassSpec, ERROR_CLASP(JSEXN_ERR)) \
real(InternalError, 12, js_InitViaClassSpec, ERROR_CLASP(JSEXN_INTERNALERR)) \
real(EvalError, 13, js_InitViaClassSpec, ERROR_CLASP(JSEXN_EVALERR)) \
real(RangeError, 14, js_InitViaClassSpec, ERROR_CLASP(JSEXN_RANGEERR)) \
real(ReferenceError, 15, js_InitViaClassSpec, ERROR_CLASP(JSEXN_REFERENCEERR)) \
real(SyntaxError, 16, js_InitViaClassSpec, ERROR_CLASP(JSEXN_SYNTAXERR)) \
real(TypeError, 17, js_InitViaClassSpec, ERROR_CLASP(JSEXN_TYPEERR)) \
real(URIError, 18, js_InitViaClassSpec, ERROR_CLASP(JSEXN_URIERR)) \
real(Iterator, 19, js_InitLegacyIteratorClass,OCLASP(PropertyIterator)) \
real(StopIteration, 20, js_InitStopIterationClass, OCLASP(StopIteration)) \
real(ArrayBuffer, 21, js_InitArrayBufferClass, &js::ArrayBufferObject::protoClass) \
real(Int8Array, 22, js_InitViaClassSpec, TYPED_ARRAY_CLASP(Int8)) \
real(Uint8Array, 23, js_InitViaClassSpec, TYPED_ARRAY_CLASP(Uint8)) \
real(Int16Array, 24, js_InitViaClassSpec, TYPED_ARRAY_CLASP(Int16)) \
real(Uint16Array, 25, js_InitViaClassSpec, TYPED_ARRAY_CLASP(Uint16)) \
real(Int32Array, 26, js_InitViaClassSpec, TYPED_ARRAY_CLASP(Int32)) \
real(Uint32Array, 27, js_InitViaClassSpec, TYPED_ARRAY_CLASP(Uint32)) \
real(Float32Array, 28, js_InitViaClassSpec, TYPED_ARRAY_CLASP(Float32)) \
real(Float64Array, 29, js_InitViaClassSpec, TYPED_ARRAY_CLASP(Float64)) \
real(Uint8ClampedArray, 30, js_InitViaClassSpec, TYPED_ARRAY_CLASP(Uint8Clamped)) \
real(Proxy, 31, js_InitProxyClass, OCLASP(Proxy)) \
real(WeakMap, 32, js_InitWeakMapClass, OCLASP(WeakMap)) \
real(Map, 33, js_InitMapClass, OCLASP(Map)) \
real(Set, 34, js_InitSetClass, OCLASP(Set)) \
real(DataView, 35, js_InitDataViewClass, OCLASP(DataView)) \
real(Symbol, 36, js_InitSymbolClass, OCLASP(Symbol)) \
IF_SAB(real,imaginary)(SharedArrayBuffer, 37, js_InitSharedArrayBufferClass, &js::SharedArrayBufferObject::protoClass) \
IF_INTL(real,imaginary) (Intl, 38, js_InitIntlClass, CLASP(Intl)) \
IF_BDATA(real,imaginary)(TypedObject, 39, js_InitTypedObjectModuleObject, OCLASP(TypedObjectModule)) \
real(SavedFrame, 40, js_InitViaClassSpec, &js::SavedFrame::class_) \
IF_BDATA(real,imaginary)(SIMD, 41, js_InitSIMDClass, OCLASP(SIMD)) \
real(WeakSet, 42, js_InitWeakSetClass, OCLASP(WeakSet)) \
IF_SAB(real,imaginary)(SharedInt8Array, 43, js_InitViaClassSpec, SHARED_TYPED_ARRAY_CLASP(Int8)) \
IF_SAB(real,imaginary)(SharedUint8Array, 44, js_InitViaClassSpec, SHARED_TYPED_ARRAY_CLASP(Uint8)) \
IF_SAB(real,imaginary)(SharedInt16Array, 45, js_InitViaClassSpec, SHARED_TYPED_ARRAY_CLASP(Int16)) \
IF_SAB(real,imaginary)(SharedUint16Array, 46, js_InitViaClassSpec, SHARED_TYPED_ARRAY_CLASP(Uint16)) \
IF_SAB(real,imaginary)(SharedInt32Array, 47, js_InitViaClassSpec, SHARED_TYPED_ARRAY_CLASP(Int32)) \
IF_SAB(real,imaginary)(SharedUint32Array, 48, js_InitViaClassSpec, SHARED_TYPED_ARRAY_CLASP(Uint32)) \
IF_SAB(real,imaginary)(SharedFloat32Array, 49, js_InitViaClassSpec, SHARED_TYPED_ARRAY_CLASP(Float32)) \
IF_SAB(real,imaginary)(SharedFloat64Array, 50, js_InitViaClassSpec, SHARED_TYPED_ARRAY_CLASP(Float64)) \
IF_SAB(real,imaginary)(SharedUint8ClampedArray, 51, js_InitViaClassSpec, SHARED_TYPED_ARRAY_CLASP(Uint8Clamped)) \
real(TypedArray, 52, js_InitViaClassSpec, &js::TypedArrayObject::sharedTypedArrayPrototypeClass) \
IF_SAB(real,imaginary)(Atomics, 53, js_InitAtomicsClass, OCLASP(Atomics)) \
imaginary(Null, 0, InitNullClass, dummy) \
real(Object, 1, InitViaClassSpec, OCLASP(Plain)) \
real(Function, 2, InitViaClassSpec, &JSFunction::class_) \
real(Array, 3, InitViaClassSpec, OCLASP(Array)) \
real(Boolean, 4, InitBooleanClass, OCLASP(Boolean)) \
real(JSON, 5, InitJSONClass, CLASP(JSON)) \
real(Date, 6, InitViaClassSpec, OCLASP(Date)) \
real(Math, 7, InitMathClass, CLASP(Math)) \
real(Number, 8, InitNumberClass, OCLASP(Number)) \
real(String, 9, InitStringClass, OCLASP(String)) \
real(RegExp, 10, InitRegExpClass, OCLASP(RegExp)) \
real(Error, 11, InitViaClassSpec, ERROR_CLASP(JSEXN_ERR)) \
real(InternalError, 12, InitViaClassSpec, ERROR_CLASP(JSEXN_INTERNALERR)) \
real(EvalError, 13, InitViaClassSpec, ERROR_CLASP(JSEXN_EVALERR)) \
real(RangeError, 14, InitViaClassSpec, ERROR_CLASP(JSEXN_RANGEERR)) \
real(ReferenceError, 15, InitViaClassSpec, ERROR_CLASP(JSEXN_REFERENCEERR)) \
real(SyntaxError, 16, InitViaClassSpec, ERROR_CLASP(JSEXN_SYNTAXERR)) \
real(TypeError, 17, InitViaClassSpec, ERROR_CLASP(JSEXN_TYPEERR)) \
real(URIError, 18, InitViaClassSpec, ERROR_CLASP(JSEXN_URIERR)) \
real(Iterator, 19, InitLegacyIteratorClass,OCLASP(PropertyIterator)) \
real(StopIteration, 20, InitStopIterationClass, OCLASP(StopIteration)) \
real(ArrayBuffer, 21, InitArrayBufferClass, &js::ArrayBufferObject::protoClass) \
real(Int8Array, 22, InitViaClassSpec, TYPED_ARRAY_CLASP(Int8)) \
real(Uint8Array, 23, InitViaClassSpec, TYPED_ARRAY_CLASP(Uint8)) \
real(Int16Array, 24, InitViaClassSpec, TYPED_ARRAY_CLASP(Int16)) \
real(Uint16Array, 25, InitViaClassSpec, TYPED_ARRAY_CLASP(Uint16)) \
real(Int32Array, 26, InitViaClassSpec, TYPED_ARRAY_CLASP(Int32)) \
real(Uint32Array, 27, InitViaClassSpec, TYPED_ARRAY_CLASP(Uint32)) \
real(Float32Array, 28, InitViaClassSpec, TYPED_ARRAY_CLASP(Float32)) \
real(Float64Array, 29, InitViaClassSpec, TYPED_ARRAY_CLASP(Float64)) \
real(Uint8ClampedArray, 30, InitViaClassSpec, TYPED_ARRAY_CLASP(Uint8Clamped)) \
real(Proxy, 31, InitProxyClass, OCLASP(Proxy)) \
real(WeakMap, 32, InitWeakMapClass, OCLASP(WeakMap)) \
real(Map, 33, InitMapClass, OCLASP(Map)) \
real(Set, 34, InitSetClass, OCLASP(Set)) \
real(DataView, 35, InitDataViewClass, OCLASP(DataView)) \
real(Symbol, 36, InitSymbolClass, OCLASP(Symbol)) \
IF_SAB(real,imaginary)(SharedArrayBuffer, 37, InitSharedArrayBufferClass, &js::SharedArrayBufferObject::protoClass) \
IF_INTL(real,imaginary) (Intl, 38, InitIntlClass, CLASP(Intl)) \
IF_BDATA(real,imaginary)(TypedObject, 39, InitTypedObjectModuleObject, OCLASP(TypedObjectModule)) \
real(SavedFrame, 40, InitViaClassSpec, &js::SavedFrame::class_) \
IF_BDATA(real,imaginary)(SIMD, 41, InitSIMDClass, OCLASP(SIMD)) \
real(WeakSet, 42, InitWeakSetClass, OCLASP(WeakSet)) \
IF_SAB(real,imaginary)(SharedInt8Array, 43, InitViaClassSpec, SHARED_TYPED_ARRAY_CLASP(Int8)) \
IF_SAB(real,imaginary)(SharedUint8Array, 44, InitViaClassSpec, SHARED_TYPED_ARRAY_CLASP(Uint8)) \
IF_SAB(real,imaginary)(SharedInt16Array, 45, InitViaClassSpec, SHARED_TYPED_ARRAY_CLASP(Int16)) \
IF_SAB(real,imaginary)(SharedUint16Array, 46, InitViaClassSpec, SHARED_TYPED_ARRAY_CLASP(Uint16)) \
IF_SAB(real,imaginary)(SharedInt32Array, 47, InitViaClassSpec, SHARED_TYPED_ARRAY_CLASP(Int32)) \
IF_SAB(real,imaginary)(SharedUint32Array, 48, InitViaClassSpec, SHARED_TYPED_ARRAY_CLASP(Uint32)) \
IF_SAB(real,imaginary)(SharedFloat32Array, 49, InitViaClassSpec, SHARED_TYPED_ARRAY_CLASP(Float32)) \
IF_SAB(real,imaginary)(SharedFloat64Array, 50, InitViaClassSpec, SHARED_TYPED_ARRAY_CLASP(Float64)) \
IF_SAB(real,imaginary)(SharedUint8ClampedArray, 51, InitViaClassSpec, SHARED_TYPED_ARRAY_CLASP(Uint8Clamped)) \
real(TypedArray, 52, InitViaClassSpec, &js::TypedArrayObject::sharedTypedArrayPrototypeClass) \
IF_SAB(real,imaginary)(Atomics, 53, InitAtomicsClass, OCLASP(Atomics)) \
+3 -2
View File
@@ -119,9 +119,10 @@ typedef JSConstScalarSpec<int32_t> JSConstIntegerSpec;
typedef void
(* JSTraceDataOp)(JSTracer* trc, void* data);
void js_FinishGC(JSRuntime* rt);
namespace js {
void FinishGC(JSRuntime* rt);
namespace gc {
class StoreBuffer;
void MarkPersistentRootedChains(JSTracer*);
+4 -4
View File
@@ -113,7 +113,7 @@ typedef AutoValueVector NodeVector;
JS_BEGIN_MACRO \
MOZ_ASSERT(expr); \
if (!(expr)) { \
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_PARSE_NODE); \
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_PARSE_NODE); \
return false; \
} \
JS_END_MACRO
@@ -121,7 +121,7 @@ typedef AutoValueVector NodeVector;
#define LOCAL_NOT_REACHED(expr) \
JS_BEGIN_MACRO \
MOZ_ASSERT(false); \
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_PARSE_NODE); \
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_PARSE_NODE); \
return false; \
JS_END_MACRO
@@ -726,7 +726,7 @@ NodeBuilder::newArray(NodeVector& elts, MutableHandleValue dst)
{
const size_t len = elts.length();
if (len > UINT32_MAX) {
js_ReportAllocationOverflow(cx);
ReportAllocationOverflow(cx);
return false;
}
RootedObject array(cx, NewDenseFullyAllocatedArray(cx, uint32_t(len)));
@@ -3586,7 +3586,7 @@ reflect_parse(JSContext* cx, uint32_t argc, jsval* vp)
CallArgs args = CallArgsFromVp(argc, vp);
if (args.length() < 1) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
"Reflect.parse", "0", "s");
return false;
}
+9 -9
View File
@@ -2067,7 +2067,7 @@ ScriptSource::setDisplayURL(ExclusiveContext* cx, const char16_t* displayURL)
if (hasDisplayURL()) {
if (cx->isJSContext() &&
!JS_ReportErrorFlagsAndNumber(cx->asJSContext(), JSREPORT_WARNING,
js_GetErrorMessage, nullptr,
GetErrorMessage, nullptr,
JSMSG_ALREADY_HAS_PRAGMA, filename_.get(),
"//# sourceURL"))
{
@@ -2172,7 +2172,7 @@ SaveSharedScriptData(ExclusiveContext* cx, Handle<JSScript*> script, SharedScrip
script->setCode(nullptr);
script->atoms = nullptr;
js_free(ssd);
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return false;
}
}
@@ -2383,7 +2383,7 @@ JSScript::Create(ExclusiveContext* cx, HandleObject enclosingScope, bool savedCa
{
MOZ_ASSERT(bufStart <= bufEnd);
RootedScript script(cx, js_NewGCScript(cx));
RootedScript script(cx, NewGCScript(cx));
if (!script)
return nullptr;
@@ -2408,7 +2408,7 @@ JSScript::Create(ExclusiveContext* cx, HandleObject enclosingScope, bool savedCa
if (staticLevel > UINT16_MAX) {
if (cx->isJSContext()) {
JS_ReportErrorNumber(cx->asJSContext(),
js_GetErrorMessage, nullptr, JSMSG_TOO_DEEP, js_function_str);
GetErrorMessage, nullptr, JSMSG_TOO_DEEP, js_function_str);
}
return nullptr;
}
@@ -2782,7 +2782,7 @@ js::GetSrcNote(GSNCache& cache, JSScript* script, jsbytecode* pc)
}
jssrcnote*
js_GetSrcNote(JSContext* cx, JSScript* script, jsbytecode* pc)
js::GetSrcNote(JSContext* cx, JSScript* script, jsbytecode* pc)
{
return GetSrcNote(cx->runtime()->gsnCache, script, pc);
}
@@ -2841,7 +2841,7 @@ js::PCToLineNumber(JSScript* script, jsbytecode* pc, unsigned* columnp)
}
jsbytecode*
js_LineNumberToPC(JSScript* script, unsigned target)
js::LineNumberToPC(JSScript* script, unsigned target)
{
ptrdiff_t offset = 0;
ptrdiff_t best = -1;
@@ -2876,7 +2876,7 @@ out:
}
JS_FRIEND_API(unsigned)
js_GetScriptLineExtent(JSScript* script)
js::GetScriptLineExtent(JSScript* script)
{
unsigned lineno = script->lineno();
unsigned maxLineNo = lineno;
@@ -3325,7 +3325,7 @@ JSScript::getOrCreateBreakpointSite(JSContext* cx, jsbytecode* pc)
if (!site) {
site = cx->runtime()->new_<BreakpointSite>(this, pc);
if (!site) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return nullptr;
}
debug->numSites++;
@@ -3761,7 +3761,7 @@ LazyScript::CreateRaw(ExclusiveContext* cx, HandleFunction fun,
if (bytes && !table)
return nullptr;
LazyScript* res = js_NewGCLazyScript(cx);
LazyScript* res = NewGCLazyScript(cx);
if (!res)
return nullptr;
+6 -6
View File
@@ -747,7 +747,7 @@ GeneratorKindFromBits(unsigned val) {
/*
* NB: after a successful XDR_DECODE, XDRScript callers must do any required
* subsequent set-up of owning function or script object and then call
* js_CallNewScriptHook.
* CallNewScriptHook.
*/
template<XDRMode mode>
bool
@@ -2127,16 +2127,16 @@ struct GSNCache;
jssrcnote*
GetSrcNote(GSNCache& cache, JSScript* script, jsbytecode* pc);
} /* namespace js */
extern jssrcnote*
js_GetSrcNote(JSContext* cx, JSScript* script, jsbytecode* pc);
GetSrcNote(JSContext* cx, JSScript* script, jsbytecode* pc);
extern jsbytecode*
js_LineNumberToPC(JSScript* script, unsigned lineno);
LineNumberToPC(JSScript* script, unsigned lineno);
extern JS_FRIEND_API(unsigned)
js_GetScriptLineExtent(JSScript* script);
GetScriptLineExtent(JSScript* script);
} /* namespace js */
namespace js {
+28 -28
View File
@@ -446,14 +446,14 @@ ThisToStringForStringProto(JSContext* cx, CallReceiver call)
if (obj->is<StringObject>()) {
StringObject* nobj = &obj->as<StringObject>();
Rooted<jsid> id(cx, NameToId(cx->names().toString));
if (ClassMethodIsNative(cx, nobj, &StringObject::class_, id, js_str_toString)) {
if (ClassMethodIsNative(cx, nobj, &StringObject::class_, id, str_toString)) {
JSString* str = nobj->unbox();
call.setThis(StringValue(str));
return str;
}
}
} else if (call.thisv().isNullOrUndefined()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
call.thisv().isNull() ? "null" : "undefined", "object");
return nullptr;
}
@@ -483,7 +483,7 @@ str_toSource_impl(JSContext* cx, const CallArgs& args)
if (!str)
return false;
str = js_QuoteString(cx, str, '"');
str = QuoteString(cx, str, '"');
if (!str)
return false;
@@ -519,7 +519,7 @@ str_toString_impl(JSContext* cx, const CallArgs& args)
}
bool
js_str_toString(JSContext* cx, unsigned argc, Value* vp)
js::str_toString(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod<IsString, str_toString_impl>(cx, args);
@@ -901,7 +901,7 @@ str_normalize(JSContext* cx, unsigned argc, Value* vp)
} else if (formStr == cx->names().NFKD) {
form = UNORM_NFKD;
} else {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
JSMSG_INVALID_NORMALIZE_FORM);
return false;
}
@@ -950,7 +950,7 @@ str_normalize(JSContext* cx, unsigned argc, Value* vp)
#endif
bool
js_str_charAt(JSContext* cx, unsigned argc, Value* vp)
js::str_charAt(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
@@ -1016,7 +1016,7 @@ out_of_range:
}
bool
js_str_charCodeAt(JSContext* cx, unsigned argc, Value* vp)
js::str_charCodeAt(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
RootedString str(cx);
@@ -1740,7 +1740,7 @@ js::str_startsWith(JSContext* cx, unsigned argc, Value* vp)
// Step 4
if (args.get(0).isObject() && IsObjectWithClass(args[0], ESClass_RegExp, cx)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INVALID_ARG_TYPE,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INVALID_ARG_TYPE,
"first", "", "Regular Expression");
return false;
}
@@ -1801,7 +1801,7 @@ str_endsWith(JSContext* cx, unsigned argc, Value* vp)
// Step 4
if (args.get(0).isObject() && IsObjectWithClass(args[0], ESClass_RegExp, cx)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INVALID_ARG_TYPE,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INVALID_ARG_TYPE,
"first", "", "Regular Expression");
return false;
}
@@ -2659,7 +2659,7 @@ FindReplaceLengthString(JSContext* cx, RegExpStatics* res, ReplaceData& rdata, s
}
if (!replen.isValid()) {
js_ReportAllocationOverflow(cx);
ReportAllocationOverflow(cx);
return false;
}
@@ -2822,7 +2822,7 @@ ReplaceRegExp(JSContext* cx, RegExpStatics* res, ReplaceData& rdata)
newlen += leftlen;
newlen += replen;
if (!newlen.isValid()) {
js_ReportAllocationOverflow(cx);
ReportAllocationOverflow(cx);
return false;
}
@@ -3943,12 +3943,12 @@ static const JSFunctionSpec string_methods[] = {
#endif
/* Java-like methods. */
JS_FN(js_toString_str, js_str_toString, 0,0),
JS_FN(js_valueOf_str, js_str_toString, 0,0),
JS_FN(js_toString_str, str_toString, 0,0),
JS_FN(js_valueOf_str, str_toString, 0,0),
JS_FN("toLowerCase", str_toLowerCase, 0,JSFUN_GENERIC_NATIVE),
JS_FN("toUpperCase", str_toUpperCase, 0,JSFUN_GENERIC_NATIVE),
JS_FN("charAt", js_str_charAt, 1,JSFUN_GENERIC_NATIVE),
JS_FN("charCodeAt", js_str_charCodeAt, 1,JSFUN_GENERIC_NATIVE),
JS_FN("charAt", str_charAt, 1,JSFUN_GENERIC_NATIVE),
JS_FN("charCodeAt", str_charCodeAt, 1,JSFUN_GENERIC_NATIVE),
JS_SELF_HOSTED_FN("substring", "String_substring", 2,0),
JS_SELF_HOSTED_FN("codePointAt", "String_codePointAt", 1,0),
JS_FN("includes", str_includes, 1,JSFUN_GENERIC_NATIVE),
@@ -4004,7 +4004,7 @@ static const JSFunctionSpec string_methods[] = {
// ES6 rev 27 (2014 Aug 24) 21.1.1
bool
js_String(JSContext* cx, unsigned argc, Value* vp)
js::StringConstructor(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
@@ -4112,7 +4112,7 @@ StringObject::assignInitialShape(ExclusiveContext* cx, Handle<StringObject*> obj
}
JSObject*
js_InitStringClass(JSContext* cx, HandleObject obj)
js::InitStringClass(JSContext* cx, HandleObject obj)
{
MOZ_ASSERT(obj->isNative());
@@ -4125,7 +4125,7 @@ js_InitStringClass(JSContext* cx, HandleObject obj)
/* Now create the String function. */
RootedFunction ctor(cx);
ctor = global->createConstructor(cx, js_String, cx->names().String, 1);
ctor = global->createConstructor(cx, StringConstructor, cx->names().String, 1);
if (!ctor)
return nullptr;
@@ -4152,7 +4152,7 @@ js_InitStringClass(JSContext* cx, HandleObject obj)
}
const char*
js_ValueToPrintable(JSContext* cx, const Value& vArg, JSAutoByteString* bytes, bool asSource)
js::ValueToPrintable(JSContext* cx, const Value& vArg, JSAutoByteString* bytes, bool asSource)
{
RootedValue v(cx, vArg);
JSString* str;
@@ -4162,7 +4162,7 @@ js_ValueToPrintable(JSContext* cx, const Value& vArg, JSAutoByteString* bytes, b
str = ToString<CanGC>(cx, v);
if (!str)
return nullptr;
str = js_QuoteString(cx, str, 0);
str = QuoteString(cx, str, 0);
if (!str)
return nullptr;
return bytes->encodeLatin1(cx, str);
@@ -4193,12 +4193,12 @@ js::ToStringSlow(ExclusiveContext* cx, typename MaybeRooted<Value, allowGC>::Han
} else if (v.isDouble()) {
str = NumberToString<allowGC>(cx, v.toDouble());
} else if (v.isBoolean()) {
str = js_BooleanToString(cx, v.toBoolean());
str = BooleanToString(cx, v.toBoolean());
} else if (v.isNull()) {
str = cx->names().null;
} else if (v.isSymbol()) {
if (cx->shouldBeJSContext() && allowGC) {
JS_ReportErrorNumber(cx->asJSContext(), js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx->asJSContext(), GetErrorMessage, nullptr,
JSMSG_SYMBOL_TO_STRING);
}
return nullptr;
@@ -4285,7 +4285,7 @@ js::ValueToSource(JSContext* cx, HandleValue v)
JSString*
js::StringToSource(JSContext* cx, JSString* str)
{
return js_QuoteString(cx, str, '"');
return QuoteString(cx, str, '"');
}
bool
@@ -4521,7 +4521,7 @@ js::DeflateStringToBuffer(JSContext* maybecx, const CharT* src, size_t srclen,
dst[i] = char(src[i]);
if (maybecx) {
AutoSuppressGC suppress(maybecx);
JS_ReportErrorNumber(maybecx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(maybecx, GetErrorMessage, nullptr,
JSMSG_BUFFER_TOO_SMALL);
}
return false;
@@ -4730,7 +4730,7 @@ Encode(StringBuffer& sb, const CharT* chars, size_t length,
v = ((c - 0xD800) << 10) + (c2 - 0xDC00) + 0x10000;
}
uint8_t utf8buf[4];
size_t L = js_OneUcs4ToUtf8Char(utf8buf, v);
size_t L = OneUcs4ToUtf8Char(utf8buf, v);
for (size_t j = 0; j < L; j++) {
hexBuf[1] = HexDigits[utf8buf[j] >> 4];
hexBuf[2] = HexDigits[utf8buf[j] & 0xf];
@@ -4770,7 +4770,7 @@ Encode(JSContext* cx, HandleLinearString str, const bool* unescapedSet,
return false;
if (res == Encode_BadUri) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_URI, nullptr);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_URI, nullptr);
return false;
}
@@ -4880,7 +4880,7 @@ Decode(JSContext* cx, HandleLinearString str, const bool* reservedSet, MutableHa
return false;
if (res == Decode_BadUri) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_URI);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_URI);
return false;
}
@@ -4937,7 +4937,7 @@ str_encodeURI_Component(JSContext* cx, unsigned argc, Value* vp)
* least 4 bytes long. Return the number of UTF-8 bytes of data written.
*/
int
js_OneUcs4ToUtf8Char(uint8_t* utf8Buffer, uint32_t ucs4Char)
js::OneUcs4ToUtf8Char(uint8_t* utf8Buffer, uint32_t ucs4Char)
{
int utf8Length = 1;
+18 -27
View File
@@ -98,17 +98,6 @@ struct JSSubString {
#define JS7_UNHEX(c) (unsigned)(JS7_ISDEC(c) ? (c) - '0' : 10 + tolower(c) - 'a')
#define JS7_ISLET(c) (mozilla::IsAsciiAlpha(c))
/* Initialize the String class, returning its prototype object. */
extern JSObject*
js_InitStringClass(JSContext* cx, js::HandleObject obj);
/*
* Convert a value to a printable C string.
*/
extern const char*
js_ValueToPrintable(JSContext* cx, const js::Value&,
JSAutoByteString* bytes, bool asSource = false);
extern size_t
js_strlen(const char16_t* s);
@@ -127,6 +116,16 @@ js_strncpy(char16_t* dst, const char16_t* src, size_t nelem)
namespace js {
/* Initialize the String class, returning its prototype object. */
extern JSObject *
InitStringClass(JSContext *cx, HandleObject obj);
/*
* Convert a value to a printable C string.
*/
extern const char *
ValueToPrintable(JSContext *cx, const Value &, JSAutoByteString *bytes, bool asSource = false);
extern mozilla::UniquePtr<char[], JS::FreePolicy>
DuplicateString(ExclusiveContext* cx, const char* s);
@@ -328,31 +327,23 @@ str_toLowerCase(JSContext* cx, unsigned argc, Value* vp);
extern bool
str_toUpperCase(JSContext* cx, unsigned argc, Value* vp);
} /* namespace js */
extern bool
str_toString(JSContext* cx, unsigned argc, Value* vp);
extern bool
js_str_toString(JSContext* cx, unsigned argc, js::Value* vp);
extern bool
js_str_charAt(JSContext* cx, unsigned argc, js::Value* vp);
namespace js {
str_charAt(JSContext* cx, unsigned argc, Value* vp);
extern bool
str_charCodeAt_impl(JSContext* cx, HandleString string, HandleValue index, MutableHandleValue res);
} /* namespace js */
extern bool
js_str_charCodeAt(JSContext* cx, unsigned argc, js::Value* vp);
str_charCodeAt(JSContext* cx, unsigned argc, Value* vp);
/*
* Convert one UCS-4 char and write it into a UTF-8 buffer, which must be at
* least 6 bytes long. Return the number of UTF-8 bytes of data written.
*/
extern int
js_OneUcs4ToUtf8Char(uint8_t* utf8Buffer, uint32_t ucs4Char);
namespace js {
OneUcs4ToUtf8Char(uint8_t* utf8Buffer, uint32_t ucs4Char);
extern size_t
PutEscapedStringImpl(char* buffer, size_t size, FILE* fp, JSLinearString* str, uint32_t quote);
@@ -432,9 +423,9 @@ bool
str_replace_string_raw(JSContext* cx, HandleString string, HandleString pattern,
HandleString replacement, MutableHandleValue rval);
extern bool
StringConstructor(JSContext* cx, unsigned argc, Value* vp);
} /* namespace js */
extern bool
js_String(JSContext* cx, unsigned argc, js::Value* vp);
#endif /* jsstr_h */
+1 -1
View File
@@ -68,7 +68,7 @@ WatchpointMap::watch(JSContext* cx, HandleObject obj, HandleId id,
Watchpoint w(handler, closure, false);
if (!map.put(WatchKey(obj, id), w)) {
js_ReportOutOfMemory(cx);
ReportOutOfMemory(cx);
return false;
}
/*
+5 -5
View File
@@ -329,7 +329,7 @@ TryPreserveReflector(JSContext* cx, HandleObject obj)
{
MOZ_ASSERT(cx->runtime()->preserveWrapperCallback);
if (!cx->runtime()->preserveWrapperCallback(cx, obj)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_WEAKMAP_KEY);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_WEAKMAP_KEY);
return false;
}
}
@@ -391,7 +391,7 @@ WeakMap_set_impl(JSContext* cx, const CallArgs& args)
char *bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, args.get(0), NullPtr());
if (!bytes)
return false;
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, bytes);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, bytes);
return false;
}
@@ -552,7 +552,7 @@ WeakMap_construct(JSContext* cx, unsigned argc, Value* vp)
// Step 12f.
if (!pairVal.isObject()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
JSMSG_INVALID_MAP_ITERABLE, "WeakMap");
return false;
}
@@ -575,7 +575,7 @@ WeakMap_construct(JSContext* cx, unsigned argc, Value* vp)
char *bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, keyVal, NullPtr());
if (!bytes)
return false;
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, bytes);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, bytes);
return false;
}
@@ -658,7 +658,7 @@ InitWeakMapClass(JSContext* cx, HandleObject obj, bool defineMembers)
}
JSObject*
js_InitWeakMapClass(JSContext* cx, HandleObject obj)
js::InitWeakMapClass(JSContext *cx, HandleObject obj)
{
return InitWeakMapClass(cx, obj, true);
}
+3 -3
View File
@@ -322,9 +322,9 @@ WeakMap_delete(JSContext* cx, unsigned argc, Value* vp);
extern bool
WeakMap_clear(JSContext* cx, unsigned argc, Value* vp);
extern JSObject*
InitWeakMapClass(JSContext* cx, HandleObject obj);
} /* namespace js */
extern JSObject*
js_InitWeakMapClass(JSContext* cx, js::HandleObject obj);
#endif /* jsweakmap_h */

Some files were not shown because too many files have changed in this diff Show More