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

Side by Side Diff: test/unittests/compiler/node-test-utils.cc

Issue 1456453002: [Interpreter] Add support for Call bytecode to bytecode graph builder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Compilation fix (signed/unsigned). 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 "test/unittests/compiler/node-test-utils.h" 5 #include "test/unittests/compiler/node-test-utils.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "src/assembler.h" 9 #include "src/assembler.h"
10 #include "src/compiler/common-operator.h" 10 #include "src/compiler/common-operator.h"
(...skipping 1462 matching lines...) Expand 10 before | Expand all | Expand 10 after
1473 } 1473 }
1474 1474
1475 private: 1475 private:
1476 const Matcher<Handle<Name>> name_matcher_; 1476 const Matcher<Handle<Name>> name_matcher_;
1477 const Matcher<Node*> object_value_matcher_; 1477 const Matcher<Node*> object_value_matcher_;
1478 const Matcher<Node*> feedback_vector_matcher_; 1478 const Matcher<Node*> feedback_vector_matcher_;
1479 const Matcher<Node*> effect_matcher_; 1479 const Matcher<Node*> effect_matcher_;
1480 const Matcher<Node*> control_matcher_; 1480 const Matcher<Node*> control_matcher_;
1481 }; 1481 };
1482 1482
1483
1484 class IsJSCallFunctionMatcher final : public NodeMatcher {
1485 public:
1486 IsJSCallFunctionMatcher(const std::vector<Matcher<Node*>>& value_matchers,
1487 const Matcher<Node*>& effect_matcher,
1488 const Matcher<Node*>& control_matcher)
1489 : NodeMatcher(IrOpcode::kJSCallFunction),
1490 value_matchers_(value_matchers),
1491 effect_matcher_(effect_matcher),
1492 control_matcher_(control_matcher) {}
1493
1494 void DescribeTo(std::ostream* os) const final {
1495 NodeMatcher::DescribeTo(os);
1496 for (size_t i = 0; i < value_matchers_.size(); ++i) {
1497 if (i == 0) {
1498 *os << " whose value0 (";
1499 } else {
1500 *os << "), value" << i << " (";
1501 }
1502 value_matchers_[i].DescribeTo(os);
1503 }
1504 *os << "), effect (";
1505 effect_matcher_.DescribeTo(os);
1506 *os << ") and control (";
1507 control_matcher_.DescribeTo(os);
1508 *os << ")";
1509 }
1510
1511 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
1512 if (!NodeMatcher::MatchAndExplain(node, listener)) {
1513 return false;
1514 }
1515 for (size_t i = 0; i < value_matchers_.size(); ++i) {
1516 std::ostringstream ost;
1517 ost << "value" << i;
1518 if (!PrintMatchAndExplain(
1519 NodeProperties::GetValueInput(node, static_cast<int>(i)),
1520 ost.str(), value_matchers_[i], listener)) {
1521 return false;
1522 }
1523 }
1524 return (PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
1525 effect_matcher_, listener) &&
1526 PrintMatchAndExplain(NodeProperties::GetControlInput(node),
1527 "control", control_matcher_, listener));
1528 }
1529
1530 private:
1531 const std::vector<Matcher<Node*>> value_matchers_;
1532 const Matcher<Node*> effect_matcher_;
1533 const Matcher<Node*> control_matcher_;
1534 };
1535
1483 } // namespace 1536 } // namespace
1484 1537
1485 1538
1486 Matcher<Node*> IsDead() { 1539 Matcher<Node*> IsDead() {
1487 return MakeMatcher(new NodeMatcher(IrOpcode::kDead)); 1540 return MakeMatcher(new NodeMatcher(IrOpcode::kDead));
1488 } 1541 }
1489 1542
1490 1543
1491 Matcher<Node*> IsEnd(const Matcher<Node*>& control0_matcher) { 1544 Matcher<Node*> IsEnd(const Matcher<Node*>& control0_matcher) {
1492 return MakeMatcher(new IsControl1Matcher(IrOpcode::kEnd, control0_matcher)); 1545 return MakeMatcher(new IsControl1Matcher(IrOpcode::kEnd, control0_matcher));
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
2057 const Matcher<Node*>& object_value_matcher, 2110 const Matcher<Node*>& object_value_matcher,
2058 const Matcher<Node*>& feedback_vector_matcher, 2111 const Matcher<Node*>& feedback_vector_matcher,
2059 const Matcher<Node*>& effect_matcher, 2112 const Matcher<Node*>& effect_matcher,
2060 const Matcher<Node*>& control_matcher) { 2113 const Matcher<Node*>& control_matcher) {
2061 return MakeMatcher(new IsJSLoadNamedMatcher(name, object_value_matcher, 2114 return MakeMatcher(new IsJSLoadNamedMatcher(name, object_value_matcher,
2062 feedback_vector_matcher, 2115 feedback_vector_matcher,
2063 effect_matcher, control_matcher)); 2116 effect_matcher, control_matcher));
2064 } 2117 }
2065 2118
2066 2119
2120 Matcher<Node*> IsJSCallFunction(std::vector<Matcher<Node*>> value_matchers,
2121 const Matcher<Node*>& effect_matcher,
2122 const Matcher<Node*>& control_matcher) {
2123 return MakeMatcher(new IsJSCallFunctionMatcher(value_matchers, effect_matcher,
2124 control_matcher));
2125 }
2126
2127
2067 #define IS_BINOP_MATCHER(Name) \ 2128 #define IS_BINOP_MATCHER(Name) \
2068 Matcher<Node*> Is##Name(const Matcher<Node*>& lhs_matcher, \ 2129 Matcher<Node*> Is##Name(const Matcher<Node*>& lhs_matcher, \
2069 const Matcher<Node*>& rhs_matcher) { \ 2130 const Matcher<Node*>& rhs_matcher) { \
2070 return MakeMatcher( \ 2131 return MakeMatcher( \
2071 new IsBinopMatcher(IrOpcode::k##Name, lhs_matcher, rhs_matcher)); \ 2132 new IsBinopMatcher(IrOpcode::k##Name, lhs_matcher, rhs_matcher)); \
2072 } 2133 }
2073 IS_BINOP_MATCHER(NumberEqual) 2134 IS_BINOP_MATCHER(NumberEqual)
2074 IS_BINOP_MATCHER(NumberLessThan) 2135 IS_BINOP_MATCHER(NumberLessThan)
2075 IS_BINOP_MATCHER(NumberSubtract) 2136 IS_BINOP_MATCHER(NumberSubtract)
2076 IS_BINOP_MATCHER(NumberMultiply) 2137 IS_BINOP_MATCHER(NumberMultiply)
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
2140 IS_UNOP_MATCHER(Float64ExtractHighWord32) 2201 IS_UNOP_MATCHER(Float64ExtractHighWord32)
2141 IS_UNOP_MATCHER(NumberToInt32) 2202 IS_UNOP_MATCHER(NumberToInt32)
2142 IS_UNOP_MATCHER(NumberToUint32) 2203 IS_UNOP_MATCHER(NumberToUint32)
2143 IS_UNOP_MATCHER(ObjectIsSmi) 2204 IS_UNOP_MATCHER(ObjectIsSmi)
2144 IS_UNOP_MATCHER(Word32Clz) 2205 IS_UNOP_MATCHER(Word32Clz)
2145 #undef IS_UNOP_MATCHER 2206 #undef IS_UNOP_MATCHER
2146 2207
2147 } // namespace compiler 2208 } // namespace compiler
2148 } // namespace internal 2209 } // namespace internal
2149 } // namespace v8 2210 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/node-test-utils.h ('k') | test/unittests/interpreter/bytecode-array-builder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698