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 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 RawMachineLabel*[case_count]; | 1026 RawMachineLabel*[case_count]; |
1027 for (size_t i = 0; i < case_count; ++i) { | 1027 for (size_t i = 0; i < case_count; ++i) { |
1028 labels[i] = case_labels[i]->label_; | 1028 labels[i] = case_labels[i]->label_; |
1029 case_labels[i]->MergeVariables(); | 1029 case_labels[i]->MergeVariables(); |
1030 default_label->MergeVariables(); | 1030 default_label->MergeVariables(); |
1031 } | 1031 } |
1032 return raw_assembler()->Switch(index, default_label->label_, case_values, | 1032 return raw_assembler()->Switch(index, default_label->label_, case_values, |
1033 labels, case_count); | 1033 labels, case_count); |
1034 } | 1034 } |
1035 | 1035 |
1036 Node* CodeAssembler::Select(Node* condition, Node* true_value, | |
1037 Node* false_value, MachineRepresentation rep) { | |
1038 Variable value(this, rep); | |
1039 Label vtrue(this), vfalse(this), end(this); | |
1040 Branch(condition, &vtrue, &vfalse); | |
1041 | |
1042 Bind(&vtrue); | |
1043 { | |
1044 value.Bind(true_value); | |
1045 Goto(&end); | |
1046 } | |
1047 Bind(&vfalse); | |
1048 { | |
1049 value.Bind(false_value); | |
1050 Goto(&end); | |
1051 } | |
1052 | |
1053 Bind(&end); | |
1054 return value.value(); | |
1055 } | |
1056 | |
1057 // RawMachineAssembler delegate helpers: | 1036 // RawMachineAssembler delegate helpers: |
1058 Isolate* CodeAssembler::isolate() const { return raw_assembler()->isolate(); } | 1037 Isolate* CodeAssembler::isolate() const { return raw_assembler()->isolate(); } |
1059 | 1038 |
1060 Factory* CodeAssembler::factory() const { return isolate()->factory(); } | 1039 Factory* CodeAssembler::factory() const { return isolate()->factory(); } |
1061 | 1040 |
1062 Zone* CodeAssembler::zone() const { return raw_assembler()->zone(); } | 1041 Zone* CodeAssembler::zone() const { return raw_assembler()->zone(); } |
1063 | 1042 |
1064 RawMachineAssembler* CodeAssembler::raw_assembler() const { | 1043 RawMachineAssembler* CodeAssembler::raw_assembler() const { |
1065 return state_->raw_assembler_.get(); | 1044 return state_->raw_assembler_.get(); |
1066 } | 1045 } |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1212 } | 1191 } |
1213 } | 1192 } |
1214 } | 1193 } |
1215 | 1194 |
1216 bound_ = true; | 1195 bound_ = true; |
1217 } | 1196 } |
1218 | 1197 |
1219 } // namespace compiler | 1198 } // namespace compiler |
1220 } // namespace internal | 1199 } // namespace internal |
1221 } // namespace v8 | 1200 } // namespace v8 |
OLD | NEW |