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

Side by Side Diff: src/compiler/effect-control-linearizer.cc

Issue 1916763003: [turbofan] Move ChangeTaggedToFoo lowerings to EffectControlLinearizer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
« no previous file with comments | « src/compiler/effect-control-linearizer.h ('k') | test/cctest/compiler/test-changes-lowering.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/effect-control-linearizer.h" 5 #include "src/compiler/effect-control-linearizer.h"
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/compiler/access-builder.h" 8 #include "src/compiler/access-builder.h"
9 #include "src/compiler/js-graph.h" 9 #include "src/compiler/js-graph.h"
10 #include "src/compiler/linkage.h" 10 #include "src/compiler/linkage.h"
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 switch (node->opcode()) { 348 switch (node->opcode()) {
349 case IrOpcode::kChangeInt32ToTagged: 349 case IrOpcode::kChangeInt32ToTagged:
350 state = LowerChangeInt32ToTagged(node, *effect, *control); 350 state = LowerChangeInt32ToTagged(node, *effect, *control);
351 break; 351 break;
352 case IrOpcode::kChangeUint32ToTagged: 352 case IrOpcode::kChangeUint32ToTagged:
353 state = LowerChangeUint32ToTagged(node, *effect, *control); 353 state = LowerChangeUint32ToTagged(node, *effect, *control);
354 break; 354 break;
355 case IrOpcode::kChangeFloat64ToTagged: 355 case IrOpcode::kChangeFloat64ToTagged:
356 state = LowerChangeFloat64ToTagged(node, *effect, *control); 356 state = LowerChangeFloat64ToTagged(node, *effect, *control);
357 break; 357 break;
358 case IrOpcode::kChangeTaggedToInt32:
359 state = LowerChangeTaggedToInt32(node, *effect, *control);
360 break;
361 case IrOpcode::kChangeTaggedToUint32:
362 state = LowerChangeTaggedToUint32(node, *effect, *control);
363 break;
364 case IrOpcode::kChangeTaggedToFloat64:
365 state = LowerChangeTaggedToFloat64(node, *effect, *control);
366 break;
367 case IrOpcode::kTruncateTaggedToWord32:
368 state = LowerTruncateTaggedToWord32(node, *effect, *control);
369 break;
358 case IrOpcode::kObjectIsCallable: 370 case IrOpcode::kObjectIsCallable:
359 state = LowerObjectIsCallable(node, *effect, *control); 371 state = LowerObjectIsCallable(node, *effect, *control);
360 break; 372 break;
361 case IrOpcode::kObjectIsNumber: 373 case IrOpcode::kObjectIsNumber:
362 state = LowerObjectIsNumber(node, *effect, *control); 374 state = LowerObjectIsNumber(node, *effect, *control);
363 break; 375 break;
364 case IrOpcode::kObjectIsReceiver: 376 case IrOpcode::kObjectIsReceiver:
365 state = LowerObjectIsReceiver(node, *effect, *control); 377 state = LowerObjectIsReceiver(node, *effect, *control);
366 break; 378 break;
367 case IrOpcode::kObjectIsString: 379 case IrOpcode::kObjectIsString:
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 Node* merge = graph()->NewNode(common()->Merge(2), if_true, alloc.control); 511 Node* merge = graph()->NewNode(common()->Merge(2), if_true, alloc.control);
500 Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), 512 Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
501 vtrue, alloc.value, merge); 513 vtrue, alloc.value, merge);
502 Node* ephi = 514 Node* ephi =
503 graph()->NewNode(common()->EffectPhi(2), effect, alloc.effect, merge); 515 graph()->NewNode(common()->EffectPhi(2), effect, alloc.effect, merge);
504 516
505 return ValueEffectControl(phi, ephi, merge); 517 return ValueEffectControl(phi, ephi, merge);
506 } 518 }
507 519
508 EffectControlLinearizer::ValueEffectControl 520 EffectControlLinearizer::ValueEffectControl
521 EffectControlLinearizer::LowerChangeTaggedToInt32(Node* node, Node* effect,
522 Node* control) {
523 Node* value = node->InputAt(0);
524
525 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value);
526 Node* branch =
527 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control);
528
529 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
530 Node* etrue = effect;
531 Node* vtrue =
532 graph()->NewNode(simplified()->ChangeTaggedSignedToInt32(), value);
533
534 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
535 Node* efalse = effect;
536 Node* vfalse;
537 {
538 STATIC_ASSERT(HeapNumber::kValueOffset == Oddball::kToNumberRawOffset);
539 vfalse = efalse = graph()->NewNode(
540 simplified()->LoadField(AccessBuilder::ForHeapNumberValue()), value,
541 efalse, if_false);
542 vfalse = graph()->NewNode(machine()->ChangeFloat64ToInt32(), vfalse);
543 }
544
545 control = graph()->NewNode(common()->Merge(2), if_true, if_false);
546 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control);
547 value = graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2),
548 vtrue, vfalse, control);
549
550 return ValueEffectControl(value, effect, control);
551 }
552
553 EffectControlLinearizer::ValueEffectControl
554 EffectControlLinearizer::LowerChangeTaggedToUint32(Node* node, Node* effect,
555 Node* control) {
556 Node* value = node->InputAt(0);
557
558 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value);
559 Node* branch =
560 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control);
561
562 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
563 Node* etrue = effect;
564 Node* vtrue =
565 graph()->NewNode(simplified()->ChangeTaggedSignedToInt32(), value);
566
567 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
568 Node* efalse = effect;
569 Node* vfalse;
570 {
571 STATIC_ASSERT(HeapNumber::kValueOffset == Oddball::kToNumberRawOffset);
572 vfalse = efalse = graph()->NewNode(
573 simplified()->LoadField(AccessBuilder::ForHeapNumberValue()), value,
574 efalse, if_false);
575 vfalse = graph()->NewNode(machine()->ChangeFloat64ToUint32(), vfalse);
576 }
577
578 control = graph()->NewNode(common()->Merge(2), if_true, if_false);
579 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control);
580 value = graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2),
581 vtrue, vfalse, control);
582
583 return ValueEffectControl(value, effect, control);
584 }
585
586 EffectControlLinearizer::ValueEffectControl
587 EffectControlLinearizer::LowerChangeTaggedToFloat64(Node* node, Node* effect,
588 Node* control) {
589 Node* value = node->InputAt(0);
590
591 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value);
592 Node* branch =
593 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control);
594
595 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
596 Node* etrue = effect;
597 Node* vtrue;
598 {
599 vtrue = graph()->NewNode(simplified()->ChangeTaggedSignedToInt32(), value);
600 vtrue = graph()->NewNode(machine()->ChangeInt32ToFloat64(), vtrue);
601 }
602
603 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
604 Node* efalse = effect;
605 Node* vfalse;
606 {
607 STATIC_ASSERT(HeapNumber::kValueOffset == Oddball::kToNumberRawOffset);
608 vfalse = efalse = graph()->NewNode(
609 simplified()->LoadField(AccessBuilder::ForHeapNumberValue()), value,
610 efalse, if_false);
611 }
612
613 control = graph()->NewNode(common()->Merge(2), if_true, if_false);
614 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control);
615 value = graph()->NewNode(common()->Phi(MachineRepresentation::kFloat64, 2),
616 vtrue, vfalse, control);
617
618 return ValueEffectControl(value, effect, control);
619 }
620
621 EffectControlLinearizer::ValueEffectControl
622 EffectControlLinearizer::LowerTruncateTaggedToWord32(Node* node, Node* effect,
623 Node* control) {
624 Node* value = node->InputAt(0);
625
626 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value);
627 Node* branch =
628 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control);
629
630 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
631 Node* etrue = effect;
632 Node* vtrue =
633 graph()->NewNode(simplified()->ChangeTaggedSignedToInt32(), value);
634
635 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
636 Node* efalse = effect;
637 Node* vfalse;
638 {
639 STATIC_ASSERT(HeapNumber::kValueOffset == Oddball::kToNumberRawOffset);
640 vfalse = efalse = graph()->NewNode(
641 simplified()->LoadField(AccessBuilder::ForHeapNumberValue()), value,
642 efalse, if_false);
643 vfalse = graph()->NewNode(machine()->TruncateFloat64ToWord32(), vfalse);
644 }
645
646 control = graph()->NewNode(common()->Merge(2), if_true, if_false);
647 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control);
648 value = graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2),
649 vtrue, vfalse, control);
650
651 return ValueEffectControl(value, effect, control);
652 }
653
654 EffectControlLinearizer::ValueEffectControl
509 EffectControlLinearizer::LowerObjectIsCallable(Node* node, Node* effect, 655 EffectControlLinearizer::LowerObjectIsCallable(Node* node, Node* effect,
510 Node* control) { 656 Node* control) {
511 Node* value = node->InputAt(0); 657 Node* value = node->InputAt(0);
512 658
513 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value); 659 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value);
514 Node* branch = 660 Node* branch =
515 graph()->NewNode(common()->Branch(BranchHint::kFalse), check, control); 661 graph()->NewNode(common()->Branch(BranchHint::kFalse), check, control);
516 662
517 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); 663 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
518 Node* etrue = effect; 664 Node* etrue = effect;
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 return jsgraph()->Int32Constant(Smi::kMaxValue); 878 return jsgraph()->Int32Constant(Smi::kMaxValue);
733 } 879 }
734 880
735 Node* EffectControlLinearizer::SmiShiftBitsConstant() { 881 Node* EffectControlLinearizer::SmiShiftBitsConstant() {
736 return jsgraph()->IntPtrConstant(kSmiShiftSize + kSmiTagSize); 882 return jsgraph()->IntPtrConstant(kSmiShiftSize + kSmiTagSize);
737 } 883 }
738 884
739 } // namespace compiler 885 } // namespace compiler
740 } // namespace internal 886 } // namespace internal
741 } // namespace v8 887 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/effect-control-linearizer.h ('k') | test/cctest/compiler/test-changes-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698