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:
Jeff Walden 2013-08-08 15:17:08 -07:00
Родитель 67cfe2d626
Коммит 8414c21ffd
11 изменённых файлов: 63 добавлений и 35 удалений

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

@ -9384,15 +9384,18 @@ fi
dist=$MOZ_BUILD_ROOT/dist
ac_configure_args="$_SUBDIR_CONFIG_ARGS"
ac_configure_args="$ac_configure_args --enable-threadsafe"
# Switch to "$MOZ_BUILD_APP" != "browser" when enabling for desktop builds.
if test "A" = "A"; then
# The Internationalization API isn't on by default except in standalone JS
# engine builds. Bugs to enable it in the browser:
if test "$NIGHTLY_BUILD" = "1" -a "$MOZ_BUILD_APP" = "browser"; then
# In desktop nightlies the Internationalization API is disabled, but all
# code for it is still built. Bug 853301 will remove this so that it's
# 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
# B2G: bug 866301
ac_configure_args="$ac_configure_args --disable-intl-api"
ac_configure_args="$ac_configure_args --without-intl-api"
fi
if test "$BUILD_CTYPES"; then
# Build js-ctypes on the platforms we can.

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

@ -4246,10 +4246,35 @@ dnl ========================================================
dnl ECMAScript Internationalization API Support (uses ICU)
dnl ========================================================
ENABLE_INTL_API=1
MOZ_ARG_DISABLE_BOOL(intl-api,
[ --disable-intl-api Disable the ECMAScript Internationalization API],
ENABLE_INTL_API= )
MOZ_ARG_WITH_STRING(intl-api,
[ --with-intl-api, --with-intl-api=build, --without-intl-api
Determine the status of the ECMAScript Internationalization API. The first
(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
if test -n "$ENABLE_INTL_API"; then

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

@ -688,12 +688,12 @@ JS_Init(void)
if (!ForkJoinSlice::InitializeTLS())
return false;
#if ENABLE_INTL_API
#if EXPOSE_INTL_API
UErrorCode err = U_ZERO_ERROR;
u_init(&err);
if (U_FAILURE(err))
return false;
#endif // ENABLE_INTL_API
#endif // EXPOSE_INTL_API
jsInitState = Running;
return true;
@ -716,9 +716,9 @@ JS_ShutDown(void)
PRMJ_NowShutdown();
#if ENABLE_INTL_API
#if EXPOSE_INTL_API
u_cleanup();
#endif // ENABLE_INTL_API
#endif // EXPOSE_INTL_API
jsInitState = ShutDown;
}
@ -765,7 +765,7 @@ JS_SetICUMemoryFunctions(JS_ICUAllocFn allocFn, JS_ICUReallocFn reallocFn, JS_IC
"must call JS_SetICUMemoryFunctions before any other JSAPI "
"operation (including JS_Init)");
#if ENABLE_INTL_API
#if EXPOSE_INTL_API
UErrorCode status = U_ZERO_ERROR;
u_setMemoryFunctions(/* context = */ NULL, allocFn, reallocFn, freeFn, &status);
return U_SUCCESS(status);
@ -1396,7 +1396,7 @@ static const JSStdName standard_class_atoms[] = {
{js_InitParallelArrayClass, EAGER_ATOM_AND_OCLASP(ParallelArray)},
#endif
{js_InitProxyClass, EAGER_CLASS_ATOM(Proxy), OCLASP(ObjectProxy)},
#if ENABLE_INTL_API
#if EXPOSE_INTL_API
{js_InitIntlClass, EAGER_ATOM_AND_CLASP(Intl)},
#endif
#ifdef ENABLE_BINARYDATA

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

@ -4834,7 +4834,7 @@ JS_ResetDefaultLocale(JSRuntime *rt);
struct JSLocaleCallbacks {
JSLocaleToUpperCase localeToUpperCase;
JSLocaleToLowerCase localeToLowerCase;
JSLocaleCompare localeCompare; // not used #if ENABLE_INTL_API
JSLocaleCompare localeCompare; // not used #if EXPOSE_INTL_API
JSLocaleToUnicode localeToUnicode;
JSErrorCallback localeGetErrorMessage;
};

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

@ -2704,7 +2704,7 @@ ToLocaleFormatHelper(JSContext *cx, HandleObject obj, const char *format, Mutabl
return true;
}
#if !ENABLE_INTL_API
#if !EXPOSE_INTL_API
static bool
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);
return CallNonGenericMethod<IsDate, date_toLocaleTimeString_impl>(cx, args);
}
#endif
#endif /* !EXPOSE_INTL_API */
JS_ALWAYS_INLINE bool
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("toUTCString", date_toGMTString, 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"},
{"toLocaleDateString", {NULL, NULL}, 0,0, "Date_toLocaleDateString"},
{"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);
}
#if !ENABLE_INTL_API
#if !EXPOSE_INTL_API
JS_ALWAYS_INLINE bool
num_toLocaleString_impl(JSContext *cx, CallArgs args)
{
@ -790,7 +790,7 @@ num_toLocaleString(JSContext *cx, unsigned argc, Value *vp)
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod<IsNumber, num_toLocaleString_impl>(cx, args);
}
#endif
#endif /* !EXPOSE_INTL_API */
JS_ALWAYS_INLINE bool
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),
#endif
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"},
#else
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();
// 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
// change its return type.
#if !ENABLE_INTL_API
#if !EXPOSE_INTL_API
/* Copy locale-specific separators into the runtime strings. */
const char *thousandsSeparator, *decimalPoint, *grouping;
#ifdef HAVE_LOCALECONV
@ -1148,11 +1148,11 @@ js::InitRuntimeNumberState(JSRuntime *rt)
js_memcpy(storage, grouping, groupingSize);
rt->numGrouping = grouping;
#endif
#endif /* !EXPOSE_INTL_API */
return true;
}
#if !ENABLE_INTL_API
#if !EXPOSE_INTL_API
void
js::FinishRuntimeNumberState(JSRuntime *rt)
{

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

@ -23,7 +23,7 @@ class StringBuffer;
extern bool
InitRuntimeNumberState(JSRuntime *rt);
#if !ENABLE_INTL_API
#if !EXPOSE_INTL_API
extern void
FinishRuntimeNumberState(JSRuntime *rt);
#endif

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

@ -808,7 +808,7 @@ str_toLocaleUpperCase(JSContext *cx, unsigned argc, Value *vp)
return ToUpperCaseHelper(cx, args);
}
#if !ENABLE_INTL_API
#if !EXPOSE_INTL_API
static bool
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("toLocaleLowerCase", str_toLocaleLowerCase, 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"},
#else
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
// 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"},
#endif
JS_FS_END

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

@ -478,7 +478,7 @@ GlobalObject::initStandardClasses(JSContext *cx, Handle<GlobalObject*> global)
GlobalObject::initMapIteratorProto(cx, global) &&
js_InitSetClass(cx, global) &&
GlobalObject::initSetIteratorProto(cx, global) &&
#if ENABLE_INTL_API
#if EXPOSE_INTL_API
js_InitIntlClass(cx, global) &&
#endif
true;

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

@ -246,7 +246,7 @@ JSRuntime::JSRuntime(JSUseHelperThreads useHelperThreads)
structuredCloneCallbacks(NULL),
telemetryCallback(NULL),
propertyRemovals(0),
#if !ENABLE_INTL_API
#if !EXPOSE_INTL_API
thousandsSeparator(0),
decimalSeparator(0),
numGrouping(0),
@ -424,7 +424,7 @@ JSRuntime::~JSRuntime()
}
#endif
#if !ENABLE_INTL_API
#if !EXPOSE_INTL_API
FinishRuntimeNumberState(this);
#endif
FinishAtoms(this);

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

@ -1341,7 +1341,7 @@ struct JSRuntime : public JS::shadow::Runtime,
*/
uint32_t propertyRemovals;
#if !ENABLE_INTL_API
#if !EXPOSE_INTL_API
/* Number localization, used by jsnum.cpp. */
const char *thousandsSeparator;
const char *decimalSeparator;