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 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 size_t num_snippets = sizeof(snippets) / sizeof(snippets[0]); | 699 size_t num_snippets = sizeof(snippets) / sizeof(snippets[0]); |
700 for (size_t i = 0; i < num_snippets; i++) { | 700 for (size_t i = 0; i < num_snippets; i++) { |
701 BytecodeGraphTester tester(isolate, zone, snippets[i].code_snippet); | 701 BytecodeGraphTester tester(isolate, zone, snippets[i].code_snippet); |
702 auto callable = tester.GetCallable<>(); | 702 auto callable = tester.GetCallable<>(); |
703 Handle<Object> return_value = callable().ToHandleChecked(); | 703 Handle<Object> return_value = callable().ToHandleChecked(); |
704 CHECK(return_value->SameValue(*snippets[i].return_value())); | 704 CHECK(return_value->SameValue(*snippets[i].return_value())); |
705 } | 705 } |
706 } | 706 } |
707 | 707 |
708 | 708 |
| 709 TEST(BytecodeGraphBuilderCast) { |
| 710 // TODO(mythria): tests for ToBoolean, ToObject, ToName, ToNumber. |
| 711 // They need other unimplemented features to test. |
| 712 // ToBoolean -> If |
| 713 // ToObject -> ForIn |
| 714 // ToNumber -> Inc/Dec |
| 715 // ToName -> CreateObjectLiteral |
| 716 } |
| 717 |
| 718 |
709 TEST(BytecodeGraphBuilderLogicalNot) { | 719 TEST(BytecodeGraphBuilderLogicalNot) { |
710 HandleAndZoneScope scope; | 720 HandleAndZoneScope scope; |
711 Isolate* isolate = scope.main_isolate(); | 721 Isolate* isolate = scope.main_isolate(); |
712 Zone* zone = scope.main_zone(); | 722 Zone* zone = scope.main_zone(); |
713 Factory* factory = isolate->factory(); | 723 Factory* factory = isolate->factory(); |
714 | 724 |
715 ExpectedSnippet<1> snippets[] = { | 725 ExpectedSnippet<1> snippets[] = { |
716 {"return !p1;", | 726 {"return !p1;", |
717 {factory->false_value(), | 727 {factory->false_value(), |
718 BytecodeGraphTester::NewObject("({val : 10})")}}, | 728 BytecodeGraphTester::NewObject("({val : 10})")}}, |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 v8::Local<v8::String> expected_string = v8_str(snippets[i].return_value()); | 998 v8::Local<v8::String> expected_string = v8_str(snippets[i].return_value()); |
989 CHECK( | 999 CHECK( |
990 message->Equals(CcTest::isolate()->GetCurrentContext(), expected_string) | 1000 message->Equals(CcTest::isolate()->GetCurrentContext(), expected_string) |
991 .FromJust()); | 1001 .FromJust()); |
992 } | 1002 } |
993 } | 1003 } |
994 | 1004 |
995 } // namespace compiler | 1005 } // namespace compiler |
996 } // namespace internal | 1006 } // namespace internal |
997 } // namespace v8 | 1007 } // namespace v8 |
OLD | NEW |