зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1590907 - Make ENABLE_INTL_API and ENABLE_TYPED_OBJECTS into js-config macros. r=sfink,firefox-build-system-reviewers,mshal
Whether ENABLE_INTL_API and ENABLE_TYPED_OBJECTS are defined, affects the behaviour of JS_FOR_PROTOTYPES for the prototypes of Intl and TypedObject. Therefore, these macros have to be available to embedders. Rename them to JS_HAS_INTL_API and JS_HAS_TYPED_OBJECTS (in line with the existing JS_HAS_CTYPES) everywhere they are used, and add them to js-config.h.in. Differential Revision: https://phabricator.services.mozilla.com/D52461 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
60223e4965
Коммит
46313a101e
|
@ -29,24 +29,24 @@ MOZ_ARG_WITH_STRING(intl-api,
|
|||
build ICU at all.],
|
||||
_INTL_API=$withval)
|
||||
|
||||
ENABLE_INTL_API=
|
||||
JS_HAS_INTL_API=
|
||||
case "$_INTL_API" in
|
||||
no)
|
||||
;;
|
||||
yes)
|
||||
ENABLE_INTL_API=1
|
||||
JS_HAS_INTL_API=1
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Invalid value passed to --with-intl-api: $_INTL_API])
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -n "$ENABLE_INTL_API"; then
|
||||
if test -n "$JS_HAS_INTL_API"; then
|
||||
USE_ICU=1
|
||||
fi
|
||||
|
||||
if test -n "$ENABLE_INTL_API"; then
|
||||
AC_DEFINE(ENABLE_INTL_API)
|
||||
if test -n "$JS_HAS_INTL_API"; then
|
||||
AC_DEFINE(JS_HAS_INTL_API)
|
||||
fi
|
||||
|
||||
dnl Settings for the implementation of the ECMAScript Internationalization API
|
||||
|
@ -72,7 +72,7 @@ if test -n "$USE_ICU"; then
|
|||
fi
|
||||
|
||||
AC_SUBST(MOZ_ICU_VERSION)
|
||||
AC_SUBST(ENABLE_INTL_API)
|
||||
AC_SUBST(JS_HAS_INTL_API)
|
||||
AC_SUBST(USE_ICU)
|
||||
AC_SUBST(ICU_DATA_FILE)
|
||||
|
||||
|
|
|
@ -491,8 +491,8 @@ js_option('--enable-typed-objects',
|
|||
default=default_typed_objects,
|
||||
help='{Enable|Disable} typed objects')
|
||||
|
||||
set_config('ENABLE_TYPED_OBJECTS', depends_if('--enable-typed-objects')(lambda x: True))
|
||||
set_define('ENABLE_TYPED_OBJECTS', depends_if('--enable-typed-objects')(lambda x: True))
|
||||
set_config('JS_HAS_TYPED_OBJECTS', depends_if('--enable-typed-objects')(lambda x: True))
|
||||
set_define('JS_HAS_TYPED_OBJECTS', depends_if('--enable-typed-objects')(lambda x: True))
|
||||
|
||||
|
||||
# Support for WebAssembly bulk memory operations.
|
||||
|
|
|
@ -65,7 +65,7 @@ using JSLocaleToUnicode = bool (*)(JSContext* cx, const char* src,
|
|||
* used to implement locale-sensitive behaviors (such as those performed by
|
||||
* the various toLocaleString and toLocale{Date,Time}String functions).
|
||||
*
|
||||
* If SpiderMonkey is compiled --with-intl-api, then #if ENABLE_INTL_API. In
|
||||
* If SpiderMonkey is compiled --with-intl-api, then #if JS_HAS_INTL_API. In
|
||||
* this case, SpiderMonkey itself will implement ECMA-402-compliant behavior by
|
||||
* calling on ICU, and none of the fields in this struct will ever be used.
|
||||
* (You'll still be able to call the get/set-callbacks functions; they just
|
||||
|
|
|
@ -34,13 +34,13 @@
|
|||
#define TYPED_ARRAY_CLASP(TYPE) (&TypedArrayObject::classes[Scalar::TYPE])
|
||||
#define ERROR_CLASP(TYPE) (&ErrorObject::classes[TYPE])
|
||||
|
||||
#ifdef ENABLE_INTL_API
|
||||
#ifdef JS_HAS_INTL_API
|
||||
# define IF_INTL(REAL, IMAGINARY) REAL
|
||||
#else
|
||||
# define IF_INTL(REAL, IMAGINARY) IMAGINARY
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_TYPED_OBJECTS
|
||||
#ifdef JS_HAS_TYPED_OBJECTS
|
||||
# define IF_TYPEDOBJ(REAL, IMAGINARY) REAL
|
||||
#else
|
||||
# define IF_TYPEDOBJ(REAL, IMAGINARY) IMAGINARY
|
||||
|
|
|
@ -39,7 +39,7 @@ else:
|
|||
FORCE_STATIC_LIB = True
|
||||
STATIC_LIBRARY_NAME = 'js_static'
|
||||
|
||||
if CONFIG['ENABLE_INTL_API']:
|
||||
if CONFIG['JS_HAS_INTL_API']:
|
||||
USE_LIBS += [
|
||||
'icu',
|
||||
]
|
||||
|
|
|
@ -854,7 +854,7 @@ function ArrayToLocaleString(locales, options) {
|
|||
if (firstElement === undefined || firstElement === null) {
|
||||
R = "";
|
||||
} else {
|
||||
#if ENABLE_INTL_API
|
||||
#if JS_HAS_INTL_API
|
||||
R = ToString(callContentFunction(firstElement.toLocaleString, firstElement, locales, options));
|
||||
#else
|
||||
R = ToString(callContentFunction(firstElement.toLocaleString, firstElement));
|
||||
|
@ -873,7 +873,7 @@ function ArrayToLocaleString(locales, options) {
|
|||
// Steps 9.a, 9.c-e.
|
||||
R += separator;
|
||||
if (!(nextElement === undefined || nextElement === null)) {
|
||||
#if ENABLE_INTL_API
|
||||
#if JS_HAS_INTL_API
|
||||
R += ToString(callContentFunction(nextElement.toLocaleString, nextElement, locales, options));
|
||||
#else
|
||||
R += ToString(callContentFunction(nextElement.toLocaleString, nextElement));
|
||||
|
|
|
@ -124,7 +124,7 @@ bool BigIntObject::toString(JSContext* cx, unsigned argc, Value* vp) {
|
|||
return CallNonGenericMethod<IsBigInt, toString_impl>(cx, args);
|
||||
}
|
||||
|
||||
#ifndef ENABLE_INTL_API
|
||||
#ifndef JS_HAS_INTL_API
|
||||
// BigInt proposal section 5.3.2. "This function is
|
||||
// implementation-dependent, and it is permissible, but not encouraged,
|
||||
// for it to return the same thing as toString."
|
||||
|
@ -147,7 +147,7 @@ bool BigIntObject::toLocaleString(JSContext* cx, unsigned argc, Value* vp) {
|
|||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
return CallNonGenericMethod<IsBigInt, toLocaleString_impl>(cx, args);
|
||||
}
|
||||
#endif /* !ENABLE_INTL_API */
|
||||
#endif /* !JS_HAS_INTL_API */
|
||||
|
||||
// BigInt proposal section 5.2.1. BigInt.asUintN ( bits, bigint )
|
||||
bool BigIntObject::asUintN(JSContext* cx, unsigned argc, Value* vp) {
|
||||
|
@ -226,7 +226,7 @@ const JSPropertySpec BigIntObject::properties[] = {
|
|||
|
||||
const JSFunctionSpec BigIntObject::methods[] = {
|
||||
JS_FN("valueOf", valueOf, 0, 0), JS_FN("toString", toString, 0, 0),
|
||||
#ifdef ENABLE_INTL_API
|
||||
#ifdef JS_HAS_INTL_API
|
||||
JS_SELF_HOSTED_FN("toLocaleString", "BigInt_toLocaleString", 0, 0),
|
||||
#else
|
||||
JS_FN("toLocaleString", toLocaleString, 0, 0),
|
||||
|
|
|
@ -32,7 +32,7 @@ class BigIntObject : public NativeObject {
|
|||
static bool valueOf(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
static bool toString_impl(JSContext* cx, const CallArgs& args);
|
||||
static bool toString(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
#ifndef ENABLE_INTL_API
|
||||
#ifndef JS_HAS_INTL_API
|
||||
static bool toLocaleString_impl(JSContext* cx, const CallArgs& args);
|
||||
static bool toLocaleString(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
#endif
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#if ENABLE_INTL_API
|
||||
#if JS_HAS_INTL_API
|
||||
/**
|
||||
* Format this BigInt object into a string, using the locale and formatting
|
||||
* options provided.
|
||||
|
@ -33,4 +33,4 @@ function BigInt_toLocaleString() {
|
|||
// Step 3.
|
||||
return intl_FormatNumber(numberFormat, x, /* formatToParts = */ false);
|
||||
}
|
||||
#endif // ENABLE_INTL_API
|
||||
#endif // JS_HAS_INTL_API
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#if ENABLE_INTL_API
|
||||
#if JS_HAS_INTL_API
|
||||
// This cache, once primed, has these properties:
|
||||
//
|
||||
// runtimeDefaultLocale:
|
||||
|
@ -167,4 +167,4 @@ function Date_toLocaleTimeString() {
|
|||
// Step 7.
|
||||
return intl_FormatDateTime(dateTimeFormat, x, /* formatToParts = */ false);
|
||||
}
|
||||
#endif // ENABLE_INTL_API
|
||||
#endif // JS_HAS_INTL_API
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#if ENABLE_INTL_API
|
||||
#if JS_HAS_INTL_API
|
||||
var numberFormatCache = new Record();
|
||||
|
||||
/**
|
||||
|
@ -37,7 +37,7 @@ function Number_toLocaleString() {
|
|||
// Step 5.
|
||||
return intl_FormatNumber(numberFormat, x, /* formatToParts = */ false);
|
||||
}
|
||||
#endif // ENABLE_INTL_API
|
||||
#endif // JS_HAS_INTL_API
|
||||
|
||||
// ES6 draft ES6 20.1.2.4
|
||||
function Number_isFinite(num) {
|
||||
|
|
|
@ -27,19 +27,19 @@
|
|||
|
||||
#include "builtin/Array.h"
|
||||
#include "builtin/Boolean.h"
|
||||
#if ENABLE_INTL_API
|
||||
#if JS_HAS_INTL_API
|
||||
# include "builtin/intl/CommonFunctions.h"
|
||||
#endif
|
||||
#include "builtin/RegExp.h"
|
||||
#include "jit/InlinableNatives.h"
|
||||
#include "js/Conversions.h"
|
||||
#if !ENABLE_INTL_API
|
||||
#if !JS_HAS_INTL_API
|
||||
# include "js/LocaleSensitive.h"
|
||||
#endif
|
||||
#include "js/PropertySpec.h"
|
||||
#include "js/StableStringChars.h"
|
||||
#include "js/UniquePtr.h"
|
||||
#if ENABLE_INTL_API
|
||||
#if JS_HAS_INTL_API
|
||||
# include "unicode/uchar.h"
|
||||
# include "unicode/unorm2.h"
|
||||
# include "unicode/ustring.h"
|
||||
|
@ -623,7 +623,7 @@ static char16_t Final_Sigma(const char16_t* chars, size_t length,
|
|||
MOZ_ASSERT(unicode::ToLowerCase(unicode::GREEK_CAPITAL_LETTER_SIGMA) ==
|
||||
unicode::GREEK_SMALL_LETTER_SIGMA);
|
||||
|
||||
#if ENABLE_INTL_API
|
||||
#if JS_HAS_INTL_API
|
||||
// Tell the analysis the BinaryProperty.contains function pointer called by
|
||||
// u_hasBinaryProperty cannot GC.
|
||||
JS::AutoSuppressGCAnalysis nogc;
|
||||
|
@ -889,7 +889,7 @@ bool js::str_toLowerCase(JSContext* cx, unsigned argc, Value* vp) {
|
|||
return true;
|
||||
}
|
||||
|
||||
#if ENABLE_INTL_API
|
||||
#if JS_HAS_INTL_API
|
||||
// String.prototype.toLocaleLowerCase is self-hosted when Intl is exposed,
|
||||
// with core functionality performed by the intrinsic below.
|
||||
|
||||
|
@ -1022,7 +1022,7 @@ static bool str_toLocaleLowerCase(JSContext* cx, unsigned argc, Value* vp) {
|
|||
return true;
|
||||
}
|
||||
|
||||
#endif // ENABLE_INTL_API
|
||||
#endif // JS_HAS_INTL_API
|
||||
|
||||
static inline bool ToUpperCaseHasSpecialCasing(Latin1Char charCode) {
|
||||
// U+00DF LATIN SMALL LETTER SHARP S is the only Latin-1 code point with
|
||||
|
@ -1331,7 +1331,7 @@ bool js::str_toUpperCase(JSContext* cx, unsigned argc, Value* vp) {
|
|||
return true;
|
||||
}
|
||||
|
||||
#if ENABLE_INTL_API
|
||||
#if JS_HAS_INTL_API
|
||||
// String.prototype.toLocaleUpperCase is self-hosted when Intl is exposed,
|
||||
// with core functionality performed by the intrinsic below.
|
||||
|
||||
|
@ -1438,9 +1438,9 @@ static bool str_toLocaleUpperCase(JSContext* cx, unsigned argc, Value* vp) {
|
|||
return true;
|
||||
}
|
||||
|
||||
#endif // ENABLE_INTL_API
|
||||
#endif // JS_HAS_INTL_API
|
||||
|
||||
#if ENABLE_INTL_API
|
||||
#if JS_HAS_INTL_API
|
||||
|
||||
// String.prototype.localeCompare is self-hosted when Intl functionality is
|
||||
// exposed, and the only intrinsics it requires are provided in the
|
||||
|
@ -1483,9 +1483,9 @@ static bool str_localeCompare(JSContext* cx, unsigned argc, Value* vp) {
|
|||
return true;
|
||||
}
|
||||
|
||||
#endif // ENABLE_INTL_API
|
||||
#endif // JS_HAS_INTL_API
|
||||
|
||||
#if ENABLE_INTL_API
|
||||
#if JS_HAS_INTL_API
|
||||
|
||||
// ES2017 draft rev 45e890512fd77add72cc0ee742785f9f6f6482de
|
||||
// 21.1.3.12 String.prototype.normalize ( [ form ] )
|
||||
|
@ -1621,7 +1621,7 @@ static bool str_normalize(JSContext* cx, unsigned argc, Value* vp) {
|
|||
return true;
|
||||
}
|
||||
|
||||
#endif // ENABLE_INTL_API
|
||||
#endif // JS_HAS_INTL_API
|
||||
|
||||
static bool str_charAt(JSContext* cx, unsigned argc, Value* vp) {
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
@ -3632,7 +3632,7 @@ static const JSFunctionSpec string_methods[] = {
|
|||
JS_FN("endsWith", str_endsWith, 1, 0), JS_FN("trim", str_trim, 0, 0),
|
||||
JS_FN("trimStart", str_trimStart, 0, 0),
|
||||
JS_FN("trimEnd", str_trimEnd, 0, 0),
|
||||
#if ENABLE_INTL_API
|
||||
#if JS_HAS_INTL_API
|
||||
JS_SELF_HOSTED_FN("toLocaleLowerCase", "String_toLocaleLowerCase", 0, 0),
|
||||
JS_SELF_HOSTED_FN("toLocaleUpperCase", "String_toLocaleUpperCase", 0, 0),
|
||||
JS_SELF_HOSTED_FN("localeCompare", "String_localeCompare", 1, 0),
|
||||
|
@ -3642,7 +3642,7 @@ static const JSFunctionSpec string_methods[] = {
|
|||
JS_FN("localeCompare", str_localeCompare, 1, 0),
|
||||
#endif
|
||||
JS_SELF_HOSTED_FN("repeat", "String_repeat", 1, 0),
|
||||
#if ENABLE_INTL_API
|
||||
#if JS_HAS_INTL_API
|
||||
JS_FN("normalize", str_normalize, 0, 0),
|
||||
#endif
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ extern bool str_charCodeAt(JSContext* cx, unsigned argc, Value* vp);
|
|||
|
||||
extern bool str_endsWith(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
#if ENABLE_INTL_API
|
||||
#if JS_HAS_INTL_API
|
||||
/**
|
||||
* Returns the input string converted to lower case based on the language
|
||||
* specific case mappings for the input locale.
|
||||
|
|
|
@ -673,7 +673,7 @@ function StringIteratorNext() {
|
|||
return result;
|
||||
}
|
||||
|
||||
#if ENABLE_INTL_API
|
||||
#if JS_HAS_INTL_API
|
||||
var collatorCache = new Record();
|
||||
|
||||
/**
|
||||
|
@ -791,7 +791,7 @@ function String_toLocaleUpperCase() {
|
|||
// Steps 7-16.
|
||||
return intl_toLocaleUpperCase(string, requestedLocale);
|
||||
}
|
||||
#endif // ENABLE_INTL_API
|
||||
#endif // JS_HAS_INTL_API
|
||||
|
||||
// ES2018 draft rev 8fadde42cf6a9879b4ab0cb6142b31c4ee501667
|
||||
// 21.1.2.4 String.raw ( template, ...substitutions )
|
||||
|
|
|
@ -386,7 +386,7 @@ static bool GetBuildConfiguration(JSContext* cx, unsigned argc, Value* vp) {
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_TYPED_OBJECTS
|
||||
#ifdef JS_HAS_TYPED_OBJECTS
|
||||
value = BooleanValue(true);
|
||||
#else
|
||||
value = BooleanValue(false);
|
||||
|
@ -395,7 +395,7 @@ static bool GetBuildConfiguration(JSContext* cx, unsigned argc, Value* vp) {
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_INTL_API
|
||||
#ifdef JS_HAS_INTL_API
|
||||
value = BooleanValue(true);
|
||||
#else
|
||||
value = BooleanValue(false);
|
||||
|
|
|
@ -1243,7 +1243,7 @@ function TypedArrayToLocaleString(locales = undefined, options = undefined) {
|
|||
// Steps 6-7.
|
||||
// Omit the 'if' clause in step 6, since typed arrays can't have undefined
|
||||
// or null elements.
|
||||
#if ENABLE_INTL_API
|
||||
#if JS_HAS_INTL_API
|
||||
var R = ToString(callContentFunction(firstElement.toLocaleString, firstElement, locales, options));
|
||||
#else
|
||||
var R = ToString(callContentFunction(firstElement.toLocaleString, firstElement));
|
||||
|
@ -1269,7 +1269,7 @@ function TypedArrayToLocaleString(locales = undefined, options = undefined) {
|
|||
// the error message. So despite bug 1079853, we can skip step 9.c.
|
||||
|
||||
// Step 9.d.
|
||||
#if ENABLE_INTL_API
|
||||
#if JS_HAS_INTL_API
|
||||
R = ToString(callContentFunction(nextElement.toLocaleString, nextElement, locales, options));
|
||||
#else
|
||||
R = ToString(callContentFunction(nextElement.toLocaleString, nextElement));
|
||||
|
|
|
@ -384,7 +384,7 @@ void js::gc::GCRuntime::traceRuntimeCommon(JSTracer* trc,
|
|||
// Trace the self-hosting global compartment.
|
||||
rt->traceSelfHostingGlobal(trc);
|
||||
|
||||
#ifdef ENABLE_INTL_API
|
||||
#ifdef JS_HAS_INTL_API
|
||||
// Trace the shared Intl data.
|
||||
rt->traceSharedIntlData(trc);
|
||||
#endif
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "jsmath.h"
|
||||
|
||||
#include "builtin/AtomicsObject.h"
|
||||
#ifdef ENABLE_INTL_API
|
||||
#ifdef JS_HAS_INTL_API
|
||||
# include "builtin/intl/Collator.h"
|
||||
# include "builtin/intl/DateTimeFormat.h"
|
||||
# include "builtin/intl/ListFormat.h"
|
||||
|
@ -314,7 +314,7 @@ IonBuilder::InliningResult IonBuilder::inlineNativeCall(CallInfo& callInfo,
|
|||
case InlinableNative::Boolean:
|
||||
return inlineBoolean(callInfo);
|
||||
|
||||
#ifdef ENABLE_INTL_API
|
||||
#ifdef JS_HAS_INTL_API
|
||||
// Intl natives.
|
||||
case InlinableNative::IntlGuardToCollator:
|
||||
return inlineGuardToClass(callInfo, &CollatorObject::class_);
|
||||
|
|
|
@ -35,6 +35,12 @@
|
|||
/* Define to 1 if SpiderMonkey should include trace logging support. */
|
||||
#undef JS_TRACE_LOGGING
|
||||
|
||||
/* Define to 1 if SpiderMonkey should include typed objects support. */
|
||||
#undef JS_HAS_TYPED_OBJECTS
|
||||
|
||||
/* Define to 1 if SpiderMonkey should include support for the Intl API. */
|
||||
#undef JS_HAS_INTL_API
|
||||
|
||||
/* Define to 1 if SpiderMonkey should include a breakpoint function for
|
||||
* artificial OOMs. */
|
||||
#undef JS_OOM_BREAKPOINT
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "builtin/Promise.h"
|
||||
#include "builtin/Stream.h"
|
||||
#include "builtin/Symbol.h"
|
||||
#ifdef ENABLE_TYPED_OBJECTS
|
||||
#ifdef JS_HAS_TYPED_OBJECTS
|
||||
# include "builtin/TypedObject.h"
|
||||
#endif
|
||||
#include "frontend/BytecodeCompiler.h"
|
||||
|
|
|
@ -131,7 +131,7 @@ namespace {
|
|||
|
||||
class DateTimeHelper {
|
||||
private:
|
||||
#if ENABLE_INTL_API && !MOZ_SYSTEM_ICU
|
||||
#if JS_HAS_INTL_API && !MOZ_SYSTEM_ICU
|
||||
static double localTZA(double t, DateTimeInfo::TimeZoneOffset offset);
|
||||
#else
|
||||
static int equivalentYearForDST(int year);
|
||||
|
@ -146,7 +146,7 @@ class DateTimeHelper {
|
|||
static double UTC(double t);
|
||||
static JSString* timeZoneComment(JSContext* cx, double utcTime,
|
||||
double localTime);
|
||||
#if !ENABLE_INTL_API || MOZ_SYSTEM_ICU
|
||||
#if !JS_HAS_INTL_API || MOZ_SYSTEM_ICU
|
||||
static size_t formatTime(char* buf, size_t buflen, const char* fmt,
|
||||
double utcTime, double localTime);
|
||||
#endif
|
||||
|
@ -441,7 +441,7 @@ JS_PUBLIC_API void JS::SetTimeResolutionUsec(uint32_t resolution, bool jitter) {
|
|||
sJitter = jitter;
|
||||
}
|
||||
|
||||
#if ENABLE_INTL_API && !MOZ_SYSTEM_ICU
|
||||
#if JS_HAS_INTL_API && !MOZ_SYSTEM_ICU
|
||||
// ES2019 draft rev 0ceb728a1adbffe42b26972a6541fd7f398b1557
|
||||
// 20.3.1.7 LocalTZA ( t, isUTC )
|
||||
double DateTimeHelper::localTZA(double t, DateTimeInfo::TimeZoneOffset offset) {
|
||||
|
@ -563,7 +563,7 @@ double DateTimeHelper::UTC(double t) {
|
|||
|
||||
return t - adjustTime(t - DateTimeInfo::localTZA() - msPerHour);
|
||||
}
|
||||
#endif /* ENABLE_INTL_API && !MOZ_SYSTEM_ICU */
|
||||
#endif /* JS_HAS_INTL_API && !MOZ_SYSTEM_ICU */
|
||||
|
||||
static double LocalTime(double t) { return DateTimeHelper::localTime(t); }
|
||||
|
||||
|
@ -2687,7 +2687,7 @@ static bool date_toJSON(JSContext* cx, unsigned argc, Value* vp) {
|
|||
return Call(cx, toISO, obj, args.rval());
|
||||
}
|
||||
|
||||
#if ENABLE_INTL_API && !MOZ_SYSTEM_ICU
|
||||
#if JS_HAS_INTL_API && !MOZ_SYSTEM_ICU
|
||||
JSString* DateTimeHelper::timeZoneComment(JSContext* cx, double utcTime,
|
||||
double localTime) {
|
||||
const char* locale = cx->runtime()->getDefaultLocale();
|
||||
|
@ -2793,7 +2793,7 @@ JSString* DateTimeHelper::timeZoneComment(JSContext* cx, double utcTime,
|
|||
|
||||
return cx->names().empty;
|
||||
}
|
||||
#endif /* ENABLE_INTL_API && !MOZ_SYSTEM_ICU */
|
||||
#endif /* JS_HAS_INTL_API && !MOZ_SYSTEM_ICU */
|
||||
|
||||
static JSString* TimeZoneComment(JSContext* cx, double utcTime,
|
||||
double localTime) {
|
||||
|
@ -2887,7 +2887,7 @@ static bool FormatDate(JSContext* cx, double utcTime, FormatSpec format,
|
|||
return true;
|
||||
}
|
||||
|
||||
#if !ENABLE_INTL_API
|
||||
#if !JS_HAS_INTL_API
|
||||
static bool ToLocaleFormatHelper(JSContext* cx, HandleObject obj,
|
||||
const char* format, MutableHandleValue rval) {
|
||||
double utcTime = obj->as<DateObject>().UTCTime().toNumber();
|
||||
|
@ -2995,7 +2995,7 @@ static bool date_toLocaleTimeString(JSContext* cx, unsigned argc, Value* vp) {
|
|||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
return CallNonGenericMethod<IsDate, date_toLocaleTimeString_impl>(cx, args);
|
||||
}
|
||||
#endif /* !ENABLE_INTL_API */
|
||||
#endif /* !JS_HAS_INTL_API */
|
||||
|
||||
/* ES5 15.9.5.4. */
|
||||
MOZ_ALWAYS_INLINE bool date_toTimeString_impl(JSContext* cx,
|
||||
|
@ -3134,7 +3134,7 @@ static const JSFunctionSpec date_methods[] = {
|
|||
JS_FN("setMilliseconds", date_setMilliseconds, 1, 0),
|
||||
JS_FN("setUTCMilliseconds", date_setUTCMilliseconds, 1, 0),
|
||||
JS_FN("toUTCString", date_toGMTString, 0, 0),
|
||||
#if ENABLE_INTL_API
|
||||
#if JS_HAS_INTL_API
|
||||
JS_SELF_HOSTED_FN(js_toLocaleString_str, "Date_toLocaleString", 0, 0),
|
||||
JS_SELF_HOSTED_FN("toLocaleDateString", "Date_toLocaleDateString", 0, 0),
|
||||
JS_SELF_HOSTED_FN("toLocaleTimeString", "Date_toLocaleTimeString", 0, 0),
|
||||
|
|
|
@ -1452,7 +1452,7 @@ JS_FRIEND_API bool js::RuntimeIsBeingDestroyed() {
|
|||
|
||||
// No-op implementations of public API that would depend on --with-intl-api
|
||||
|
||||
#ifndef ENABLE_INTL_API
|
||||
#ifndef JS_HAS_INTL_API
|
||||
|
||||
static bool IntlNotEnabled(JSContext* cx) {
|
||||
JS_ReportErrorNumberASCII(cx, js::GetErrorMessage, nullptr,
|
||||
|
@ -1472,4 +1472,4 @@ bool js::AddLocaleConstructor(JSContext* cx, JS::HandleObject intl) {
|
|||
return IntlNotEnabled(cx);
|
||||
}
|
||||
|
||||
#endif // !ENABLE_INTL_API
|
||||
#endif // !JS_HAS_INTL_API
|
||||
|
|
|
@ -2595,7 +2595,7 @@ extern JS_FRIEND_API JSObject* ToWindowIfWindowProxy(JSObject* obj);
|
|||
|
||||
// Create and add the Intl.MozDateTimeFormat constructor function to the
|
||||
// provided object.
|
||||
// If JS was built without ENABLE_INTL_API, this function will throw an
|
||||
// If JS was built without JS_HAS_INTL_API, this function will throw an
|
||||
// exception.
|
||||
//
|
||||
// This custom date/time formatter constructor gives users the ability
|
||||
|
@ -2611,13 +2611,13 @@ extern bool AddMozDateTimeFormatConstructor(JSContext* cx,
|
|||
JS::Handle<JSObject*> intl);
|
||||
|
||||
// Create and add the Intl.Locale constructor function to the provided object.
|
||||
// If JS was built without ENABLE_INTL_API, this function will throw an
|
||||
// If JS was built without JS_HAS_INTL_API, this function will throw an
|
||||
// exception.
|
||||
extern bool AddLocaleConstructor(JSContext* cx, JS::Handle<JSObject*> intl);
|
||||
|
||||
// Create and add the Intl.ListFormat constructor function to the provided
|
||||
// object.
|
||||
// If JS was built without ENABLE_INTL_API, this function will throw an
|
||||
// If JS was built without JS_HAS_INTL_API, this function will throw an
|
||||
// exception.
|
||||
extern bool AddListFormatConstructor(JSContext* cx, JS::Handle<JSObject*> intl);
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "double-conversion/double-conversion.h"
|
||||
#include "js/CharacterEncoding.h"
|
||||
#include "js/Conversions.h"
|
||||
#if !ENABLE_INTL_API
|
||||
#if !JS_HAS_INTL_API
|
||||
# include "js/LocaleSensitive.h"
|
||||
#endif
|
||||
#include "js/PropertySpec.h"
|
||||
|
@ -891,7 +891,7 @@ bool js::num_toString(JSContext* cx, unsigned argc, Value* vp) {
|
|||
return CallNonGenericMethod<IsNumber, num_toString_impl>(cx, args);
|
||||
}
|
||||
|
||||
#if !ENABLE_INTL_API
|
||||
#if !JS_HAS_INTL_API
|
||||
MOZ_ALWAYS_INLINE bool num_toLocaleString_impl(JSContext* cx,
|
||||
const CallArgs& args) {
|
||||
MOZ_ASSERT(IsNumber(args.thisv()));
|
||||
|
@ -1033,7 +1033,7 @@ static bool num_toLocaleString(JSContext* cx, unsigned argc, Value* vp) {
|
|||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
return CallNonGenericMethod<IsNumber, num_toLocaleString_impl>(cx, args);
|
||||
}
|
||||
#endif /* !ENABLE_INTL_API */
|
||||
#endif /* !JS_HAS_INTL_API */
|
||||
|
||||
MOZ_ALWAYS_INLINE bool num_valueOf_impl(JSContext* cx, const CallArgs& args) {
|
||||
MOZ_ASSERT(IsNumber(args.thisv()));
|
||||
|
@ -1246,7 +1246,7 @@ static bool num_toPrecision(JSContext* cx, unsigned argc, Value* vp) {
|
|||
static const JSFunctionSpec number_methods[] = {
|
||||
JS_FN(js_toSource_str, num_toSource, 0, 0),
|
||||
JS_FN(js_toString_str, num_toString, 1, 0),
|
||||
#if ENABLE_INTL_API
|
||||
#if JS_HAS_INTL_API
|
||||
JS_SELF_HOSTED_FN(js_toLocaleString_str, "Number_toLocaleString", 0, 0),
|
||||
#else
|
||||
JS_FN(js_toLocaleString_str, num_toLocaleString, 0, 0),
|
||||
|
@ -1273,10 +1273,10 @@ static const JSFunctionSpec number_static_methods[] = {
|
|||
JS_FS_END};
|
||||
|
||||
bool js::InitRuntimeNumberState(JSRuntime* rt) {
|
||||
// XXX If ENABLE_INTL_API becomes true all the time at some point,
|
||||
// XXX If JS_HAS_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 !JS_HAS_INTL_API
|
||||
/* Copy locale-specific separators into the runtime strings. */
|
||||
const char* thousandsSeparator;
|
||||
const char* decimalPoint;
|
||||
|
@ -1325,19 +1325,19 @@ bool js::InitRuntimeNumberState(JSRuntime* rt) {
|
|||
|
||||
js_memcpy(storage, grouping, groupingSize);
|
||||
rt->numGrouping = grouping;
|
||||
#endif /* !ENABLE_INTL_API */
|
||||
#endif /* !JS_HAS_INTL_API */
|
||||
return true;
|
||||
}
|
||||
|
||||
void js::FinishRuntimeNumberState(JSRuntime* rt) {
|
||||
#if !ENABLE_INTL_API
|
||||
#if !JS_HAS_INTL_API
|
||||
/*
|
||||
* The free also releases the memory for decimalSeparator and numGrouping
|
||||
* strings.
|
||||
*/
|
||||
char* storage = const_cast<char*>(rt->thousandsSeparator.ref());
|
||||
js_free(storage);
|
||||
#endif // !ENABLE_INTL_API
|
||||
#endif // !JS_HAS_INTL_API
|
||||
}
|
||||
|
||||
JSObject* NumberObject::createPrototype(JSContext* cx, JSProtoKey key) {
|
||||
|
|
|
@ -40,7 +40,7 @@ class StringBuffer;
|
|||
|
||||
extern MOZ_MUST_USE bool InitRuntimeNumberState(JSRuntime* rt);
|
||||
|
||||
// This is a no-op if built with ENABLE_INTL_API.
|
||||
// This is a no-op if built with JS_HAS_INTL_API.
|
||||
extern void FinishRuntimeNumberState(JSRuntime* rt);
|
||||
|
||||
/* Initialize the Number class, returning its prototype object. */
|
||||
|
|
|
@ -380,7 +380,7 @@ SOURCES += [
|
|||
'vm/ProfilingStack.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['ENABLE_INTL_API']:
|
||||
if CONFIG['JS_HAS_INTL_API']:
|
||||
UNIFIED_SOURCES += [
|
||||
'builtin/intl/Collator.cpp',
|
||||
'builtin/intl/CommonFunctions.cpp',
|
||||
|
@ -493,7 +493,7 @@ selfhosted_inputs = [
|
|||
'builtin/intl/NumberFormat.js',
|
||||
'builtin/intl/PluralRules.js',
|
||||
'builtin/intl/RelativeTimeFormat.js',
|
||||
] if CONFIG['ENABLE_INTL_API'] else [])
|
||||
] if CONFIG['JS_HAS_INTL_API'] else [])
|
||||
|
||||
# Prepare self-hosted JS code for embedding
|
||||
GeneratedFile('selfhosted.out.h', 'selfhosted.js',
|
||||
|
|
|
@ -1301,7 +1301,7 @@ static bool BindToAsyncStack(JSContext* cx, unsigned argc, Value* vp) {
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_INTL_API
|
||||
#ifdef JS_HAS_INTL_API
|
||||
static bool AddIntlExtras(JSContext* cx, unsigned argc, Value* vp) {
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
if (!args.get(0).isObject()) {
|
||||
|
@ -1335,7 +1335,7 @@ static bool AddIntlExtras(JSContext* cx, unsigned argc, Value* vp) {
|
|||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
#endif // ENABLE_INTL_API
|
||||
#endif // JS_HAS_INTL_API
|
||||
|
||||
static MOZ_MUST_USE bool EvalUtf8AndPrint(JSContext* cx, const char* bytes,
|
||||
size_t length, int lineno,
|
||||
|
@ -9069,7 +9069,7 @@ JS_FN_HELP("parseBin", BinParse, 1, 0,
|
|||
" or only when there are no other JavaScript frames on the stack\n"
|
||||
" below it (false). If omitted, this is treated as 'true'."),
|
||||
|
||||
#ifdef ENABLE_INTL_API
|
||||
#ifdef JS_HAS_INTL_API
|
||||
JS_FN_HELP("addIntlExtras", AddIntlExtras, 1, 0,
|
||||
"addIntlExtras(obj)",
|
||||
"Adds various not-yet-standardized Intl functions as properties on the\n"
|
||||
|
@ -9077,7 +9077,7 @@ JS_FN_HELP("parseBin", BinParse, 1, 0,
|
|||
"functions and their behavior are experimental: don't depend upon them\n"
|
||||
"unless you're willing to update your code if these experimental APIs change\n"
|
||||
"underneath you."),
|
||||
#endif // ENABLE_INTL_API
|
||||
#endif // JS_HAS_INTL_API
|
||||
|
||||
JS_FN_HELP("wasmCompileInSeparateProcess", WasmCompileInSeparateProcess, 1, 0,
|
||||
"wasmCompileInSeparateProcess(buffer)",
|
||||
|
|
|
@ -24,12 +24,12 @@
|
|||
#include "js/Date.h"
|
||||
#include "threading/ExclusiveData.h"
|
||||
|
||||
#if ENABLE_INTL_API && !MOZ_SYSTEM_ICU
|
||||
#if JS_HAS_INTL_API && !MOZ_SYSTEM_ICU
|
||||
# include "unicode/basictz.h"
|
||||
# include "unicode/locid.h"
|
||||
# include "unicode/timezone.h"
|
||||
# include "unicode/unistr.h"
|
||||
#endif /* ENABLE_INTL_API && !MOZ_SYSTEM_ICU */
|
||||
#endif /* JS_HAS_INTL_API && !MOZ_SYSTEM_ICU */
|
||||
|
||||
#include "util/Text.h"
|
||||
#include "vm/MutexIDs.h"
|
||||
|
@ -189,7 +189,7 @@ void js::DateTimeInfo::updateTimeZone() {
|
|||
|
||||
dstRange_.reset();
|
||||
|
||||
#if ENABLE_INTL_API && !MOZ_SYSTEM_ICU
|
||||
#if JS_HAS_INTL_API && !MOZ_SYSTEM_ICU
|
||||
utcRange_.reset();
|
||||
localRange_.reset();
|
||||
|
||||
|
@ -203,7 +203,7 @@ void js::DateTimeInfo::updateTimeZone() {
|
|||
|
||||
standardName_ = nullptr;
|
||||
daylightSavingsName_ = nullptr;
|
||||
#endif /* ENABLE_INTL_API && !MOZ_SYSTEM_ICU */
|
||||
#endif /* JS_HAS_INTL_API && !MOZ_SYSTEM_ICU */
|
||||
|
||||
// Propagate the time zone change to ICU, too.
|
||||
{
|
||||
|
@ -239,7 +239,7 @@ int32_t js::DateTimeInfo::computeDSTOffsetMilliseconds(int64_t utcSeconds) {
|
|||
MOZ_ASSERT(utcSeconds >= MinTimeT);
|
||||
MOZ_ASSERT(utcSeconds <= MaxTimeT);
|
||||
|
||||
#if ENABLE_INTL_API && !MOZ_SYSTEM_ICU
|
||||
#if JS_HAS_INTL_API && !MOZ_SYSTEM_ICU
|
||||
UDate date = UDate(utcSeconds * msPerSecond);
|
||||
constexpr bool dateIsLocalTime = false;
|
||||
int32_t rawOffset, dstOffset;
|
||||
|
@ -273,7 +273,7 @@ int32_t js::DateTimeInfo::computeDSTOffsetMilliseconds(int64_t utcSeconds) {
|
|||
}
|
||||
|
||||
return diff * msPerSecond;
|
||||
#endif /* ENABLE_INTL_API && !MOZ_SYSTEM_ICU */
|
||||
#endif /* JS_HAS_INTL_API && !MOZ_SYSTEM_ICU */
|
||||
}
|
||||
|
||||
int32_t js::DateTimeInfo::internalGetDSTOffsetMilliseconds(
|
||||
|
@ -381,7 +381,7 @@ void js::DateTimeInfo::RangeCache::sanityCheck() {
|
|||
assertRange(oldStartSeconds, oldEndSeconds);
|
||||
}
|
||||
|
||||
#if ENABLE_INTL_API && !MOZ_SYSTEM_ICU
|
||||
#if JS_HAS_INTL_API && !MOZ_SYSTEM_ICU
|
||||
int32_t js::DateTimeInfo::computeUTCOffsetMilliseconds(int64_t localSeconds) {
|
||||
MOZ_ASSERT(localSeconds >= MinTimeT);
|
||||
MOZ_ASSERT(localSeconds <= MaxTimeT);
|
||||
|
@ -506,7 +506,7 @@ icu::TimeZone* js::DateTimeInfo::timeZone() {
|
|||
|
||||
return timeZone_.get();
|
||||
}
|
||||
#endif /* ENABLE_INTL_API && !MOZ_SYSTEM_ICU */
|
||||
#endif /* JS_HAS_INTL_API && !MOZ_SYSTEM_ICU */
|
||||
|
||||
/* static */ js::ExclusiveData<js::DateTimeInfo>* js::DateTimeInfo::instance;
|
||||
|
||||
|
@ -581,7 +581,7 @@ static bool IsOlsonCompatibleWindowsTimeZoneId(const char* tz) {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
#elif ENABLE_INTL_API && !MOZ_SYSTEM_ICU
|
||||
#elif JS_HAS_INTL_API && !MOZ_SYSTEM_ICU
|
||||
static inline const char* TZContainsAbsolutePath(const char* tzVar) {
|
||||
// A TZ environment variable may be an absolute path. The path
|
||||
// format of TZ may begin with a colon. (ICU handles relative paths.)
|
||||
|
@ -718,14 +718,14 @@ static icu::UnicodeString ReadTimeZoneLink(const char* tz) {
|
|||
|
||||
return icu::UnicodeString(timeZone, timeZoneLen, US_INV);
|
||||
}
|
||||
#endif /* ENABLE_INTL_API && !MOZ_SYSTEM_ICU */
|
||||
#endif /* JS_HAS_INTL_API && !MOZ_SYSTEM_ICU */
|
||||
|
||||
void js::ResyncICUDefaultTimeZone() {
|
||||
js::DateTimeInfo::resyncICUDefaultTimeZone();
|
||||
}
|
||||
|
||||
void js::DateTimeInfo::internalResyncICUDefaultTimeZone() {
|
||||
#if ENABLE_INTL_API && !MOZ_SYSTEM_ICU
|
||||
#if JS_HAS_INTL_API && !MOZ_SYSTEM_ICU
|
||||
if (const char* tz = std::getenv("TZ")) {
|
||||
icu::UnicodeString tzid;
|
||||
|
||||
|
|
|
@ -17,13 +17,13 @@
|
|||
#include "js/Utility.h"
|
||||
#include "threading/ExclusiveData.h"
|
||||
|
||||
#if ENABLE_INTL_API && !MOZ_SYSTEM_ICU
|
||||
#if JS_HAS_INTL_API && !MOZ_SYSTEM_ICU
|
||||
# include "unicode/uversion.h"
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
class TimeZone;
|
||||
U_NAMESPACE_END
|
||||
#endif /* ENABLE_INTL_API && !MOZ_SYSTEM_ICU */
|
||||
#endif /* JS_HAS_INTL_API && !MOZ_SYSTEM_ICU */
|
||||
|
||||
namespace js {
|
||||
|
||||
|
@ -166,7 +166,7 @@ class DateTimeInfo {
|
|||
return guard->utcToLocalStandardOffsetSeconds_;
|
||||
}
|
||||
|
||||
#if ENABLE_INTL_API && !MOZ_SYSTEM_ICU
|
||||
#if JS_HAS_INTL_API && !MOZ_SYSTEM_ICU
|
||||
enum class TimeZoneOffset { UTC, Local };
|
||||
|
||||
/**
|
||||
|
@ -199,7 +199,7 @@ class DateTimeInfo {
|
|||
static int32_t localTZA() {
|
||||
return utcToLocalStandardOffsetSeconds() * msPerSecond;
|
||||
}
|
||||
#endif /* ENABLE_INTL_API && !MOZ_SYSTEM_ICU */
|
||||
#endif /* JS_HAS_INTL_API && !MOZ_SYSTEM_ICU */
|
||||
|
||||
private:
|
||||
// The two methods below should only be called via js::ResetTimeZoneInternal()
|
||||
|
@ -265,7 +265,7 @@ class DateTimeInfo {
|
|||
* <https://unicode-org.atlassian.net/browse/ICU-13845>.
|
||||
*
|
||||
* When ICU is exclusively used for time zone computations, that means when
|
||||
* |ENABLE_INTL_API && !MOZ_SYSTEM_ICU| is true, this field is only used to
|
||||
* |JS_HAS_INTL_API && !MOZ_SYSTEM_ICU| is true, this field is only used to
|
||||
* detect system default time zone changes. It must not be used to convert
|
||||
* between local and UTC time, because, as outlined above, this could lead to
|
||||
* different results when compared to ICU.
|
||||
|
@ -274,7 +274,7 @@ class DateTimeInfo {
|
|||
|
||||
RangeCache dstRange_; // UTC-based ranges
|
||||
|
||||
#if ENABLE_INTL_API && !MOZ_SYSTEM_ICU
|
||||
#if JS_HAS_INTL_API && !MOZ_SYSTEM_ICU
|
||||
// ICU's TimeZone class is currently only available through the C++ API,
|
||||
// see <https://unicode-org.atlassian.net/browse/ICU-13706>. Due to the
|
||||
// lack of a stable ABI in C++, we therefore need to restrict this class
|
||||
|
@ -311,7 +311,7 @@ class DateTimeInfo {
|
|||
// underlying operating system.
|
||||
static constexpr int64_t MinTimeT = 0; /* time_t 01/01/1970 */
|
||||
static constexpr int64_t MaxTimeT = 2145830400; /* time_t 12/31/2037 */
|
||||
#endif /* ENABLE_INTL_API && !MOZ_SYSTEM_ICU */
|
||||
#endif /* JS_HAS_INTL_API && !MOZ_SYSTEM_ICU */
|
||||
|
||||
static constexpr int64_t RangeExpansionAmount = 30 * SecondsPerDay;
|
||||
|
||||
|
@ -340,7 +340,7 @@ class DateTimeInfo {
|
|||
|
||||
int32_t internalGetDSTOffsetMilliseconds(int64_t utcMilliseconds);
|
||||
|
||||
#if ENABLE_INTL_API && !MOZ_SYSTEM_ICU
|
||||
#if JS_HAS_INTL_API && !MOZ_SYSTEM_ICU
|
||||
/**
|
||||
* Compute the UTC offset in milliseconds for the given local time. Called
|
||||
* by internalGetOffsetMilliseconds on a cache miss.
|
||||
|
@ -360,7 +360,7 @@ class DateTimeInfo {
|
|||
int64_t utcMilliseconds, const char* locale);
|
||||
|
||||
icu::TimeZone* timeZone();
|
||||
#endif /* ENABLE_INTL_API && !MOZ_SYSTEM_ICU */
|
||||
#endif /* JS_HAS_INTL_API && !MOZ_SYSTEM_ICU */
|
||||
};
|
||||
|
||||
} /* namespace js */
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "builtin/BigInt.h"
|
||||
#include "builtin/DataViewObject.h"
|
||||
#include "builtin/Eval.h"
|
||||
#ifdef ENABLE_INTL_API
|
||||
#ifdef JS_HAS_INTL_API
|
||||
# include "builtin/intl/Collator.h"
|
||||
# include "builtin/intl/DateTimeFormat.h"
|
||||
# include "builtin/intl/ListFormat.h"
|
||||
|
|
|
@ -21,11 +21,11 @@
|
|||
#include "jit/Ion.h"
|
||||
#include "jit/JitCommon.h"
|
||||
#include "js/Utility.h"
|
||||
#if ENABLE_INTL_API
|
||||
#if JS_HAS_INTL_API
|
||||
# include "unicode/putil.h"
|
||||
# include "unicode/uclean.h"
|
||||
# include "unicode/utypes.h"
|
||||
#endif // ENABLE_INTL_API
|
||||
#endif // JS_HAS_INTL_API
|
||||
#include "util/Poison.h"
|
||||
#include "vm/BigIntType.h"
|
||||
#include "vm/DateTime.h"
|
||||
|
@ -166,7 +166,7 @@ JS_PUBLIC_API const char* JS::detail::InitWithFailureDiagnostic(
|
|||
|
||||
RETURN_IF_FAIL(js::jit::AtomicOperations::Initialize());
|
||||
|
||||
#if ENABLE_INTL_API
|
||||
#if JS_HAS_INTL_API
|
||||
# if !MOZ_SYSTEM_ICU
|
||||
// Explicitly set the data directory to its default value, but only when we're
|
||||
// sure that we use our in-tree ICU copy. See bug 1527879 and ICU bug
|
||||
|
@ -179,7 +179,7 @@ JS_PUBLIC_API const char* JS::detail::InitWithFailureDiagnostic(
|
|||
if (U_FAILURE(err)) {
|
||||
return "u_init() failed";
|
||||
}
|
||||
#endif // ENABLE_INTL_API
|
||||
#endif // JS_HAS_INTL_API
|
||||
|
||||
RETURN_IF_FAIL(js::CreateHelperThreadsState());
|
||||
RETURN_IF_FAIL(FutexThread::initialize());
|
||||
|
@ -243,9 +243,9 @@ JS_PUBLIC_API void JS_ShutDown(void) {
|
|||
// to do it only when PRMJ_Now is eventually called.
|
||||
PRMJ_NowShutdown();
|
||||
|
||||
#if ENABLE_INTL_API
|
||||
#if JS_HAS_INTL_API
|
||||
u_cleanup();
|
||||
#endif // ENABLE_INTL_API
|
||||
#endif // JS_HAS_INTL_API
|
||||
|
||||
#ifdef MOZ_VTUNE
|
||||
js::vtune::Shutdown();
|
||||
|
@ -270,7 +270,7 @@ JS_PUBLIC_API bool JS_SetICUMemoryFunctions(JS_ICUAllocFn allocFn,
|
|||
"must call JS_SetICUMemoryFunctions before any other JSAPI "
|
||||
"operation (including JS_Init)");
|
||||
|
||||
#if ENABLE_INTL_API
|
||||
#if JS_HAS_INTL_API
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
u_setMemoryFunctions(/* context = */ nullptr, allocFn, reallocFn, freeFn,
|
||||
&status);
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "js/SliceBudget.h"
|
||||
#include "js/StableStringChars.h"
|
||||
#include "js/Wrapper.h"
|
||||
#if ENABLE_INTL_API
|
||||
#if JS_HAS_INTL_API
|
||||
# include "unicode/uloc.h"
|
||||
#endif
|
||||
#include "util/Windows.h"
|
||||
|
@ -136,7 +136,7 @@ JSRuntime::JSRuntime(JSRuntime* parentRuntime)
|
|||
gcInitialized(false),
|
||||
emptyString(nullptr),
|
||||
defaultFreeOp_(nullptr),
|
||||
#if !ENABLE_INTL_API
|
||||
#if !JS_HAS_INTL_API
|
||||
thousandsSeparator(nullptr),
|
||||
decimalSeparator(nullptr),
|
||||
numGrouping(nullptr),
|
||||
|
@ -242,7 +242,7 @@ void JSRuntime::destroyRuntime() {
|
|||
MOZ_ASSERT(childRuntimeCount == 0);
|
||||
MOZ_ASSERT(initialized_);
|
||||
|
||||
#ifdef ENABLE_INTL_API
|
||||
#ifdef JS_HAS_INTL_API
|
||||
sharedIntlData.ref().destroyInstance();
|
||||
#endif
|
||||
|
||||
|
@ -296,7 +296,7 @@ void JSRuntime::destroyRuntime() {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if !ENABLE_INTL_API
|
||||
#if !JS_HAS_INTL_API
|
||||
FinishRuntimeNumberState(this);
|
||||
#endif
|
||||
|
||||
|
@ -370,7 +370,7 @@ void JSRuntime::addSizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf,
|
|||
sharedImmutableStrings_->sizeOfExcludingThis(mallocSizeOf);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_INTL_API
|
||||
#ifdef JS_HAS_INTL_API
|
||||
rtSizes->sharedIntlData +=
|
||||
sharedIntlData.ref().sizeOfExcludingThis(mallocSizeOf);
|
||||
#endif
|
||||
|
@ -544,7 +544,7 @@ const char* JSRuntime::getDefaultLocale() {
|
|||
|
||||
// Use ICU if available to retrieve the default locale, this ensures ICU's
|
||||
// default locale matches our default locale.
|
||||
#if ENABLE_INTL_API
|
||||
#if JS_HAS_INTL_API
|
||||
const char* locale = uloc_getDefault();
|
||||
#else
|
||||
const char* locale = setlocale(LC_ALL, nullptr);
|
||||
|
@ -572,7 +572,7 @@ const char* JSRuntime::getDefaultLocale() {
|
|||
return defaultLocale.ref().get();
|
||||
}
|
||||
|
||||
#ifdef ENABLE_INTL_API
|
||||
#ifdef JS_HAS_INTL_API
|
||||
void JSRuntime::traceSharedIntlData(JSTracer* trc) {
|
||||
sharedIntlData.ref().trace(trc);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include <setjmp.h>
|
||||
|
||||
#include "builtin/AtomicsObject.h"
|
||||
#ifdef ENABLE_INTL_API
|
||||
#ifdef JS_HAS_INTL_API
|
||||
# include "builtin/intl/SharedIntlData.h"
|
||||
#endif
|
||||
#include "builtin/Promise.h"
|
||||
|
@ -684,7 +684,7 @@ struct JSRuntime {
|
|||
return defaultFreeOp_;
|
||||
}
|
||||
|
||||
#if !ENABLE_INTL_API
|
||||
#if !JS_HAS_INTL_API
|
||||
/* Number localization, used by jsnum.cpp. */
|
||||
js::WriteOnceData<const char*> thousandsSeparator;
|
||||
js::WriteOnceData<const char*> decimalSeparator;
|
||||
|
@ -804,7 +804,7 @@ struct JSRuntime {
|
|||
// these are shared with the parentRuntime, if any.
|
||||
js::WriteOnceData<js::WellKnownSymbols*> wellKnownSymbols;
|
||||
|
||||
#ifdef ENABLE_INTL_API
|
||||
#ifdef JS_HAS_INTL_API
|
||||
/* Shared Intl data for this runtime. */
|
||||
js::MainThreadData<js::intl::SharedIntlData> sharedIntlData;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "builtin/Array.h"
|
||||
#include "builtin/BigInt.h"
|
||||
#ifdef ENABLE_INTL_API
|
||||
#ifdef JS_HAS_INTL_API
|
||||
# include "builtin/intl/Collator.h"
|
||||
# include "builtin/intl/DateTimeFormat.h"
|
||||
# include "builtin/intl/IntlObject.h"
|
||||
|
@ -1761,7 +1761,7 @@ bool js::ReportIncompatibleSelfHostedMethod(JSContext* cx,
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_INTL_API
|
||||
#ifdef JS_HAS_INTL_API
|
||||
/**
|
||||
* Returns the default locale as a well-formed, but not necessarily
|
||||
* canonicalized, BCP-47 language tag.
|
||||
|
@ -1816,7 +1816,7 @@ static bool intrinsic_IsRuntimeDefaultLocale(JSContext* cx, unsigned argc,
|
|||
args.rval().setBoolean(equals);
|
||||
return true;
|
||||
}
|
||||
#endif // ENABLE_INTL_API
|
||||
#endif // JS_HAS_INTL_API
|
||||
|
||||
static bool intrinsic_ThrowArgTypeNotObject(JSContext* cx, unsigned argc,
|
||||
Value* vp) {
|
||||
|
@ -2420,7 +2420,7 @@ static const JSFunctionSpec intrinsic_functions[] = {
|
|||
// clang-format on
|
||||
#undef LOAD_AND_STORE_REFERENCE_FN_DECLS
|
||||
|
||||
#ifdef ENABLE_INTL_API
|
||||
#ifdef JS_HAS_INTL_API
|
||||
// See builtin/intl/*.h for descriptions of the intl_* functions.
|
||||
JS_FN("intl_availableCalendars", intl_availableCalendars, 1, 0),
|
||||
JS_FN("intl_availableCollations", intl_availableCollations, 1, 0),
|
||||
|
@ -2501,7 +2501,7 @@ static const JSFunctionSpec intrinsic_functions[] = {
|
|||
|
||||
JS_FN("RuntimeDefaultLocale", intrinsic_RuntimeDefaultLocale, 0, 0),
|
||||
JS_FN("IsRuntimeDefaultLocale", intrinsic_IsRuntimeDefaultLocale, 1, 0),
|
||||
#endif // ENABLE_INTL_API
|
||||
#endif // JS_HAS_INTL_API
|
||||
|
||||
JS_FN("GetOwnPropertyDescriptorToArray", GetOwnPropertyDescriptorToArray, 2,
|
||||
0),
|
||||
|
|
|
@ -246,7 +246,7 @@ static int64_t PRMJ_NowImpl() {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if !ENABLE_INTL_API || MOZ_SYSTEM_ICU
|
||||
#if !JS_HAS_INTL_API || MOZ_SYSTEM_ICU
|
||||
# ifdef XP_WIN
|
||||
static void PRMJ_InvalidParameterHandler(const wchar_t* expression,
|
||||
const wchar_t* function,
|
||||
|
@ -394,4 +394,4 @@ size_t PRMJ_FormatTime(char* buf, size_t buflen, const char* fmt,
|
|||
# endif
|
||||
return result;
|
||||
}
|
||||
#endif /* !ENABLE_INTL_API || MOZ_SYSTEM_ICU */
|
||||
#endif /* !JS_HAS_INTL_API || MOZ_SYSTEM_ICU */
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#if !ENABLE_INTL_API || MOZ_SYSTEM_ICU
|
||||
#if !JS_HAS_INTL_API || MOZ_SYSTEM_ICU
|
||||
/*
|
||||
* Broken down form of 64 bit time value.
|
||||
*/
|
||||
|
@ -52,7 +52,7 @@ extern void PRMJ_NowShutdown();
|
|||
inline void PRMJ_NowShutdown() {}
|
||||
#endif
|
||||
|
||||
#if !ENABLE_INTL_API || MOZ_SYSTEM_ICU
|
||||
#if !JS_HAS_INTL_API || MOZ_SYSTEM_ICU
|
||||
/* Format a time value into a buffer. Same semantics as strftime() */
|
||||
extern size_t PRMJ_FormatTime(char* buf, size_t buflen, const char* fmt,
|
||||
const PRMJTime* tm, int timeZoneYear,
|
||||
|
|
|
@ -1196,7 +1196,7 @@ bool Module::makeStructTypeDescrs(
|
|||
MOZ_CRASH("Should not have seen any struct types");
|
||||
#else
|
||||
|
||||
# ifndef ENABLE_TYPED_OBJECTS
|
||||
# ifndef JS_HAS_TYPED_OBJECTS
|
||||
# error "GC types require TypedObject"
|
||||
# endif
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ def js_subconfigure(build_env, prepare_configure_options, mozconfig,
|
|||
if not o.startswith('--with-system-nspr')
|
||||
]
|
||||
|
||||
if not substs.get('ENABLE_INTL_API'):
|
||||
if not substs.get('JS_HAS_INTL_API'):
|
||||
options.append('--without-intl-api')
|
||||
|
||||
if substs.get('NSPR_CFLAGS') or substs.get('NSPR_LIBS'):
|
||||
|
|
|
@ -70,7 +70,7 @@ struct XPCLocaleCallbacks : public JSLocaleCallbacks {
|
|||
|
||||
// Disable the toLocaleUpper/Lower case hooks to use the standard,
|
||||
// locale-insensitive definition from String.prototype. (These hooks are
|
||||
// only consulted when ENABLE_INTL_API is not set.) Since ENABLE_INTL_API
|
||||
// only consulted when JS_HAS_INTL_API is not set.) Since JS_HAS_INTL_API
|
||||
// is always set, these hooks should be disabled.
|
||||
localeToUpperCase = nullptr;
|
||||
localeToLowerCase = nullptr;
|
||||
|
|
Загрузка…
Ссылка в новой задаче