Commit c9850782 authored by Frank Tang's avatar Frank Tang Committed by Commit Bot

[Intl] Fix -0 formatting bugs

The spec changed in 7/2018 to treat -0 and 0 differently.
https://github.com/tc39/ecma402/pull/232

Bug: v8:7474, v8:8099
Change-Id: I77db4ae716b081b7628dc7ee253a463520c7f6e9
Reviewed-on: https://chromium-review.googlesource.com/c/1400403Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58645}
parent d953d9fb
...@@ -405,11 +405,6 @@ BUILTIN(NumberFormatInternalFormatNumber) { ...@@ -405,11 +405,6 @@ BUILTIN(NumberFormatInternalFormatNumber) {
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, number_obj, ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, number_obj,
Object::ToNumber(isolate, value)); Object::ToNumber(isolate, value));
// Spec treats -0 as 0.
if (number_obj->IsMinusZero()) {
number_obj = Handle<Smi>(Smi::zero(), isolate);
}
double number = number_obj->Number(); double number = number_obj->Number();
icu::NumberFormat* icu_number_format = icu::NumberFormat* icu_number_format =
number_format->icu_number_format()->raw(); number_format->icu_number_format()->raw();
......
...@@ -974,8 +974,7 @@ MaybeHandle<String> Intl::NumberToLocaleString(Isolate* isolate, ...@@ -974,8 +974,7 @@ MaybeHandle<String> Intl::NumberToLocaleString(Isolate* isolate,
ASSIGN_RETURN_ON_EXCEPTION(isolate, number_obj, ASSIGN_RETURN_ON_EXCEPTION(isolate, number_obj,
Object::ToNumber(isolate, num), String); Object::ToNumber(isolate, num), String);
// Spec treats -0 and +0 as 0. double number = number_obj->Number();
double number = number_obj->Number() + 0;
// We only cache the instance when both locales and options are undefined, // We only cache the instance when both locales and options are undefined,
// as that is the only case when the specified side-effects of examining // as that is the only case when the specified side-effects of examining
......
...@@ -532,10 +532,6 @@ ...@@ -532,10 +532,6 @@
# https://bugs.chromium.org/p/v8/issues/detail?id=7472 # https://bugs.chromium.org/p/v8/issues/detail?id=7472
'intl402/NumberFormat/currency-digits': [FAIL], 'intl402/NumberFormat/currency-digits': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=7474
'intl402/NumberFormat/prototype/format/format-fraction-digits': [FAIL],
'intl402/NumberFormat/prototype/format/format-significant-digits': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=7482 # https://bugs.chromium.org/p/v8/issues/detail?id=7482
'intl402/DateTimeFormat/prototype/resolvedOptions/resolved-locale-with-hc-unicode': [FAIL], 'intl402/DateTimeFormat/prototype/resolvedOptions/resolved-locale-with-hc-unicode': [FAIL],
...@@ -587,9 +583,6 @@ ...@@ -587,9 +583,6 @@
'language/expressions/async-generator/generator-created-after-decl-inst': [FAIL], 'language/expressions/async-generator/generator-created-after-decl-inst': [FAIL],
'language/statements/async-generator/generator-created-after-decl-inst': [FAIL], 'language/statements/async-generator/generator-created-after-decl-inst': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=8099
'intl402/NumberFormat/prototype/format/format-negative-numbers': [FAIL],
# await tests that require flags # await tests that require flags
'language/expressions/await/async-generator-interleaved': ['--harmony-await-optimization'], 'language/expressions/await/async-generator-interleaved': ['--harmony-await-optimization'],
'language/expressions/await/await-monkey-patched-promise': ['--harmony-await-optimization'], 'language/expressions/await/await-monkey-patched-promise': ['--harmony-await-optimization'],
......
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