OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef V8_COMPILER_OPERATOR_PROPERTIES_INL_H_ | |
6 #define V8_COMPILER_OPERATOR_PROPERTIES_INL_H_ | |
7 | |
8 #include "src/compiler/common-operator.h" | |
9 #include "src/compiler/js-operator.h" | |
10 #include "src/compiler/linkage.h" | |
11 #include "src/compiler/opcodes.h" | |
12 #include "src/compiler/operator-properties.h" | |
13 | |
14 namespace v8 { | |
15 namespace internal { | |
16 namespace compiler { | |
17 | |
18 inline bool OperatorProperties::HasContextInput(const Operator* op) { | |
19 IrOpcode::Value opcode = static_cast<IrOpcode::Value>(op->opcode()); | |
20 return IrOpcode::IsJsOpcode(opcode); | |
21 } | |
22 | |
23 inline bool OperatorProperties::HasFrameStateInput(const Operator* op) { | |
24 if (!FLAG_turbo_deoptimization) { | |
25 return false; | |
26 } | |
27 | |
28 switch (op->opcode()) { | |
29 case IrOpcode::kFrameState: | |
30 return true; | |
31 case IrOpcode::kJSCallRuntime: { | |
32 const CallRuntimeParameters& p = CallRuntimeParametersOf(op); | |
33 return Linkage::NeedsFrameState(p.id()); | |
34 } | |
35 | |
36 // Strict equality cannot lazily deoptimize. | |
37 case IrOpcode::kJSStrictEqual: | |
38 case IrOpcode::kJSStrictNotEqual: | |
39 return false; | |
40 | |
41 // Calls | |
42 case IrOpcode::kJSCallFunction: | |
43 case IrOpcode::kJSCallConstruct: | |
44 | |
45 // Compare operations | |
46 case IrOpcode::kJSEqual: | |
47 case IrOpcode::kJSGreaterThan: | |
48 case IrOpcode::kJSGreaterThanOrEqual: | |
49 case IrOpcode::kJSHasProperty: | |
50 case IrOpcode::kJSInstanceOf: | |
51 case IrOpcode::kJSLessThan: | |
52 case IrOpcode::kJSLessThanOrEqual: | |
53 case IrOpcode::kJSNotEqual: | |
54 | |
55 // Binary operations | |
56 case IrOpcode::kJSAdd: | |
57 case IrOpcode::kJSBitwiseAnd: | |
58 case IrOpcode::kJSBitwiseOr: | |
59 case IrOpcode::kJSBitwiseXor: | |
60 case IrOpcode::kJSDivide: | |
61 case IrOpcode::kJSLoadNamed: | |
62 case IrOpcode::kJSLoadProperty: | |
63 case IrOpcode::kJSModulus: | |
64 case IrOpcode::kJSMultiply: | |
65 case IrOpcode::kJSShiftLeft: | |
66 case IrOpcode::kJSShiftRight: | |
67 case IrOpcode::kJSShiftRightLogical: | |
68 case IrOpcode::kJSStoreNamed: | |
69 case IrOpcode::kJSStoreProperty: | |
70 case IrOpcode::kJSSubtract: | |
71 | |
72 // Conversions | |
73 case IrOpcode::kJSToObject: | |
74 | |
75 // Other | |
76 case IrOpcode::kJSDeleteProperty: | |
77 return true; | |
78 | |
79 default: | |
80 return false; | |
81 } | |
82 } | |
83 | |
84 inline int OperatorProperties::GetContextInputCount(const Operator* op) { | |
85 return OperatorProperties::HasContextInput(op) ? 1 : 0; | |
86 } | |
87 | |
88 inline int OperatorProperties::GetFrameStateInputCount(const Operator* op) { | |
89 return OperatorProperties::HasFrameStateInput(op) ? 1 : 0; | |
90 } | |
91 | |
92 inline int OperatorProperties::GetTotalInputCount(const Operator* op) { | |
93 return op->ValueInputCount() + GetContextInputCount(op) + | |
94 GetFrameStateInputCount(op) + op->EffectInputCount() + | |
95 op->ControlInputCount(); | |
96 } | |
97 | |
98 // ----------------------------------------------------------------------------- | |
99 // Output properties. | |
100 | |
101 inline bool OperatorProperties::IsBasicBlockBegin(const Operator* op) { | |
102 uint8_t opcode = op->opcode(); | |
103 return opcode == IrOpcode::kStart || opcode == IrOpcode::kEnd || | |
104 opcode == IrOpcode::kDead || opcode == IrOpcode::kLoop || | |
105 opcode == IrOpcode::kMerge || opcode == IrOpcode::kIfTrue || | |
106 opcode == IrOpcode::kIfFalse; | |
107 } | |
108 | |
109 } // namespace compiler | |
110 } // namespace internal | |
111 } // namespace v8 | |
112 | |
113 #endif // V8_COMPILER_OPERATOR_PROPERTIES_INL_H_ | |
OLD | NEW |