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/code-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/compiler/pipeline.h" | 6 #include "src/compiler/pipeline.h" |
7 #include "src/compiler/raw-machine-assembler.h" | 7 #include "src/compiler/raw-machine-assembler.h" |
8 #include "src/compiler/scheduler.h" | 8 #include "src/compiler/scheduler.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 Node* branch = NewNode(common()->Branch(), condition); | 73 Node* branch = NewNode(common()->Branch(), condition); |
74 schedule()->AddBranch(CurrentBlock(), branch, Use(true_val), Use(false_val)); | 74 schedule()->AddBranch(CurrentBlock(), branch, Use(true_val), Use(false_val)); |
75 current_block_ = NULL; | 75 current_block_ = NULL; |
76 } | 76 } |
77 | 77 |
78 | 78 |
79 void RawMachineAssembler::Switch(Node* index, Label** succ_labels, | 79 void RawMachineAssembler::Switch(Node* index, Label** succ_labels, |
80 size_t succ_count) { | 80 size_t succ_count) { |
81 DCHECK_NE(schedule()->end(), current_block_); | 81 DCHECK_NE(schedule()->end(), current_block_); |
82 Node* sw = NewNode(common()->Switch(succ_count), index); | 82 Node* sw = NewNode(common()->Switch(succ_count), index); |
83 BasicBlock** succ_blocks = | 83 BasicBlock** succ_blocks = zone()->NewArray<BasicBlock*>(succ_count); |
84 zone()->NewArray<BasicBlock*>(static_cast<int>(succ_count)); | |
85 for (size_t index = 0; index < succ_count; ++index) { | 84 for (size_t index = 0; index < succ_count; ++index) { |
86 succ_blocks[index] = Use(succ_labels[index]); | 85 succ_blocks[index] = Use(succ_labels[index]); |
87 } | 86 } |
88 schedule()->AddSwitch(CurrentBlock(), sw, succ_blocks, succ_count); | 87 schedule()->AddSwitch(CurrentBlock(), sw, succ_blocks, succ_count); |
89 current_block_ = nullptr; | 88 current_block_ = nullptr; |
90 } | 89 } |
91 | 90 |
92 | 91 |
93 void RawMachineAssembler::Return(Node* value) { | 92 void RawMachineAssembler::Return(Node* value) { |
94 schedule()->AddReturn(CurrentBlock(), value); | 93 schedule()->AddReturn(CurrentBlock(), value); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 Node* node = graph()->NewNode(op, input_count, inputs, incomplete); | 172 Node* node = graph()->NewNode(op, input_count, inputs, incomplete); |
174 BasicBlock* block = op->opcode() == IrOpcode::kParameter ? schedule()->start() | 173 BasicBlock* block = op->opcode() == IrOpcode::kParameter ? schedule()->start() |
175 : CurrentBlock(); | 174 : CurrentBlock(); |
176 schedule()->AddNode(block, node); | 175 schedule()->AddNode(block, node); |
177 return node; | 176 return node; |
178 } | 177 } |
179 | 178 |
180 } // namespace compiler | 179 } // namespace compiler |
181 } // namespace internal | 180 } // namespace internal |
182 } // namespace v8 | 181 } // namespace v8 |
OLD | NEW |