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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 } | 135 } |
136 | 136 |
137 void RawMachineAssembler::DebugBreak() { AddNode(machine()->DebugBreak()); } | 137 void RawMachineAssembler::DebugBreak() { AddNode(machine()->DebugBreak()); } |
138 | 138 |
139 void RawMachineAssembler::Comment(const char* msg) { | 139 void RawMachineAssembler::Comment(const char* msg) { |
140 AddNode(machine()->Comment(msg)); | 140 AddNode(machine()->Comment(msg)); |
141 } | 141 } |
142 | 142 |
143 Node* RawMachineAssembler::CallN(CallDescriptor* desc, Node* function, | 143 Node* RawMachineAssembler::CallN(CallDescriptor* desc, Node* function, |
144 Node** args) { | 144 Node** args) { |
145 int param_count = | 145 int param_count = static_cast<int>(desc->ParameterCount()); |
146 static_cast<int>(desc->GetMachineSignature()->parameter_count()); | |
147 int input_count = param_count + 1; | 146 int input_count = param_count + 1; |
148 Node** buffer = zone()->NewArray<Node*>(input_count); | 147 Node** buffer = zone()->NewArray<Node*>(input_count); |
149 int index = 0; | 148 int index = 0; |
150 buffer[index++] = function; | 149 buffer[index++] = function; |
151 for (int i = 0; i < param_count; i++) { | 150 for (int i = 0; i < param_count; i++) { |
152 buffer[index++] = args[i]; | 151 buffer[index++] = args[i]; |
153 } | 152 } |
154 return AddNode(common()->Call(desc), input_count, buffer); | 153 return AddNode(common()->Call(desc), input_count, buffer); |
155 } | 154 } |
156 | 155 |
157 | 156 |
158 Node* RawMachineAssembler::CallNWithFrameState(CallDescriptor* desc, | 157 Node* RawMachineAssembler::CallNWithFrameState(CallDescriptor* desc, |
159 Node* function, Node** args, | 158 Node* function, Node** args, |
160 Node* frame_state) { | 159 Node* frame_state) { |
161 DCHECK(desc->NeedsFrameState()); | 160 DCHECK(desc->NeedsFrameState()); |
162 int param_count = | 161 int param_count = static_cast<int>(desc->ParameterCount()); |
163 static_cast<int>(desc->GetMachineSignature()->parameter_count()); | |
164 int input_count = param_count + 2; | 162 int input_count = param_count + 2; |
165 Node** buffer = zone()->NewArray<Node*>(input_count); | 163 Node** buffer = zone()->NewArray<Node*>(input_count); |
166 int index = 0; | 164 int index = 0; |
167 buffer[index++] = function; | 165 buffer[index++] = function; |
168 for (int i = 0; i < param_count; i++) { | 166 for (int i = 0; i < param_count; i++) { |
169 buffer[index++] = args[i]; | 167 buffer[index++] = args[i]; |
170 } | 168 } |
171 buffer[index++] = frame_state; | 169 buffer[index++] = frame_state; |
172 return AddNode(common()->Call(desc), input_count, buffer); | 170 return AddNode(common()->Call(desc), input_count, buffer); |
173 } | 171 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 common()->ExternalConstant(ExternalReference(function, isolate()))); | 242 common()->ExternalConstant(ExternalReference(function, isolate()))); |
245 Node* arity = Int32Constant(4); | 243 Node* arity = Int32Constant(4); |
246 | 244 |
247 return AddNode(common()->Call(descriptor), centry, arg1, arg2, arg3, arg4, | 245 return AddNode(common()->Call(descriptor), centry, arg1, arg2, arg3, arg4, |
248 ref, arity, context); | 246 ref, arity, context); |
249 } | 247 } |
250 | 248 |
251 | 249 |
252 Node* RawMachineAssembler::TailCallN(CallDescriptor* desc, Node* function, | 250 Node* RawMachineAssembler::TailCallN(CallDescriptor* desc, Node* function, |
253 Node** args) { | 251 Node** args) { |
254 int param_count = | 252 int param_count = static_cast<int>(desc->ParameterCount()); |
255 static_cast<int>(desc->GetMachineSignature()->parameter_count()); | |
256 int input_count = param_count + 1; | 253 int input_count = param_count + 1; |
257 Node** buffer = zone()->NewArray<Node*>(input_count); | 254 Node** buffer = zone()->NewArray<Node*>(input_count); |
258 int index = 0; | 255 int index = 0; |
259 buffer[index++] = function; | 256 buffer[index++] = function; |
260 for (int i = 0; i < param_count; i++) { | 257 for (int i = 0; i < param_count; i++) { |
261 buffer[index++] = args[i]; | 258 buffer[index++] = args[i]; |
262 } | 259 } |
263 Node* tail_call = MakeNode(common()->TailCall(desc), input_count, buffer); | 260 Node* tail_call = MakeNode(common()->TailCall(desc), input_count, buffer); |
264 schedule()->AddTailCall(CurrentBlock(), tail_call); | 261 schedule()->AddTailCall(CurrentBlock(), tail_call); |
265 current_block_ = nullptr; | 262 current_block_ = nullptr; |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 // The raw machine assembler nodes do not have effect and control inputs, | 490 // The raw machine assembler nodes do not have effect and control inputs, |
494 // so we disable checking input counts here. | 491 // so we disable checking input counts here. |
495 return graph()->NewNodeUnchecked(op, input_count, inputs); | 492 return graph()->NewNodeUnchecked(op, input_count, inputs); |
496 } | 493 } |
497 | 494 |
498 RawMachineLabel::~RawMachineLabel() { DCHECK(bound_ || !used_); } | 495 RawMachineLabel::~RawMachineLabel() { DCHECK(bound_ || !used_); } |
499 | 496 |
500 } // namespace compiler | 497 } // namespace compiler |
501 } // namespace internal | 498 } // namespace internal |
502 } // namespace v8 | 499 } // namespace v8 |
OLD | NEW |