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/scopes.h" | 10 #include "src/scopes.h" |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 __ bind(&done); \ | 290 __ bind(&done); \ |
291 } while (false) | 291 } while (false) |
292 | 292 |
293 | 293 |
294 void CodeGenerator::AssembleDeconstructActivationRecord() { | 294 void CodeGenerator::AssembleDeconstructActivationRecord() { |
295 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 295 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
296 int stack_slots = frame()->GetSpillSlotCount(); | 296 int stack_slots = frame()->GetSpillSlotCount(); |
297 if (descriptor->IsJSFunctionCall() || stack_slots > 0) { | 297 if (descriptor->IsJSFunctionCall() || stack_slots > 0) { |
298 __ mov(esp, ebp); | 298 __ mov(esp, ebp); |
299 __ pop(ebp); | 299 __ pop(ebp); |
300 int32_t bytes_to_pop = | |
301 descriptor->IsJSFunctionCall() | |
302 ? static_cast<int32_t>(descriptor->JSParameterCount() * | |
303 kPointerSize) | |
304 : 0; | |
305 __ pop(Operand(esp, bytes_to_pop)); | |
306 __ add(esp, Immediate(bytes_to_pop)); | |
307 } | 300 } |
308 } | 301 } |
309 | 302 |
310 | 303 |
311 // Assembles an instruction after register allocation, producing machine code. | 304 // Assembles an instruction after register allocation, producing machine code. |
312 void CodeGenerator::AssembleArchInstruction(Instruction* instr) { | 305 void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
313 X87OperandConverter i(this, instr); | 306 X87OperandConverter i(this, instr); |
314 | 307 |
315 switch (ArchOpcodeField::decode(instr->opcode())) { | 308 switch (ArchOpcodeField::decode(instr->opcode())) { |
316 case kArchCallCodeObject: { | 309 case kArchCallCodeObject: { |
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1597 } else if (descriptor->IsJSFunctionCall() || needs_frame_) { | 1590 } else if (descriptor->IsJSFunctionCall() || needs_frame_) { |
1598 // Canonicalize JSFunction return sites for now. | 1591 // Canonicalize JSFunction return sites for now. |
1599 if (return_label_.is_bound()) { | 1592 if (return_label_.is_bound()) { |
1600 __ jmp(&return_label_); | 1593 __ jmp(&return_label_); |
1601 } else { | 1594 } else { |
1602 __ bind(&return_label_); | 1595 __ bind(&return_label_); |
1603 __ mov(esp, ebp); // Move stack pointer back to frame pointer. | 1596 __ mov(esp, ebp); // Move stack pointer back to frame pointer. |
1604 __ pop(ebp); // Pop caller's frame pointer. | 1597 __ pop(ebp); // Pop caller's frame pointer. |
1605 int pop_count = descriptor->IsJSFunctionCall() | 1598 int pop_count = descriptor->IsJSFunctionCall() |
1606 ? static_cast<int>(descriptor->JSParameterCount()) | 1599 ? static_cast<int>(descriptor->JSParameterCount()) |
1607 : 0; | 1600 : (info()->IsStub() |
1608 __ Ret(pop_count * kPointerSize, ebx); | 1601 ? info()->code_stub()->GetStackParameterCount() |
| 1602 : 0); |
| 1603 if (pop_count == 0) { |
| 1604 __ ret(0); |
| 1605 } else { |
| 1606 __ Ret(pop_count * kPointerSize, ebx); |
| 1607 } |
1609 } | 1608 } |
1610 } else { | 1609 } else { |
1611 __ ret(0); | 1610 __ ret(0); |
1612 } | 1611 } |
1613 } | 1612 } |
1614 | 1613 |
1615 | 1614 |
1616 void CodeGenerator::AssembleMove(InstructionOperand* source, | 1615 void CodeGenerator::AssembleMove(InstructionOperand* source, |
1617 InstructionOperand* destination) { | 1616 InstructionOperand* destination) { |
1618 X87OperandConverter g(this, NULL); | 1617 X87OperandConverter g(this, NULL); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1842 __ Nop(padding_size); | 1841 __ Nop(padding_size); |
1843 } | 1842 } |
1844 } | 1843 } |
1845 } | 1844 } |
1846 | 1845 |
1847 #undef __ | 1846 #undef __ |
1848 | 1847 |
1849 } // namespace compiler | 1848 } // namespace compiler |
1850 } // namespace internal | 1849 } // namespace internal |
1851 } // namespace v8 | 1850 } // namespace v8 |
OLD | NEW |