| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/compiler.h" | 5 #include "vm/compiler.h" |
| 6 #include "vm/dart_api_impl.h" | 6 #include "vm/dart_api_impl.h" |
| 7 #include "vm/dart_entry.h" | 7 #include "vm/dart_entry.h" |
| 8 #include "vm/flow_graph_builder.h" | 8 #include "vm/flow_graph_builder.h" |
| 9 #include "vm/intermediate_language.h" | 9 #include "vm/intermediate_language.h" |
| 10 #include "vm/unit_test.h" | 10 #include "vm/unit_test.h" |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 | 530 |
| 531 spt.FuzzyInstructionMatchAt("LoadLocal(z", 8, 8); | 531 spt.FuzzyInstructionMatchAt("LoadLocal(z", 8, 8); |
| 532 spt.InstanceCallAt(8, 7, Token::kBIT_NOT); | 532 spt.InstanceCallAt(8, 7, Token::kBIT_NOT); |
| 533 spt.FuzzyInstructionMatchAt("StoreLocal(z", 8, 3); | 533 spt.FuzzyInstructionMatchAt("StoreLocal(z", 8, 3); |
| 534 | 534 |
| 535 spt.FuzzyInstructionMatchAt("LoadLocal(z", 9, 10); | 535 spt.FuzzyInstructionMatchAt("LoadLocal(z", 9, 10); |
| 536 spt.FuzzyInstructionMatchAt("DebugStepCheck", 9, 3); | 536 spt.FuzzyInstructionMatchAt("DebugStepCheck", 9, 3); |
| 537 spt.FuzzyInstructionMatchAt("Return", 9, 3); | 537 spt.FuzzyInstructionMatchAt("Return", 9, 3); |
| 538 } | 538 } |
| 539 | 539 |
| 540 |
| 541 TEST_CASE(SourcePosition_IfElse) { |
| 542 const char* kScript = |
| 543 "var x = 5;\n" |
| 544 "var y = 5;\n" |
| 545 "main() {\n" |
| 546 " if (x != 0) {\n" |
| 547 " return x;\n" |
| 548 " } else {\n" |
| 549 " return y;\n" |
| 550 " }\n" |
| 551 "}\n"; |
| 552 |
| 553 SourcePositionTest spt(thread, kScript); |
| 554 spt.BuildGraphFor("main"); |
| 555 spt.FuzzyInstructionMatchAt("DebugStepCheck", 3, 5); |
| 556 spt.FuzzyInstructionMatchAt("CheckStackOverflow", 3, 5); |
| 557 spt.FuzzyInstructionMatchAt("LoadStaticField", 4, 7); |
| 558 spt.InstanceCallAt(4, 9, Token::kEQ); |
| 559 spt.FuzzyInstructionMatchAt("Branch if StrictCompare", 4, 9); |
| 560 spt.FuzzyInstructionMatchAt("LoadStaticField", 5, 12); |
| 561 spt.FuzzyInstructionMatchAt("DebugStepCheck", 5, 5); |
| 562 spt.FuzzyInstructionMatchAt("Return", 5, 5); |
| 563 spt.FuzzyInstructionMatchAt("LoadStaticField", 7, 10); |
| 564 spt.FuzzyInstructionMatchAt("DebugStepCheck", 7, 3); |
| 565 spt.FuzzyInstructionMatchAt("Return", 7, 3); |
| 566 } |
| 567 |
| 540 } // namespace dart | 568 } // namespace dart |
| 541 | 569 |
| OLD | NEW |