| 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 <ostream> // NOLINT(readability/streams) |
| 8 |
| 7 #include "src/base/lazy-instance.h" | 9 #include "src/base/lazy-instance.h" |
| 8 #include "src/compiler/opcodes.h" | 10 #include "src/compiler/opcodes.h" |
| 9 #include "src/compiler/operator.h" | 11 #include "src/compiler/operator.h" |
| 10 #include "src/types-inl.h" | 12 #include "src/types-inl.h" |
| 11 | 13 |
| 12 namespace v8 { | 14 namespace v8 { |
| 13 namespace internal { | 15 namespace internal { |
| 14 namespace compiler { | 16 namespace compiler { |
| 15 | 17 |
| 16 std::ostream& operator<<(std::ostream& os, BaseTaggedness base_taggedness) { | 18 std::ostream& operator<<(std::ostream& os, BaseTaggedness base_taggedness) { |
| 17 switch (base_taggedness) { | 19 switch (base_taggedness) { |
| 18 case kUntaggedBase: | 20 case kUntaggedBase: |
| 19 return os << "untagged base"; | 21 return os << "untagged base"; |
| 20 case kTaggedBase: | 22 case kTaggedBase: |
| 21 return os << "tagged base"; | 23 return os << "tagged base"; |
| 22 } | 24 } |
| 23 UNREACHABLE(); | 25 UNREACHABLE(); |
| 24 return os; | 26 return os; |
| 25 } | 27 } |
| 26 | 28 |
| 27 | 29 |
| 30 std::ostream& operator<<(std::ostream& os, BoundsCheckMode bounds_check_mode) { |
| 31 switch (bounds_check_mode) { |
| 32 case kNoBoundsCheck: |
| 33 return os << "no bounds check"; |
| 34 case kTypedArrayBoundsCheck: |
| 35 return os << "ignore out of bounds"; |
| 36 } |
| 37 UNREACHABLE(); |
| 38 return os; |
| 39 } |
| 40 |
| 41 |
| 28 bool operator==(ElementAccess const& lhs, ElementAccess const& rhs) { | 42 bool operator==(ElementAccess const& lhs, ElementAccess const& rhs) { |
| 29 return lhs.base_is_tagged == rhs.base_is_tagged && | 43 return lhs.base_is_tagged == rhs.base_is_tagged && |
| 30 lhs.header_size == rhs.header_size && lhs.type == rhs.type && | 44 lhs.header_size == rhs.header_size && lhs.type == rhs.type && |
| 31 lhs.machine_type == rhs.machine_type; | 45 lhs.machine_type == rhs.machine_type; |
| 32 } | 46 } |
| 33 | 47 |
| 34 | 48 |
| 35 bool operator!=(ElementAccess const& lhs, ElementAccess const& rhs) { | 49 bool operator!=(ElementAccess const& lhs, ElementAccess const& rhs) { |
| 36 return !(lhs == rhs); | 50 return !(lhs == rhs); |
| 37 } | 51 } |
| 38 | 52 |
| 39 | 53 |
| 40 std::ostream& operator<<(std::ostream& os, ElementAccess const& access) { | 54 std::ostream& operator<<(std::ostream& os, ElementAccess const& access) { |
| 41 os << "[" << access.base_is_tagged << ", " << access.header_size << ", "; | 55 os << "[" << access.base_is_tagged << ", " << access.header_size << ", "; |
| 42 access.type->PrintTo(os); | 56 access.type->PrintTo(os); |
| 43 os << ", " << access.machine_type << "]"; | 57 os << ", " << access.machine_type << ", " << access.bounds_check << "]"; |
| 44 return os; | 58 return os; |
| 45 } | 59 } |
| 46 | 60 |
| 47 | 61 |
| 48 const FieldAccess& FieldAccessOf(const Operator* op) { | 62 const FieldAccess& FieldAccessOf(const Operator* op) { |
| 49 DCHECK_NOT_NULL(op); | 63 DCHECK_NOT_NULL(op); |
| 50 DCHECK(op->opcode() == IrOpcode::kLoadField || | 64 DCHECK(op->opcode() == IrOpcode::kLoadField || |
| 51 op->opcode() == IrOpcode::kStoreField); | 65 op->opcode() == IrOpcode::kStoreField); |
| 52 return OpParameter<FieldAccess>(op); | 66 return OpParameter<FieldAccess>(op); |
| 53 } | 67 } |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 return new (zone()) \ | 183 return new (zone()) \ |
| 170 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \ | 184 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \ |
| 171 input_count, output_count, #Name, access); \ | 185 input_count, output_count, #Name, access); \ |
| 172 } | 186 } |
| 173 ACCESS_OP_LIST(ACCESS) | 187 ACCESS_OP_LIST(ACCESS) |
| 174 #undef ACCESS | 188 #undef ACCESS |
| 175 | 189 |
| 176 } // namespace compiler | 190 } // namespace compiler |
| 177 } // namespace internal | 191 } // namespace internal |
| 178 } // namespace v8 | 192 } // namespace v8 |
| OLD | NEW |