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

Side by Side Diff: src/compiler/machine-operator.h

Issue 555283004: [turbofan] Next step towards shared operators. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/js-typed-lowering.cc ('k') | src/compiler/machine-operator-reducer-unittest.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_MACHINE_OPERATOR_H_ 5 #ifndef V8_COMPILER_MACHINE_OPERATOR_H_
6 #define V8_COMPILER_MACHINE_OPERATOR_H_ 6 #define V8_COMPILER_MACHINE_OPERATOR_H_
7 7
8 #include "src/compiler/machine-type.h" 8 #include "src/compiler/machine-type.h"
9 #include "src/compiler/opcodes.h" 9 #include "src/compiler/opcodes.h"
10 #include "src/compiler/operator.h" 10 #include "src/compiler/operator.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 1) 66 1)
67 #define BINOP_ACO(name) \ 67 #define BINOP_ACO(name) \
68 SIMPLE(name, \ 68 SIMPLE(name, \
69 Operator::kAssociative | Operator::kCommutative | Operator::kPure, 2, \ 69 Operator::kAssociative | Operator::kCommutative | Operator::kPure, 2, \
70 2) 70 2)
71 #define UNOP(name) SIMPLE(name, Operator::kPure, 1, 1) 71 #define UNOP(name) SIMPLE(name, Operator::kPure, 1, 1)
72 72
73 #define WORD_SIZE(x) return is64() ? Word64##x() : Word32##x() 73 #define WORD_SIZE(x) return is64() ? Word64##x() : Word32##x()
74 #define INT_SIZE(x) return is64() ? Int64##x() : Int32##x() 74 #define INT_SIZE(x) return is64() ? Int64##x() : Int32##x()
75 75
76 Operator* Load(MachineType rep) { // load [base + index] 76 const Operator* Load(MachineType rep) { // load [base + index]
77 OP1(Load, MachineType, rep, Operator::kNoWrite, 2, 1); 77 OP1(Load, MachineType, rep, Operator::kNoWrite, 2, 1);
78 } 78 }
79 // store [base + index], value 79 // store [base + index], value
80 Operator* Store(MachineType rep, WriteBarrierKind kind) { 80 const Operator* Store(MachineType rep, WriteBarrierKind kind) {
81 StoreRepresentation store_rep = {rep, kind}; 81 StoreRepresentation store_rep = {rep, kind};
82 OP1(Store, StoreRepresentation, store_rep, Operator::kNoRead, 3, 0); 82 OP1(Store, StoreRepresentation, store_rep, Operator::kNoRead, 3, 0);
83 } 83 }
84 84
85 Operator* WordAnd() { WORD_SIZE(And); } 85 const Operator* WordAnd() { WORD_SIZE(And); }
86 Operator* WordOr() { WORD_SIZE(Or); } 86 const Operator* WordOr() { WORD_SIZE(Or); }
87 Operator* WordXor() { WORD_SIZE(Xor); } 87 const Operator* WordXor() { WORD_SIZE(Xor); }
88 Operator* WordShl() { WORD_SIZE(Shl); } 88 const Operator* WordShl() { WORD_SIZE(Shl); }
89 Operator* WordShr() { WORD_SIZE(Shr); } 89 const Operator* WordShr() { WORD_SIZE(Shr); }
90 Operator* WordSar() { WORD_SIZE(Sar); } 90 const Operator* WordSar() { WORD_SIZE(Sar); }
91 Operator* WordRor() { WORD_SIZE(Ror); } 91 const Operator* WordRor() { WORD_SIZE(Ror); }
92 Operator* WordEqual() { WORD_SIZE(Equal); } 92 const Operator* WordEqual() { WORD_SIZE(Equal); }
93 93
94 Operator* Word32And() { BINOP_AC(Word32And); } 94 const Operator* Word32And() { BINOP_AC(Word32And); }
95 Operator* Word32Or() { BINOP_AC(Word32Or); } 95 const Operator* Word32Or() { BINOP_AC(Word32Or); }
96 Operator* Word32Xor() { BINOP_AC(Word32Xor); } 96 const Operator* Word32Xor() { BINOP_AC(Word32Xor); }
97 Operator* Word32Shl() { BINOP(Word32Shl); } 97 const Operator* Word32Shl() { BINOP(Word32Shl); }
98 Operator* Word32Shr() { BINOP(Word32Shr); } 98 const Operator* Word32Shr() { BINOP(Word32Shr); }
99 Operator* Word32Sar() { BINOP(Word32Sar); } 99 const Operator* Word32Sar() { BINOP(Word32Sar); }
100 Operator* Word32Ror() { BINOP(Word32Ror); } 100 const Operator* Word32Ror() { BINOP(Word32Ror); }
101 Operator* Word32Equal() { BINOP_C(Word32Equal); } 101 const Operator* Word32Equal() { BINOP_C(Word32Equal); }
102 102
103 Operator* Word64And() { BINOP_AC(Word64And); } 103 const Operator* Word64And() { BINOP_AC(Word64And); }
104 Operator* Word64Or() { BINOP_AC(Word64Or); } 104 const Operator* Word64Or() { BINOP_AC(Word64Or); }
105 Operator* Word64Xor() { BINOP_AC(Word64Xor); } 105 const Operator* Word64Xor() { BINOP_AC(Word64Xor); }
106 Operator* Word64Shl() { BINOP(Word64Shl); } 106 const Operator* Word64Shl() { BINOP(Word64Shl); }
107 Operator* Word64Shr() { BINOP(Word64Shr); } 107 const Operator* Word64Shr() { BINOP(Word64Shr); }
108 Operator* Word64Sar() { BINOP(Word64Sar); } 108 const Operator* Word64Sar() { BINOP(Word64Sar); }
109 Operator* Word64Ror() { BINOP(Word64Ror); } 109 const Operator* Word64Ror() { BINOP(Word64Ror); }
110 Operator* Word64Equal() { BINOP_C(Word64Equal); } 110 const Operator* Word64Equal() { BINOP_C(Word64Equal); }
111 111
112 Operator* Int32Add() { BINOP_AC(Int32Add); } 112 const Operator* Int32Add() { BINOP_AC(Int32Add); }
113 Operator* Int32AddWithOverflow() { BINOP_ACO(Int32AddWithOverflow); } 113 const Operator* Int32AddWithOverflow() { BINOP_ACO(Int32AddWithOverflow); }
114 Operator* Int32Sub() { BINOP(Int32Sub); } 114 const Operator* Int32Sub() { BINOP(Int32Sub); }
115 Operator* Int32SubWithOverflow() { BINOP_O(Int32SubWithOverflow); } 115 const Operator* Int32SubWithOverflow() { BINOP_O(Int32SubWithOverflow); }
116 Operator* Int32Mul() { BINOP_AC(Int32Mul); } 116 const Operator* Int32Mul() { BINOP_AC(Int32Mul); }
117 Operator* Int32Div() { BINOP(Int32Div); } 117 const Operator* Int32Div() { BINOP(Int32Div); }
118 Operator* Int32UDiv() { BINOP(Int32UDiv); } 118 const Operator* Int32UDiv() { BINOP(Int32UDiv); }
119 Operator* Int32Mod() { BINOP(Int32Mod); } 119 const Operator* Int32Mod() { BINOP(Int32Mod); }
120 Operator* Int32UMod() { BINOP(Int32UMod); } 120 const Operator* Int32UMod() { BINOP(Int32UMod); }
121 Operator* Int32LessThan() { BINOP(Int32LessThan); } 121 const Operator* Int32LessThan() { BINOP(Int32LessThan); }
122 Operator* Int32LessThanOrEqual() { BINOP(Int32LessThanOrEqual); } 122 const Operator* Int32LessThanOrEqual() { BINOP(Int32LessThanOrEqual); }
123 Operator* Uint32LessThan() { BINOP(Uint32LessThan); } 123 const Operator* Uint32LessThan() { BINOP(Uint32LessThan); }
124 Operator* Uint32LessThanOrEqual() { BINOP(Uint32LessThanOrEqual); } 124 const Operator* Uint32LessThanOrEqual() { BINOP(Uint32LessThanOrEqual); }
125 125
126 Operator* Int64Add() { BINOP_AC(Int64Add); } 126 const Operator* Int64Add() { BINOP_AC(Int64Add); }
127 Operator* Int64Sub() { BINOP(Int64Sub); } 127 const Operator* Int64Sub() { BINOP(Int64Sub); }
128 Operator* Int64Mul() { BINOP_AC(Int64Mul); } 128 const Operator* Int64Mul() { BINOP_AC(Int64Mul); }
129 Operator* Int64Div() { BINOP(Int64Div); } 129 const Operator* Int64Div() { BINOP(Int64Div); }
130 Operator* Int64UDiv() { BINOP(Int64UDiv); } 130 const Operator* Int64UDiv() { BINOP(Int64UDiv); }
131 Operator* Int64Mod() { BINOP(Int64Mod); } 131 const Operator* Int64Mod() { BINOP(Int64Mod); }
132 Operator* Int64UMod() { BINOP(Int64UMod); } 132 const Operator* Int64UMod() { BINOP(Int64UMod); }
133 Operator* Int64LessThan() { BINOP(Int64LessThan); } 133 const Operator* Int64LessThan() { BINOP(Int64LessThan); }
134 Operator* Int64LessThanOrEqual() { BINOP(Int64LessThanOrEqual); } 134 const Operator* Int64LessThanOrEqual() { BINOP(Int64LessThanOrEqual); }
135 135
136 // Signed comparison of word-sized integer values, translates to int32/int64 136 // Signed comparison of word-sized integer values, translates to int32/int64
137 // comparisons depending on the word-size of the machine. 137 // comparisons depending on the word-size of the machine.
138 Operator* IntLessThan() { INT_SIZE(LessThan); } 138 const Operator* IntLessThan() { INT_SIZE(LessThan); }
139 Operator* IntLessThanOrEqual() { INT_SIZE(LessThanOrEqual); } 139 const Operator* IntLessThanOrEqual() { INT_SIZE(LessThanOrEqual); }
140 140
141 // Convert representation of integers between float64 and int32/uint32. 141 // Convert representation of integers between float64 and int32/uint32.
142 // The precise rounding mode and handling of out of range inputs are *not* 142 // The precise rounding mode and handling of out of range inputs are *not*
143 // defined for these operators, since they are intended only for use with 143 // defined for these operators, since they are intended only for use with
144 // integers. 144 // integers.
145 Operator* ChangeInt32ToFloat64() { UNOP(ChangeInt32ToFloat64); } 145 const Operator* ChangeInt32ToFloat64() { UNOP(ChangeInt32ToFloat64); }
146 Operator* ChangeUint32ToFloat64() { UNOP(ChangeUint32ToFloat64); } 146 const Operator* ChangeUint32ToFloat64() { UNOP(ChangeUint32ToFloat64); }
147 Operator* ChangeFloat64ToInt32() { UNOP(ChangeFloat64ToInt32); } 147 const Operator* ChangeFloat64ToInt32() { UNOP(ChangeFloat64ToInt32); }
148 Operator* ChangeFloat64ToUint32() { UNOP(ChangeFloat64ToUint32); } 148 const Operator* ChangeFloat64ToUint32() { UNOP(ChangeFloat64ToUint32); }
149 149
150 // Sign/zero extend int32/uint32 to int64/uint64. 150 // Sign/zero extend int32/uint32 to int64/uint64.
151 Operator* ChangeInt32ToInt64() { UNOP(ChangeInt32ToInt64); } 151 const Operator* ChangeInt32ToInt64() { UNOP(ChangeInt32ToInt64); }
152 Operator* ChangeUint32ToUint64() { UNOP(ChangeUint32ToUint64); } 152 const Operator* ChangeUint32ToUint64() { UNOP(ChangeUint32ToUint64); }
153 153
154 // Truncate double to int32 using JavaScript semantics. 154 // Truncate double to int32 using JavaScript semantics.
155 Operator* TruncateFloat64ToInt32() { UNOP(TruncateFloat64ToInt32); } 155 const Operator* TruncateFloat64ToInt32() { UNOP(TruncateFloat64ToInt32); }
156 156
157 // Truncate the high order bits and convert the remaining bits to int32. 157 // Truncate the high order bits and convert the remaining bits to int32.
158 Operator* TruncateInt64ToInt32() { UNOP(TruncateInt64ToInt32); } 158 const Operator* TruncateInt64ToInt32() { UNOP(TruncateInt64ToInt32); }
159 159
160 // Floating point operators always operate with IEEE 754 round-to-nearest. 160 // Floating point operators always operate with IEEE 754 round-to-nearest.
161 Operator* Float64Add() { BINOP_C(Float64Add); } 161 const Operator* Float64Add() { BINOP_C(Float64Add); }
162 Operator* Float64Sub() { BINOP(Float64Sub); } 162 const Operator* Float64Sub() { BINOP(Float64Sub); }
163 Operator* Float64Mul() { BINOP_C(Float64Mul); } 163 const Operator* Float64Mul() { BINOP_C(Float64Mul); }
164 Operator* Float64Div() { BINOP(Float64Div); } 164 const Operator* Float64Div() { BINOP(Float64Div); }
165 Operator* Float64Mod() { BINOP(Float64Mod); } 165 const Operator* Float64Mod() { BINOP(Float64Mod); }
166 166
167 // Floating point comparisons complying to IEEE 754. 167 // Floating point comparisons complying to IEEE 754.
168 Operator* Float64Equal() { BINOP_C(Float64Equal); } 168 const Operator* Float64Equal() { BINOP_C(Float64Equal); }
169 Operator* Float64LessThan() { BINOP(Float64LessThan); } 169 const Operator* Float64LessThan() { BINOP(Float64LessThan); }
170 Operator* Float64LessThanOrEqual() { BINOP(Float64LessThanOrEqual); } 170 const Operator* Float64LessThanOrEqual() { BINOP(Float64LessThanOrEqual); }
171 171
172 inline bool is32() const { return word_ == kRepWord32; } 172 inline bool is32() const { return word_ == kRepWord32; }
173 inline bool is64() const { return word_ == kRepWord64; } 173 inline bool is64() const { return word_ == kRepWord64; }
174 inline MachineType word() const { return word_; } 174 inline MachineType word() const { return word_; }
175 175
176 #undef WORD_SIZE 176 #undef WORD_SIZE
177 #undef INT_SIZE 177 #undef INT_SIZE
178 #undef UNOP 178 #undef UNOP
179 #undef BINOP 179 #undef BINOP
180 #undef OP1 180 #undef OP1
181 #undef SIMPLE 181 #undef SIMPLE
182 182
183 private: 183 private:
184 Zone* zone_; 184 Zone* zone_;
185 MachineType word_; 185 MachineType word_;
186 }; 186 };
187 } 187
188 } 188 } // namespace compiler
189 } // namespace v8::internal::compiler 189 } // namespace internal
190 } // namespace v8
190 191
191 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ 192 #endif // V8_COMPILER_MACHINE_OPERATOR_H_
OLDNEW
« no previous file with comments | « src/compiler/js-typed-lowering.cc ('k') | src/compiler/machine-operator-reducer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698