| OLD | NEW |
| 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 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1455 {"var a = 1; try { a = 2; throw 23; } finally { return a; };", | 1455 {"var a = 1; try { a = 2; throw 23; } finally { return a; };", |
| 1456 {handle(Smi::FromInt(2), isolate)}}, | 1456 {handle(Smi::FromInt(2), isolate)}}, |
| 1457 {"var a = 1; for (var i = 10; i < 20; i += 5) {" | 1457 {"var a = 1; for (var i = 10; i < 20; i += 5) {" |
| 1458 " try { a = 2; break; } finally { a = 3; }" | 1458 " try { a = 2; break; } finally { a = 3; }" |
| 1459 "} return a + i;", | 1459 "} return a + i;", |
| 1460 {handle(Smi::FromInt(13), isolate)}}, | 1460 {handle(Smi::FromInt(13), isolate)}}, |
| 1461 {"var a = 1; for (var i = 10; i < 20; i += 5) {" | 1461 {"var a = 1; for (var i = 10; i < 20; i += 5) {" |
| 1462 " try { a = 2; continue; } finally { a = 3; }" | 1462 " try { a = 2; continue; } finally { a = 3; }" |
| 1463 "} return a + i;", | 1463 "} return a + i;", |
| 1464 {handle(Smi::FromInt(23), isolate)}}, | 1464 {handle(Smi::FromInt(23), isolate)}}, |
| 1465 // TODO(mstarzinger): Investigate failure! | 1465 {"var a = 1; try { a = 2;" |
| 1466 // {"var a = 1; try { a = 2;" | 1466 " try { a = 3; throw 23; } finally { a = 4; }" |
| 1467 // " try { a = 3; throw 23; } finally { a = 4; }" | 1467 "} catch(e) { a = a + e; } return a;", |
| 1468 // "} catch(e) { a = a + e; } return a;", | 1468 {handle(Smi::FromInt(27), isolate)}}, |
| 1469 // {handle(Smi::FromInt(27), isolate)}}, | |
| 1470 }; | 1469 }; |
| 1471 | 1470 |
| 1472 size_t num_snippets = sizeof(snippets) / sizeof(snippets[0]); | 1471 size_t num_snippets = sizeof(snippets) / sizeof(snippets[0]); |
| 1473 for (size_t i = 0; i < num_snippets; i++) { | 1472 for (size_t i = 0; i < num_snippets; i++) { |
| 1474 ScopedVector<char> script(1024); | 1473 ScopedVector<char> script(1024); |
| 1475 SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, | 1474 SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, |
| 1476 snippets[i].code_snippet, kFunctionName); | 1475 snippets[i].code_snippet, kFunctionName); |
| 1477 | 1476 |
| 1478 BytecodeGraphTester tester(isolate, zone, script.start()); | 1477 BytecodeGraphTester tester(isolate, zone, script.start()); |
| 1479 auto callable = tester.GetCallable<>(); | 1478 auto callable = tester.GetCallable<>(); |
| (...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2628 Handle<Object> return_value = callable().ToHandleChecked(); | 2627 Handle<Object> return_value = callable().ToHandleChecked(); |
| 2629 CHECK(return_value->SameValue(*snippets[i].return_value())); | 2628 CHECK(return_value->SameValue(*snippets[i].return_value())); |
| 2630 } | 2629 } |
| 2631 | 2630 |
| 2632 FLAG_harmony_do_expressions = old_flag; | 2631 FLAG_harmony_do_expressions = old_flag; |
| 2633 } | 2632 } |
| 2634 | 2633 |
| 2635 } // namespace compiler | 2634 } // namespace compiler |
| 2636 } // namespace internal | 2635 } // namespace internal |
| 2637 } // namespace v8 | 2636 } // namespace v8 |
| OLD | NEW |