[test] Make mjsunit harness more robust to fuzzers

Some fuzzers replaced strigify and then caused uncaught errors
from harness methods using prettyPrinted.

Bug: chromium:1102897
Change-Id: I7ae6a90040ba0aa5ec1efa4a8b73e053ec75dd79
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2304814
Auto-Submit: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68947}
This commit is contained in:
Michael Achenbach 2020-07-18 13:02:52 +02:00 committed by Commit Bot
parent 2946d73481
commit 448c25f233

View File

@ -216,6 +216,7 @@ var prettyPrinted;
var ArrayPrototypeJoin = Array.prototype.join;
var ArrayPrototypeMap = Array.prototype.map;
var ArrayPrototypePush = Array.prototype.push;
var JSONStringify = JSON.stringify;
var BigIntPrototypeValueOf;
// TODO(neis): Remove try-catch once BigInts are enabled by default.
@ -252,7 +253,7 @@ var prettyPrinted;
prettyPrinted = function prettyPrinted(value) {
switch (typeof value) {
case "string":
return JSON.stringify(value);
return JSONStringify(value);
case "bigint":
return String(value) + "n";
case "number":