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 | |
89 void RawMachineAssembler::Switch(Node* index, RawMachineLabel* default_label, | 88 void RawMachineAssembler::Switch(Node* index, RawMachineLabel* default_label, |
90 int32_t* case_values, | 89 const int32_t* case_values, |
91 RawMachineLabel** case_labels, | 90 RawMachineLabel** case_labels, |
92 size_t case_count) { | 91 size_t case_count) { |
93 DCHECK_NE(schedule()->end(), current_block_); | 92 DCHECK_NE(schedule()->end(), current_block_); |
94 size_t succ_count = case_count + 1; | 93 size_t succ_count = case_count + 1; |
95 Node* switch_node = AddNode(common()->Switch(succ_count), index); | 94 Node* switch_node = AddNode(common()->Switch(succ_count), index); |
96 BasicBlock** succ_blocks = zone()->NewArray<BasicBlock*>(succ_count); | 95 BasicBlock** succ_blocks = zone()->NewArray<BasicBlock*>(succ_count); |
97 for (size_t index = 0; index < case_count; ++index) { | 96 for (size_t index = 0; index < case_count; ++index) { |
98 int32_t case_value = case_values[index]; | 97 int32_t case_value = case_values[index]; |
99 BasicBlock* case_block = schedule()->NewBasicBlock(); | 98 BasicBlock* case_block = schedule()->NewBasicBlock(); |
100 Node* case_node = | 99 Node* case_node = |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 // The raw machine assembler nodes do not have effect and control inputs, | 512 // The raw machine assembler nodes do not have effect and control inputs, |
514 // so we disable checking input counts here. | 513 // so we disable checking input counts here. |
515 return graph()->NewNodeUnchecked(op, input_count, inputs); | 514 return graph()->NewNodeUnchecked(op, input_count, inputs); |
516 } | 515 } |
517 | 516 |
518 RawMachineLabel::~RawMachineLabel() { DCHECK(bound_ || !used_); } | 517 RawMachineLabel::~RawMachineLabel() { DCHECK(bound_ || !used_); } |
519 | 518 |
520 } // namespace compiler | 519 } // namespace compiler |
521 } // namespace internal | 520 } // namespace internal |
522 } // namespace v8 | 521 } // namespace v8 |
OLD | NEW |