OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 | 6 |
7 #include "src/compiler/code-generator-impl.h" | 7 #include "src/compiler/code-generator-impl.h" |
8 #include "src/compiler/gap-resolver.h" | 8 #include "src/compiler/gap-resolver.h" |
9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
10 #include "src/ia32/assembler-ia32.h" | 10 #include "src/ia32/assembler-ia32.h" |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 __ bind(&done); \ | 283 __ bind(&done); \ |
284 } while (false) | 284 } while (false) |
285 | 285 |
286 | 286 |
287 void CodeGenerator::AssembleDeconstructActivationRecord() { | 287 void CodeGenerator::AssembleDeconstructActivationRecord() { |
288 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 288 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
289 int stack_slots = frame()->GetSpillSlotCount(); | 289 int stack_slots = frame()->GetSpillSlotCount(); |
290 if (descriptor->IsJSFunctionCall() || stack_slots > 0) { | 290 if (descriptor->IsJSFunctionCall() || stack_slots > 0) { |
291 __ mov(esp, ebp); | 291 __ mov(esp, ebp); |
292 __ pop(ebp); | 292 __ pop(ebp); |
293 int32_t bytes_to_pop = | |
294 descriptor->IsJSFunctionCall() | |
295 ? static_cast<int32_t>(descriptor->JSParameterCount() * | |
296 kPointerSize) | |
297 : 0; | |
298 __ pop(Operand(esp, bytes_to_pop)); | |
299 __ add(esp, Immediate(bytes_to_pop)); | |
300 } | 293 } |
301 } | 294 } |
302 | 295 |
303 | 296 |
304 // Assembles an instruction after register allocation, producing machine code. | 297 // Assembles an instruction after register allocation, producing machine code. |
305 void CodeGenerator::AssembleArchInstruction(Instruction* instr) { | 298 void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
306 IA32OperandConverter i(this, instr); | 299 IA32OperandConverter i(this, instr); |
307 | 300 |
308 switch (ArchOpcodeField::decode(instr->opcode())) { | 301 switch (ArchOpcodeField::decode(instr->opcode())) { |
309 case kArchCallCodeObject: { | 302 case kArchCallCodeObject: { |
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1341 } else if (descriptor->IsJSFunctionCall() || needs_frame_) { | 1334 } else if (descriptor->IsJSFunctionCall() || needs_frame_) { |
1342 // Canonicalize JSFunction return sites for now. | 1335 // Canonicalize JSFunction return sites for now. |
1343 if (return_label_.is_bound()) { | 1336 if (return_label_.is_bound()) { |
1344 __ jmp(&return_label_); | 1337 __ jmp(&return_label_); |
1345 } else { | 1338 } else { |
1346 __ bind(&return_label_); | 1339 __ bind(&return_label_); |
1347 __ mov(esp, ebp); // Move stack pointer back to frame pointer. | 1340 __ mov(esp, ebp); // Move stack pointer back to frame pointer. |
1348 __ pop(ebp); // Pop caller's frame pointer. | 1341 __ pop(ebp); // Pop caller's frame pointer. |
1349 int pop_count = descriptor->IsJSFunctionCall() | 1342 int pop_count = descriptor->IsJSFunctionCall() |
1350 ? static_cast<int>(descriptor->JSParameterCount()) | 1343 ? static_cast<int>(descriptor->JSParameterCount()) |
1351 : 0; | 1344 : (info()->IsStub() |
1352 __ Ret(pop_count * kPointerSize, ebx); | 1345 ? info()->code_stub()->GetStackParameterCount() |
| 1346 : 0); |
| 1347 if (pop_count == 0) { |
| 1348 __ ret(0); |
| 1349 } else { |
| 1350 __ Ret(pop_count * kPointerSize, ebx); |
| 1351 } |
1353 } | 1352 } |
1354 } else { | 1353 } else { |
1355 __ ret(0); | 1354 __ ret(0); |
1356 } | 1355 } |
1357 } | 1356 } |
1358 | 1357 |
1359 | 1358 |
1360 void CodeGenerator::AssembleMove(InstructionOperand* source, | 1359 void CodeGenerator::AssembleMove(InstructionOperand* source, |
1361 InstructionOperand* destination) { | 1360 InstructionOperand* destination) { |
1362 IA32OperandConverter g(this, NULL); | 1361 IA32OperandConverter g(this, NULL); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1542 __ Nop(padding_size); | 1541 __ Nop(padding_size); |
1543 } | 1542 } |
1544 } | 1543 } |
1545 } | 1544 } |
1546 | 1545 |
1547 #undef __ | 1546 #undef __ |
1548 | 1547 |
1549 } // namespace compiler | 1548 } // namespace compiler |
1550 } // namespace internal | 1549 } // namespace internal |
1551 } // namespace v8 | 1550 } // namespace v8 |
OLD | NEW |