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

Side by Side Diff: src/compiler/operator-properties-inl.h

Issue 479163002: [turbofan] Add new ControlEffect and Finish operators. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/opcodes.h ('k') | src/compiler/typer.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_OPERATOR_PROPERTIES_INL_H_ 5 #ifndef V8_COMPILER_OPERATOR_PROPERTIES_INL_H_
6 #define V8_COMPILER_OPERATOR_PROPERTIES_INL_H_ 6 #define V8_COMPILER_OPERATOR_PROPERTIES_INL_H_
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/compiler/js-operator.h" 10 #include "src/compiler/js-operator.h"
(...skipping 24 matching lines...) Expand all
35 35
36 inline int OperatorProperties::GetValueInputCount(Operator* op) { 36 inline int OperatorProperties::GetValueInputCount(Operator* op) {
37 return op->InputCount(); 37 return op->InputCount();
38 } 38 }
39 39
40 inline int OperatorProperties::GetContextInputCount(Operator* op) { 40 inline int OperatorProperties::GetContextInputCount(Operator* op) {
41 return OperatorProperties::HasContextInput(op) ? 1 : 0; 41 return OperatorProperties::HasContextInput(op) ? 1 : 0;
42 } 42 }
43 43
44 inline int OperatorProperties::GetEffectInputCount(Operator* op) { 44 inline int OperatorProperties::GetEffectInputCount(Operator* op) {
45 if (op->opcode() == IrOpcode::kEffectPhi) { 45 if (op->opcode() == IrOpcode::kEffectPhi ||
46 op->opcode() == IrOpcode::kFinish) {
46 return static_cast<Operator1<int>*>(op)->parameter(); 47 return static_cast<Operator1<int>*>(op)->parameter();
47 } 48 }
48 if (op->HasProperty(Operator::kNoRead) && op->HasProperty(Operator::kNoWrite)) 49 if (op->HasProperty(Operator::kNoRead) && op->HasProperty(Operator::kNoWrite))
49 return 0; // no effects. 50 return 0; // no effects.
50 return 1; 51 return 1;
51 } 52 }
52 53
53 inline int OperatorProperties::GetControlInputCount(Operator* op) { 54 inline int OperatorProperties::GetControlInputCount(Operator* op) {
54 switch (op->opcode()) { 55 switch (op->opcode()) {
55 case IrOpcode::kPhi: 56 case IrOpcode::kPhi:
56 case IrOpcode::kEffectPhi: 57 case IrOpcode::kEffectPhi:
58 case IrOpcode::kControlEffect:
57 return 1; 59 return 1;
58 #define OPCODE_CASE(x) case IrOpcode::k##x: 60 #define OPCODE_CASE(x) case IrOpcode::k##x:
59 CONTROL_OP_LIST(OPCODE_CASE) 61 CONTROL_OP_LIST(OPCODE_CASE)
60 #undef OPCODE_CASE 62 #undef OPCODE_CASE
61 return static_cast<ControlOperator*>(op)->ControlInputCount(); 63 return static_cast<ControlOperator*>(op)->ControlInputCount();
62 default: 64 default:
63 // If a node can lazily deoptimize, it needs control dependency. 65 // If a node can lazily deoptimize, it needs control dependency.
64 if (CanLazilyDeoptimize(op)) { 66 if (CanLazilyDeoptimize(op)) {
65 return 1; 67 return 1;
66 } 68 }
(...skipping 13 matching lines...) Expand all
80 } 82 }
81 83
82 // ----------------------------------------------------------------------------- 84 // -----------------------------------------------------------------------------
83 // Output properties. 85 // Output properties.
84 86
85 inline bool OperatorProperties::HasValueOutput(Operator* op) { 87 inline bool OperatorProperties::HasValueOutput(Operator* op) {
86 return GetValueOutputCount(op) > 0; 88 return GetValueOutputCount(op) > 0;
87 } 89 }
88 90
89 inline bool OperatorProperties::HasEffectOutput(Operator* op) { 91 inline bool OperatorProperties::HasEffectOutput(Operator* op) {
90 return op->opcode() == IrOpcode::kStart || GetEffectInputCount(op) > 0; 92 return op->opcode() == IrOpcode::kStart ||
93 op->opcode() == IrOpcode::kControlEffect ||
94 (op->opcode() != IrOpcode::kFinish && GetEffectInputCount(op) > 0);
91 } 95 }
92 96
93 inline bool OperatorProperties::HasControlOutput(Operator* op) { 97 inline bool OperatorProperties::HasControlOutput(Operator* op) {
94 IrOpcode::Value opcode = static_cast<IrOpcode::Value>(op->opcode()); 98 IrOpcode::Value opcode = static_cast<IrOpcode::Value>(op->opcode());
95 return (opcode != IrOpcode::kEnd && IrOpcode::IsControlOpcode(opcode)) || 99 return (opcode != IrOpcode::kEnd && IrOpcode::IsControlOpcode(opcode)) ||
96 CanLazilyDeoptimize(op); 100 CanLazilyDeoptimize(op);
97 } 101 }
98 102
99 103
100 inline int OperatorProperties::GetValueOutputCount(Operator* op) { 104 inline int OperatorProperties::GetValueOutputCount(Operator* op) {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 default: 186 default:
183 return false; 187 return false;
184 } 188 }
185 return false; 189 return false;
186 } 190 }
187 } 191 }
188 } 192 }
189 } // namespace v8::internal::compiler 193 } // namespace v8::internal::compiler
190 194
191 #endif // V8_COMPILER_OPERATOR_PROPERTIES_INL_H_ 195 #endif // V8_COMPILER_OPERATOR_PROPERTIES_INL_H_
OLDNEW
« no previous file with comments | « src/compiler/opcodes.h ('k') | src/compiler/typer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698