| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 BasicBlock* default_block = schedule()->NewBasicBlock(); | 113 BasicBlock* default_block = schedule()->NewBasicBlock(); |
| 114 Node* default_node = graph()->NewNode(common()->IfDefault(), switch_node); | 114 Node* default_node = graph()->NewNode(common()->IfDefault(), switch_node); |
| 115 schedule()->AddNode(default_block, default_node); | 115 schedule()->AddNode(default_block, default_node); |
| 116 schedule()->AddGoto(default_block, Use(default_label)); | 116 schedule()->AddGoto(default_block, Use(default_label)); |
| 117 succ_blocks[case_count] = default_block; | 117 succ_blocks[case_count] = default_block; |
| 118 schedule()->AddSwitch(CurrentBlock(), switch_node, succ_blocks, succ_count); | 118 schedule()->AddSwitch(CurrentBlock(), switch_node, succ_blocks, succ_count); |
| 119 current_block_ = nullptr; | 119 current_block_ = nullptr; |
| 120 } | 120 } |
| 121 | 121 |
| 122 void RawMachineAssembler::Return(Node* value) { | 122 void RawMachineAssembler::Return(Node* value) { |
| 123 Node* ret = MakeNode(common()->Return(), 1, &value); | 123 Node* values[] = {Int32Constant(0), value}; |
| 124 Node* ret = MakeNode(common()->Return(1), 2, values); |
| 124 schedule()->AddReturn(CurrentBlock(), ret); | 125 schedule()->AddReturn(CurrentBlock(), ret); |
| 125 current_block_ = nullptr; | 126 current_block_ = nullptr; |
| 126 } | 127 } |
| 127 | 128 |
| 128 | 129 |
| 129 void RawMachineAssembler::Return(Node* v1, Node* v2) { | 130 void RawMachineAssembler::Return(Node* v1, Node* v2) { |
| 130 Node* values[] = {v1, v2}; | 131 Node* values[] = {Int32Constant(0), v1, v2}; |
| 131 Node* ret = MakeNode(common()->Return(2), 2, values); | 132 Node* ret = MakeNode(common()->Return(2), 3, values); |
| 132 schedule()->AddReturn(CurrentBlock(), ret); | 133 schedule()->AddReturn(CurrentBlock(), ret); |
| 133 current_block_ = nullptr; | 134 current_block_ = nullptr; |
| 134 } | 135 } |
| 135 | 136 |
| 136 | 137 |
| 137 void RawMachineAssembler::Return(Node* v1, Node* v2, Node* v3) { | 138 void RawMachineAssembler::Return(Node* v1, Node* v2, Node* v3) { |
| 138 Node* values[] = {v1, v2, v3}; | 139 Node* values[] = {Int32Constant(0), v1, v2, v3}; |
| 139 Node* ret = MakeNode(common()->Return(3), 3, values); | 140 Node* ret = MakeNode(common()->Return(3), 4, values); |
| 140 schedule()->AddReturn(CurrentBlock(), ret); | 141 schedule()->AddReturn(CurrentBlock(), ret); |
| 141 current_block_ = nullptr; | 142 current_block_ = nullptr; |
| 142 } | 143 } |
| 144 |
| 145 void RawMachineAssembler::PopAndReturn(Node* pop, Node* value) { |
| 146 Node* values[] = {pop, value}; |
| 147 Node* ret = MakeNode(common()->Return(1), 2, values); |
| 148 schedule()->AddReturn(CurrentBlock(), ret); |
| 149 current_block_ = nullptr; |
| 150 } |
| 151 |
| 152 void RawMachineAssembler::PopAndReturn(Node* pop, Node* v1, Node* v2) { |
| 153 Node* values[] = {pop, v1, v2}; |
| 154 Node* ret = MakeNode(common()->Return(2), 3, values); |
| 155 schedule()->AddReturn(CurrentBlock(), ret); |
| 156 current_block_ = nullptr; |
| 157 } |
| 158 |
| 159 void RawMachineAssembler::PopAndReturn(Node* pop, Node* v1, Node* v2, |
| 160 Node* v3) { |
| 161 Node* values[] = {pop, v1, v2, v3}; |
| 162 Node* ret = MakeNode(common()->Return(3), 4, values); |
| 163 schedule()->AddReturn(CurrentBlock(), ret); |
| 164 current_block_ = nullptr; |
| 165 } |
| 143 | 166 |
| 144 void RawMachineAssembler::DebugBreak() { AddNode(machine()->DebugBreak()); } | 167 void RawMachineAssembler::DebugBreak() { AddNode(machine()->DebugBreak()); } |
| 145 | 168 |
| 146 void RawMachineAssembler::Comment(const char* msg) { | 169 void RawMachineAssembler::Comment(const char* msg) { |
| 147 AddNode(machine()->Comment(msg)); | 170 AddNode(machine()->Comment(msg)); |
| 148 } | 171 } |
| 149 | 172 |
| 150 Node* RawMachineAssembler::CallN(CallDescriptor* desc, Node* function, | 173 Node* RawMachineAssembler::CallN(CallDescriptor* desc, Node* function, |
| 151 Node** args) { | 174 Node** args) { |
| 152 int param_count = static_cast<int>(desc->ParameterCount()); | 175 int param_count = static_cast<int>(desc->ParameterCount()); |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 // The raw machine assembler nodes do not have effect and control inputs, | 567 // The raw machine assembler nodes do not have effect and control inputs, |
| 545 // so we disable checking input counts here. | 568 // so we disable checking input counts here. |
| 546 return graph()->NewNodeUnchecked(op, input_count, inputs); | 569 return graph()->NewNodeUnchecked(op, input_count, inputs); |
| 547 } | 570 } |
| 548 | 571 |
| 549 RawMachineLabel::~RawMachineLabel() { DCHECK(bound_ || !used_); } | 572 RawMachineLabel::~RawMachineLabel() { DCHECK(bound_ || !used_); } |
| 550 | 573 |
| 551 } // namespace compiler | 574 } // namespace compiler |
| 552 } // namespace internal | 575 } // namespace internal |
| 553 } // namespace v8 | 576 } // namespace v8 |
| OLD | NEW |