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

Side by Side Diff: src/compiler/simplified-operator.cc

Issue 1369313004: [turbofan] Make string comparisons effectful. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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/simplified-lowering.cc ('k') | test/cctest/compiler/test-js-typed-lowering.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #include "src/compiler/simplified-operator.h" 5 #include "src/compiler/simplified-operator.h"
6 6
7 #include "src/base/lazy-instance.h" 7 #include "src/base/lazy-instance.h"
8 #include "src/compiler/opcodes.h" 8 #include "src/compiler/opcodes.h"
9 #include "src/compiler/operator.h" 9 #include "src/compiler/operator.h"
10 #include "src/types-inl.h" 10 #include "src/types-inl.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 V(NumberSubtract, Operator::kNoProperties, 2) \ 167 V(NumberSubtract, Operator::kNoProperties, 2) \
168 V(NumberMultiply, Operator::kCommutative, 2) \ 168 V(NumberMultiply, Operator::kCommutative, 2) \
169 V(NumberDivide, Operator::kNoProperties, 2) \ 169 V(NumberDivide, Operator::kNoProperties, 2) \
170 V(NumberModulus, Operator::kNoProperties, 2) \ 170 V(NumberModulus, Operator::kNoProperties, 2) \
171 V(NumberShiftLeft, Operator::kNoProperties, 2) \ 171 V(NumberShiftLeft, Operator::kNoProperties, 2) \
172 V(NumberShiftRight, Operator::kNoProperties, 2) \ 172 V(NumberShiftRight, Operator::kNoProperties, 2) \
173 V(NumberShiftRightLogical, Operator::kNoProperties, 2) \ 173 V(NumberShiftRightLogical, Operator::kNoProperties, 2) \
174 V(NumberToInt32, Operator::kNoProperties, 1) \ 174 V(NumberToInt32, Operator::kNoProperties, 1) \
175 V(NumberToUint32, Operator::kNoProperties, 1) \ 175 V(NumberToUint32, Operator::kNoProperties, 1) \
176 V(PlainPrimitiveToNumber, Operator::kNoProperties, 1) \ 176 V(PlainPrimitiveToNumber, Operator::kNoProperties, 1) \
177 V(StringEqual, Operator::kCommutative, 2) \
178 V(StringLessThan, Operator::kNoProperties, 2) \
179 V(StringLessThanOrEqual, Operator::kNoProperties, 2) \
180 V(ChangeTaggedToInt32, Operator::kNoProperties, 1) \ 177 V(ChangeTaggedToInt32, Operator::kNoProperties, 1) \
181 V(ChangeTaggedToUint32, Operator::kNoProperties, 1) \ 178 V(ChangeTaggedToUint32, Operator::kNoProperties, 1) \
182 V(ChangeTaggedToFloat64, Operator::kNoProperties, 1) \ 179 V(ChangeTaggedToFloat64, Operator::kNoProperties, 1) \
183 V(ChangeInt32ToTagged, Operator::kNoProperties, 1) \ 180 V(ChangeInt32ToTagged, Operator::kNoProperties, 1) \
184 V(ChangeUint32ToTagged, Operator::kNoProperties, 1) \ 181 V(ChangeUint32ToTagged, Operator::kNoProperties, 1) \
185 V(ChangeFloat64ToTagged, Operator::kNoProperties, 1) \ 182 V(ChangeFloat64ToTagged, Operator::kNoProperties, 1) \
186 V(ChangeBoolToBit, Operator::kNoProperties, 1) \ 183 V(ChangeBoolToBit, Operator::kNoProperties, 1) \
187 V(ChangeBitToBool, Operator::kNoProperties, 1) \ 184 V(ChangeBitToBool, Operator::kNoProperties, 1) \
188 V(ObjectIsSmi, Operator::kNoProperties, 1) 185 V(ObjectIsSmi, Operator::kNoProperties, 1)
189 186
187 #define NO_THROW_OP_LIST(V) \
188 V(StringEqual, Operator::kCommutative, 2) \
189 V(StringLessThan, Operator::kNoThrow, 2) \
190 V(StringLessThanOrEqual, Operator::kNoThrow, 2)
190 191
191 struct SimplifiedOperatorGlobalCache final { 192 struct SimplifiedOperatorGlobalCache final {
192 #define PURE(Name, properties, input_count) \ 193 #define PURE(Name, properties, input_count) \
193 struct Name##Operator final : public Operator { \ 194 struct Name##Operator final : public Operator { \
194 Name##Operator() \ 195 Name##Operator() \
195 : Operator(IrOpcode::k##Name, Operator::kPure | properties, #Name, \ 196 : Operator(IrOpcode::k##Name, Operator::kPure | properties, #Name, \
196 input_count, 0, 0, 1, 0, 0) {} \ 197 input_count, 0, 0, 1, 0, 0) {} \
197 }; \ 198 }; \
198 Name##Operator k##Name; 199 Name##Operator k##Name;
199 PURE_OP_LIST(PURE) 200 PURE_OP_LIST(PURE)
200 #undef PURE 201 #undef PURE
201 202
203 #define NO_THROW(Name, properties, input_count) \
204 struct Name##Operator final : public Operator { \
205 Name##Operator() \
206 : Operator(IrOpcode::k##Name, Operator::kNoThrow | properties, #Name, \
207 input_count, 1, 1, 1, 1, 0) {} \
208 }; \
209 Name##Operator k##Name;
210 NO_THROW_OP_LIST(NO_THROW)
211 #undef NO_THROW
212
202 #define BUFFER_ACCESS(Type, type, TYPE, ctype, size) \ 213 #define BUFFER_ACCESS(Type, type, TYPE, ctype, size) \
203 struct LoadBuffer##Type##Operator final : public Operator1<BufferAccess> { \ 214 struct LoadBuffer##Type##Operator final : public Operator1<BufferAccess> { \
204 LoadBuffer##Type##Operator() \ 215 LoadBuffer##Type##Operator() \
205 : Operator1<BufferAccess>(IrOpcode::kLoadBuffer, \ 216 : Operator1<BufferAccess>(IrOpcode::kLoadBuffer, \
206 Operator::kNoThrow | Operator::kNoWrite, \ 217 Operator::kNoThrow | Operator::kNoWrite, \
207 "LoadBuffer", 3, 1, 1, 1, 1, 0, \ 218 "LoadBuffer", 3, 1, 1, 1, 1, 0, \
208 BufferAccess(kExternal##Type##Array)) {} \ 219 BufferAccess(kExternal##Type##Array)) {} \
209 }; \ 220 }; \
210 struct StoreBuffer##Type##Operator final : public Operator1<BufferAccess> { \ 221 struct StoreBuffer##Type##Operator final : public Operator1<BufferAccess> { \
211 StoreBuffer##Type##Operator() \ 222 StoreBuffer##Type##Operator() \
(...skipping 10 matching lines...) Expand all
222 233
223 234
224 static base::LazyInstance<SimplifiedOperatorGlobalCache>::type kCache = 235 static base::LazyInstance<SimplifiedOperatorGlobalCache>::type kCache =
225 LAZY_INSTANCE_INITIALIZER; 236 LAZY_INSTANCE_INITIALIZER;
226 237
227 238
228 SimplifiedOperatorBuilder::SimplifiedOperatorBuilder(Zone* zone) 239 SimplifiedOperatorBuilder::SimplifiedOperatorBuilder(Zone* zone)
229 : cache_(kCache.Get()), zone_(zone) {} 240 : cache_(kCache.Get()), zone_(zone) {}
230 241
231 242
232 #define PURE(Name, properties, input_count) \ 243 #define GET_FROM_CACHE(Name, properties, input_count) \
233 const Operator* SimplifiedOperatorBuilder::Name() { return &cache_.k##Name; } 244 const Operator* SimplifiedOperatorBuilder::Name() { return &cache_.k##Name; }
234 PURE_OP_LIST(PURE) 245 PURE_OP_LIST(GET_FROM_CACHE)
235 #undef PURE 246 NO_THROW_OP_LIST(GET_FROM_CACHE)
247 #undef GET_FROM_CACHE
236 248
237 249
238 const Operator* SimplifiedOperatorBuilder::ReferenceEqual(Type* type) { 250 const Operator* SimplifiedOperatorBuilder::ReferenceEqual(Type* type) {
239 // TODO(titzer): What about the type parameter? 251 // TODO(titzer): What about the type parameter?
240 return new (zone()) Operator(IrOpcode::kReferenceEqual, 252 return new (zone()) Operator(IrOpcode::kReferenceEqual,
241 Operator::kCommutative | Operator::kPure, 253 Operator::kCommutative | Operator::kPure,
242 "ReferenceEqual", 2, 0, 0, 1, 0, 0); 254 "ReferenceEqual", 2, 0, 0, 1, 0, 0);
243 } 255 }
244 256
245 257
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \ 302 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \
291 #Name, value_input_count, 1, control_input_count, \ 303 #Name, value_input_count, 1, control_input_count, \
292 output_count, 1, 0, access); \ 304 output_count, 1, 0, access); \
293 } 305 }
294 ACCESS_OP_LIST(ACCESS) 306 ACCESS_OP_LIST(ACCESS)
295 #undef ACCESS 307 #undef ACCESS
296 308
297 } // namespace compiler 309 } // namespace compiler
298 } // namespace internal 310 } // namespace internal
299 } // namespace v8 311 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/simplified-lowering.cc ('k') | test/cctest/compiler/test-js-typed-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698