OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/raw-machine-assembler.h" | 5 #include "src/compiler/raw-machine-assembler.h" |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/compiler/node-properties.h" | 8 #include "src/compiler/node-properties.h" |
9 #include "src/compiler/pipeline.h" | 9 #include "src/compiler/pipeline.h" |
10 #include "src/compiler/scheduler.h" | 10 #include "src/compiler/scheduler.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 | 79 |
80 void RawMachineAssembler::Branch(Node* condition, RawMachineLabel* true_val, | 80 void RawMachineAssembler::Branch(Node* condition, RawMachineLabel* true_val, |
81 RawMachineLabel* false_val) { | 81 RawMachineLabel* false_val) { |
82 DCHECK(current_block_ != schedule()->end()); | 82 DCHECK(current_block_ != schedule()->end()); |
83 Node* branch = MakeNode(common()->Branch(), 1, &condition); | 83 Node* branch = MakeNode(common()->Branch(), 1, &condition); |
84 schedule()->AddBranch(CurrentBlock(), branch, Use(true_val), Use(false_val)); | 84 schedule()->AddBranch(CurrentBlock(), branch, Use(true_val), Use(false_val)); |
85 current_block_ = nullptr; | 85 current_block_ = nullptr; |
86 } | 86 } |
87 | 87 |
| 88 |
88 void RawMachineAssembler::Switch(Node* index, RawMachineLabel* default_label, | 89 void RawMachineAssembler::Switch(Node* index, RawMachineLabel* default_label, |
89 const int32_t* case_values, | 90 int32_t* case_values, |
90 RawMachineLabel** case_labels, | 91 RawMachineLabel** case_labels, |
91 size_t case_count) { | 92 size_t case_count) { |
92 DCHECK_NE(schedule()->end(), current_block_); | 93 DCHECK_NE(schedule()->end(), current_block_); |
93 size_t succ_count = case_count + 1; | 94 size_t succ_count = case_count + 1; |
94 Node* switch_node = AddNode(common()->Switch(succ_count), index); | 95 Node* switch_node = AddNode(common()->Switch(succ_count), index); |
95 BasicBlock** succ_blocks = zone()->NewArray<BasicBlock*>(succ_count); | 96 BasicBlock** succ_blocks = zone()->NewArray<BasicBlock*>(succ_count); |
96 for (size_t index = 0; index < case_count; ++index) { | 97 for (size_t index = 0; index < case_count; ++index) { |
97 int32_t case_value = case_values[index]; | 98 int32_t case_value = case_values[index]; |
98 BasicBlock* case_block = schedule()->NewBasicBlock(); | 99 BasicBlock* case_block = schedule()->NewBasicBlock(); |
99 Node* case_node = | 100 Node* case_node = |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 // The raw machine assembler nodes do not have effect and control inputs, | 513 // The raw machine assembler nodes do not have effect and control inputs, |
513 // so we disable checking input counts here. | 514 // so we disable checking input counts here. |
514 return graph()->NewNodeUnchecked(op, input_count, inputs); | 515 return graph()->NewNodeUnchecked(op, input_count, inputs); |
515 } | 516 } |
516 | 517 |
517 RawMachineLabel::~RawMachineLabel() { DCHECK(bound_ || !used_); } | 518 RawMachineLabel::~RawMachineLabel() { DCHECK(bound_ || !used_); } |
518 | 519 |
519 } // namespace compiler | 520 } // namespace compiler |
520 } // namespace internal | 521 } // namespace internal |
521 } // namespace v8 | 522 } // namespace v8 |
OLD | NEW |