[js-perf-test] Add more WeakMap perf tests

Change-Id: I46eb94e58fc4da55cb1b2adb9ffdbb09e5e33a5d
Bug: v8:8557
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1530800
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60326}
diff --git a/test/js-perf-test/Collections/weakmap.js b/test/js-perf-test/Collections/weakmap.js
index e13d1b3..0473b2d 100644
--- a/test/js-perf-test/Collections/weakmap.js
+++ b/test/js-perf-test/Collections/weakmap.js
@@ -19,6 +19,11 @@
                 WeakMapSetupBaseLarge, WeakMapTearDown),
 ]);
 
+var MapBenchmark = new BenchmarkSuite('WeakMapSet-Huge', [1e8], [
+  new Benchmark('Set-Get', false, false, 0, WeakMapSetHuge,
+                WeakMapSetupBaseLarge, WeakMapTearDown),
+]);
+
 var MapBenchmark = new BenchmarkSuite('WeakMap-Constructor', [1000], [
   new Benchmark('Constructor', false, false, 0, WeakMapConstructor, SetupObjectKeyValuePairs,
       WeakMapTearDown),
@@ -92,7 +97,7 @@
 
 function WeakMapDelete() {
   // This is run more than once per setup so we will end up deleting items
-  // more than once. Therefore, we do not the return value of delete.
+  // more than once. Therefore, we do not check the return value of delete.
   for (var i = 0; i < N; i++) {
     wm.delete(keys[i]);
   }
@@ -113,3 +118,15 @@
     }
   }
 }
+
+function WeakMapSetHuge() {
+  function Foo(i) {
+    this.x = i;
+  }
+  const N = 50 * 1000;
+  let obj;
+  for (let i = 0; i < N; i++) {
+    obj = new Foo(i);         // Make sure we do not scalar-replace the object.
+    wm.set(obj, 1);
+  }
+}
diff --git a/test/js-perf-test/JSTests.json b/test/js-perf-test/JSTests.json
index fb5d972..f29a5a7 100644
--- a/test/js-perf-test/JSTests.json
+++ b/test/js-perf-test/JSTests.json
@@ -380,6 +380,8 @@
         {"name": "Set-Iterator"},
         {"name": "WeakMap"},
         {"name": "WeakMap-Constructor"},
+        {"name": "WeakMapSetGet-Large"},
+        {"name": "WeakMapSet-Huge"},
         {"name": "WeakSet"},
         {"name": "WeakSet-Constructor"}
       ]