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

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

Issue 1419373007: [Interpreter] Adds implementation of bytecode graph builder for LoadICSloppy/Strict (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Removes FrameStateBeforeAndAfter and adds a function to replace framestate inputs with emtpy frame … 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 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { 1397 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
1398 return (NodeMatcher::MatchAndExplain(node, listener) && 1398 return (NodeMatcher::MatchAndExplain(node, listener) &&
1399 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), 1399 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
1400 "input", input_matcher_, listener)); 1400 "input", input_matcher_, listener));
1401 } 1401 }
1402 1402
1403 private: 1403 private:
1404 const Matcher<Node*> input_matcher_; 1404 const Matcher<Node*> input_matcher_;
1405 }; 1405 };
1406 1406
1407
1407 class IsParameterMatcher final : public NodeMatcher { 1408 class IsParameterMatcher final : public NodeMatcher {
1408 public: 1409 public:
1409 explicit IsParameterMatcher(const Matcher<int>& index_matcher) 1410 explicit IsParameterMatcher(const Matcher<int>& index_matcher)
1410 : NodeMatcher(IrOpcode::kParameter), index_matcher_(index_matcher) {} 1411 : NodeMatcher(IrOpcode::kParameter), index_matcher_(index_matcher) {}
1411 1412
1412 void DescribeTo(std::ostream* os) const override { 1413 void DescribeTo(std::ostream* os) const override {
1413 *os << "is a Parameter node with index("; 1414 *os << "is a Parameter node with index(";
1414 index_matcher_.DescribeTo(os); 1415 index_matcher_.DescribeTo(os);
1415 *os << ")"; 1416 *os << ")";
1416 } 1417 }
1417 1418
1418 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { 1419 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
1419 return (NodeMatcher::MatchAndExplain(node, listener) && 1420 return (NodeMatcher::MatchAndExplain(node, listener) &&
1420 PrintMatchAndExplain(ParameterIndexOf(node->op()), "index", 1421 PrintMatchAndExplain(ParameterIndexOf(node->op()), "index",
1421 index_matcher_, listener)); 1422 index_matcher_, listener));
1422 } 1423 }
1423 1424
1424 private: 1425 private:
1425 const Matcher<int> index_matcher_; 1426 const Matcher<int> index_matcher_;
1426 }; 1427 };
1427 1428
1429
1430 // TODO(mythria): Check if we can use the same matcher for Load and Store
1431 class IsNamedLoadMatcher final : public NodeMatcher {
rmcilroy 2015/11/11 14:23:51 /s/IsNamedLoadMatcher/IsJsLoadNamedMatcher/
rmcilroy 2015/11/11 14:24:56 Actually to correct case: IsJSLoadNamedMatcher
mythria 2015/11/11 15:32:50 Done.
1432 public:
1433 IsNamedLoadMatcher(const Matcher<Handle<Name>>& name_matcher,
1434 const Matcher<Node*>& object_value_matcher,
1435 const Matcher<Node*>& feedback_vector_matcher,
1436 const Matcher<Node*>& effect_matcher,
1437 const Matcher<Node*>& control_matcher)
1438 : NodeMatcher(IrOpcode::kJSLoadNamed),
1439 name_matcher_(name_matcher),
1440 object_value_matcher_(object_value_matcher),
1441 feedback_vector_matcher_(feedback_vector_matcher),
1442 effect_matcher_(effect_matcher),
1443 control_matcher_(control_matcher) {}
1444
1445 void DescribeTo(std::ostream* os) const final {
1446 NodeMatcher::DescribeTo(os);
1447 *os << " whose object (";
1448 object_value_matcher_.DescribeTo(os);
1449 *os << "), name (";
1450 name_matcher_.DescribeTo(os);
1451 *os << "), feedback vector (";
1452 feedback_vector_matcher_.DescribeTo(os);
1453 *os << "), effect (";
1454 effect_matcher_.DescribeTo(os);
1455 *os << "), and control (";
1456 control_matcher_.DescribeTo(os);
1457 *os << ")";
1458 }
1459
1460 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
1461 return (NodeMatcher::MatchAndExplain(node, listener) &&
1462 PrintMatchAndExplain(OpParameter<const NamedAccess>(node).name(),
1463 "descriptor", name_matcher_, listener) &&
1464 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
1465 "object", object_value_matcher_, listener) &&
1466 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
1467 "feedback vector", feedback_vector_matcher_,
1468 listener) &&
1469 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
1470 effect_matcher_, listener) &&
1471 PrintMatchAndExplain(NodeProperties::GetControlInput(node),
1472 "control", control_matcher_, listener));
1473 }
1474
1475 private:
1476 const Matcher<Handle<Name>> name_matcher_;
1477 const Matcher<Node*> object_value_matcher_;
1478 const Matcher<Node*> feedback_vector_matcher_;
1479 const Matcher<Node*> effect_matcher_;
1480 const Matcher<Node*> control_matcher_;
1481 };
1482
1428 } // namespace 1483 } // namespace
1429 1484
1430 1485
1431 Matcher<Node*> IsDead() { 1486 Matcher<Node*> IsDead() {
1432 return MakeMatcher(new NodeMatcher(IrOpcode::kDead)); 1487 return MakeMatcher(new NodeMatcher(IrOpcode::kDead));
1433 } 1488 }
1434 1489
1435 1490
1436 Matcher<Node*> IsEnd(const Matcher<Node*>& control0_matcher) { 1491 Matcher<Node*> IsEnd(const Matcher<Node*>& control0_matcher) {
1437 return MakeMatcher(new IsControl1Matcher(IrOpcode::kEnd, control0_matcher)); 1492 return MakeMatcher(new IsControl1Matcher(IrOpcode::kEnd, control0_matcher));
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
1991 Matcher<Node*> IsParameter(const Matcher<int> index_matcher) { 2046 Matcher<Node*> IsParameter(const Matcher<int> index_matcher) {
1992 return MakeMatcher(new IsParameterMatcher(index_matcher)); 2047 return MakeMatcher(new IsParameterMatcher(index_matcher));
1993 } 2048 }
1994 2049
1995 2050
1996 Matcher<Node*> IsLoadFramePointer() { 2051 Matcher<Node*> IsLoadFramePointer() {
1997 return MakeMatcher(new NodeMatcher(IrOpcode::kLoadFramePointer)); 2052 return MakeMatcher(new NodeMatcher(IrOpcode::kLoadFramePointer));
1998 } 2053 }
1999 2054
2000 2055
2056 Matcher<Node*> IsJSLoadNamed(const Handle<Name> name,
2057 const Matcher<Node*>& object_value_matcher,
2058 const Matcher<Node*>& feedback_vector_matcher,
2059 const Matcher<Node*>& effect_matcher,
2060 const Matcher<Node*>& control_matcher) {
2061 return MakeMatcher(new IsNamedLoadMatcher(name, object_value_matcher,
2062 feedback_vector_matcher,
2063 effect_matcher, control_matcher));
2064 }
2065
2066
2001 #define IS_BINOP_MATCHER(Name) \ 2067 #define IS_BINOP_MATCHER(Name) \
2002 Matcher<Node*> Is##Name(const Matcher<Node*>& lhs_matcher, \ 2068 Matcher<Node*> Is##Name(const Matcher<Node*>& lhs_matcher, \
2003 const Matcher<Node*>& rhs_matcher) { \ 2069 const Matcher<Node*>& rhs_matcher) { \
2004 return MakeMatcher( \ 2070 return MakeMatcher( \
2005 new IsBinopMatcher(IrOpcode::k##Name, lhs_matcher, rhs_matcher)); \ 2071 new IsBinopMatcher(IrOpcode::k##Name, lhs_matcher, rhs_matcher)); \
2006 } 2072 }
2007 IS_BINOP_MATCHER(NumberEqual) 2073 IS_BINOP_MATCHER(NumberEqual)
2008 IS_BINOP_MATCHER(NumberLessThan) 2074 IS_BINOP_MATCHER(NumberLessThan)
2009 IS_BINOP_MATCHER(NumberSubtract) 2075 IS_BINOP_MATCHER(NumberSubtract)
2010 IS_BINOP_MATCHER(NumberMultiply) 2076 IS_BINOP_MATCHER(NumberMultiply)
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
2071 IS_UNOP_MATCHER(Float64ExtractHighWord32) 2137 IS_UNOP_MATCHER(Float64ExtractHighWord32)
2072 IS_UNOP_MATCHER(NumberToInt32) 2138 IS_UNOP_MATCHER(NumberToInt32)
2073 IS_UNOP_MATCHER(NumberToUint32) 2139 IS_UNOP_MATCHER(NumberToUint32)
2074 IS_UNOP_MATCHER(ObjectIsSmi) 2140 IS_UNOP_MATCHER(ObjectIsSmi)
2075 IS_UNOP_MATCHER(Word32Clz) 2141 IS_UNOP_MATCHER(Word32Clz)
2076 #undef IS_UNOP_MATCHER 2142 #undef IS_UNOP_MATCHER
2077 2143
2078 } // namespace compiler 2144 } // namespace compiler
2079 } // namespace internal 2145 } // namespace internal
2080 } // namespace v8 2146 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698