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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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) { |
87 return lhs.base_is_tagged == rhs.base_is_tagged && lhs.offset == rhs.offset && | 91 return lhs.base_is_tagged == rhs.base_is_tagged && lhs.offset == rhs.offset && |
88 lhs.machine_type == rhs.machine_type; | 92 lhs.machine_type == rhs.machine_type; |
Michael Starzinger
2016/05/02 17:20:37
nit: Can we play it safe and also compare and hash
Benedikt Meurer
2016/05/03 09:05:14
Done.
| |
89 } | 93 } |
90 | 94 |
91 | 95 |
92 bool operator!=(FieldAccess const& lhs, FieldAccess const& rhs) { | 96 bool operator!=(FieldAccess const& lhs, FieldAccess const& rhs) { |
93 return !(lhs == rhs); | 97 return !(lhs == rhs); |
94 } | 98 } |
95 | 99 |
96 | 100 |
97 size_t hash_value(FieldAccess const& access) { | 101 size_t hash_value(FieldAccess const& access) { |
98 return base::hash_combine(access.base_is_tagged, access.offset, | 102 return base::hash_combine(access.base_is_tagged, access.offset, |
Michael Starzinger
2016/05/02 17:20:37
nit: Likewise.
Benedikt Meurer
2016/05/03 09:05:14
Done.
| |
99 access.machine_type); | 103 access.machine_type); |
100 } | 104 } |
101 | 105 |
102 | 106 |
103 std::ostream& operator<<(std::ostream& os, FieldAccess const& access) { | 107 std::ostream& operator<<(std::ostream& os, FieldAccess const& access) { |
104 os << "[" << access.base_is_tagged << ", " << access.offset << ", "; | 108 os << "[" << access.base_is_tagged << ", " << access.offset << ", "; |
105 #ifdef OBJECT_PRINT | 109 #ifdef OBJECT_PRINT |
106 Handle<Name> name; | 110 Handle<Name> name; |
107 if (access.name.ToHandle(&name)) { | 111 if (access.name.ToHandle(&name)) { |
108 name->Print(os); | 112 name->Print(os); |
109 os << ", "; | 113 os << ", "; |
110 } | 114 } |
111 #endif | 115 #endif |
112 access.type->PrintTo(os); | 116 access.type->PrintTo(os); |
113 os << ", " << access.machine_type << "]"; | 117 os << ", " << access.machine_type << ", " << access.write_barrier_kind << "]"; |
114 return os; | 118 return os; |
115 } | 119 } |
116 | 120 |
117 | 121 |
118 bool operator==(ElementAccess const& lhs, ElementAccess const& rhs) { | 122 bool operator==(ElementAccess const& lhs, ElementAccess const& rhs) { |
119 return lhs.base_is_tagged == rhs.base_is_tagged && | 123 return lhs.base_is_tagged == rhs.base_is_tagged && |
120 lhs.header_size == rhs.header_size && | 124 lhs.header_size == rhs.header_size && |
121 lhs.machine_type == rhs.machine_type; | 125 lhs.machine_type == rhs.machine_type; |
Michael Starzinger
2016/05/02 17:20:37
nit: Likewise.
Benedikt Meurer
2016/05/03 09:05:14
Done.
| |
122 } | 126 } |
123 | 127 |
124 | 128 |
125 bool operator!=(ElementAccess const& lhs, ElementAccess const& rhs) { | 129 bool operator!=(ElementAccess const& lhs, ElementAccess const& rhs) { |
126 return !(lhs == rhs); | 130 return !(lhs == rhs); |
127 } | 131 } |
128 | 132 |
129 | 133 |
130 size_t hash_value(ElementAccess const& access) { | 134 size_t hash_value(ElementAccess const& access) { |
131 return base::hash_combine(access.base_is_tagged, access.header_size, | 135 return base::hash_combine(access.base_is_tagged, access.header_size, |
Michael Starzinger
2016/05/02 17:20:37
nit: Likewise.
Benedikt Meurer
2016/05/03 09:05:14
Done.
| |
132 access.machine_type); | 136 access.machine_type); |
133 } | 137 } |
134 | 138 |
135 | 139 |
136 std::ostream& operator<<(std::ostream& os, ElementAccess const& access) { | 140 std::ostream& operator<<(std::ostream& os, ElementAccess const& access) { |
137 os << access.base_is_tagged << ", " << access.header_size << ", "; | 141 os << access.base_is_tagged << ", " << access.header_size << ", "; |
138 access.type->PrintTo(os); | 142 access.type->PrintTo(os); |
139 os << ", " << access.machine_type; | 143 os << ", " << access.machine_type << ", " << access.write_barrier_kind; |
140 return os; | 144 return os; |
141 } | 145 } |
142 | 146 |
143 | 147 |
144 const FieldAccess& FieldAccessOf(const Operator* op) { | 148 const FieldAccess& FieldAccessOf(const Operator* op) { |
145 DCHECK_NOT_NULL(op); | 149 DCHECK_NOT_NULL(op); |
146 DCHECK(op->opcode() == IrOpcode::kLoadField || | 150 DCHECK(op->opcode() == IrOpcode::kLoadField || |
147 op->opcode() == IrOpcode::kStoreField); | 151 op->opcode() == IrOpcode::kStoreField); |
148 return OpParameter<FieldAccess>(op); | 152 return OpParameter<FieldAccess>(op); |
149 } | 153 } |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
318 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \ | 322 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \ |
319 #Name, value_input_count, 1, control_input_count, \ | 323 #Name, value_input_count, 1, control_input_count, \ |
320 output_count, 1, 0, access); \ | 324 output_count, 1, 0, access); \ |
321 } | 325 } |
322 ACCESS_OP_LIST(ACCESS) | 326 ACCESS_OP_LIST(ACCESS) |
323 #undef ACCESS | 327 #undef ACCESS |
324 | 328 |
325 } // namespace compiler | 329 } // namespace compiler |
326 } // namespace internal | 330 } // namespace internal |
327 } // namespace v8 | 331 } // namespace v8 |
OLD | NEW |