зеркало из https://github.com/mozilla/gecko-dev.git
Bug 853301 - Make a --with-intl-api/--with-intl-api=build/--without-intl-api configure option that builds/exposes Intl, only builds it, and doesn't build it at all. This will allow tests with the Intl code, built, but with no changes to JS behavior, permitting disentangling binary-size-increase effects from effects due to changes in JS functionality (or in code invoked to expose that functionality). r=glandium
This commit is contained in:
Родитель
67cfe2d626
Коммит
8414c21ffd
15
configure.in
15
configure.in
|
@ -9384,15 +9384,18 @@ fi
|
||||||
dist=$MOZ_BUILD_ROOT/dist
|
dist=$MOZ_BUILD_ROOT/dist
|
||||||
ac_configure_args="$_SUBDIR_CONFIG_ARGS"
|
ac_configure_args="$_SUBDIR_CONFIG_ARGS"
|
||||||
ac_configure_args="$ac_configure_args --enable-threadsafe"
|
ac_configure_args="$ac_configure_args --enable-threadsafe"
|
||||||
# Switch to "$MOZ_BUILD_APP" != "browser" when enabling for desktop builds.
|
if test "$NIGHTLY_BUILD" = "1" -a "$MOZ_BUILD_APP" = "browser"; then
|
||||||
if test "A" = "A"; then
|
# In desktop nightlies the Internationalization API is disabled, but all
|
||||||
# The Internationalization API isn't on by default except in standalone JS
|
# code for it is still built. Bug 853301 will remove this so that it's
|
||||||
# engine builds. Bugs to enable it in the browser:
|
# built and the API is enabled.
|
||||||
|
ac_configure_args="$ac_configure_args --with-intl-api=build"
|
||||||
|
else
|
||||||
|
# Internationalization isn't built or exposed by default in non-desktop and
|
||||||
|
# non-nightly builds. Bugs to enable:
|
||||||
#
|
#
|
||||||
# Desktop: bug 853301
|
|
||||||
# Android: bug 864843
|
# Android: bug 864843
|
||||||
# B2G: bug 866301
|
# B2G: bug 866301
|
||||||
ac_configure_args="$ac_configure_args --disable-intl-api"
|
ac_configure_args="$ac_configure_args --without-intl-api"
|
||||||
fi
|
fi
|
||||||
if test "$BUILD_CTYPES"; then
|
if test "$BUILD_CTYPES"; then
|
||||||
# Build js-ctypes on the platforms we can.
|
# Build js-ctypes on the platforms we can.
|
||||||
|
|
|
@ -4246,10 +4246,35 @@ dnl ========================================================
|
||||||
dnl ECMAScript Internationalization API Support (uses ICU)
|
dnl ECMAScript Internationalization API Support (uses ICU)
|
||||||
dnl ========================================================
|
dnl ========================================================
|
||||||
|
|
||||||
ENABLE_INTL_API=1
|
MOZ_ARG_WITH_STRING(intl-api,
|
||||||
MOZ_ARG_DISABLE_BOOL(intl-api,
|
[ --with-intl-api, --with-intl-api=build, --without-intl-api
|
||||||
[ --disable-intl-api Disable the ECMAScript Internationalization API],
|
Determine the status of the ECMAScript Internationalization API. The first
|
||||||
ENABLE_INTL_API= )
|
(or lack of any of these) builds and exposes the API. The second builds it
|
||||||
|
but doesn't use ICU or expose the API to script. The third doesn't build
|
||||||
|
ICU at all.],
|
||||||
|
_INTL_API=$withval,
|
||||||
|
_INTL_API=yes)
|
||||||
|
|
||||||
|
ENABLE_INTL_API=
|
||||||
|
EXPOSE_INTL_API=
|
||||||
|
case "$_INTL_API" in
|
||||||
|
no)
|
||||||
|
;;
|
||||||
|
build)
|
||||||
|
ENABLE_INTL_API=1
|
||||||
|
;;
|
||||||
|
yes)
|
||||||
|
ENABLE_INTL_API=1
|
||||||
|
EXPOSE_INTL_API=1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
AC_MSG_ERROR([Invalid value passed to --with-intl-api: $_INTL_API])
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if test -n "$EXPOSE_INTL_API"; then
|
||||||
|
AC_DEFINE(EXPOSE_INTL_API)
|
||||||
|
fi
|
||||||
|
|
||||||
dnl Settings for the implementation of the ECMAScript Internationalization API
|
dnl Settings for the implementation of the ECMAScript Internationalization API
|
||||||
if test -n "$ENABLE_INTL_API"; then
|
if test -n "$ENABLE_INTL_API"; then
|
||||||
|
|
|
@ -688,12 +688,12 @@ JS_Init(void)
|
||||||
if (!ForkJoinSlice::InitializeTLS())
|
if (!ForkJoinSlice::InitializeTLS())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#if ENABLE_INTL_API
|
#if EXPOSE_INTL_API
|
||||||
UErrorCode err = U_ZERO_ERROR;
|
UErrorCode err = U_ZERO_ERROR;
|
||||||
u_init(&err);
|
u_init(&err);
|
||||||
if (U_FAILURE(err))
|
if (U_FAILURE(err))
|
||||||
return false;
|
return false;
|
||||||
#endif // ENABLE_INTL_API
|
#endif // EXPOSE_INTL_API
|
||||||
|
|
||||||
jsInitState = Running;
|
jsInitState = Running;
|
||||||
return true;
|
return true;
|
||||||
|
@ -716,9 +716,9 @@ JS_ShutDown(void)
|
||||||
|
|
||||||
PRMJ_NowShutdown();
|
PRMJ_NowShutdown();
|
||||||
|
|
||||||
#if ENABLE_INTL_API
|
#if EXPOSE_INTL_API
|
||||||
u_cleanup();
|
u_cleanup();
|
||||||
#endif // ENABLE_INTL_API
|
#endif // EXPOSE_INTL_API
|
||||||
|
|
||||||
jsInitState = ShutDown;
|
jsInitState = ShutDown;
|
||||||
}
|
}
|
||||||
|
@ -765,7 +765,7 @@ JS_SetICUMemoryFunctions(JS_ICUAllocFn allocFn, JS_ICUReallocFn reallocFn, JS_IC
|
||||||
"must call JS_SetICUMemoryFunctions before any other JSAPI "
|
"must call JS_SetICUMemoryFunctions before any other JSAPI "
|
||||||
"operation (including JS_Init)");
|
"operation (including JS_Init)");
|
||||||
|
|
||||||
#if ENABLE_INTL_API
|
#if EXPOSE_INTL_API
|
||||||
UErrorCode status = U_ZERO_ERROR;
|
UErrorCode status = U_ZERO_ERROR;
|
||||||
u_setMemoryFunctions(/* context = */ NULL, allocFn, reallocFn, freeFn, &status);
|
u_setMemoryFunctions(/* context = */ NULL, allocFn, reallocFn, freeFn, &status);
|
||||||
return U_SUCCESS(status);
|
return U_SUCCESS(status);
|
||||||
|
@ -1396,7 +1396,7 @@ static const JSStdName standard_class_atoms[] = {
|
||||||
{js_InitParallelArrayClass, EAGER_ATOM_AND_OCLASP(ParallelArray)},
|
{js_InitParallelArrayClass, EAGER_ATOM_AND_OCLASP(ParallelArray)},
|
||||||
#endif
|
#endif
|
||||||
{js_InitProxyClass, EAGER_CLASS_ATOM(Proxy), OCLASP(ObjectProxy)},
|
{js_InitProxyClass, EAGER_CLASS_ATOM(Proxy), OCLASP(ObjectProxy)},
|
||||||
#if ENABLE_INTL_API
|
#if EXPOSE_INTL_API
|
||||||
{js_InitIntlClass, EAGER_ATOM_AND_CLASP(Intl)},
|
{js_InitIntlClass, EAGER_ATOM_AND_CLASP(Intl)},
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_BINARYDATA
|
#ifdef ENABLE_BINARYDATA
|
||||||
|
|
|
@ -4834,7 +4834,7 @@ JS_ResetDefaultLocale(JSRuntime *rt);
|
||||||
struct JSLocaleCallbacks {
|
struct JSLocaleCallbacks {
|
||||||
JSLocaleToUpperCase localeToUpperCase;
|
JSLocaleToUpperCase localeToUpperCase;
|
||||||
JSLocaleToLowerCase localeToLowerCase;
|
JSLocaleToLowerCase localeToLowerCase;
|
||||||
JSLocaleCompare localeCompare; // not used #if ENABLE_INTL_API
|
JSLocaleCompare localeCompare; // not used #if EXPOSE_INTL_API
|
||||||
JSLocaleToUnicode localeToUnicode;
|
JSLocaleToUnicode localeToUnicode;
|
||||||
JSErrorCallback localeGetErrorMessage;
|
JSErrorCallback localeGetErrorMessage;
|
||||||
};
|
};
|
||||||
|
|
|
@ -2704,7 +2704,7 @@ ToLocaleFormatHelper(JSContext *cx, HandleObject obj, const char *format, Mutabl
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !ENABLE_INTL_API
|
#if !EXPOSE_INTL_API
|
||||||
static bool
|
static bool
|
||||||
ToLocaleStringHelper(JSContext *cx, Handle<DateObject*> dateObj, MutableHandleValue rval)
|
ToLocaleStringHelper(JSContext *cx, Handle<DateObject*> dateObj, MutableHandleValue rval)
|
||||||
{
|
{
|
||||||
|
@ -2777,7 +2777,7 @@ date_toLocaleTimeString(JSContext *cx, unsigned argc, Value *vp)
|
||||||
CallArgs args = CallArgsFromVp(argc, vp);
|
CallArgs args = CallArgsFromVp(argc, vp);
|
||||||
return CallNonGenericMethod<IsDate, date_toLocaleTimeString_impl>(cx, args);
|
return CallNonGenericMethod<IsDate, date_toLocaleTimeString_impl>(cx, args);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* !EXPOSE_INTL_API */
|
||||||
|
|
||||||
JS_ALWAYS_INLINE bool
|
JS_ALWAYS_INLINE bool
|
||||||
date_toLocaleFormat_impl(JSContext *cx, CallArgs args)
|
date_toLocaleFormat_impl(JSContext *cx, CallArgs args)
|
||||||
|
@ -2947,7 +2947,7 @@ static const JSFunctionSpec date_methods[] = {
|
||||||
JS_FN("setUTCMilliseconds", date_setUTCMilliseconds, 1,0),
|
JS_FN("setUTCMilliseconds", date_setUTCMilliseconds, 1,0),
|
||||||
JS_FN("toUTCString", date_toGMTString, 0,0),
|
JS_FN("toUTCString", date_toGMTString, 0,0),
|
||||||
JS_FN("toLocaleFormat", date_toLocaleFormat, 0,0),
|
JS_FN("toLocaleFormat", date_toLocaleFormat, 0,0),
|
||||||
#if ENABLE_INTL_API
|
#if EXPOSE_INTL_API
|
||||||
{js_toLocaleString_str, {NULL, NULL}, 0,0, "Date_toLocaleString"},
|
{js_toLocaleString_str, {NULL, NULL}, 0,0, "Date_toLocaleString"},
|
||||||
{"toLocaleDateString", {NULL, NULL}, 0,0, "Date_toLocaleDateString"},
|
{"toLocaleDateString", {NULL, NULL}, 0,0, "Date_toLocaleDateString"},
|
||||||
{"toLocaleTimeString", {NULL, NULL}, 0,0, "Date_toLocaleTimeString"},
|
{"toLocaleTimeString", {NULL, NULL}, 0,0, "Date_toLocaleTimeString"},
|
||||||
|
|
|
@ -657,7 +657,7 @@ js_num_toString(JSContext *cx, unsigned argc, Value *vp)
|
||||||
return CallNonGenericMethod<IsNumber, num_toString_impl>(cx, args);
|
return CallNonGenericMethod<IsNumber, num_toString_impl>(cx, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !ENABLE_INTL_API
|
#if !EXPOSE_INTL_API
|
||||||
JS_ALWAYS_INLINE bool
|
JS_ALWAYS_INLINE bool
|
||||||
num_toLocaleString_impl(JSContext *cx, CallArgs args)
|
num_toLocaleString_impl(JSContext *cx, CallArgs args)
|
||||||
{
|
{
|
||||||
|
@ -790,7 +790,7 @@ num_toLocaleString(JSContext *cx, unsigned argc, Value *vp)
|
||||||
CallArgs args = CallArgsFromVp(argc, vp);
|
CallArgs args = CallArgsFromVp(argc, vp);
|
||||||
return CallNonGenericMethod<IsNumber, num_toLocaleString_impl>(cx, args);
|
return CallNonGenericMethod<IsNumber, num_toLocaleString_impl>(cx, args);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* !EXPOSE_INTL_API */
|
||||||
|
|
||||||
JS_ALWAYS_INLINE bool
|
JS_ALWAYS_INLINE bool
|
||||||
num_valueOf_impl(JSContext *cx, CallArgs args)
|
num_valueOf_impl(JSContext *cx, CallArgs args)
|
||||||
|
@ -939,7 +939,7 @@ static const JSFunctionSpec number_methods[] = {
|
||||||
JS_FN(js_toSource_str, num_toSource, 0, 0),
|
JS_FN(js_toSource_str, num_toSource, 0, 0),
|
||||||
#endif
|
#endif
|
||||||
JS_FN(js_toString_str, js_num_toString, 1, 0),
|
JS_FN(js_toString_str, js_num_toString, 1, 0),
|
||||||
#if ENABLE_INTL_API
|
#if EXPOSE_INTL_API
|
||||||
{js_toLocaleString_str, {NULL, NULL}, 0,0, "Number_toLocaleString"},
|
{js_toLocaleString_str, {NULL, NULL}, 0,0, "Number_toLocaleString"},
|
||||||
#else
|
#else
|
||||||
JS_FN(js_toLocaleString_str, num_toLocaleString, 0,0),
|
JS_FN(js_toLocaleString_str, num_toLocaleString, 0,0),
|
||||||
|
@ -1101,10 +1101,10 @@ js::InitRuntimeNumberState(JSRuntime *rt)
|
||||||
|
|
||||||
number_constants[NC_MIN_VALUE].dval = mozilla::MinDoubleValue();
|
number_constants[NC_MIN_VALUE].dval = mozilla::MinDoubleValue();
|
||||||
|
|
||||||
// XXX If ENABLE_INTL_API becomes true all the time at some point,
|
// XXX If EXPOSE_INTL_API becomes true all the time at some point,
|
||||||
// js::InitRuntimeNumberState is no longer fallible, and we should
|
// js::InitRuntimeNumberState is no longer fallible, and we should
|
||||||
// change its return type.
|
// change its return type.
|
||||||
#if !ENABLE_INTL_API
|
#if !EXPOSE_INTL_API
|
||||||
/* Copy locale-specific separators into the runtime strings. */
|
/* Copy locale-specific separators into the runtime strings. */
|
||||||
const char *thousandsSeparator, *decimalPoint, *grouping;
|
const char *thousandsSeparator, *decimalPoint, *grouping;
|
||||||
#ifdef HAVE_LOCALECONV
|
#ifdef HAVE_LOCALECONV
|
||||||
|
@ -1148,11 +1148,11 @@ js::InitRuntimeNumberState(JSRuntime *rt)
|
||||||
|
|
||||||
js_memcpy(storage, grouping, groupingSize);
|
js_memcpy(storage, grouping, groupingSize);
|
||||||
rt->numGrouping = grouping;
|
rt->numGrouping = grouping;
|
||||||
#endif
|
#endif /* !EXPOSE_INTL_API */
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !ENABLE_INTL_API
|
#if !EXPOSE_INTL_API
|
||||||
void
|
void
|
||||||
js::FinishRuntimeNumberState(JSRuntime *rt)
|
js::FinishRuntimeNumberState(JSRuntime *rt)
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,7 +23,7 @@ class StringBuffer;
|
||||||
extern bool
|
extern bool
|
||||||
InitRuntimeNumberState(JSRuntime *rt);
|
InitRuntimeNumberState(JSRuntime *rt);
|
||||||
|
|
||||||
#if !ENABLE_INTL_API
|
#if !EXPOSE_INTL_API
|
||||||
extern void
|
extern void
|
||||||
FinishRuntimeNumberState(JSRuntime *rt);
|
FinishRuntimeNumberState(JSRuntime *rt);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -808,7 +808,7 @@ str_toLocaleUpperCase(JSContext *cx, unsigned argc, Value *vp)
|
||||||
return ToUpperCaseHelper(cx, args);
|
return ToUpperCaseHelper(cx, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !ENABLE_INTL_API
|
#if !EXPOSE_INTL_API
|
||||||
static bool
|
static bool
|
||||||
str_localeCompare(JSContext *cx, unsigned argc, Value *vp)
|
str_localeCompare(JSContext *cx, unsigned argc, Value *vp)
|
||||||
{
|
{
|
||||||
|
@ -3549,7 +3549,7 @@ static const JSFunctionSpec string_methods[] = {
|
||||||
JS_FN("trimRight", str_trimRight, 0,JSFUN_GENERIC_NATIVE),
|
JS_FN("trimRight", str_trimRight, 0,JSFUN_GENERIC_NATIVE),
|
||||||
JS_FN("toLocaleLowerCase", str_toLocaleLowerCase, 0,JSFUN_GENERIC_NATIVE),
|
JS_FN("toLocaleLowerCase", str_toLocaleLowerCase, 0,JSFUN_GENERIC_NATIVE),
|
||||||
JS_FN("toLocaleUpperCase", str_toLocaleUpperCase, 0,JSFUN_GENERIC_NATIVE),
|
JS_FN("toLocaleUpperCase", str_toLocaleUpperCase, 0,JSFUN_GENERIC_NATIVE),
|
||||||
#if ENABLE_INTL_API
|
#if EXPOSE_INTL_API
|
||||||
{"localeCompare", {NULL, NULL}, 1,0, "String_localeCompare"},
|
{"localeCompare", {NULL, NULL}, 1,0, "String_localeCompare"},
|
||||||
#else
|
#else
|
||||||
JS_FN("localeCompare", str_localeCompare, 1,JSFUN_GENERIC_NATIVE),
|
JS_FN("localeCompare", str_localeCompare, 1,JSFUN_GENERIC_NATIVE),
|
||||||
|
@ -3657,7 +3657,7 @@ static const JSFunctionSpec string_static_methods[] = {
|
||||||
|
|
||||||
// This must be at the end because of bug 853075: functions listed after
|
// This must be at the end because of bug 853075: functions listed after
|
||||||
// self-hosted methods aren't available in self-hosted code.
|
// self-hosted methods aren't available in self-hosted code.
|
||||||
#if ENABLE_INTL_API
|
#if EXPOSE_INTL_API
|
||||||
{"localeCompare", {NULL, NULL}, 2,0, "String_static_localeCompare"},
|
{"localeCompare", {NULL, NULL}, 2,0, "String_static_localeCompare"},
|
||||||
#endif
|
#endif
|
||||||
JS_FS_END
|
JS_FS_END
|
||||||
|
|
|
@ -478,7 +478,7 @@ GlobalObject::initStandardClasses(JSContext *cx, Handle<GlobalObject*> global)
|
||||||
GlobalObject::initMapIteratorProto(cx, global) &&
|
GlobalObject::initMapIteratorProto(cx, global) &&
|
||||||
js_InitSetClass(cx, global) &&
|
js_InitSetClass(cx, global) &&
|
||||||
GlobalObject::initSetIteratorProto(cx, global) &&
|
GlobalObject::initSetIteratorProto(cx, global) &&
|
||||||
#if ENABLE_INTL_API
|
#if EXPOSE_INTL_API
|
||||||
js_InitIntlClass(cx, global) &&
|
js_InitIntlClass(cx, global) &&
|
||||||
#endif
|
#endif
|
||||||
true;
|
true;
|
||||||
|
|
|
@ -246,7 +246,7 @@ JSRuntime::JSRuntime(JSUseHelperThreads useHelperThreads)
|
||||||
structuredCloneCallbacks(NULL),
|
structuredCloneCallbacks(NULL),
|
||||||
telemetryCallback(NULL),
|
telemetryCallback(NULL),
|
||||||
propertyRemovals(0),
|
propertyRemovals(0),
|
||||||
#if !ENABLE_INTL_API
|
#if !EXPOSE_INTL_API
|
||||||
thousandsSeparator(0),
|
thousandsSeparator(0),
|
||||||
decimalSeparator(0),
|
decimalSeparator(0),
|
||||||
numGrouping(0),
|
numGrouping(0),
|
||||||
|
@ -424,7 +424,7 @@ JSRuntime::~JSRuntime()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !ENABLE_INTL_API
|
#if !EXPOSE_INTL_API
|
||||||
FinishRuntimeNumberState(this);
|
FinishRuntimeNumberState(this);
|
||||||
#endif
|
#endif
|
||||||
FinishAtoms(this);
|
FinishAtoms(this);
|
||||||
|
|
|
@ -1341,7 +1341,7 @@ struct JSRuntime : public JS::shadow::Runtime,
|
||||||
*/
|
*/
|
||||||
uint32_t propertyRemovals;
|
uint32_t propertyRemovals;
|
||||||
|
|
||||||
#if !ENABLE_INTL_API
|
#if !EXPOSE_INTL_API
|
||||||
/* Number localization, used by jsnum.cpp. */
|
/* Number localization, used by jsnum.cpp. */
|
||||||
const char *thousandsSeparator;
|
const char *thousandsSeparator;
|
||||||
const char *decimalSeparator;
|
const char *decimalSeparator;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче