Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: src/compiler/js-global-object-specialization.cc

Issue 1721103003: [turbofan] Introduce DeoptimizeIf And DeoptimizeUnless common operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/js-generic-lowering.cc ('k') | src/compiler/js-native-context-specialization.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 case PropertyCellType::kUndefined: { 164 case PropertyCellType::kUndefined: {
165 return NoChange(); 165 return NoChange();
166 } 166 }
167 case PropertyCellType::kConstant: { 167 case PropertyCellType::kConstant: {
168 // Record a code dependency on the cell, and just deoptimize if the new 168 // Record a code dependency on the cell, and just deoptimize if the new
169 // value doesn't match the previous value stored inside the cell. 169 // value doesn't match the previous value stored inside the cell.
170 dependencies()->AssumePropertyCell(property_cell); 170 dependencies()->AssumePropertyCell(property_cell);
171 Node* check = 171 Node* check =
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 control = graph()->NewNode(common()->DeoptimizeUnless(), check,
175 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control); 175 frame_state, effect, control);
176 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
177 Node* deoptimize =
178 graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kEager),
179 frame_state, effect, if_false);
180 // TODO(bmeurer): This should be on the AdvancedReducer somehow.
181 NodeProperties::MergeControlToEnd(graph(), common(), deoptimize);
182 Revisit(graph()->end());
183 control = graph()->NewNode(common()->IfTrue(), branch);
184 break; 176 break;
185 } 177 }
186 case PropertyCellType::kConstantType: { 178 case PropertyCellType::kConstantType: {
187 // Record a code dependency on the cell, and just deoptimize if the new 179 // Record a code dependency on the cell, and just deoptimize if the new
188 // values' type doesn't match the type of the previous value in the cell. 180 // values' type doesn't match the type of the previous value in the cell.
189 dependencies()->AssumePropertyCell(property_cell); 181 dependencies()->AssumePropertyCell(property_cell);
190 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value); 182 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value);
191 Type* property_cell_value_type = Type::TaggedSigned(); 183 Type* property_cell_value_type = Type::TaggedSigned();
192 if (property_cell_value->IsHeapObject()) { 184 if (property_cell_value->IsHeapObject()) {
193 // Deoptimize if the {value} is a Smi. 185 // Deoptimize if the {value} is a Smi.
194 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kFalse), 186 control = graph()->NewNode(common()->DeoptimizeIf(), check, frame_state,
195 check, control); 187 effect, control);
196 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
197 Node* deoptimize =
198 graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kEager),
199 frame_state, effect, if_true);
200 // TODO(bmeurer): This should be on the AdvancedReducer somehow.
201 NodeProperties::MergeControlToEnd(graph(), common(), deoptimize);
202 Revisit(graph()->end());
203 control = graph()->NewNode(common()->IfFalse(), branch);
204 188
205 // Load the {value} map check against the {property_cell} map. 189 // Load the {value} map check against the {property_cell} map.
206 Node* value_map = effect = 190 Node* value_map = effect =
207 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), 191 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()),
208 value, effect, control); 192 value, effect, control);
209 Handle<Map> property_cell_value_map( 193 Handle<Map> property_cell_value_map(
210 Handle<HeapObject>::cast(property_cell_value)->map(), isolate()); 194 Handle<HeapObject>::cast(property_cell_value)->map(), isolate());
211 check = graph()->NewNode( 195 check = graph()->NewNode(
212 simplified()->ReferenceEqual(Type::Any()), value_map, 196 simplified()->ReferenceEqual(Type::Any()), value_map,
213 jsgraph()->HeapConstant(property_cell_value_map)); 197 jsgraph()->HeapConstant(property_cell_value_map));
214 property_cell_value_type = Type::TaggedPointer(); 198 property_cell_value_type = Type::TaggedPointer();
215 } 199 }
216 Node* branch = 200 control = graph()->NewNode(common()->DeoptimizeUnless(), check,
217 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control); 201 frame_state, effect, control);
218 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
219 Node* deoptimize =
220 graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kEager),
221 frame_state, effect, if_false);
222 // TODO(bmeurer): This should be on the AdvancedReducer somehow.
223 NodeProperties::MergeControlToEnd(graph(), common(), deoptimize);
224 Revisit(graph()->end());
225 control = graph()->NewNode(common()->IfTrue(), branch);
226 effect = graph()->NewNode( 202 effect = graph()->NewNode(
227 simplified()->StoreField( 203 simplified()->StoreField(
228 AccessBuilder::ForPropertyCellValue(property_cell_value_type)), 204 AccessBuilder::ForPropertyCellValue(property_cell_value_type)),
229 jsgraph()->HeapConstant(property_cell), value, effect, control); 205 jsgraph()->HeapConstant(property_cell), value, effect, control);
230 break; 206 break;
231 } 207 }
232 case PropertyCellType::kMutable: { 208 case PropertyCellType::kMutable: {
233 // Store to non-configurable, data property on the global can be lowered 209 // Store to non-configurable, data property on the global can be lowered
234 // to a field store, even without recording a code dependency on the cell, 210 // to a field store, even without recording a code dependency on the cell,
235 // because the property cannot be deleted or reconfigured to an accessor 211 // because the property cannot be deleted or reconfigured to an accessor
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 } 273 }
298 274
299 275
300 SimplifiedOperatorBuilder* JSGlobalObjectSpecialization::simplified() const { 276 SimplifiedOperatorBuilder* JSGlobalObjectSpecialization::simplified() const {
301 return jsgraph()->simplified(); 277 return jsgraph()->simplified();
302 } 278 }
303 279
304 } // namespace compiler 280 } // namespace compiler
305 } // namespace internal 281 } // namespace internal
306 } // namespace v8 282 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-generic-lowering.cc ('k') | src/compiler/js-native-context-specialization.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698