| 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 2f4641174c3292a9bef6f9dc7c551cb4ab9f0af5..7a815ca0c886f624bbc19e577aeb9f9cba9a707f 100644
|
| --- a/test/unittests/compiler/bytecode-graph-builder-unittest.cc
|
| +++ b/test/unittests/compiler/bytecode-graph-builder-unittest.cc
|
| @@ -485,6 +485,54 @@ TEST_F(BytecodeGraphBuilderTest, NamedLoadStrictWide) {
|
| EXPECT_THAT(ret, IsReturn(load_named_matcher_wide, _, _));
|
| }
|
|
|
| +
|
| +TEST_F(BytecodeGraphBuilderTest, CallProperty0) {
|
| + const char* code_snippet =
|
| + "function f(p1) {return p1.func();}; f({func(){}});";
|
| + GraphGeneratorHelper helper(isolate(), zone(), code_snippet);
|
| + Graph* graph = helper.GetCompletedGraph();
|
| +
|
| + Node* ret = graph->end()->InputAt(0);
|
| + Node* start = graph->start();
|
| +
|
| + Handle<Name> name = GraphGeneratorHelper::GetName(isolate(), "func");
|
| + Matcher<Node*> feedback_vector_matcher = IsFeedbackVector(start, start);
|
| + Matcher<Node*> load_named_matcher = IsJSLoadNamed(
|
| + name, IsParameter(1), feedback_vector_matcher, start, start);
|
| + std::vector<Matcher<Node*>> call_inputs;
|
| + call_inputs.push_back(load_named_matcher);
|
| + call_inputs.push_back(IsParameter(1));
|
| + Matcher<Node*> call_matcher =
|
| + IsJSCallFunction(call_inputs, load_named_matcher, IsIfSuccess(_));
|
| +
|
| + EXPECT_THAT(ret, IsReturn(call_matcher, _, _));
|
| +}
|
| +
|
| +
|
| +TEST_F(BytecodeGraphBuilderTest, CallProperty2) {
|
| + const char* code_snippet =
|
| + "function f(p1, p2, p3) {return p1.func(p2, p3);}; f({func(a){}}, 1, 2);";
|
| + GraphGeneratorHelper helper(isolate(), zone(), code_snippet);
|
| + Graph* graph = helper.GetCompletedGraph();
|
| +
|
| + Node* ret = graph->end()->InputAt(0);
|
| + Node* start = graph->start();
|
| +
|
| + Handle<Name> name = GraphGeneratorHelper::GetName(isolate(), "func");
|
| + Matcher<Node*> feedback_vector_matcher = IsFeedbackVector(start, start);
|
| + Matcher<Node*> load_named_matcher = IsJSLoadNamed(
|
| + name, IsParameter(1), feedback_vector_matcher, start, start);
|
| + std::vector<Matcher<Node*>> call_inputs;
|
| + call_inputs.push_back(load_named_matcher);
|
| + call_inputs.push_back(IsParameter(1));
|
| + call_inputs.push_back(IsParameter(2));
|
| + call_inputs.push_back(IsParameter(3));
|
| + Matcher<Node*> call_matcher =
|
| + IsJSCallFunction(call_inputs, load_named_matcher, IsIfSuccess(_));
|
| +
|
| + EXPECT_THAT(ret, IsReturn(call_matcher, _, _));
|
| +}
|
| +
|
| } // namespace compiler
|
| } // namespace internal
|
| } // namespace v8
|
|
|