| 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-inl.h" | 10 #include "src/types-inl.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 DCHECK_NOT_NULL(op); | 145 DCHECK_NOT_NULL(op); |
| 146 DCHECK(op->opcode() == IrOpcode::kLoadField || | 146 DCHECK(op->opcode() == IrOpcode::kLoadField || |
| 147 op->opcode() == IrOpcode::kStoreField); | 147 op->opcode() == IrOpcode::kStoreField); |
| 148 return OpParameter<FieldAccess>(op); | 148 return OpParameter<FieldAccess>(op); |
| 149 } | 149 } |
| 150 | 150 |
| 151 | 151 |
| 152 const ElementAccess& ElementAccessOf(const Operator* op) { | 152 const ElementAccess& ElementAccessOf(const Operator* op) { |
| 153 DCHECK_NOT_NULL(op); | 153 DCHECK_NOT_NULL(op); |
| 154 DCHECK(op->opcode() == IrOpcode::kLoadElement || | 154 DCHECK(op->opcode() == IrOpcode::kLoadElement || |
| 155 op->opcode() == IrOpcode::kLoadElementAtomic || |
| 155 op->opcode() == IrOpcode::kStoreElement); | 156 op->opcode() == IrOpcode::kStoreElement); |
| 156 return OpParameter<ElementAccess>(op); | 157 return OpParameter<ElementAccess>(op); |
| 157 } | 158 } |
| 158 | 159 |
| 159 | 160 |
| 160 #define PURE_OP_LIST(V) \ | 161 #define PURE_OP_LIST(V) \ |
| 161 V(BooleanNot, Operator::kNoProperties, 1) \ | 162 V(BooleanNot, Operator::kNoProperties, 1) \ |
| 162 V(BooleanToNumber, Operator::kNoProperties, 1) \ | 163 V(BooleanToNumber, Operator::kNoProperties, 1) \ |
| 163 V(NumberEqual, Operator::kCommutative, 2) \ | 164 V(NumberEqual, Operator::kCommutative, 2) \ |
| 164 V(NumberLessThan, Operator::kNoProperties, 2) \ | 165 V(NumberLessThan, Operator::kNoProperties, 2) \ |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 case kExternal##Type##Array: \ | 269 case kExternal##Type##Array: \ |
| 269 return &cache_.kStoreBuffer##Type; | 270 return &cache_.kStoreBuffer##Type; |
| 270 TYPED_ARRAYS(STORE_BUFFER) | 271 TYPED_ARRAYS(STORE_BUFFER) |
| 271 #undef STORE_BUFFER | 272 #undef STORE_BUFFER |
| 272 } | 273 } |
| 273 UNREACHABLE(); | 274 UNREACHABLE(); |
| 274 return nullptr; | 275 return nullptr; |
| 275 } | 276 } |
| 276 | 277 |
| 277 | 278 |
| 278 #define ACCESS_OP_LIST(V) \ | 279 #define ACCESS_OP_LIST(V) \ |
| 279 V(LoadField, FieldAccess, Operator::kNoWrite, 1, 1, 1) \ | 280 V(LoadField, FieldAccess, Operator::kNoWrite, 1, 1, 1) \ |
| 280 V(StoreField, FieldAccess, Operator::kNoRead, 2, 1, 0) \ | 281 V(StoreField, FieldAccess, Operator::kNoRead, 2, 1, 0) \ |
| 281 V(LoadElement, ElementAccess, Operator::kNoWrite, 2, 1, 1) \ | 282 V(LoadElement, ElementAccess, Operator::kNoWrite, 2, 1, 1) \ |
| 283 V(LoadElementAtomic, ElementAccess, Operator::kNoWrite, 2, 1, 1) \ |
| 282 V(StoreElement, ElementAccess, Operator::kNoRead, 3, 1, 0) | 284 V(StoreElement, ElementAccess, Operator::kNoRead, 3, 1, 0) |
| 283 | 285 |
| 284 | 286 |
| 285 #define ACCESS(Name, Type, properties, value_input_count, control_input_count, \ | 287 #define ACCESS(Name, Type, properties, value_input_count, control_input_count, \ |
| 286 output_count) \ | 288 output_count) \ |
| 287 const Operator* SimplifiedOperatorBuilder::Name(const Type& access) { \ | 289 const Operator* SimplifiedOperatorBuilder::Name(const Type& access) { \ |
| 288 return new (zone()) \ | 290 return new (zone()) \ |
| 289 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \ | 291 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \ |
| 290 #Name, value_input_count, 1, control_input_count, \ | 292 #Name, value_input_count, 1, control_input_count, \ |
| 291 output_count, 1, 0, access); \ | 293 output_count, 1, 0, access); \ |
| 292 } | 294 } |
| 293 ACCESS_OP_LIST(ACCESS) | 295 ACCESS_OP_LIST(ACCESS) |
| 294 #undef ACCESS | 296 #undef ACCESS |
| 295 | 297 |
| 296 } // namespace compiler | 298 } // namespace compiler |
| 297 } // namespace internal | 299 } // namespace internal |
| 298 } // namespace v8 | 300 } // namespace v8 |
| OLD | NEW |