OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 2735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2746 if (instr->has_constant_parameter_count()) { | 2746 if (instr->has_constant_parameter_count()) { |
2747 int parameter_count = ToInteger32(instr->constant_parameter_count()); | 2747 int parameter_count = ToInteger32(instr->constant_parameter_count()); |
2748 if (dynamic_frame_alignment && FLAG_debug_code) { | 2748 if (dynamic_frame_alignment && FLAG_debug_code) { |
2749 __ cmp(Operand(esp, | 2749 __ cmp(Operand(esp, |
2750 (parameter_count + extra_value_count) * kPointerSize), | 2750 (parameter_count + extra_value_count) * kPointerSize), |
2751 Immediate(kAlignmentZapValue)); | 2751 Immediate(kAlignmentZapValue)); |
2752 __ Assert(equal, kExpectedAlignmentMarker); | 2752 __ Assert(equal, kExpectedAlignmentMarker); |
2753 } | 2753 } |
2754 __ Ret((parameter_count + extra_value_count) * kPointerSize, ecx); | 2754 __ Ret((parameter_count + extra_value_count) * kPointerSize, ecx); |
2755 } else { | 2755 } else { |
| 2756 DCHECK(info()->IsStub()); // Functions would need to drop one more value. |
2756 Register reg = ToRegister(instr->parameter_count()); | 2757 Register reg = ToRegister(instr->parameter_count()); |
2757 // The argument count parameter is a smi | 2758 // The argument count parameter is a smi |
2758 __ SmiUntag(reg); | 2759 __ SmiUntag(reg); |
2759 Register return_addr_reg = reg.is(ecx) ? ebx : ecx; | 2760 Register return_addr_reg = reg.is(ecx) ? ebx : ecx; |
2760 if (dynamic_frame_alignment && FLAG_debug_code) { | 2761 if (dynamic_frame_alignment && FLAG_debug_code) { |
2761 DCHECK(extra_value_count == 2); | 2762 DCHECK(extra_value_count == 2); |
2762 __ cmp(Operand(esp, reg, times_pointer_size, | 2763 __ cmp(Operand(esp, reg, times_pointer_size, |
2763 extra_value_count * kPointerSize), | 2764 extra_value_count * kPointerSize), |
2764 Immediate(kAlignmentZapValue)); | 2765 Immediate(kAlignmentZapValue)); |
2765 __ Assert(equal, kExpectedAlignmentMarker); | 2766 __ Assert(equal, kExpectedAlignmentMarker); |
2766 } | 2767 } |
2767 | 2768 |
2768 // emit code to restore stack based on instr->parameter_count() | 2769 // emit code to restore stack based on instr->parameter_count() |
2769 __ pop(return_addr_reg); // save return address | 2770 __ pop(return_addr_reg); // save return address |
2770 if (dynamic_frame_alignment) { | 2771 if (dynamic_frame_alignment) { |
2771 __ inc(reg); // 1 more for alignment | 2772 __ inc(reg); // 1 more for alignment |
2772 } | 2773 } |
| 2774 |
2773 __ shl(reg, kPointerSizeLog2); | 2775 __ shl(reg, kPointerSizeLog2); |
2774 __ add(esp, reg); | 2776 __ add(esp, reg); |
2775 __ jmp(return_addr_reg); | 2777 __ jmp(return_addr_reg); |
2776 } | 2778 } |
2777 } | 2779 } |
2778 | 2780 |
2779 | 2781 |
2780 void LCodeGen::DoReturn(LReturn* instr) { | 2782 void LCodeGen::DoReturn(LReturn* instr) { |
2781 if (FLAG_trace && info()->IsOptimizing()) { | 2783 if (FLAG_trace && info()->IsOptimizing()) { |
2782 // Preserve the return value on the stack and rely on the runtime call | 2784 // Preserve the return value on the stack and rely on the runtime call |
(...skipping 2917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5700 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5702 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5701 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5703 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5702 } | 5704 } |
5703 | 5705 |
5704 | 5706 |
5705 #undef __ | 5707 #undef __ |
5706 | 5708 |
5707 } } // namespace v8::internal | 5709 } } // namespace v8::internal |
5708 | 5710 |
5709 #endif // V8_TARGET_ARCH_IA32 | 5711 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |