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

Unified Diff: test/unittests/compiler/bytecode-graph-builder-unittest.cc

Issue 1459543003: [Interpreter] Add support for unary operators to bytecode graph builder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/compiler/test-run-bytecode-graph-builder.cc ('k') | test/unittests/compiler/node-test-utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/compiler/bytecode-graph-builder-unittest.cc
diff --git a/test/unittests/compiler/bytecode-graph-builder-unittest.cc b/test/unittests/compiler/bytecode-graph-builder-unittest.cc
index db13ae0940c34eee5d15b333437878c63c5f0e50..5263ec941c99ea34844fb905544800917450e3d6 100644
--- a/test/unittests/compiler/bytecode-graph-builder-unittest.cc
+++ b/test/unittests/compiler/bytecode-graph-builder-unittest.cc
@@ -527,6 +527,70 @@ TEST_F(BytecodeGraphBuilderTest, StoreGlobal) {
}
+TEST_F(BytecodeGraphBuilderTest, LogicalNot) {
+ interpreter::BytecodeArrayBuilder array_builder(isolate(), zone());
+ array_builder.set_locals_count(1);
+ array_builder.set_context_count(0);
+ array_builder.set_parameter_count(2);
+ array_builder.LoadAccumulatorWithRegister(array_builder.Parameter(1))
+ .LogicalNot()
+ .Return();
+
+ FeedbackVectorSpec feedback_spec(zone());
+ Handle<TypeFeedbackVector> vector =
+ NewTypeFeedbackVector(isolate(), &feedback_spec);
+ Graph* graph = GetCompletedGraph(array_builder.ToBytecodeArray(), vector);
+
+ Node* ret = graph->end()->InputAt(0);
+ EXPECT_THAT(ret, IsReturn(IsJSUnaryNot(IsParameter(1)), _, _));
+}
+
+
+TEST_F(BytecodeGraphBuilderTest, TypeOf) {
+ interpreter::BytecodeArrayBuilder array_builder(isolate(), zone());
+ array_builder.set_locals_count(1);
+ array_builder.set_context_count(0);
+ array_builder.set_parameter_count(2);
+ array_builder.LoadAccumulatorWithRegister(array_builder.Parameter(1))
+ .TypeOf()
+ .Return();
+
+ FeedbackVectorSpec feedback_spec(zone());
+ Handle<TypeFeedbackVector> vector =
+ NewTypeFeedbackVector(isolate(), &feedback_spec);
+ Graph* graph = GetCompletedGraph(array_builder.ToBytecodeArray(), vector);
+
+ Node* ret = graph->end()->InputAt(0);
+ EXPECT_THAT(ret, IsReturn(IsJSTypeOf(IsParameter(1)), _, _));
+}
+
+
+TEST_F(BytecodeGraphBuilderTest, Delete) {
+ TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) {
+ interpreter::BytecodeArrayBuilder array_builder(isolate(), zone());
+ array_builder.set_locals_count(1);
+ array_builder.set_context_count(0);
+ array_builder.set_parameter_count(2);
+ Handle<Name> name = GetName(isolate(), "val");
+ array_builder.LoadLiteral(name)
+ .Delete(array_builder.Parameter(1), language_mode)
+ .Return();
+
+ FeedbackVectorSpec feedback_spec(zone());
+ Handle<TypeFeedbackVector> vector =
+ NewTypeFeedbackVector(isolate(), &feedback_spec);
+ Graph* graph = GetCompletedGraph(array_builder.ToBytecodeArray(), vector,
+ language_mode);
+
+ Node* start = graph->start();
+ Node* ret = graph->end()->InputAt(0);
+
+ Matcher<Node*> delete_matcher =
+ IsJSDeleteProperty(IsParameter(1), IsHeapConstant(name), start, start);
+ EXPECT_THAT(ret, IsReturn(delete_matcher, _, _));
+ }
+}
+
} // namespace compiler
} // namespace internal
} // namespace v8
« no previous file with comments | « test/cctest/compiler/test-run-bytecode-graph-builder.cc ('k') | test/unittests/compiler/node-test-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698