| OLD | NEW |
| 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/code-assembler.h" | 5 #include "src/compiler/code-assembler.h" |
| 6 | 6 |
| 7 #include <ostream> | 7 #include <ostream> |
| 8 | 8 |
| 9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 RawMachineLabel*[case_count]; | 687 RawMachineLabel*[case_count]; |
| 688 for (size_t i = 0; i < case_count; ++i) { | 688 for (size_t i = 0; i < case_count; ++i) { |
| 689 labels[i] = case_labels[i]->label_; | 689 labels[i] = case_labels[i]->label_; |
| 690 case_labels[i]->MergeVariables(); | 690 case_labels[i]->MergeVariables(); |
| 691 default_label->MergeVariables(); | 691 default_label->MergeVariables(); |
| 692 } | 692 } |
| 693 return raw_assembler_->Switch(index, default_label->label_, case_values, | 693 return raw_assembler_->Switch(index, default_label->label_, case_values, |
| 694 labels, case_count); | 694 labels, case_count); |
| 695 } | 695 } |
| 696 | 696 |
| 697 Node* CodeAssembler::Select(Node* condition, Node* true_value, |
| 698 Node* false_value, MachineRepresentation rep) { |
| 699 Variable value(this, rep); |
| 700 Label vtrue(this), vfalse(this), end(this); |
| 701 Branch(condition, &vtrue, &vfalse); |
| 702 |
| 703 Bind(&vtrue); |
| 704 { |
| 705 value.Bind(true_value); |
| 706 Goto(&end); |
| 707 } |
| 708 Bind(&vfalse); |
| 709 { |
| 710 value.Bind(false_value); |
| 711 Goto(&end); |
| 712 } |
| 713 |
| 714 Bind(&end); |
| 715 return value.value(); |
| 716 } |
| 717 |
| 697 // RawMachineAssembler delegate helpers: | 718 // RawMachineAssembler delegate helpers: |
| 698 Isolate* CodeAssembler::isolate() const { return raw_assembler_->isolate(); } | 719 Isolate* CodeAssembler::isolate() const { return raw_assembler_->isolate(); } |
| 699 | 720 |
| 700 Factory* CodeAssembler::factory() const { return isolate()->factory(); } | 721 Factory* CodeAssembler::factory() const { return isolate()->factory(); } |
| 701 | 722 |
| 702 Graph* CodeAssembler::graph() const { return raw_assembler_->graph(); } | 723 Graph* CodeAssembler::graph() const { return raw_assembler_->graph(); } |
| 703 | 724 |
| 704 Zone* CodeAssembler::zone() const { return raw_assembler_->zone(); } | 725 Zone* CodeAssembler::zone() const { return raw_assembler_->zone(); } |
| 705 | 726 |
| 706 // The core implementation of Variable is stored through an indirection so | 727 // The core implementation of Variable is stored through an indirection so |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 } | 869 } |
| 849 } | 870 } |
| 850 } | 871 } |
| 851 | 872 |
| 852 bound_ = true; | 873 bound_ = true; |
| 853 } | 874 } |
| 854 | 875 |
| 855 } // namespace compiler | 876 } // namespace compiler |
| 856 } // namespace internal | 877 } // namespace internal |
| 857 } // namespace v8 | 878 } // namespace v8 |
| OLD | NEW |