[foozzie] Suppress access to CurrentTimeValue

This stubs out CurrentTimeValue for differential fuzzing as otherwise
the non-deterministic value leaks from Intl.DateTimeFormat format and
formatToParts.

This also affects other date creations, like Date.now(), which is
already stubbed out on the JS side. We keep that code for
backwards-compatibility to keep bisection stable.

Bug: chromium:1149050
Change-Id: Ifd82844c9fb8ce7262b55da6cf9f88f544268942
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2546685
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71294}
This commit is contained in:
Michael Achenbach 2020-11-18 10:26:57 +01:00 committed by Commit Bot
parent 5405bbc50f
commit e26863df27
2 changed files with 7 additions and 1 deletions

View File

@ -5068,6 +5068,7 @@ MaybeHandle<JSDate> JSDate::New(Handle<JSFunction> constructor,
// static
double JSDate::CurrentTimeValue(Isolate* isolate) {
if (FLAG_log_internal_timer_events) LOG(isolate, CurrentTimeEvent());
if (FLAG_correctness_fuzzer_suppressions) return 4.2;
// According to ECMA-262, section 15.9.1, page 117, the precision of
// the number in a Date object representing a particular instant in

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax
// Flags: --allow-natives-syntax --correctness-fuzzer-suppressions
// Files: tools/clusterfuzz/v8_mock.js
// Test foozzie mocks for differential fuzzing.
@ -22,6 +22,11 @@ assertEquals(710, new Date.prototype.constructor().getUTCMilliseconds());
assertEquals(819134640000,
new Date('December 17, 1995 03:24:00 GMT+1000').getTime());
// Deterministic DateTimeFormat.
const df = new Intl.DateTimeFormat(undefined, {fractionalSecondDigits: 3});
assertEquals('004', df.format());
assertEquals('004', df.formatToParts()[0].value);
// Dummy performance methods.
assertEquals(1.2, performance.now());
assertEquals([], performance.measureMemory());