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

Side by Side Diff: src/compiler/js-call-reducer.cc

Issue 1511883002: [turbofan] Add initial support for SOFT deopts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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/instruction-selector.cc ('k') | src/compiler/js-global-object-specialization.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-call-reducer.h" 5 #include "src/compiler/js-call-reducer.h"
6 6
7 #include "src/compiler/js-graph.h" 7 #include "src/compiler/js-graph.h"
8 #include "src/compiler/node-matchers.h" 8 #include "src/compiler/node-matchers.h"
9 #include "src/objects-inl.h" 9 #include "src/objects-inl.h"
10 #include "src/type-feedback-vector-inl.h" 10 #include "src/type-feedback-vector-inl.h"
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 } 291 }
292 292
293 // Check that the {target} is still the {array_function}. 293 // Check that the {target} is still the {array_function}.
294 Node* check = effect = 294 Node* check = effect =
295 graph()->NewNode(javascript()->StrictEqual(), target, array_function, 295 graph()->NewNode(javascript()->StrictEqual(), target, array_function,
296 context, effect, control); 296 context, effect, control);
297 Node* branch = 297 Node* branch =
298 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control); 298 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control);
299 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 299 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
300 Node* deoptimize = 300 Node* deoptimize =
301 graph()->NewNode(common()->Deoptimize(), frame_state, effect, if_false); 301 graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kEager),
302 frame_state, effect, if_false);
302 // TODO(bmeurer): This should be on the AdvancedReducer somehow. 303 // TODO(bmeurer): This should be on the AdvancedReducer somehow.
303 NodeProperties::MergeControlToEnd(graph(), common(), deoptimize); 304 NodeProperties::MergeControlToEnd(graph(), common(), deoptimize);
304 control = graph()->NewNode(common()->IfTrue(), branch); 305 control = graph()->NewNode(common()->IfTrue(), branch);
305 306
306 // Turn the {node} into a {JSCreateArray} call. 307 // Turn the {node} into a {JSCreateArray} call.
307 NodeProperties::ReplaceValueInput(node, array_function, 0); 308 NodeProperties::ReplaceValueInput(node, array_function, 0);
308 NodeProperties::ReplaceEffectInput(node, effect); 309 NodeProperties::ReplaceEffectInput(node, effect);
309 NodeProperties::ReplaceControlInput(node, control); 310 NodeProperties::ReplaceControlInput(node, control);
310 return ReduceArrayConstructor(node); 311 return ReduceArrayConstructor(node);
311 } else if (feedback->IsWeakCell()) { 312 } else if (feedback->IsWeakCell()) {
312 Handle<WeakCell> cell = Handle<WeakCell>::cast(feedback); 313 Handle<WeakCell> cell = Handle<WeakCell>::cast(feedback);
313 if (cell->value()->IsJSFunction()) { 314 if (cell->value()->IsJSFunction()) {
314 Node* target_function = 315 Node* target_function =
315 jsgraph()->Constant(handle(cell->value(), isolate())); 316 jsgraph()->Constant(handle(cell->value(), isolate()));
316 317
317 // Check that the {target} is still the {target_function}. 318 // Check that the {target} is still the {target_function}.
318 Node* check = effect = 319 Node* check = effect =
319 graph()->NewNode(javascript()->StrictEqual(), target, target_function, 320 graph()->NewNode(javascript()->StrictEqual(), target, target_function,
320 context, effect, control); 321 context, effect, control);
321 Node* branch = 322 Node* branch =
322 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control); 323 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control);
323 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 324 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
324 Node* deoptimize = graph()->NewNode(common()->Deoptimize(), frame_state, 325 Node* deoptimize =
325 effect, if_false); 326 graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kEager),
327 frame_state, effect, if_false);
326 // TODO(bmeurer): This should be on the AdvancedReducer somehow. 328 // TODO(bmeurer): This should be on the AdvancedReducer somehow.
327 NodeProperties::MergeControlToEnd(graph(), common(), deoptimize); 329 NodeProperties::MergeControlToEnd(graph(), common(), deoptimize);
328 control = graph()->NewNode(common()->IfTrue(), branch); 330 control = graph()->NewNode(common()->IfTrue(), branch);
329 331
330 // Specialize the JSCallFunction node to the {target_function}. 332 // Specialize the JSCallFunction node to the {target_function}.
331 NodeProperties::ReplaceValueInput(node, target_function, 0); 333 NodeProperties::ReplaceValueInput(node, target_function, 0);
332 NodeProperties::ReplaceEffectInput(node, effect); 334 NodeProperties::ReplaceEffectInput(node, effect);
333 NodeProperties::ReplaceControlInput(node, control); 335 NodeProperties::ReplaceControlInput(node, control);
334 336
335 // Try to further reduce the JSCallFunction {node}. 337 // Try to further reduce the JSCallFunction {node}.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 } 434 }
433 435
434 // Check that the {target} is still the {array_function}. 436 // Check that the {target} is still the {array_function}.
435 Node* check = effect = 437 Node* check = effect =
436 graph()->NewNode(javascript()->StrictEqual(), target, array_function, 438 graph()->NewNode(javascript()->StrictEqual(), target, array_function,
437 context, effect, control); 439 context, effect, control);
438 Node* branch = 440 Node* branch =
439 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control); 441 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control);
440 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 442 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
441 Node* deoptimize = 443 Node* deoptimize =
442 graph()->NewNode(common()->Deoptimize(), frame_state, effect, if_false); 444 graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kEager),
445 frame_state, effect, if_false);
443 // TODO(bmeurer): This should be on the AdvancedReducer somehow. 446 // TODO(bmeurer): This should be on the AdvancedReducer somehow.
444 NodeProperties::MergeControlToEnd(graph(), common(), deoptimize); 447 NodeProperties::MergeControlToEnd(graph(), common(), deoptimize);
445 control = graph()->NewNode(common()->IfTrue(), branch); 448 control = graph()->NewNode(common()->IfTrue(), branch);
446 449
447 // Turn the {node} into a {JSCreateArray} call. 450 // Turn the {node} into a {JSCreateArray} call.
448 NodeProperties::ReplaceEffectInput(node, effect); 451 NodeProperties::ReplaceEffectInput(node, effect);
449 NodeProperties::ReplaceControlInput(node, control); 452 NodeProperties::ReplaceControlInput(node, control);
450 NodeProperties::RemoveFrameStateInput(node, 1); 453 NodeProperties::RemoveFrameStateInput(node, 1);
451 for (int i = arity; i > 0; --i) { 454 for (int i = arity; i > 0; --i) {
452 NodeProperties::ReplaceValueInput( 455 NodeProperties::ReplaceValueInput(
453 node, NodeProperties::GetValueInput(node, i), i + 1); 456 node, NodeProperties::GetValueInput(node, i), i + 1);
454 } 457 }
455 NodeProperties::ReplaceValueInput(node, new_target, 1); 458 NodeProperties::ReplaceValueInput(node, new_target, 1);
456 NodeProperties::ChangeOp(node, javascript()->CreateArray(arity, site)); 459 NodeProperties::ChangeOp(node, javascript()->CreateArray(arity, site));
457 return Changed(node); 460 return Changed(node);
458 } else if (feedback->IsWeakCell()) { 461 } else if (feedback->IsWeakCell()) {
459 Handle<WeakCell> cell = Handle<WeakCell>::cast(feedback); 462 Handle<WeakCell> cell = Handle<WeakCell>::cast(feedback);
460 if (cell->value()->IsJSFunction()) { 463 if (cell->value()->IsJSFunction()) {
461 Node* target_function = 464 Node* target_function =
462 jsgraph()->Constant(handle(cell->value(), isolate())); 465 jsgraph()->Constant(handle(cell->value(), isolate()));
463 466
464 // Check that the {target} is still the {target_function}. 467 // Check that the {target} is still the {target_function}.
465 Node* check = effect = 468 Node* check = effect =
466 graph()->NewNode(javascript()->StrictEqual(), target, target_function, 469 graph()->NewNode(javascript()->StrictEqual(), target, target_function,
467 context, effect, control); 470 context, effect, control);
468 Node* branch = 471 Node* branch =
469 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control); 472 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control);
470 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 473 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
471 Node* deoptimize = graph()->NewNode(common()->Deoptimize(), frame_state, 474 Node* deoptimize =
472 effect, if_false); 475 graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kEager),
476 frame_state, effect, if_false);
473 // TODO(bmeurer): This should be on the AdvancedReducer somehow. 477 // TODO(bmeurer): This should be on the AdvancedReducer somehow.
474 NodeProperties::MergeControlToEnd(graph(), common(), deoptimize); 478 NodeProperties::MergeControlToEnd(graph(), common(), deoptimize);
475 control = graph()->NewNode(common()->IfTrue(), branch); 479 control = graph()->NewNode(common()->IfTrue(), branch);
476 480
477 // Specialize the JSCallConstruct node to the {target_function}. 481 // Specialize the JSCallConstruct node to the {target_function}.
478 NodeProperties::ReplaceValueInput(node, target_function, 0); 482 NodeProperties::ReplaceValueInput(node, target_function, 0);
479 NodeProperties::ReplaceEffectInput(node, effect); 483 NodeProperties::ReplaceEffectInput(node, effect);
480 NodeProperties::ReplaceControlInput(node, control); 484 NodeProperties::ReplaceControlInput(node, control);
481 if (target == new_target) { 485 if (target == new_target) {
482 NodeProperties::ReplaceValueInput(node, target_function, arity + 1); 486 NodeProperties::ReplaceValueInput(node, target_function, arity + 1);
(...skipping 27 matching lines...) Expand all
510 } 514 }
511 515
512 516
513 JSOperatorBuilder* JSCallReducer::javascript() const { 517 JSOperatorBuilder* JSCallReducer::javascript() const {
514 return jsgraph()->javascript(); 518 return jsgraph()->javascript();
515 } 519 }
516 520
517 } // namespace compiler 521 } // namespace compiler
518 } // namespace internal 522 } // namespace internal
519 } // namespace v8 523 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/instruction-selector.cc ('k') | src/compiler/js-global-object-specialization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698