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

Side by Side Diff: test/cctest/compiler/test-graph-reducer.cc

Issue 680313003: Move input/output counts directly into Operators, simplying OperatorProperties. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: yes Created 6 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 | Annotate | Revision Log
« no previous file with comments | « test/cctest/compiler/simplified-graph-builder.cc ('k') | test/cctest/compiler/test-linkage.cc » ('j') | 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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "graph-tester.h" 7 #include "graph-tester.h"
8 #include "src/compiler/generic-node-inl.h" 8 #include "src/compiler/generic-node-inl.h"
9 #include "src/compiler/graph-reducer.h" 9 #include "src/compiler/graph-reducer.h"
10 10
11 using namespace v8::internal; 11 using namespace v8::internal;
12 using namespace v8::internal::compiler; 12 using namespace v8::internal::compiler;
13 13
14 const uint8_t OPCODE_A0 = 10; 14 const uint8_t OPCODE_A0 = 10;
15 const uint8_t OPCODE_A1 = 11; 15 const uint8_t OPCODE_A1 = 11;
16 const uint8_t OPCODE_A2 = 12; 16 const uint8_t OPCODE_A2 = 12;
17 const uint8_t OPCODE_B0 = 20; 17 const uint8_t OPCODE_B0 = 20;
18 const uint8_t OPCODE_B1 = 21; 18 const uint8_t OPCODE_B1 = 21;
19 const uint8_t OPCODE_B2 = 22; 19 const uint8_t OPCODE_B2 = 22;
20 const uint8_t OPCODE_C0 = 30; 20 const uint8_t OPCODE_C0 = 30;
21 const uint8_t OPCODE_C1 = 31; 21 const uint8_t OPCODE_C1 = 31;
22 const uint8_t OPCODE_C2 = 32; 22 const uint8_t OPCODE_C2 = 32;
23 23
24 static SimpleOperator OPA0(OPCODE_A0, Operator::kNoWrite, 0, 0, "opa0"); 24 static Operator OPA0(OPCODE_A0, Operator::kNoWrite, "opa0", 0, 0, 0, 0, 0, 0);
25 static SimpleOperator OPA1(OPCODE_A1, Operator::kNoWrite, 1, 0, "opa1"); 25 static Operator OPA1(OPCODE_A1, Operator::kNoWrite, "opa1", 1, 0, 0, 0, 0, 0);
26 static SimpleOperator OPA2(OPCODE_A2, Operator::kNoWrite, 2, 0, "opa2"); 26 static Operator OPA2(OPCODE_A2, Operator::kNoWrite, "opa2", 2, 0, 0, 0, 0, 0);
27 static SimpleOperator OPB0(OPCODE_B0, Operator::kNoWrite, 0, 0, "opa0"); 27 static Operator OPB0(OPCODE_B0, Operator::kNoWrite, "opa0", 0, 0, 0, 0, 0, 0);
28 static SimpleOperator OPB1(OPCODE_B1, Operator::kNoWrite, 1, 0, "opa1"); 28 static Operator OPB1(OPCODE_B1, Operator::kNoWrite, "opa1", 1, 0, 0, 0, 0, 0);
29 static SimpleOperator OPB2(OPCODE_B2, Operator::kNoWrite, 2, 0, "opa2"); 29 static Operator OPB2(OPCODE_B2, Operator::kNoWrite, "opa2", 2, 0, 0, 0, 0, 0);
30 static SimpleOperator OPC0(OPCODE_C0, Operator::kNoWrite, 0, 0, "opc0"); 30 static Operator OPC0(OPCODE_C0, Operator::kNoWrite, "opc0", 0, 0, 0, 0, 0, 0);
31 static SimpleOperator OPC1(OPCODE_C1, Operator::kNoWrite, 1, 0, "opc1"); 31 static Operator OPC1(OPCODE_C1, Operator::kNoWrite, "opc1", 1, 0, 0, 0, 0, 0);
32 static SimpleOperator OPC2(OPCODE_C2, Operator::kNoWrite, 2, 0, "opc2"); 32 static Operator OPC2(OPCODE_C2, Operator::kNoWrite, "opc2", 2, 0, 0, 0, 0, 0);
33 33
34 34
35 // Replaces all "A" operators with "B" operators without creating new nodes. 35 // Replaces all "A" operators with "B" operators without creating new nodes.
36 class InPlaceABReducer : public Reducer { 36 class InPlaceABReducer : public Reducer {
37 public: 37 public:
38 virtual Reduction Reduce(Node* node) { 38 virtual Reduction Reduce(Node* node) {
39 switch (node->op()->opcode()) { 39 switch (node->op()->opcode()) {
40 case OPCODE_A0: 40 case OPCODE_A0:
41 CHECK_EQ(0, node->InputCount()); 41 CHECK_EQ(0, node->InputCount());
42 node->set_op(&OPB0); 42 node->set_op(&OPB0);
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 for (int i = 0; i < 3; i++) { 614 for (int i = 0; i < 3; i++) {
615 int before = graph.NodeCount(); 615 int before = graph.NodeCount();
616 reducer.ReduceGraph(); 616 reducer.ReduceGraph();
617 CHECK_EQ(before, graph.NodeCount()); 617 CHECK_EQ(before, graph.NodeCount());
618 CHECK_EQ(&OPC0, n1->op()); 618 CHECK_EQ(&OPC0, n1->op());
619 CHECK_EQ(&OPC1, end->op()); 619 CHECK_EQ(&OPC1, end->op());
620 CHECK_EQ(n1, end->InputAt(0)); 620 CHECK_EQ(n1, end->InputAt(0));
621 } 621 }
622 } 622 }
623 } 623 }
OLDNEW
« no previous file with comments | « test/cctest/compiler/simplified-graph-builder.cc ('k') | test/cctest/compiler/test-linkage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698