| 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 // TODO(jochen): Remove this after the setting is turned on globally. | 5 // TODO(jochen): Remove this after the setting is turned on globally. |
| 6 #define V8_IMMINENT_DEPRECATION_WARNINGS | 6 #define V8_IMMINENT_DEPRECATION_WARNINGS |
| 7 | 7 |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "src/compiler/pipeline.h" | 10 #include "src/compiler/pipeline.h" |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 size_t num_snippets = sizeof(snippets) / sizeof(snippets[0]); | 643 size_t num_snippets = sizeof(snippets) / sizeof(snippets[0]); |
| 644 for (size_t i = 0; i < num_snippets; i++) { | 644 for (size_t i = 0; i < num_snippets; i++) { |
| 645 BytecodeGraphTester tester(isolate, zone, snippets[i].code_snippet); | 645 BytecodeGraphTester tester(isolate, zone, snippets[i].code_snippet); |
| 646 auto callable = tester.GetCallable<>(); | 646 auto callable = tester.GetCallable<>(); |
| 647 Handle<Object> return_value = callable().ToHandleChecked(); | 647 Handle<Object> return_value = callable().ToHandleChecked(); |
| 648 CHECK(return_value->SameValue(*snippets[i].return_value())); | 648 CHECK(return_value->SameValue(*snippets[i].return_value())); |
| 649 } | 649 } |
| 650 } | 650 } |
| 651 | 651 |
| 652 | 652 |
| 653 TEST(BytecodeGraphBuilderCast) { |
| 654 // TODO(mythria): tests for ToBoolean, ToObject, ToName, ToNumber. |
| 655 // They need other unimplemented features to test. |
| 656 // ToBoolean -> If |
| 657 // ToObject -> ForIn |
| 658 // ToNumber -> Inc/Dec |
| 659 // ToName -> CreateObjectLiteral |
| 660 } |
| 661 |
| 662 |
| 653 TEST(BytecodeGraphBuilderLogicalNot) { | 663 TEST(BytecodeGraphBuilderLogicalNot) { |
| 654 HandleAndZoneScope scope; | 664 HandleAndZoneScope scope; |
| 655 Isolate* isolate = scope.main_isolate(); | 665 Isolate* isolate = scope.main_isolate(); |
| 656 Zone* zone = scope.main_zone(); | 666 Zone* zone = scope.main_zone(); |
| 657 Factory* factory = isolate->factory(); | 667 Factory* factory = isolate->factory(); |
| 658 | 668 |
| 659 ExpectedSnippet<1> snippets[] = { | 669 ExpectedSnippet<1> snippets[] = { |
| 660 {"return !p1;", | 670 {"return !p1;", |
| 661 {factory->false_value(), | 671 {factory->false_value(), |
| 662 BytecodeGraphTester::NewObject("({val : 10})")}}, | 672 BytecodeGraphTester::NewObject("({val : 10})")}}, |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 auto callable = tester.GetCallable<Handle<Object>>(); | 768 auto callable = tester.GetCallable<Handle<Object>>(); |
| 759 Handle<Object> return_value = | 769 Handle<Object> return_value = |
| 760 callable(snippets[i].parameter(0)).ToHandleChecked(); | 770 callable(snippets[i].parameter(0)).ToHandleChecked(); |
| 761 CHECK(return_value->SameValue(*snippets[i].return_value())); | 771 CHECK(return_value->SameValue(*snippets[i].return_value())); |
| 762 } | 772 } |
| 763 } | 773 } |
| 764 | 774 |
| 765 } // namespace compiler | 775 } // namespace compiler |
| 766 } // namespace internal | 776 } // namespace internal |
| 767 } // namespace v8 | 777 } // namespace v8 |
| OLD | NEW |