| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 } | 174 } |
| 175 | 175 |
| 176 | 176 |
| 177 const ElementAccess& ElementAccessOf(const Operator* op) { | 177 const ElementAccess& ElementAccessOf(const Operator* op) { |
| 178 DCHECK_NOT_NULL(op); | 178 DCHECK_NOT_NULL(op); |
| 179 DCHECK(op->opcode() == IrOpcode::kLoadElement || | 179 DCHECK(op->opcode() == IrOpcode::kLoadElement || |
| 180 op->opcode() == IrOpcode::kStoreElement); | 180 op->opcode() == IrOpcode::kStoreElement); |
| 181 return OpParameter<ElementAccess>(op); | 181 return OpParameter<ElementAccess>(op); |
| 182 } | 182 } |
| 183 | 183 |
| 184 ExternalArrayType ExternalArrayTypeOf(const Operator* op) { |
| 185 DCHECK(op->opcode() == IrOpcode::kLoadTypedElement || |
| 186 op->opcode() == IrOpcode::kStoreTypedElement); |
| 187 return OpParameter<ExternalArrayType>(op); |
| 188 } |
| 189 |
| 184 size_t hash_value(CheckFloat64HoleMode mode) { | 190 size_t hash_value(CheckFloat64HoleMode mode) { |
| 185 return static_cast<size_t>(mode); | 191 return static_cast<size_t>(mode); |
| 186 } | 192 } |
| 187 | 193 |
| 188 std::ostream& operator<<(std::ostream& os, CheckFloat64HoleMode mode) { | 194 std::ostream& operator<<(std::ostream& os, CheckFloat64HoleMode mode) { |
| 189 switch (mode) { | 195 switch (mode) { |
| 190 case CheckFloat64HoleMode::kAllowReturnHole: | 196 case CheckFloat64HoleMode::kAllowReturnHole: |
| 191 return os << "allow-return-hole"; | 197 return os << "allow-return-hole"; |
| 192 case CheckFloat64HoleMode::kNeverReturnHole: | 198 case CheckFloat64HoleMode::kNeverReturnHole: |
| 193 return os << "never-return-hole"; | 199 return os << "never-return-hole"; |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 } | 633 } |
| 628 | 634 |
| 629 const Operator* SimplifiedOperatorBuilder::SpeculativeNumberLessThanOrEqual( | 635 const Operator* SimplifiedOperatorBuilder::SpeculativeNumberLessThanOrEqual( |
| 630 CompareOperationHints::Hint hint) { | 636 CompareOperationHints::Hint hint) { |
| 631 return new (zone()) Operator1<CompareOperationHints::Hint>( | 637 return new (zone()) Operator1<CompareOperationHints::Hint>( |
| 632 IrOpcode::kSpeculativeNumberLessThanOrEqual, | 638 IrOpcode::kSpeculativeNumberLessThanOrEqual, |
| 633 Operator::kFoldable | Operator::kNoThrow, | 639 Operator::kFoldable | Operator::kNoThrow, |
| 634 "SpeculativeNumberLessThanOrEqual", 2, 1, 1, 1, 1, 0, hint); | 640 "SpeculativeNumberLessThanOrEqual", 2, 1, 1, 1, 1, 0, hint); |
| 635 } | 641 } |
| 636 | 642 |
| 637 #define ACCESS_OP_LIST(V) \ | 643 #define ACCESS_OP_LIST(V) \ |
| 638 V(LoadField, FieldAccess, Operator::kNoWrite, 1, 1, 1) \ | 644 V(LoadField, FieldAccess, Operator::kNoWrite, 1, 1, 1) \ |
| 639 V(StoreField, FieldAccess, Operator::kNoRead, 2, 1, 0) \ | 645 V(StoreField, FieldAccess, Operator::kNoRead, 2, 1, 0) \ |
| 640 V(LoadElement, ElementAccess, Operator::kNoWrite, 2, 1, 1) \ | 646 V(LoadElement, ElementAccess, Operator::kNoWrite, 2, 1, 1) \ |
| 641 V(StoreElement, ElementAccess, Operator::kNoRead, 3, 1, 0) | 647 V(StoreElement, ElementAccess, Operator::kNoRead, 3, 1, 0) \ |
| 648 V(LoadTypedElement, ExternalArrayType, Operator::kNoWrite, 4, 1, 1) \ |
| 649 V(StoreTypedElement, ExternalArrayType, Operator::kNoRead, 5, 1, 0) |
| 642 | 650 |
| 643 #define ACCESS(Name, Type, properties, value_input_count, control_input_count, \ | 651 #define ACCESS(Name, Type, properties, value_input_count, control_input_count, \ |
| 644 output_count) \ | 652 output_count) \ |
| 645 const Operator* SimplifiedOperatorBuilder::Name(const Type& access) { \ | 653 const Operator* SimplifiedOperatorBuilder::Name(const Type& access) { \ |
| 646 return new (zone()) \ | 654 return new (zone()) \ |
| 647 Operator1<Type>(IrOpcode::k##Name, \ | 655 Operator1<Type>(IrOpcode::k##Name, \ |
| 648 Operator::kNoDeopt | Operator::kNoThrow | properties, \ | 656 Operator::kNoDeopt | Operator::kNoThrow | properties, \ |
| 649 #Name, value_input_count, 1, control_input_count, \ | 657 #Name, value_input_count, 1, control_input_count, \ |
| 650 output_count, 1, 0, access); \ | 658 output_count, 1, 0, access); \ |
| 651 } | 659 } |
| 652 ACCESS_OP_LIST(ACCESS) | 660 ACCESS_OP_LIST(ACCESS) |
| 653 #undef ACCESS | 661 #undef ACCESS |
| 654 | 662 |
| 655 } // namespace compiler | 663 } // namespace compiler |
| 656 } // namespace internal | 664 } // namespace internal |
| 657 } // namespace v8 | 665 } // namespace v8 |
| OLD | NEW |