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

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

Issue 426233002: Land the Fan (disabled) (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
OLDNEW
(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/v8.h"
9
10 #include "src/compiler/opcodes.h"
11 #include "src/compiler/operator-properties.h"
12
13 namespace v8 {
14 namespace internal {
15 namespace compiler {
16
17 inline int OperatorProperties::GetValueOutputCount(Operator* op) {
18 return op->OutputCount();
19 }
20
21 inline int OperatorProperties::GetValueInputCount(Operator* op) {
22 return op->InputCount();
23 }
24
25 inline int OperatorProperties::GetControlInputCount(Operator* op) {
26 switch (op->opcode()) {
27 case IrOpcode::kPhi:
28 case IrOpcode::kEffectPhi:
29 return 1;
30 #define OPCODE_CASE(x) \
31 case IrOpcode::k##x:
32 CONTROL_OP_LIST(OPCODE_CASE)
33 #undef OPCODE_CASE
34 return static_cast<ControlOperator*>(op)->ControlInputCount();
35 default:
36 // Operators that have write effects must have a control
37 // dependency. Effect dependencies only ensure the correct order of
38 // write/read operations without consideration of control flow. Without an
39 // explicit control dependency writes can be float in the schedule too
40 // early along a path that shouldn't generate a side-effect.
41 return op->HasProperty(Operator::kNoWrite) ? 0 : 1;
42 }
43 return 0;
44 }
45
46 inline int OperatorProperties::GetEffectInputCount(Operator* op) {
47 if (op->opcode() == IrOpcode::kEffectPhi) {
48 return static_cast<Operator1<int>*>(op)->parameter();
49 }
50 if (op->HasProperty(Operator::kNoRead) &&
51 op->HasProperty(Operator::kNoWrite)) return 0; // no effects.
52 return 1;
53 }
54
55 inline bool OperatorProperties::HasContextInput(Operator* op) {
56 IrOpcode::Value opcode = static_cast<IrOpcode::Value>(op->opcode());
57 return IrOpcode::IsJsOpcode(opcode);
58 }
59
60 inline bool OperatorProperties::IsBasicBlockBegin(Operator* op) {
61 uint8_t opcode = op->opcode();
62 return opcode == IrOpcode::kStart ||
63 opcode == IrOpcode::kEnd ||
64 opcode == IrOpcode::kDead ||
65 opcode == IrOpcode::kLoop ||
66 opcode == IrOpcode::kMerge ||
67 opcode == IrOpcode::kIfTrue ||
68 opcode == IrOpcode::kIfFalse;
69 }
70
71 inline bool OperatorProperties::CanBeScheduled(Operator* op) {
72 return true;
73 }
74
75 inline bool OperatorProperties::HasFixedSchedulePosition(Operator* op) {
76 IrOpcode::Value opcode = static_cast<IrOpcode::Value>(op->opcode());
77 return (IrOpcode::IsControlOpcode(opcode)) ||
78 opcode == IrOpcode::kParameter ||
79 opcode == IrOpcode::kEffectPhi ||
80 opcode == IrOpcode::kPhi;
81 }
82
83 inline bool OperatorProperties::IsScheduleRoot(Operator* op) {
84 uint8_t opcode = op->opcode();
85 return opcode == IrOpcode::kEnd ||
86 opcode == IrOpcode::kEffectPhi ||
87 opcode == IrOpcode::kPhi;
88 }
89
90 inline bool OperatorProperties::CanLazilyDeoptimize(Operator* op) {
91 if (op->opcode() == IrOpcode::kCall) {
92 CallOperator* call_op = reinterpret_cast<CallOperator*>(op);
93 CallDescriptor* descriptor = call_op->parameter();
94 return descriptor->CanLazilyDeoptimize();
95 }
96 if (op->opcode() == IrOpcode::kJSCallRuntime) {
97 // TODO(jarin) At the moment, we only support lazy deoptimization for
98 // the %DeoptimizeFunction runtime function.
99 Runtime::FunctionId function =
100 reinterpret_cast<Operator1<Runtime::FunctionId>*>(op)->parameter();
101 return function == Runtime::kDeoptimizeFunction;
102 }
103 return false;
104 }
105 } } } // namespace v8::internal::compiler
106
107 #endif // V8_COMPILER_OPERATOR_PROPERTIES_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698