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

Side by Side Diff: test/cctest/compiler/test-run-bytecode-graph-builder.cc

Issue 2254493002: [interpreter] Use VisitForTest for loop conditions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase(line) golden file Created 4 years, 4 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
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 #include <utility> 5 #include <utility>
6 6
7 #include "src/compiler/pipeline.h" 7 #include "src/compiler/pipeline.h"
8 #include "src/execution.h" 8 #include "src/execution.h"
9 #include "src/handles.h" 9 #include "src/handles.h"
10 #include "src/interpreter/bytecode-array-builder.h" 10 #include "src/interpreter/bytecode-array-builder.h"
(...skipping 2314 matching lines...) Expand 10 before | Expand all | Expand 10 after
2325 {factory->NewNumberFromInt(2)}}, 2325 {factory->NewNumberFromInt(2)}},
2326 {"var x = 1, y = 0;\n" 2326 {"var x = 1, y = 0;\n"
2327 "do {\n" 2327 "do {\n"
2328 " x += 1;\n" 2328 " x += 1;\n"
2329 " if (x == 2) continue;\n" 2329 " if (x == 2) continue;\n"
2330 " if (x == 3) continue;\n" 2330 " if (x == 3) continue;\n"
2331 " y += x * x;\n" 2331 " y += x * x;\n"
2332 " if (x == 4) break;\n" 2332 " if (x == 4) break;\n"
2333 "} while (x < 7);\n" 2333 "} while (x < 7);\n"
2334 "return y;", 2334 "return y;",
2335 {factory->NewNumberFromInt(16)}}}; 2335 {factory->NewNumberFromInt(16)}},
2336 {"var x = 0, sum = 0;\n"
2337 "do {\n"
2338 " do {\n"
2339 " ++sum;\n"
2340 " ++x;\n"
2341 " } while (sum < 1 || x < 2)\n"
2342 " do {\n"
2343 " ++x;\n"
2344 " } while (x < 1)\n"
2345 "} while (sum < 3)\n"
2346 "return sum;",
2347 {factory->NewNumber(3)}}};
2336 2348
2337 for (size_t i = 0; i < arraysize(snippets); i++) { 2349 for (size_t i = 0; i < arraysize(snippets); i++) {
2338 ScopedVector<char> script(1024); 2350 ScopedVector<char> script(1024);
2339 SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, 2351 SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
2340 snippets[i].code_snippet, kFunctionName); 2352 snippets[i].code_snippet, kFunctionName);
2341 2353
2342 BytecodeGraphTester tester(isolate, zone, script.start()); 2354 BytecodeGraphTester tester(isolate, zone, script.start());
2343 auto callable = tester.GetCallable<>(); 2355 auto callable = tester.GetCallable<>();
2344 Handle<Object> return_value = callable().ToHandleChecked(); 2356 Handle<Object> return_value = callable().ToHandleChecked();
2345 CHECK(return_value->SameValue(*snippets[i].return_value())); 2357 CHECK(return_value->SameValue(*snippets[i].return_value()));
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
2406 "return sum;", 2418 "return sum;",
2407 {factory->NewNumberFromInt(18)}}, 2419 {factory->NewNumberFromInt(18)}},
2408 {"var sum = 0;\n" 2420 {"var sum = 0;\n"
2409 "for (var x = 1; x < 10; x += 2) {\n" 2421 "for (var x = 1; x < 10; x += 2) {\n"
2410 " for (var y = x; y < x + 2; y++) {\n" 2422 " for (var y = x; y < x + 2; y++) {\n"
2411 " sum += y * y;\n" 2423 " sum += y * y;\n"
2412 " }\n" 2424 " }\n"
2413 "}\n" 2425 "}\n"
2414 "return sum;", 2426 "return sum;",
2415 {factory->NewNumberFromInt(385)}}, 2427 {factory->NewNumberFromInt(385)}},
2428 {"var sum = 0;\n"
2429 "for (var x = 0; x < 5; x++) {\n"
2430 " for (var y = 0; y < 5; y++) {\n"
2431 " ++sum;\n"
2432 " }\n"
2433 "}\n"
2434 "for (var x = 0; x < 5; x++) {\n"
2435 " for (var y = 0; y < 5; y++) {\n"
2436 " ++sum;\n"
2437 " }\n"
2438 "}\n"
2439 "return sum;",
2440 {factory->NewNumberFromInt(50)}},
2416 }; 2441 };
2417 2442
2418 for (size_t i = 0; i < arraysize(snippets); i++) { 2443 for (size_t i = 0; i < arraysize(snippets); i++) {
2419 ScopedVector<char> script(1024); 2444 ScopedVector<char> script(1024);
2420 SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, 2445 SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
2421 snippets[i].code_snippet, kFunctionName); 2446 snippets[i].code_snippet, kFunctionName);
2422 2447
2423 BytecodeGraphTester tester(isolate, zone, script.start()); 2448 BytecodeGraphTester tester(isolate, zone, script.start());
2424 auto callable = tester.GetCallable<>(); 2449 auto callable = tester.GetCallable<>();
2425 Handle<Object> return_value = callable().ToHandleChecked(); 2450 Handle<Object> return_value = callable().ToHandleChecked();
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
2931 2956
2932 BytecodeGraphTester tester(isolate, zone, script.start()); 2957 BytecodeGraphTester tester(isolate, zone, script.start());
2933 auto callable = tester.GetCallable<>(); 2958 auto callable = tester.GetCallable<>();
2934 Handle<Object> return_value = callable().ToHandleChecked(); 2959 Handle<Object> return_value = callable().ToHandleChecked();
2935 CHECK(return_value->SameValue(*snippet.return_value())); 2960 CHECK(return_value->SameValue(*snippet.return_value()));
2936 } 2961 }
2937 2962
2938 } // namespace compiler 2963 } // namespace compiler
2939 } // namespace internal 2964 } // namespace internal
2940 } // namespace v8 2965 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/control-flow-builders.cc ('k') | test/cctest/interpreter/bytecode_expectations/BasicLoops.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698