node/deps/v8/test/js-perf-test/ClassFields/classes.js
Michaël Zasso 62719c5fd2
deps: update V8 to 9.5.172.19
PR-URL: https://github.com/nodejs/node/pull/40178
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2021-10-12 08:07:50 +02:00

60 lines
1.2 KiB
JavaScript

// Copyright 2021 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
"use strict";
let i = 0;
function EvaluateSinglePublicFieldClass() {
return class SinglePublicFieldClass {
x = i;
check() {
return this.x === i;
}
};
}
function EvaluateMultiPublicFieldClass() {
return class MultiPublicFieldClass {
x = i;
y = i+1;
z = i+2;
q = i+3;
r = i+4;
a = i+5;
check() {
return this.x + 1 === this.y && this.y + 1 === this.z &&
this.z + 1 === this.q && this.q + 1 === this.r &&
this.r + 1 === this.a;
}
};
}
function EvaluateSinglePrivateFieldClass() {
return class SinglePrivateFieldClass {
#x = i;
check() {
return this.#x === i;
}
}
}
function EvaluateMultiPrivateFieldClass() {
return class MultiPrivateFieldClass {
#x = i;
#y = i+1;
#z = i+2;
#q = i+3;
#r = i+4;
#a = i+5;
check() {
return this.#x + 1 === this.#y && this.#y + 1 === this.#z &&
this.#z + 1 === this.#q && this.#q + 1 === this.#r &&
this.#r + 1 === this.#a;
}
};
}