Commit e26863df authored by Michael Achenbach's avatar Michael Achenbach Committed by Commit Bot

[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/+/2546685Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71294}
parent 5405bbc5
...@@ -5068,6 +5068,7 @@ MaybeHandle<JSDate> JSDate::New(Handle<JSFunction> constructor, ...@@ -5068,6 +5068,7 @@ MaybeHandle<JSDate> JSDate::New(Handle<JSFunction> constructor,
// static // static
double JSDate::CurrentTimeValue(Isolate* isolate) { double JSDate::CurrentTimeValue(Isolate* isolate) {
if (FLAG_log_internal_timer_events) LOG(isolate, CurrentTimeEvent()); 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 // According to ECMA-262, section 15.9.1, page 117, the precision of
// the number in a Date object representing a particular instant in // the number in a Date object representing a particular instant in
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --allow-natives-syntax // Flags: --allow-natives-syntax --correctness-fuzzer-suppressions
// Files: tools/clusterfuzz/v8_mock.js // Files: tools/clusterfuzz/v8_mock.js
// Test foozzie mocks for differential fuzzing. // Test foozzie mocks for differential fuzzing.
...@@ -22,6 +22,11 @@ assertEquals(710, new Date.prototype.constructor().getUTCMilliseconds()); ...@@ -22,6 +22,11 @@ assertEquals(710, new Date.prototype.constructor().getUTCMilliseconds());
assertEquals(819134640000, assertEquals(819134640000,
new Date('December 17, 1995 03:24:00 GMT+1000').getTime()); 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. // Dummy performance methods.
assertEquals(1.2, performance.now()); assertEquals(1.2, performance.now());
assertEquals([], performance.measureMemory()); assertEquals([], performance.measureMemory());
......
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