summaryrefslogtreecommitdiff
path: root/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2021-08-29 14:20:49 +0200
committerMichaël Zasso <targos@protonmail.com>2021-08-30 21:02:51 +0200
commit50930a0fa08297d0ce7e67fa6594fe47937b99ff (patch)
tree96bd30c0c63790bc1992a2f241a3df94d563b283 /deps/v8/test/cctest/interpreter/test-bytecode-generator.cc
parentb63e449b2eade1111b52f6559669400a4e855903 (diff)
downloadnode-new-50930a0fa08297d0ce7e67fa6594fe47937b99ff.tar.gz
deps: update V8 to 9.3.345.16
PR-URL: https://github.com/nodejs/node/pull/39469 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'deps/v8/test/cctest/interpreter/test-bytecode-generator.cc')
-rw-r--r--deps/v8/test/cctest/interpreter/test-bytecode-generator.cc268
1 files changed, 5 insertions, 263 deletions
diff --git a/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc b/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc
index 450c45fb24..93454b22f2 100644
--- a/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc
+++ b/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc
@@ -433,83 +433,7 @@ TEST(PropertyLoads) {
LoadGolden("PropertyLoads.golden")));
}
-TEST(PropertyLoadStoreOneShot) {
- InitializedIgnitionHandleScope scope;
- BytecodeExpectationsPrinter printer(CcTest::isolate());
- printer.set_wrap(false);
- printer.set_top_level(true);
- printer.set_oneshot_opt(true);
-
- const char* snippets[] = {
- R"(
- l = {
- 'a': 1,
- 'b': 2
- };
-
- v = l['a'] + l['b'];
- l['b'] = 7;
- l['a'] = l['b'];
- )",
-
- R"(
- l = {
- 'a': 1.1,
- 'b': 2.2
- };
- for (i = 0; i < 5; ++i) {
- l['a'] = l['a'] + l['b'];
- l['b'] = l['a'] + l['b'];
- }
- )",
-
- R"(
- l = {
- 'a': 1.1,
- 'b': 2.2
- };
- while (s > 0) {
- l['a'] = l['a'] - l['b'];
- l['b'] = l['b'] - l['a'];
- }
- )",
-
- R"(
- l = {
- 'a': 1.1,
- 'b': 2.2
- };
- s = 10;
- do {
- l['a'] = l['b'] - l['a'];
- } while (s < 10);
- )",
-
- R"(
- l = {
- 'c': 1.1,
- 'd': 2.2
- };
- if (l['c'] < 3) {
- l['c'] = 3;
- } else {
- l['d'] = 3;
- }
- )",
-
- R"(
- a = [1.1, [2.2, 4.5]];
- )",
-
- R"(
- b = [];
- )",
- };
- CHECK(CompareTexts(BuildActual(printer, snippets),
- LoadGolden("PropertyLoadStoreOneShot.golden")));
-}
-
-TEST(PropertyLoadStoreWithoutOneShot) {
+TEST(PropertyLoadStore) {
InitializedIgnitionHandleScope scope;
BytecodeExpectationsPrinter printer(CcTest::isolate());
printer.set_wrap(false);
@@ -540,192 +464,10 @@ TEST(PropertyLoadStoreWithoutOneShot) {
)",
};
CHECK(CompareTexts(BuildActual(printer, snippets),
- LoadGolden("PropertyLoadStoreWithoutOneShot.golden")));
-}
-
-TEST(IIFEWithOneshotOpt) {
- InitializedIgnitionHandleScope scope;
- v8::Isolate* isolate = CcTest::isolate();
- BytecodeExpectationsPrinter printer(isolate);
- printer.set_wrap(false);
- printer.set_top_level(true);
- printer.set_print_callee(true);
- printer.set_oneshot_opt(true);
-
- const char* snippets[] = {
- // No feedback vectors for top-level loads/store named property in an IIFE
- R"(
- (function() {
- l = {};
- l.aa = 2;
- l.bb = l.aa;
- return arguments.callee;
- })();
- )",
- // Normal load/store within loops of an IIFE
- R"(
- (function() {
- l = {};
- for (i = 0; i < 5; ++i) {
- l.aa = 2;
- l.bb = l.aa;
- }
- return arguments.callee;
- })();
- )",
-
- R"(
- (function() {
- l = {};
- c = 4;
- while(c > 4) {
- l.aa = 2;
- l.bb = l.aa;
- c--;
- }
- return arguments.callee;
- })();
- )",
-
- R"(
- (function() {
- l = {};
- c = 4;
- do {
- l.aa = 2;
- l.bb = l.aa;
- c--;
- } while(c > 4)
- return arguments.callee;
- })();
- )",
- // No feedback vectors for loads/stores in conditionals
- R"(
- (function() {
- l = {
- 'aa': 3.3,
- 'bb': 4.4
- };
- if (l.aa < 3) {
- l.aa = 3;
- } else {
- l.aa = l.bb;
- }
- return arguments.callee;
- })();
- )",
-
- R"(
- (function() {
- a = [0, [1, 1,2,], 3];
- return arguments.callee;
- })();
- )",
-
- R"(
- (function() {
- a = [];
- return arguments.callee;
- })();
- )",
- // CallNoFeedback instead of CallProperty
- R"(
- this.f0 = function() {};
- this.f1 = function(a) {};
- this.f2 = function(a, b) {};
- this.f3 = function(a, b, c) {};
- this.f4 = function(a, b, c, d) {};
- this.f5 = function(a, b, c, d, e) {};
- (function() {
- this.f0();
- this.f1(1);
- this.f2(1, 2);
- this.f3(1, 2, 3);
- this.f4(1, 2, 3, 4);
- this.f5(1, 2, 3, 4, 5);
- return arguments.callee;
- })();
- )",
- // CallNoFeedback instead of CallUndefinedReceiver
- R"(
- function f0() {}
- function f1(a) {}
- function f2(a, b) {}
- function f3(a, b, c) {}
- function f4(a, b, c, d) {}
- function f5(a, b, c, d, e) {}
- (function() {
- f0();
- f1(1);
- f2(1, 2);
- f3(1, 2, 3);
- f4(1, 2, 3, 4);
- f5(1, 2, 3, 4, 5);
- return arguments.callee;
- })();
- )",
- // TODO(rmcilroy): Make this function produce one-shot code.
- R"(
- var t = 0;
- function f2() {};
- if (t == 0) {
- (function(){
- l = {};
- l.a = 3;
- l.b = 4;
- f2();
- return arguments.callee;
- })();
- }
- )",
- // No one-shot opt for IIFE`s within a function
- R"(
- function f2() {};
- function f() {
- return (function(){
- l = {};
- l.a = 3;
- l.b = 4;
- f2();
- return arguments.callee;
- })();
- }
- f();
- )",
- R"(
- var f = function(l) { l.a = 3; return l; };
- f({});
- f;
- )",
- // No one-shot opt for top-level functions enclosed in parentheses
- R"(
- var f = (function(l) { l.a = 3; return l; });
- f;
- )",
- R"(
- var f = (function foo(l) { l.a = 3; return l; });
- f;
- )",
- R"(
- var f = function foo(l) { l.a = 3; return l; };
- f({});
- f;
- )",
- R"(
- l = {};
- var f = (function foo(l) { l.a = 3; return arguments.callee; })(l);
- f;
- )",
- R"(
- var f = (function foo(l) { l.a = 3; return arguments.callee; })({});
- f;
- )",
- };
- CHECK(CompareTexts(BuildActual(printer, snippets),
- LoadGolden("IIFEWithOneshotOpt.golden")));
+ LoadGolden("PropertyLoadStore.golden")));
}
-TEST(IIFEWithoutOneshotOpt) {
+TEST(IIFE) {
InitializedIgnitionHandleScope scope;
v8::Isolate* isolate = CcTest::isolate();
BytecodeExpectationsPrinter printer(isolate);
@@ -791,8 +533,8 @@ TEST(IIFEWithoutOneshotOpt) {
})();
)",
};
- CHECK(CompareTexts(BuildActual(printer, snippets),
- LoadGolden("IIFEWithoutOneshotOpt.golden")));
+ CHECK(
+ CompareTexts(BuildActual(printer, snippets), LoadGolden("IIFE.golden")));
}
TEST(PropertyStores) {