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" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 namespace compiler { | 14 namespace compiler { |
15 | 15 |
| 16 size_t hash_value(BaseTaggedness base_taggedness) { |
| 17 return static_cast<uint8_t>(base_taggedness); |
| 18 } |
| 19 |
16 std::ostream& operator<<(std::ostream& os, BaseTaggedness base_taggedness) { | 20 std::ostream& operator<<(std::ostream& os, BaseTaggedness base_taggedness) { |
17 switch (base_taggedness) { | 21 switch (base_taggedness) { |
18 case kUntaggedBase: | 22 case kUntaggedBase: |
19 return os << "untagged base"; | 23 return os << "untagged base"; |
20 case kTaggedBase: | 24 case kTaggedBase: |
21 return os << "tagged base"; | 25 return os << "tagged base"; |
22 } | 26 } |
23 UNREACHABLE(); | 27 UNREACHABLE(); |
24 return os; | 28 return os; |
25 } | 29 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 81 |
78 | 82 |
79 BufferAccess const BufferAccessOf(const Operator* op) { | 83 BufferAccess const BufferAccessOf(const Operator* op) { |
80 DCHECK(op->opcode() == IrOpcode::kLoadBuffer || | 84 DCHECK(op->opcode() == IrOpcode::kLoadBuffer || |
81 op->opcode() == IrOpcode::kStoreBuffer); | 85 op->opcode() == IrOpcode::kStoreBuffer); |
82 return OpParameter<BufferAccess>(op); | 86 return OpParameter<BufferAccess>(op); |
83 } | 87 } |
84 | 88 |
85 | 89 |
86 bool operator==(FieldAccess const& lhs, FieldAccess const& rhs) { | 90 bool operator==(FieldAccess const& lhs, FieldAccess const& rhs) { |
| 91 // On purpose we don't include the write barrier kind here, as this method is |
| 92 // really only relevant for eliminating loads and they don't care about the |
| 93 // write barrier mode. |
87 return lhs.base_is_tagged == rhs.base_is_tagged && lhs.offset == rhs.offset && | 94 return lhs.base_is_tagged == rhs.base_is_tagged && lhs.offset == rhs.offset && |
88 lhs.machine_type == rhs.machine_type; | 95 lhs.machine_type == rhs.machine_type; |
89 } | 96 } |
90 | 97 |
91 | 98 |
92 bool operator!=(FieldAccess const& lhs, FieldAccess const& rhs) { | 99 bool operator!=(FieldAccess const& lhs, FieldAccess const& rhs) { |
93 return !(lhs == rhs); | 100 return !(lhs == rhs); |
94 } | 101 } |
95 | 102 |
96 | 103 |
97 size_t hash_value(FieldAccess const& access) { | 104 size_t hash_value(FieldAccess const& access) { |
| 105 // On purpose we don't include the write barrier kind here, as this method is |
| 106 // really only relevant for eliminating loads and they don't care about the |
| 107 // write barrier mode. |
98 return base::hash_combine(access.base_is_tagged, access.offset, | 108 return base::hash_combine(access.base_is_tagged, access.offset, |
99 access.machine_type); | 109 access.machine_type); |
100 } | 110 } |
101 | 111 |
102 | 112 |
103 std::ostream& operator<<(std::ostream& os, FieldAccess const& access) { | 113 std::ostream& operator<<(std::ostream& os, FieldAccess const& access) { |
104 os << "[" << access.base_is_tagged << ", " << access.offset << ", "; | 114 os << "[" << access.base_is_tagged << ", " << access.offset << ", "; |
105 #ifdef OBJECT_PRINT | 115 #ifdef OBJECT_PRINT |
106 Handle<Name> name; | 116 Handle<Name> name; |
107 if (access.name.ToHandle(&name)) { | 117 if (access.name.ToHandle(&name)) { |
108 name->Print(os); | 118 name->Print(os); |
109 os << ", "; | 119 os << ", "; |
110 } | 120 } |
111 #endif | 121 #endif |
112 access.type->PrintTo(os); | 122 access.type->PrintTo(os); |
113 os << ", " << access.machine_type << "]"; | 123 os << ", " << access.machine_type << ", " << access.write_barrier_kind << "]"; |
114 return os; | 124 return os; |
115 } | 125 } |
116 | 126 |
117 | 127 |
118 bool operator==(ElementAccess const& lhs, ElementAccess const& rhs) { | 128 bool operator==(ElementAccess const& lhs, ElementAccess const& rhs) { |
| 129 // On purpose we don't include the write barrier kind here, as this method is |
| 130 // really only relevant for eliminating loads and they don't care about the |
| 131 // write barrier mode. |
119 return lhs.base_is_tagged == rhs.base_is_tagged && | 132 return lhs.base_is_tagged == rhs.base_is_tagged && |
120 lhs.header_size == rhs.header_size && | 133 lhs.header_size == rhs.header_size && |
121 lhs.machine_type == rhs.machine_type; | 134 lhs.machine_type == rhs.machine_type; |
122 } | 135 } |
123 | 136 |
124 | 137 |
125 bool operator!=(ElementAccess const& lhs, ElementAccess const& rhs) { | 138 bool operator!=(ElementAccess const& lhs, ElementAccess const& rhs) { |
126 return !(lhs == rhs); | 139 return !(lhs == rhs); |
127 } | 140 } |
128 | 141 |
129 | 142 |
130 size_t hash_value(ElementAccess const& access) { | 143 size_t hash_value(ElementAccess const& access) { |
| 144 // On purpose we don't include the write barrier kind here, as this method is |
| 145 // really only relevant for eliminating loads and they don't care about the |
| 146 // write barrier mode. |
131 return base::hash_combine(access.base_is_tagged, access.header_size, | 147 return base::hash_combine(access.base_is_tagged, access.header_size, |
132 access.machine_type); | 148 access.machine_type); |
133 } | 149 } |
134 | 150 |
135 | 151 |
136 std::ostream& operator<<(std::ostream& os, ElementAccess const& access) { | 152 std::ostream& operator<<(std::ostream& os, ElementAccess const& access) { |
137 os << access.base_is_tagged << ", " << access.header_size << ", "; | 153 os << access.base_is_tagged << ", " << access.header_size << ", "; |
138 access.type->PrintTo(os); | 154 access.type->PrintTo(os); |
139 os << ", " << access.machine_type; | 155 os << ", " << access.machine_type << ", " << access.write_barrier_kind; |
140 return os; | 156 return os; |
141 } | 157 } |
142 | 158 |
143 | 159 |
144 const FieldAccess& FieldAccessOf(const Operator* op) { | 160 const FieldAccess& FieldAccessOf(const Operator* op) { |
145 DCHECK_NOT_NULL(op); | 161 DCHECK_NOT_NULL(op); |
146 DCHECK(op->opcode() == IrOpcode::kLoadField || | 162 DCHECK(op->opcode() == IrOpcode::kLoadField || |
147 op->opcode() == IrOpcode::kStoreField); | 163 op->opcode() == IrOpcode::kStoreField); |
148 return OpParameter<FieldAccess>(op); | 164 return OpParameter<FieldAccess>(op); |
149 } | 165 } |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \ | 334 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \ |
319 #Name, value_input_count, 1, control_input_count, \ | 335 #Name, value_input_count, 1, control_input_count, \ |
320 output_count, 1, 0, access); \ | 336 output_count, 1, 0, access); \ |
321 } | 337 } |
322 ACCESS_OP_LIST(ACCESS) | 338 ACCESS_OP_LIST(ACCESS) |
323 #undef ACCESS | 339 #undef ACCESS |
324 | 340 |
325 } // namespace compiler | 341 } // namespace compiler |
326 } // namespace internal | 342 } // namespace internal |
327 } // namespace v8 | 343 } // namespace v8 |
OLD | NEW |