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

Side by Side Diff: src/compiler/js-type-feedback.cc

Issue 1136413002: [turbofan] JSTypeFeedbackSpecializer is now an AdvancedReducer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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-type-feedback.h ('k') | src/compiler/pipeline.cc » ('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-type-feedback.h" 5 #include "src/compiler/js-type-feedback.h"
6 6
7 #include "src/property-details.h" 7 #include "src/property-details.h"
8 8
9 #include "src/accessors.h" 9 #include "src/accessors.h"
10 #include "src/ast.h" 10 #include "src/ast.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 &check_failed); 189 &check_failed);
190 190
191 // Build the actual load. 191 // Build the actual load.
192 Node* load = graph()->NewNode(simplified()->LoadField(field_access), receiver, 192 Node* load = graph()->NewNode(simplified()->LoadField(field_access), receiver,
193 effect, check_success); 193 effect, check_success);
194 194
195 // TODO(turbofan): handle slow case instead of deoptimizing. 195 // TODO(turbofan): handle slow case instead of deoptimizing.
196 Node* deopt = graph()->NewNode(common()->Deoptimize(), frame_state_before, 196 Node* deopt = graph()->NewNode(common()->Deoptimize(), frame_state_before,
197 effect, check_failed); 197 effect, check_failed);
198 NodeProperties::MergeControlToEnd(graph(), common(), deopt); 198 NodeProperties::MergeControlToEnd(graph(), common(), deopt);
199 NodeProperties::ReplaceWithValue(node, load, load, check_success); 199 ReplaceWithValue(node, load, load, check_success);
200 return Replace(load); 200 return Replace(load);
201 } 201 }
202 202
203 203
204 Reduction JSTypeFeedbackSpecializer::ReduceJSLoadNamedForGlobalVariable( 204 Reduction JSTypeFeedbackSpecializer::ReduceJSLoadNamedForGlobalVariable(
205 Node* node) { 205 Node* node) {
206 Handle<String> name = 206 Handle<String> name =
207 Handle<String>::cast(LoadNamedParametersOf(node->op()).name().handle()); 207 Handle<String>::cast(LoadNamedParametersOf(node->op()).name().handle());
208 // Try to optimize loads from the global object. 208 // Try to optimize loads from the global object.
209 Handle<Object> constant_value = 209 Handle<Object> constant_value =
210 jsgraph()->isolate()->factory()->GlobalConstantFor(name); 210 jsgraph()->isolate()->factory()->GlobalConstantFor(name);
211 if (!constant_value.is_null()) { 211 if (!constant_value.is_null()) {
212 // Always optimize global constants. 212 // Always optimize global constants.
213 Node* constant = jsgraph()->Constant(constant_value); 213 Node* constant = jsgraph()->Constant(constant_value);
214 NodeProperties::ReplaceWithValue(node, constant); 214 ReplaceWithValue(node, constant);
215 return Replace(constant); 215 return Replace(constant);
216 } 216 }
217 217
218 if (global_object_.is_null()) { 218 if (global_object_.is_null()) {
219 // Nothing else can be done if we don't have a global object. 219 // Nothing else can be done if we don't have a global object.
220 return NoChange(); 220 return NoChange();
221 } 221 }
222 222
223 if (FLAG_turbo_deoptimization) { 223 if (FLAG_turbo_deoptimization) {
224 // Handle lookups in the script context. 224 // Handle lookups in the script context.
(...skipping 15 matching lines...) Expand all
240 dependencies_->AssumePropertyCell(cell); 240 dependencies_->AssumePropertyCell(cell);
241 241
242 if (it.property_details().cell_type() == PropertyCellType::kConstant) { 242 if (it.property_details().cell_type() == PropertyCellType::kConstant) {
243 // Constant promote the global's current value. 243 // Constant promote the global's current value.
244 Handle<Object> constant_value(cell->value(), jsgraph()->isolate()); 244 Handle<Object> constant_value(cell->value(), jsgraph()->isolate());
245 if (constant_value->IsConsString()) { 245 if (constant_value->IsConsString()) {
246 constant_value = 246 constant_value =
247 String::Flatten(Handle<String>::cast(constant_value)); 247 String::Flatten(Handle<String>::cast(constant_value));
248 } 248 }
249 Node* constant = jsgraph()->Constant(constant_value); 249 Node* constant = jsgraph()->Constant(constant_value);
250 NodeProperties::ReplaceWithValue(node, constant); 250 ReplaceWithValue(node, constant);
251 return Replace(constant); 251 return Replace(constant);
252 } else { 252 } else {
253 // Load directly from the property cell. 253 // Load directly from the property cell.
254 FieldAccess access = AccessBuilder::ForPropertyCellValue(); 254 FieldAccess access = AccessBuilder::ForPropertyCellValue();
255 Node* control = NodeProperties::GetControlInput(node); 255 Node* control = NodeProperties::GetControlInput(node);
256 Node* load_field = graph()->NewNode( 256 Node* load_field = graph()->NewNode(
257 simplified()->LoadField(access), jsgraph()->Constant(cell), 257 simplified()->LoadField(access), jsgraph()->Constant(cell),
258 NodeProperties::GetEffectInput(node), control); 258 NodeProperties::GetEffectInput(node), control);
259 NodeProperties::ReplaceWithValue(node, load_field, load_field, control); 259 ReplaceWithValue(node, load_field, load_field, control);
260 return Replace(load_field); 260 return Replace(load_field);
261 } 261 }
262 } 262 }
263 } else { 263 } else {
264 // TODO(turbofan): non-configurable properties on the global object 264 // TODO(turbofan): non-configurable properties on the global object
265 // should be loadable through a cell without deoptimization support. 265 // should be loadable through a cell without deoptimization support.
266 } 266 }
267 267
268 return NoChange(); 268 return NoChange();
269 } 269 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 306
307 // Build the actual load. 307 // Build the actual load.
308 Node* value = node->InputAt(1); 308 Node* value = node->InputAt(1);
309 Node* store = graph()->NewNode(simplified()->StoreField(field_access), 309 Node* store = graph()->NewNode(simplified()->StoreField(field_access),
310 receiver, value, effect, check_success); 310 receiver, value, effect, check_success);
311 311
312 // TODO(turbofan): handle slow case instead of deoptimizing. 312 // TODO(turbofan): handle slow case instead of deoptimizing.
313 Node* deopt = graph()->NewNode(common()->Deoptimize(), frame_state_before, 313 Node* deopt = graph()->NewNode(common()->Deoptimize(), frame_state_before,
314 effect, check_failed); 314 effect, check_failed);
315 NodeProperties::MergeControlToEnd(graph(), common(), deopt); 315 NodeProperties::MergeControlToEnd(graph(), common(), deopt);
316 NodeProperties::ReplaceWithValue(node, store, store, check_success); 316 ReplaceWithValue(node, store, store, check_success);
317 return Replace(store); 317 return Replace(store);
318 } 318 }
319 319
320 320
321 Reduction JSTypeFeedbackSpecializer::ReduceJSStoreProperty(Node* node) { 321 Reduction JSTypeFeedbackSpecializer::ReduceJSStoreProperty(Node* node) {
322 return NoChange(); 322 return NoChange();
323 } 323 }
324 324
325 325
326 void JSTypeFeedbackSpecializer::BuildMapCheck(Node* receiver, Handle<Map> map, 326 void JSTypeFeedbackSpecializer::BuildMapCheck(Node* receiver, Handle<Map> map,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 BailoutId id = OpParameter<FrameStateCallInfo>(node).bailout_id(); 376 BailoutId id = OpParameter<FrameStateCallInfo>(node).bailout_id();
377 if (id != BailoutId::None()) return frame_state; 377 if (id != BailoutId::None()) return frame_state;
378 } 378 }
379 } 379 }
380 return nullptr; 380 return nullptr;
381 } 381 }
382 382
383 } // namespace compiler 383 } // namespace compiler
384 } // namespace internal 384 } // namespace internal
385 } // namespace v8 385 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-type-feedback.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698