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

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

Issue 1645763003: [Interpreter] TurboFan implementation of intrinsics. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Merged with oth@'s changes. Created 4 years, 9 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 | « test/cctest/cctest.gyp ('k') | test/cctest/interpreter/bytecode_expectations/ForOf.golden » ('j') | 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 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 652
653 for (size_t i = 0; i < arraysize(snippets); i++) { 653 for (size_t i = 0; i < arraysize(snippets); i++) {
654 BytecodeGraphTester tester(isolate, zone, snippets[i].code_snippet); 654 BytecodeGraphTester tester(isolate, zone, snippets[i].code_snippet);
655 auto callable = tester.GetCallable<Handle<Object>>(); 655 auto callable = tester.GetCallable<Handle<Object>>();
656 Handle<Object> return_value = 656 Handle<Object> return_value =
657 callable(snippets[i].parameter(0)).ToHandleChecked(); 657 callable(snippets[i].parameter(0)).ToHandleChecked();
658 CHECK(return_value->SameValue(*snippets[i].return_value())); 658 CHECK(return_value->SameValue(*snippets[i].return_value()));
659 } 659 }
660 } 660 }
661 661
662 TEST(BytecodeGraphBuilderInvokeIntrinsic) {
663 HandleAndZoneScope scope;
664 Isolate* isolate = scope.main_isolate();
665 Zone* zone = scope.main_zone();
666 Factory* factory = isolate->factory();
667
668 ExpectedSnippet<1> snippets[] = {
669 {"function f(arg0) { return %_IsJSReceiver(arg0); }\nf()",
670 {factory->false_value(), factory->NewNumberFromInt(1)}},
671 {"function f(arg0) { return %_IsArray(arg0) }\nf(undefined)",
672 {factory->true_value(), BytecodeGraphTester::NewObject("[1, 2, 3]")}},
673 };
674
675 for (size_t i = 0; i < arraysize(snippets); i++) {
676 BytecodeGraphTester tester(isolate, zone, snippets[i].code_snippet);
677 auto callable = tester.GetCallable<Handle<Object>>();
678 Handle<Object> return_value =
679 callable(snippets[i].parameter(0)).ToHandleChecked();
680 CHECK(return_value->SameValue(*snippets[i].return_value()));
681 }
682 }
683
662 void TestBytecodeGraphBuilderGlobals(size_t shard) { 684 void TestBytecodeGraphBuilderGlobals(size_t shard) {
663 HandleAndZoneScope scope; 685 HandleAndZoneScope scope;
664 Isolate* isolate = scope.main_isolate(); 686 Isolate* isolate = scope.main_isolate();
665 Zone* zone = scope.main_zone(); 687 Zone* zone = scope.main_zone();
666 Factory* factory = isolate->factory(); 688 Factory* factory = isolate->factory();
667 689
668 ExpectedSnippet<0> snippets[] = { 690 ExpectedSnippet<0> snippets[] = {
669 {"var global = 321;\n function f() { return global; };\n f();", 691 {"var global = 321;\n function f() { return global; };\n f();",
670 {factory->NewNumberFromInt(321)}}, 692 {factory->NewNumberFromInt(321)}},
671 {"var global = 321;\n" 693 {"var global = 321;\n"
(...skipping 2303 matching lines...) Expand 10 before | Expand all | Expand 10 after
2975 2997
2976 BytecodeGraphTester tester(isolate, zone, script.start()); 2998 BytecodeGraphTester tester(isolate, zone, script.start());
2977 auto callable = tester.GetCallable<>(); 2999 auto callable = tester.GetCallable<>();
2978 Handle<Object> return_value = callable().ToHandleChecked(); 3000 Handle<Object> return_value = callable().ToHandleChecked();
2979 CHECK(return_value->SameValue(*snippet.return_value())); 3001 CHECK(return_value->SameValue(*snippet.return_value()));
2980 } 3002 }
2981 3003
2982 } // namespace compiler 3004 } // namespace compiler
2983 } // namespace internal 3005 } // namespace internal
2984 } // namespace v8 3006 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/cctest.gyp ('k') | test/cctest/interpreter/bytecode_expectations/ForOf.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698