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

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

Issue 1645293003: [interpreter] Reachability is implied by live environment. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_interpreter-cleanup-graph-builder-control-flow
Patch Set: Created 4 years, 10 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 | « src/compiler/bytecode-graph-builder.cc ('k') | 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 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 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after
1411 CHECK(return_value->SameValue(*snippets[i].return_value())); 1411 CHECK(return_value->SameValue(*snippets[i].return_value()));
1412 } 1412 }
1413 } 1413 }
1414 1414
1415 TEST(BytecodeGraphBuilderTryCatch) { 1415 TEST(BytecodeGraphBuilderTryCatch) {
1416 HandleAndZoneScope scope; 1416 HandleAndZoneScope scope;
1417 Isolate* isolate = scope.main_isolate(); 1417 Isolate* isolate = scope.main_isolate();
1418 Zone* zone = scope.main_zone(); 1418 Zone* zone = scope.main_zone();
1419 1419
1420 ExpectedSnippet<0> snippets[] = { 1420 ExpectedSnippet<0> snippets[] = {
1421 // TODO(mstarzinger): Fix cases where nothing throws. 1421 {"var a = 1; try { a = 2 } catch(e) { a = 3 }; return a;",
1422 // {"var a = 1; try { a = 2 } catch(e) { a = 3 }; return a;", 1422 {handle(Smi::FromInt(2), isolate)}},
1423 // {handle(Smi::FromInt(2), isolate)}},
1424 {"var a; try { undef.x } catch(e) { a = 2 }; return a;", 1423 {"var a; try { undef.x } catch(e) { a = 2 }; return a;",
1425 {handle(Smi::FromInt(2), isolate)}}, 1424 {handle(Smi::FromInt(2), isolate)}},
1426 {"var a; try { throw 1 } catch(e) { a = e + 2 }; return a;", 1425 {"var a; try { throw 1 } catch(e) { a = e + 2 }; return a;",
1427 {handle(Smi::FromInt(3), isolate)}}, 1426 {handle(Smi::FromInt(3), isolate)}},
1428 {"var a; try { throw 1 } catch(e) { a = e + 2 };" 1427 {"var a; try { throw 1 } catch(e) { a = e + 2 };"
1429 " try { throw a } catch(e) { a = e + 3 }; return a;", 1428 " try { throw a } catch(e) { a = e + 3 }; return a;",
1430 {handle(Smi::FromInt(6), isolate)}}, 1429 {handle(Smi::FromInt(6), isolate)}},
1431 }; 1430 };
1432 1431
1433 size_t num_snippets = sizeof(snippets) / sizeof(snippets[0]); 1432 size_t num_snippets = sizeof(snippets) / sizeof(snippets[0]);
(...skipping 10 matching lines...) Expand all
1444 } 1443 }
1445 1444
1446 TEST(BytecodeGraphBuilderTryFinally1) { 1445 TEST(BytecodeGraphBuilderTryFinally1) {
1447 HandleAndZoneScope scope; 1446 HandleAndZoneScope scope;
1448 Isolate* isolate = scope.main_isolate(); 1447 Isolate* isolate = scope.main_isolate();
1449 Zone* zone = scope.main_zone(); 1448 Zone* zone = scope.main_zone();
1450 1449
1451 ExpectedSnippet<0> snippets[] = { 1450 ExpectedSnippet<0> snippets[] = {
1452 {"var a = 1; try { a = a + 1; } finally { a = a + 2; }; return a;", 1451 {"var a = 1; try { a = a + 1; } finally { a = a + 2; }; return a;",
1453 {handle(Smi::FromInt(4), isolate)}}, 1452 {handle(Smi::FromInt(4), isolate)}},
1454 // TODO(mstarzinger): Fix cases where nothing throws. 1453 {"var a = 1; try { a = 2; return 23; } finally { a = 3 }; return a;",
1455 // {"var a = 1; try { a = 2; return 23; } finally { a = 3 }; return a;", 1454 {handle(Smi::FromInt(23), isolate)}},
1456 // {handle(Smi::FromInt(23), isolate)}},
1457 {"var a = 1; try { a = 2; throw 23; } finally { return a; };", 1455 {"var a = 1; try { a = 2; throw 23; } finally { return a; };",
1458 {handle(Smi::FromInt(2), isolate)}}, 1456 {handle(Smi::FromInt(2), isolate)}},
1459 // {"var a = 1; for (var i = 10; i < 20; i += 5) {" 1457 {"var a = 1; for (var i = 10; i < 20; i += 5) {"
1460 // " try { a = 2; break; } finally { a = 3; }" 1458 " try { a = 2; break; } finally { a = 3; }"
1461 // "} return a + i;", 1459 "} return a + i;",
1462 // {handle(Smi::FromInt(13), isolate)}}, 1460 {handle(Smi::FromInt(13), isolate)}},
1463 // {"var a = 1; for (var i = 10; i < 20; i += 5) {" 1461 {"var a = 1; for (var i = 10; i < 20; i += 5) {"
1464 // " try { a = 2; continue; } finally { a = 3; }" 1462 " try { a = 2; continue; } finally { a = 3; }"
1465 // "} return a + i;", 1463 "} return a + i;",
1466 // {handle(Smi::FromInt(23), isolate)}}, 1464 {handle(Smi::FromInt(23), isolate)}},
1465 // TODO(mstarzinger): Investigate failure!
1467 // {"var a = 1; try { a = 2;" 1466 // {"var a = 1; try { a = 2;"
1468 // " try { a = 3; throw 23; } finally { a = 4; }" 1467 // " try { a = 3; throw 23; } finally { a = 4; }"
1469 // "} catch(e) { a = a + e; } return a;", 1468 // "} catch(e) { a = a + e; } return a;",
1470 // {handle(Smi::FromInt(27), isolate)}}, 1469 // {handle(Smi::FromInt(27), isolate)}},
1471 }; 1470 };
1472 1471
1473 size_t num_snippets = sizeof(snippets) / sizeof(snippets[0]); 1472 size_t num_snippets = sizeof(snippets) / sizeof(snippets[0]);
1474 for (size_t i = 0; i < num_snippets; i++) { 1473 for (size_t i = 0; i < num_snippets; i++) {
1475 ScopedVector<char> script(1024); 1474 ScopedVector<char> script(1024);
1476 SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, 1475 SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after
2629 Handle<Object> return_value = callable().ToHandleChecked(); 2628 Handle<Object> return_value = callable().ToHandleChecked();
2630 CHECK(return_value->SameValue(*snippets[i].return_value())); 2629 CHECK(return_value->SameValue(*snippets[i].return_value()));
2631 } 2630 }
2632 2631
2633 FLAG_harmony_do_expressions = old_flag; 2632 FLAG_harmony_do_expressions = old_flag;
2634 } 2633 }
2635 2634
2636 } // namespace compiler 2635 } // namespace compiler
2637 } // namespace internal 2636 } // namespace internal
2638 } // namespace v8 2637 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/bytecode-graph-builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698