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

Side by Side Diff: src/compiler/diamond.h

Issue 1366753003: [turbofan] Make Node::set_op safer via wrapper. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments. Created 5 years, 3 months 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 | « src/compiler/dead-code-elimination.cc ('k') | src/compiler/js-context-specialization.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 #ifndef V8_COMPILER_DIAMOND_H_ 5 #ifndef V8_COMPILER_DIAMOND_H_
6 #define V8_COMPILER_DIAMOND_H_ 6 #define V8_COMPILER_DIAMOND_H_
7 7
8 #include "src/compiler/common-operator.h" 8 #include "src/compiler/common-operator.h"
9 #include "src/compiler/graph.h" 9 #include "src/compiler/graph.h"
10 #include "src/compiler/node.h" 10 #include "src/compiler/node.h"
11 #include "src/compiler/node-properties.h"
11 12
12 namespace v8 { 13 namespace v8 {
13 namespace internal { 14 namespace internal {
14 namespace compiler { 15 namespace compiler {
15 16
16 // A helper to make it easier to build diamond-shaped control patterns. 17 // A helper to make it easier to build diamond-shaped control patterns.
17 struct Diamond { 18 struct Diamond {
18 Graph* graph; 19 Graph* graph;
19 CommonOperatorBuilder* common; 20 CommonOperatorBuilder* common;
20 Node* branch; 21 Node* branch;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 return graph->NewNode(common->Phi(machine_type, 2), tv, fv, merge); 54 return graph->NewNode(common->Phi(machine_type, 2), tv, fv, merge);
54 } 55 }
55 56
56 Node* EffectPhi(Node* tv, Node* fv) { 57 Node* EffectPhi(Node* tv, Node* fv) {
57 return graph->NewNode(common->EffectPhi(2), tv, fv, merge); 58 return graph->NewNode(common->EffectPhi(2), tv, fv, merge);
58 } 59 }
59 60
60 void OverwriteWithPhi(Node* node, MachineType machine_type, Node* tv, 61 void OverwriteWithPhi(Node* node, MachineType machine_type, Node* tv,
61 Node* fv) { 62 Node* fv) {
62 DCHECK(node->InputCount() >= 3); 63 DCHECK(node->InputCount() >= 3);
63 node->set_op(common->Phi(machine_type, 2));
64 node->ReplaceInput(0, tv); 64 node->ReplaceInput(0, tv);
65 node->ReplaceInput(1, fv); 65 node->ReplaceInput(1, fv);
66 node->ReplaceInput(2, merge); 66 node->ReplaceInput(2, merge);
67 node->TrimInputCount(3); 67 node->TrimInputCount(3);
68 NodeProperties::ChangeOp(node, common->Phi(machine_type, 2));
68 } 69 }
69 70
70 void OverwriteWithEffectPhi(Node* node, Node* te, Node* fe) { 71 void OverwriteWithEffectPhi(Node* node, Node* te, Node* fe) {
71 DCHECK(node->InputCount() >= 3); 72 DCHECK(node->InputCount() >= 3);
72 node->set_op(common->EffectPhi(2));
73 node->ReplaceInput(0, te); 73 node->ReplaceInput(0, te);
74 node->ReplaceInput(1, fe); 74 node->ReplaceInput(1, fe);
75 node->ReplaceInput(2, merge); 75 node->ReplaceInput(2, merge);
76 node->TrimInputCount(3); 76 node->TrimInputCount(3);
77 NodeProperties::ChangeOp(node, common->EffectPhi(2));
77 } 78 }
78 }; 79 };
79 } 80 }
80 } 81 }
81 } // namespace v8::internal::compiler 82 } // namespace v8::internal::compiler
82 83
83 #endif // V8_COMPILER_DIAMOND_H_ 84 #endif // V8_COMPILER_DIAMOND_H_
OLDNEW
« no previous file with comments | « src/compiler/dead-code-elimination.cc ('k') | src/compiler/js-context-specialization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698