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

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

Issue 2002253003: [turbofan] Properly connect DeoptimizeIf/Unless to effect chain. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix JSCallReducer Created 4 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
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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true), 321 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true),
322 context, context, effect); 322 context, context, effect);
323 array_function = effect = graph()->NewNode( 323 array_function = effect = graph()->NewNode(
324 javascript()->LoadContext(0, Context::ARRAY_FUNCTION_INDEX, true), 324 javascript()->LoadContext(0, Context::ARRAY_FUNCTION_INDEX, true),
325 native_context, native_context, effect); 325 native_context, native_context, effect);
326 } 326 }
327 327
328 // Check that the {target} is still the {array_function}. 328 // Check that the {target} is still the {array_function}.
329 Node* check = graph()->NewNode(javascript()->StrictEqual(), target, 329 Node* check = graph()->NewNode(javascript()->StrictEqual(), target,
330 array_function, context); 330 array_function, context);
331 control = graph()->NewNode(common()->DeoptimizeUnless(), check, frame_state, 331 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check,
332 effect, control); 332 frame_state, effect, control);
333 333
334 // Turn the {node} into a {JSCreateArray} call. 334 // Turn the {node} into a {JSCreateArray} call.
335 NodeProperties::ReplaceValueInput(node, array_function, 0); 335 NodeProperties::ReplaceValueInput(node, array_function, 0);
336 NodeProperties::ReplaceEffectInput(node, effect); 336 NodeProperties::ReplaceEffectInput(node, effect);
337 NodeProperties::ReplaceControlInput(node, control); 337 NodeProperties::ReplaceControlInput(node, control);
338 return ReduceArrayConstructor(node); 338 return ReduceArrayConstructor(node);
339 } else if (feedback->IsWeakCell()) { 339 } else if (feedback->IsWeakCell()) {
340 Handle<WeakCell> cell = Handle<WeakCell>::cast(feedback); 340 Handle<WeakCell> cell = Handle<WeakCell>::cast(feedback);
341 if (cell->value()->IsJSFunction()) { 341 if (cell->value()->IsJSFunction()) {
342 Node* target_function = 342 Node* target_function =
343 jsgraph()->Constant(handle(cell->value(), isolate())); 343 jsgraph()->Constant(handle(cell->value(), isolate()));
344 344
345 // Check that the {target} is still the {target_function}. 345 // Check that the {target} is still the {target_function}.
346 Node* check = graph()->NewNode(javascript()->StrictEqual(), target, 346 Node* check = graph()->NewNode(javascript()->StrictEqual(), target,
347 target_function, context); 347 target_function, context);
348 control = graph()->NewNode(common()->DeoptimizeUnless(), check, 348 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check,
349 frame_state, effect, control); 349 frame_state, effect, control);
350 350
351 // Specialize the JSCallFunction node to the {target_function}. 351 // Specialize the JSCallFunction node to the {target_function}.
352 NodeProperties::ReplaceValueInput(node, target_function, 0); 352 NodeProperties::ReplaceValueInput(node, target_function, 0);
353 NodeProperties::ReplaceEffectInput(node, effect);
353 NodeProperties::ReplaceControlInput(node, control); 354 NodeProperties::ReplaceControlInput(node, control);
354 355
355 // Try to further reduce the JSCallFunction {node}. 356 // Try to further reduce the JSCallFunction {node}.
356 Reduction const reduction = ReduceJSCallFunction(node); 357 Reduction const reduction = ReduceJSCallFunction(node);
357 return reduction.Changed() ? reduction : Changed(node); 358 return reduction.Changed() ? reduction : Changed(node);
358 } 359 }
359 } 360 }
360 return NoChange(); 361 return NoChange();
361 } 362 }
362 363
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true), 447 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true),
447 context, context, effect); 448 context, context, effect);
448 array_function = effect = graph()->NewNode( 449 array_function = effect = graph()->NewNode(
449 javascript()->LoadContext(0, Context::ARRAY_FUNCTION_INDEX, true), 450 javascript()->LoadContext(0, Context::ARRAY_FUNCTION_INDEX, true),
450 native_context, native_context, effect); 451 native_context, native_context, effect);
451 } 452 }
452 453
453 // Check that the {target} is still the {array_function}. 454 // Check that the {target} is still the {array_function}.
454 Node* check = graph()->NewNode(javascript()->StrictEqual(), target, 455 Node* check = graph()->NewNode(javascript()->StrictEqual(), target,
455 array_function, context); 456 array_function, context);
456 control = graph()->NewNode(common()->DeoptimizeUnless(), check, frame_state, 457 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check,
457 effect, control); 458 frame_state, effect, control);
458 459
459 // Turn the {node} into a {JSCreateArray} call. 460 // Turn the {node} into a {JSCreateArray} call.
460 NodeProperties::ReplaceEffectInput(node, effect); 461 NodeProperties::ReplaceEffectInput(node, effect);
461 NodeProperties::ReplaceControlInput(node, control); 462 NodeProperties::ReplaceControlInput(node, control);
462 NodeProperties::RemoveFrameStateInput(node, 1); 463 NodeProperties::RemoveFrameStateInput(node, 1);
463 for (int i = arity; i > 0; --i) { 464 for (int i = arity; i > 0; --i) {
464 NodeProperties::ReplaceValueInput( 465 NodeProperties::ReplaceValueInput(
465 node, NodeProperties::GetValueInput(node, i), i + 1); 466 node, NodeProperties::GetValueInput(node, i), i + 1);
466 } 467 }
467 NodeProperties::ReplaceValueInput(node, new_target, 1); 468 NodeProperties::ReplaceValueInput(node, new_target, 1);
468 NodeProperties::ChangeOp(node, javascript()->CreateArray(arity, site)); 469 NodeProperties::ChangeOp(node, javascript()->CreateArray(arity, site));
469 return Changed(node); 470 return Changed(node);
470 } else if (feedback->IsWeakCell()) { 471 } else if (feedback->IsWeakCell()) {
471 Handle<WeakCell> cell = Handle<WeakCell>::cast(feedback); 472 Handle<WeakCell> cell = Handle<WeakCell>::cast(feedback);
472 if (cell->value()->IsJSFunction()) { 473 if (cell->value()->IsJSFunction()) {
473 Node* target_function = 474 Node* target_function =
474 jsgraph()->Constant(handle(cell->value(), isolate())); 475 jsgraph()->Constant(handle(cell->value(), isolate()));
475 476
476 // Check that the {target} is still the {target_function}. 477 // Check that the {target} is still the {target_function}.
477 Node* check = graph()->NewNode(javascript()->StrictEqual(), target, 478 Node* check = graph()->NewNode(javascript()->StrictEqual(), target,
478 target_function, context); 479 target_function, context);
479 control = graph()->NewNode(common()->DeoptimizeUnless(), check, 480 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check,
480 frame_state, effect, control); 481 frame_state, effect, control);
481 482
482 // Specialize the JSCallConstruct node to the {target_function}. 483 // Specialize the JSCallConstruct node to the {target_function}.
483 NodeProperties::ReplaceValueInput(node, target_function, 0); 484 NodeProperties::ReplaceValueInput(node, target_function, 0);
484 NodeProperties::ReplaceEffectInput(node, effect); 485 NodeProperties::ReplaceEffectInput(node, effect);
485 NodeProperties::ReplaceControlInput(node, control); 486 NodeProperties::ReplaceControlInput(node, control);
486 if (target == new_target) { 487 if (target == new_target) {
487 NodeProperties::ReplaceValueInput(node, target_function, arity + 1); 488 NodeProperties::ReplaceValueInput(node, target_function, arity + 1);
488 } 489 }
489 490
490 // Try to further reduce the JSCallConstruct {node}. 491 // Try to further reduce the JSCallConstruct {node}.
(...skipping 24 matching lines...) Expand all
515 } 516 }
516 517
517 518
518 JSOperatorBuilder* JSCallReducer::javascript() const { 519 JSOperatorBuilder* JSCallReducer::javascript() const {
519 return jsgraph()->javascript(); 520 return jsgraph()->javascript();
520 } 521 }
521 522
522 } // namespace compiler 523 } // namespace compiler
523 } // namespace internal 524 } // namespace internal
524 } // namespace v8 525 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/common-operator-reducer.cc ('k') | src/compiler/js-global-object-specialization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698