Commit 27330872 authored by Adam Klein's avatar Adam Klein Committed by Commit Bot

[intl] Remove always-true --datetime-format-to-parts flag

This flag was shipped with V8 5.7 (Chrome 57).

Bug: v8:5244
Change-Id: I044edb8d7e74ea3c84bf46ec5cf81b8ff1b7a3de
Reviewed-on: https://chromium-review.googlesource.com/477975Reviewed-by: 's avatarDaniel Ehrenberg <littledan@chromium.org>
Commit-Queue: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44667}
parent 06e45cd9
......@@ -4000,21 +4000,6 @@ void Genesis::InitializeGlobal_harmony_regexp_dotall() {
}
#ifdef V8_I18N_SUPPORT
void Genesis::InitializeGlobal_datetime_format_to_parts() {
if (!FLAG_datetime_format_to_parts) return;
Handle<JSReceiver> exports_container(
JSReceiver::cast(native_context()->exports_container()));
Handle<JSObject> date_time_format_prototype(JSObject::cast(
native_context()->intl_date_time_format_function()->prototype()));
Handle<JSFunction> format_date_to_parts = Handle<JSFunction>::cast(
JSReceiver::GetProperty(
exports_container,
factory()->InternalizeUtf8String("FormatDateToParts"))
.ToHandleChecked());
InstallFunction(date_time_format_prototype, format_date_to_parts,
factory()->InternalizeUtf8String("formatToParts"));
}
namespace {
void SetFunction(Handle<JSObject> target, Handle<JSFunction> function,
......
......@@ -228,7 +228,6 @@ DEFINE_IMPLICATION(es_staging, harmony)
#ifdef V8_I18N_SUPPORT
#define HARMONY_SHIPPING(V) \
HARMONY_SHIPPING_BASE(V) \
V(datetime_format_to_parts, "Intl.DateTimeFormat.formatToParts") \
V(icu_case_mapping, "case mapping with ICU rather than Unibrow")
#else
#define HARMONY_SHIPPING(V) HARMONY_SHIPPING_BASE(V)
......
......@@ -1723,27 +1723,29 @@ function formatDate(formatter, dateValue) {
return %InternalDateFormat(formatter, new GlobalDate(dateMs));
}
function FormatDateToParts(dateValue) {
CHECK_OBJECT_COERCIBLE(this, "Intl.DateTimeFormat.prototype.formatToParts");
if (!IS_OBJECT(this)) {
throw %make_type_error(kCalledOnNonObject, this);
}
if (!%IsInitializedIntlObjectOfType(this, 'dateformat')) {
throw %make_type_error(kIncompatibleMethodReceiver,
'Intl.DateTimeFormat.prototype.formatToParts',
this);
}
var dateMs;
if (IS_UNDEFINED(dateValue)) {
dateMs = %DateCurrentTime();
} else {
dateMs = TO_NUMBER(dateValue);
}
InstallFunction(GlobalIntlDateTimeFormat.prototype, 'formatToParts',
function(dateValue) {
CHECK_OBJECT_COERCIBLE(this, "Intl.DateTimeFormat.prototype.formatToParts");
if (!IS_OBJECT(this)) {
throw %make_type_error(kCalledOnNonObject, this);
}
if (!%IsInitializedIntlObjectOfType(this, 'dateformat')) {
throw %make_type_error(kIncompatibleMethodReceiver,
'Intl.DateTimeFormat.prototype.formatToParts',
this);
}
var dateMs;
if (IS_UNDEFINED(dateValue)) {
dateMs = %DateCurrentTime();
} else {
dateMs = TO_NUMBER(dateValue);
}
if (!NUMBER_IS_FINITE(dateMs)) throw %make_range_error(kDateRange);
if (!NUMBER_IS_FINITE(dateMs)) throw %make_range_error(kDateRange);
return %InternalDateFormatToParts(this, new GlobalDate(dateMs));
}
return %InternalDateFormatToParts(this, new GlobalDate(dateMs));
}
);
// Length is 1 as specified in ECMA 402 v2+
......@@ -2127,20 +2129,17 @@ OverrideFunction(GlobalDate.prototype, 'toLocaleTimeString', function() {
}
);
%FunctionRemovePrototype(FormatDateToParts);
%FunctionRemovePrototype(ToLowerCaseI18N);
%FunctionRemovePrototype(ToUpperCaseI18N);
%FunctionRemovePrototype(ToLocaleLowerCaseI18N);
%FunctionRemovePrototype(ToLocaleUpperCaseI18N);
utils.SetFunctionName(FormatDateToParts, "formatToParts");
utils.SetFunctionName(ToLowerCaseI18N, "toLowerCase");
utils.SetFunctionName(ToUpperCaseI18N, "toUpperCase");
utils.SetFunctionName(ToLocaleLowerCaseI18N, "toLocaleLowerCase");
utils.SetFunctionName(ToLocaleUpperCaseI18N, "toLocaleUpperCase");
utils.Export(function(to) {
to.FormatDateToParts = FormatDateToParts;
to.ToLowerCaseI18N = ToLowerCaseI18N;
to.ToUpperCaseI18N = ToUpperCaseI18N;
to.ToLocaleLowerCaseI18N = ToLocaleLowerCaseI18N;
......
......@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --datetime-format-to-parts
var d = new Date(2016, 11, 15, 14, 10, 34);
var df = Intl.DateTimeFormat("ja",
{hour: 'numeric', minute: 'numeric', second: 'numeric', year: 'numeric',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment