Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: test/js-perf-test/PropertyQueries/property-queries.js

Issue 2860403002: [js-perf-tests] Fix PropertyQueries test for fast-delete (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 function ObjectWithKeys(count, keyOffset = 0, keyGen) { 5 function ObjectWithKeys(count, keyOffset = 0, keyGen) {
6 var body = ""; 6 var body = "";
7 for (var i = 0; i < count; i++) { 7 for (var i = 0; i < count; i++) {
8 var key = keyGen(i + keyOffset); 8 var key = keyGen(i + keyOffset);
9 if (typeof key === "string") { 9 if (typeof key === "string") {
10 body += `this.${key} = 0\n`; 10 body += `this.${key} = 0\n`;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 var array = new Array(size); 64 var array = new Array(size);
65 for (var i = 0; i < size; i++) { 65 for (var i = 0; i < size; i++) {
66 array[i] = i; 66 array[i] = i;
67 } 67 }
68 return array; 68 return array;
69 } 69 }
70 70
71 // Switch object's properties and elements to dictionary mode. 71 // Switch object's properties and elements to dictionary mode.
72 function MakeDictionaryMode(obj) { 72 function MakeDictionaryMode(obj) {
73 obj.foo = 0; 73 obj.foo = 0;
74 obj.bar = 0;
75 // Delete the second-to-last property first to force normalization.
74 delete obj.foo; 76 delete obj.foo;
77 delete obj.bar;
75 obj[1e9] = 0; 78 obj[1e9] = 0;
76 return obj; 79 return obj;
77 } 80 }
78 81
79 function Internalize(s) { 82 function Internalize(s) {
80 return Object.keys({[s]:0})[0]; 83 return Object.keys({[s]:0})[0];
81 } 84 }
82 85
83 function Deinternalize(s) { 86 function Deinternalize(s) {
84 return [...s].join(""); 87 return [...s].join("");
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 } 268 }
266 var run_function = CombineTestFunctions(tests); 269 var run_function = CombineTestFunctions(tests);
267 var benchmark = new Benchmark(name, false, false, 0, run_function); 270 var benchmark = new Benchmark(name, false, false, 0, run_function);
268 benchmarks.push(benchmark); 271 benchmarks.push(benchmark);
269 } 272 }
270 Benchmarks.push(new BenchmarkSuite(suit_name, [100], benchmarks)); 273 Benchmarks.push(new BenchmarkSuite(suit_name, [100], benchmarks));
271 } 274 }
272 } 275 }
273 276
274 // ============================================================================ 277 // ============================================================================
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698