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

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

Issue 1449373002: [Interpreter] Add support for global loads / stores / calls to BytecodeGraphBuilder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@rmcilroy-0000
Patch Set: Rebase. 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
« no previous file with comments | « test/unittests/compiler/node-test-utils.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "src/compiler/js-operator.h" 11 #include "src/compiler/js-operator.h"
12 #include "src/compiler/node-properties.h" 12 #include "src/compiler/node-properties.h"
13 #include "src/compiler/simplified-operator.h" 13 #include "src/compiler/simplified-operator.h"
14 #include "src/handles-inl.h" 14 #include "src/handles-inl.h"
15 #include "src/objects.h"
15 16
16 using testing::_; 17 using testing::_;
17 using testing::MakeMatcher; 18 using testing::MakeMatcher;
18 using testing::MatcherInterface; 19 using testing::MatcherInterface;
19 using testing::MatchResultListener; 20 using testing::MatchResultListener;
20 using testing::StringMatchResultListener; 21 using testing::StringMatchResultListener;
21 22
22 namespace v8 { 23 namespace v8 {
23 namespace internal { 24 namespace internal {
24 25
(...skipping 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after
1474 1475
1475 private: 1476 private:
1476 const Matcher<Handle<Name>> name_matcher_; 1477 const Matcher<Handle<Name>> name_matcher_;
1477 const Matcher<Node*> object_value_matcher_; 1478 const Matcher<Node*> object_value_matcher_;
1478 const Matcher<Node*> feedback_vector_matcher_; 1479 const Matcher<Node*> feedback_vector_matcher_;
1479 const Matcher<Node*> effect_matcher_; 1480 const Matcher<Node*> effect_matcher_;
1480 const Matcher<Node*> control_matcher_; 1481 const Matcher<Node*> control_matcher_;
1481 }; 1482 };
1482 1483
1483 1484
1485 class IsJSLoadGlobalMatcher final : public NodeMatcher {
1486 public:
1487 IsJSLoadGlobalMatcher(const Matcher<Handle<Name>>& name_matcher,
1488 const Matcher<TypeofMode> typeof_mode_matcher,
1489 const Matcher<Node*>& feedback_vector_matcher,
1490 const Matcher<Node*>& effect_matcher,
1491 const Matcher<Node*>& control_matcher)
1492 : NodeMatcher(IrOpcode::kJSLoadGlobal),
1493 name_matcher_(name_matcher),
1494 typeof_mode_matcher_(typeof_mode_matcher),
1495 feedback_vector_matcher_(feedback_vector_matcher),
1496 effect_matcher_(effect_matcher),
1497 control_matcher_(control_matcher) {}
1498
1499 void DescribeTo(std::ostream* os) const final {
1500 NodeMatcher::DescribeTo(os);
1501 *os << " whose name (";
1502 name_matcher_.DescribeTo(os);
1503 *os << "), typeof mode (";
1504 typeof_mode_matcher_.DescribeTo(os);
1505 *os << "), feedback vector (";
1506 feedback_vector_matcher_.DescribeTo(os);
1507 *os << "), effect (";
1508 effect_matcher_.DescribeTo(os);
1509 *os << "), and control (";
1510 control_matcher_.DescribeTo(os);
1511 *os << ")";
1512 }
1513
1514 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
1515 return (NodeMatcher::MatchAndExplain(node, listener) &&
1516 PrintMatchAndExplain(
1517 OpParameter<const LoadGlobalParameters>(node).name(), "name",
1518 name_matcher_, listener) &&
1519 PrintMatchAndExplain(
1520 OpParameter<const LoadGlobalParameters>(node).typeof_mode(),
1521 "typeof mode", typeof_mode_matcher_, listener) &&
1522 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
1523 "feedback vector", feedback_vector_matcher_,
1524 listener) &&
1525 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
1526 effect_matcher_, listener) &&
1527 PrintMatchAndExplain(NodeProperties::GetControlInput(node),
1528 "control", control_matcher_, listener));
1529 }
1530
1531 private:
1532 const Matcher<Handle<Name>> name_matcher_;
1533 const Matcher<TypeofMode> typeof_mode_matcher_;
1534 const Matcher<Node*> feedback_vector_matcher_;
1535 const Matcher<Node*> effect_matcher_;
1536 const Matcher<Node*> control_matcher_;
1537 };
1538
1539
1540 class IsJSStoreGlobalMatcher final : public NodeMatcher {
1541 public:
1542 IsJSStoreGlobalMatcher(const Matcher<Handle<Name>>& name_matcher,
1543 const Matcher<Node*>& value_matcher,
1544 const Matcher<Node*>& feedback_vector_matcher,
1545 const Matcher<Node*>& effect_matcher,
1546 const Matcher<Node*>& control_matcher)
1547 : NodeMatcher(IrOpcode::kJSStoreGlobal),
1548 name_matcher_(name_matcher),
1549 value_matcher_(value_matcher),
1550 feedback_vector_matcher_(feedback_vector_matcher),
1551 effect_matcher_(effect_matcher),
1552 control_matcher_(control_matcher) {}
1553
1554 void DescribeTo(std::ostream* os) const final {
1555 NodeMatcher::DescribeTo(os);
1556 *os << " whose name (";
1557 name_matcher_.DescribeTo(os);
1558 *os << "), value (";
1559 value_matcher_.DescribeTo(os);
1560 *os << "), feedback vector (";
1561 feedback_vector_matcher_.DescribeTo(os);
1562 *os << "), effect (";
1563 effect_matcher_.DescribeTo(os);
1564 *os << "), and control (";
1565 control_matcher_.DescribeTo(os);
1566 *os << ")";
1567 }
1568
1569 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
1570 return (NodeMatcher::MatchAndExplain(node, listener) &&
1571 PrintMatchAndExplain(
1572 OpParameter<const StoreGlobalParameters>(node).name(), "name",
1573 name_matcher_, listener) &&
1574 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
1575 "value", value_matcher_, listener) &&
1576 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
1577 "feedback vector", feedback_vector_matcher_,
1578 listener) &&
1579 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
1580 effect_matcher_, listener) &&
1581 PrintMatchAndExplain(NodeProperties::GetControlInput(node),
1582 "control", control_matcher_, listener));
1583 }
1584
1585 private:
1586 const Matcher<Handle<Name>> name_matcher_;
1587 const Matcher<Node*> value_matcher_;
1588 const Matcher<Node*> feedback_vector_matcher_;
1589 const Matcher<Node*> effect_matcher_;
1590 const Matcher<Node*> control_matcher_;
1591 };
1592
1593
1484 class IsJSCallFunctionMatcher final : public NodeMatcher { 1594 class IsJSCallFunctionMatcher final : public NodeMatcher {
1485 public: 1595 public:
1486 IsJSCallFunctionMatcher(const std::vector<Matcher<Node*>>& value_matchers, 1596 IsJSCallFunctionMatcher(const std::vector<Matcher<Node*>>& value_matchers,
1487 const Matcher<Node*>& effect_matcher, 1597 const Matcher<Node*>& effect_matcher,
1488 const Matcher<Node*>& control_matcher) 1598 const Matcher<Node*>& control_matcher)
1489 : NodeMatcher(IrOpcode::kJSCallFunction), 1599 : NodeMatcher(IrOpcode::kJSCallFunction),
1490 value_matchers_(value_matchers), 1600 value_matchers_(value_matchers),
1491 effect_matcher_(effect_matcher), 1601 effect_matcher_(effect_matcher),
1492 control_matcher_(control_matcher) {} 1602 control_matcher_(control_matcher) {}
1493 1603
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
2110 const Matcher<Node*>& object_value_matcher, 2220 const Matcher<Node*>& object_value_matcher,
2111 const Matcher<Node*>& feedback_vector_matcher, 2221 const Matcher<Node*>& feedback_vector_matcher,
2112 const Matcher<Node*>& effect_matcher, 2222 const Matcher<Node*>& effect_matcher,
2113 const Matcher<Node*>& control_matcher) { 2223 const Matcher<Node*>& control_matcher) {
2114 return MakeMatcher(new IsJSLoadNamedMatcher(name, object_value_matcher, 2224 return MakeMatcher(new IsJSLoadNamedMatcher(name, object_value_matcher,
2115 feedback_vector_matcher, 2225 feedback_vector_matcher,
2116 effect_matcher, control_matcher)); 2226 effect_matcher, control_matcher));
2117 } 2227 }
2118 2228
2119 2229
2230 Matcher<Node*> IsJSLoadGlobal(const Handle<Name> name,
2231 const TypeofMode typeof_mode,
2232 const Matcher<Node*>& feedback_vector_matcher,
2233 const Matcher<Node*>& effect_matcher,
2234 const Matcher<Node*>& control_matcher) {
2235 return MakeMatcher(
2236 new IsJSLoadGlobalMatcher(name, typeof_mode, feedback_vector_matcher,
2237 effect_matcher, control_matcher));
2238 }
2239
2240
2241 Matcher<Node*> IsJSStoreGlobal(const Handle<Name> name,
2242 const Matcher<Node*>& value_matcher,
2243 const Matcher<Node*>& feedback_vector_matcher,
2244 const Matcher<Node*>& effect_matcher,
2245 const Matcher<Node*>& control_matcher) {
2246 return MakeMatcher(
2247 new IsJSStoreGlobalMatcher(name, value_matcher, feedback_vector_matcher,
2248 effect_matcher, control_matcher));
2249 }
2250
2251
2120 Matcher<Node*> IsJSCallFunction(std::vector<Matcher<Node*>> value_matchers, 2252 Matcher<Node*> IsJSCallFunction(std::vector<Matcher<Node*>> value_matchers,
2121 const Matcher<Node*>& effect_matcher, 2253 const Matcher<Node*>& effect_matcher,
2122 const Matcher<Node*>& control_matcher) { 2254 const Matcher<Node*>& control_matcher) {
2123 return MakeMatcher(new IsJSCallFunctionMatcher(value_matchers, effect_matcher, 2255 return MakeMatcher(new IsJSCallFunctionMatcher(value_matchers, effect_matcher,
2124 control_matcher)); 2256 control_matcher));
2125 } 2257 }
2126 2258
2127 2259
2128 #define IS_BINOP_MATCHER(Name) \ 2260 #define IS_BINOP_MATCHER(Name) \
2129 Matcher<Node*> Is##Name(const Matcher<Node*>& lhs_matcher, \ 2261 Matcher<Node*> Is##Name(const Matcher<Node*>& lhs_matcher, \
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
2201 IS_UNOP_MATCHER(Float64ExtractHighWord32) 2333 IS_UNOP_MATCHER(Float64ExtractHighWord32)
2202 IS_UNOP_MATCHER(NumberToInt32) 2334 IS_UNOP_MATCHER(NumberToInt32)
2203 IS_UNOP_MATCHER(NumberToUint32) 2335 IS_UNOP_MATCHER(NumberToUint32)
2204 IS_UNOP_MATCHER(ObjectIsSmi) 2336 IS_UNOP_MATCHER(ObjectIsSmi)
2205 IS_UNOP_MATCHER(Word32Clz) 2337 IS_UNOP_MATCHER(Word32Clz)
2206 #undef IS_UNOP_MATCHER 2338 #undef IS_UNOP_MATCHER
2207 2339
2208 } // namespace compiler 2340 } // namespace compiler
2209 } // namespace internal 2341 } // namespace internal
2210 } // namespace v8 2342 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/node-test-utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698