OLD | NEW |
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.h" | 10 #include "src/types.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 #define PURE(Name, properties, input_count) \ | 207 #define PURE(Name, properties, input_count) \ |
208 struct Name##Operator final : public Operator { \ | 208 struct Name##Operator final : public Operator { \ |
209 Name##Operator() \ | 209 Name##Operator() \ |
210 : Operator(IrOpcode::k##Name, Operator::kPure | properties, #Name, \ | 210 : Operator(IrOpcode::k##Name, Operator::kPure | properties, #Name, \ |
211 input_count, 0, 0, 1, 0, 0) {} \ | 211 input_count, 0, 0, 1, 0, 0) {} \ |
212 }; \ | 212 }; \ |
213 Name##Operator k##Name; | 213 Name##Operator k##Name; |
214 PURE_OP_LIST(PURE) | 214 PURE_OP_LIST(PURE) |
215 #undef PURE | 215 #undef PURE |
216 | 216 |
| 217 template <PretenureFlag kPretenure> |
| 218 struct AllocateOperator final : public Operator1<PretenureFlag> { |
| 219 AllocateOperator() |
| 220 : Operator1<PretenureFlag>(IrOpcode::kAllocate, Operator::kNoThrow, |
| 221 "Allocate", 1, 1, 1, 1, 1, 0, kPretenure) {} |
| 222 }; |
| 223 AllocateOperator<NOT_TENURED> kAllocateNotTenuredOperator; |
| 224 AllocateOperator<TENURED> kAllocateTenuredOperator; |
| 225 |
217 #define BUFFER_ACCESS(Type, type, TYPE, ctype, size) \ | 226 #define BUFFER_ACCESS(Type, type, TYPE, ctype, size) \ |
218 struct LoadBuffer##Type##Operator final : public Operator1<BufferAccess> { \ | 227 struct LoadBuffer##Type##Operator final : public Operator1<BufferAccess> { \ |
219 LoadBuffer##Type##Operator() \ | 228 LoadBuffer##Type##Operator() \ |
220 : Operator1<BufferAccess>(IrOpcode::kLoadBuffer, \ | 229 : Operator1<BufferAccess>(IrOpcode::kLoadBuffer, \ |
221 Operator::kNoThrow | Operator::kNoWrite, \ | 230 Operator::kNoThrow | Operator::kNoWrite, \ |
222 "LoadBuffer", 3, 1, 1, 1, 1, 0, \ | 231 "LoadBuffer", 3, 1, 1, 1, 1, 0, \ |
223 BufferAccess(kExternal##Type##Array)) {} \ | 232 BufferAccess(kExternal##Type##Array)) {} \ |
224 }; \ | 233 }; \ |
225 struct StoreBuffer##Type##Operator final : public Operator1<BufferAccess> { \ | 234 struct StoreBuffer##Type##Operator final : public Operator1<BufferAccess> { \ |
226 StoreBuffer##Type##Operator() \ | 235 StoreBuffer##Type##Operator() \ |
(...skipping 24 matching lines...) Expand all Loading... |
251 | 260 |
252 | 261 |
253 const Operator* SimplifiedOperatorBuilder::ReferenceEqual(Type* type) { | 262 const Operator* SimplifiedOperatorBuilder::ReferenceEqual(Type* type) { |
254 return new (zone()) Operator(IrOpcode::kReferenceEqual, | 263 return new (zone()) Operator(IrOpcode::kReferenceEqual, |
255 Operator::kCommutative | Operator::kPure, | 264 Operator::kCommutative | Operator::kPure, |
256 "ReferenceEqual", 2, 0, 0, 1, 0, 0); | 265 "ReferenceEqual", 2, 0, 0, 1, 0, 0); |
257 } | 266 } |
258 | 267 |
259 | 268 |
260 const Operator* SimplifiedOperatorBuilder::Allocate(PretenureFlag pretenure) { | 269 const Operator* SimplifiedOperatorBuilder::Allocate(PretenureFlag pretenure) { |
261 return new (zone()) | 270 switch (pretenure) { |
262 Operator1<PretenureFlag>(IrOpcode::kAllocate, Operator::kNoThrow, | 271 case NOT_TENURED: |
263 "Allocate", 1, 1, 1, 1, 1, 0, pretenure); | 272 return &cache_.kAllocateNotTenuredOperator; |
| 273 case TENURED: |
| 274 return &cache_.kAllocateTenuredOperator; |
| 275 } |
| 276 UNREACHABLE(); |
| 277 return nullptr; |
264 } | 278 } |
265 | 279 |
266 | 280 |
267 const Operator* SimplifiedOperatorBuilder::LoadBuffer(BufferAccess access) { | 281 const Operator* SimplifiedOperatorBuilder::LoadBuffer(BufferAccess access) { |
268 switch (access.external_array_type()) { | 282 switch (access.external_array_type()) { |
269 #define LOAD_BUFFER(Type, type, TYPE, ctype, size) \ | 283 #define LOAD_BUFFER(Type, type, TYPE, ctype, size) \ |
270 case kExternal##Type##Array: \ | 284 case kExternal##Type##Array: \ |
271 return &cache_.kLoadBuffer##Type; | 285 return &cache_.kLoadBuffer##Type; |
272 TYPED_ARRAYS(LOAD_BUFFER) | 286 TYPED_ARRAYS(LOAD_BUFFER) |
273 #undef LOAD_BUFFER | 287 #undef LOAD_BUFFER |
(...skipping 30 matching lines...) Expand all Loading... |
304 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \ | 318 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \ |
305 #Name, value_input_count, 1, control_input_count, \ | 319 #Name, value_input_count, 1, control_input_count, \ |
306 output_count, 1, 0, access); \ | 320 output_count, 1, 0, access); \ |
307 } | 321 } |
308 ACCESS_OP_LIST(ACCESS) | 322 ACCESS_OP_LIST(ACCESS) |
309 #undef ACCESS | 323 #undef ACCESS |
310 | 324 |
311 } // namespace compiler | 325 } // namespace compiler |
312 } // namespace internal | 326 } // namespace internal |
313 } // namespace v8 | 327 } // namespace v8 |
OLD | NEW |