OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/js-global-object-specialization.h" | 5 #include "src/compiler/js-global-object-specialization.h" |
6 | 6 |
7 #include "src/compilation-dependencies.h" | 7 #include "src/compilation-dependencies.h" |
8 #include "src/compiler/access-builder.h" | 8 #include "src/compiler/access-builder.h" |
9 #include "src/compiler/common-operator.h" | 9 #include "src/compiler/common-operator.h" |
10 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 graph()->NewNode(simplified()->ReferenceEqual(Type::Tagged()), value, | 172 graph()->NewNode(simplified()->ReferenceEqual(Type::Tagged()), value, |
173 jsgraph()->Constant(property_cell_value)); | 173 jsgraph()->Constant(property_cell_value)); |
174 Node* branch = | 174 Node* branch = |
175 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control); | 175 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control); |
176 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); | 176 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); |
177 Node* deoptimize = | 177 Node* deoptimize = |
178 graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kEager), | 178 graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kEager), |
179 frame_state, effect, if_false); | 179 frame_state, effect, if_false); |
180 // TODO(bmeurer): This should be on the AdvancedReducer somehow. | 180 // TODO(bmeurer): This should be on the AdvancedReducer somehow. |
181 NodeProperties::MergeControlToEnd(graph(), common(), deoptimize); | 181 NodeProperties::MergeControlToEnd(graph(), common(), deoptimize); |
| 182 Revisit(graph()->end()); |
182 control = graph()->NewNode(common()->IfTrue(), branch); | 183 control = graph()->NewNode(common()->IfTrue(), branch); |
183 break; | 184 break; |
184 } | 185 } |
185 case PropertyCellType::kConstantType: { | 186 case PropertyCellType::kConstantType: { |
186 // Record a code dependency on the cell, and just deoptimize if the new | 187 // Record a code dependency on the cell, and just deoptimize if the new |
187 // values' type doesn't match the type of the previous value in the cell. | 188 // values' type doesn't match the type of the previous value in the cell. |
188 dependencies()->AssumePropertyCell(property_cell); | 189 dependencies()->AssumePropertyCell(property_cell); |
189 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value); | 190 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value); |
190 Type* property_cell_value_type = Type::TaggedSigned(); | 191 Type* property_cell_value_type = Type::TaggedSigned(); |
191 if (property_cell_value->IsHeapObject()) { | 192 if (property_cell_value->IsHeapObject()) { |
192 // Deoptimize if the {value} is a Smi. | 193 // Deoptimize if the {value} is a Smi. |
193 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kFalse), | 194 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kFalse), |
194 check, control); | 195 check, control); |
195 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); | 196 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); |
196 Node* deoptimize = | 197 Node* deoptimize = |
197 graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kEager), | 198 graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kEager), |
198 frame_state, effect, if_true); | 199 frame_state, effect, if_true); |
199 // TODO(bmeurer): This should be on the AdvancedReducer somehow. | 200 // TODO(bmeurer): This should be on the AdvancedReducer somehow. |
200 NodeProperties::MergeControlToEnd(graph(), common(), deoptimize); | 201 NodeProperties::MergeControlToEnd(graph(), common(), deoptimize); |
| 202 Revisit(graph()->end()); |
201 control = graph()->NewNode(common()->IfFalse(), branch); | 203 control = graph()->NewNode(common()->IfFalse(), branch); |
202 | 204 |
203 // Load the {value} map check against the {property_cell} map. | 205 // Load the {value} map check against the {property_cell} map. |
204 Node* value_map = effect = | 206 Node* value_map = effect = |
205 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), | 207 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), |
206 value, effect, control); | 208 value, effect, control); |
207 Handle<Map> property_cell_value_map( | 209 Handle<Map> property_cell_value_map( |
208 Handle<HeapObject>::cast(property_cell_value)->map(), isolate()); | 210 Handle<HeapObject>::cast(property_cell_value)->map(), isolate()); |
209 check = graph()->NewNode( | 211 check = graph()->NewNode( |
210 simplified()->ReferenceEqual(Type::Any()), value_map, | 212 simplified()->ReferenceEqual(Type::Any()), value_map, |
211 jsgraph()->HeapConstant(property_cell_value_map)); | 213 jsgraph()->HeapConstant(property_cell_value_map)); |
212 property_cell_value_type = Type::TaggedPointer(); | 214 property_cell_value_type = Type::TaggedPointer(); |
213 } | 215 } |
214 Node* branch = | 216 Node* branch = |
215 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control); | 217 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control); |
216 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); | 218 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); |
217 Node* deoptimize = | 219 Node* deoptimize = |
218 graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kEager), | 220 graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kEager), |
219 frame_state, effect, if_false); | 221 frame_state, effect, if_false); |
220 // TODO(bmeurer): This should be on the AdvancedReducer somehow. | 222 // TODO(bmeurer): This should be on the AdvancedReducer somehow. |
221 NodeProperties::MergeControlToEnd(graph(), common(), deoptimize); | 223 NodeProperties::MergeControlToEnd(graph(), common(), deoptimize); |
| 224 Revisit(graph()->end()); |
222 control = graph()->NewNode(common()->IfTrue(), branch); | 225 control = graph()->NewNode(common()->IfTrue(), branch); |
223 effect = graph()->NewNode( | 226 effect = graph()->NewNode( |
224 simplified()->StoreField( | 227 simplified()->StoreField( |
225 AccessBuilder::ForPropertyCellValue(property_cell_value_type)), | 228 AccessBuilder::ForPropertyCellValue(property_cell_value_type)), |
226 jsgraph()->HeapConstant(property_cell), value, effect, control); | 229 jsgraph()->HeapConstant(property_cell), value, effect, control); |
227 break; | 230 break; |
228 } | 231 } |
229 case PropertyCellType::kMutable: { | 232 case PropertyCellType::kMutable: { |
230 // Store to non-configurable, data property on the global can be lowered | 233 // Store to non-configurable, data property on the global can be lowered |
231 // to a field store, even without recording a code dependency on the cell, | 234 // to a field store, even without recording a code dependency on the cell, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 } | 297 } |
295 | 298 |
296 | 299 |
297 SimplifiedOperatorBuilder* JSGlobalObjectSpecialization::simplified() const { | 300 SimplifiedOperatorBuilder* JSGlobalObjectSpecialization::simplified() const { |
298 return jsgraph()->simplified(); | 301 return jsgraph()->simplified(); |
299 } | 302 } |
300 | 303 |
301 } // namespace compiler | 304 } // namespace compiler |
302 } // namespace internal | 305 } // namespace internal |
303 } // namespace v8 | 306 } // namespace v8 |
OLD | NEW |