OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 __ bind(&do_not_pad); | 203 __ bind(&do_not_pad); |
204 } | 204 } |
205 } | 205 } |
206 | 206 |
207 info()->set_prologue_offset(masm_->pc_offset()); | 207 info()->set_prologue_offset(masm_->pc_offset()); |
208 if (NeedsEagerFrame()) { | 208 if (NeedsEagerFrame()) { |
209 ASSERT(!frame_is_built_); | 209 ASSERT(!frame_is_built_); |
210 frame_is_built_ = true; | 210 frame_is_built_ = true; |
211 __ push(ebp); // Caller's frame pointer. | 211 __ push(ebp); // Caller's frame pointer. |
212 __ mov(ebp, esp); | 212 __ mov(ebp, esp); |
213 info()->AddNoFrameRange(0, masm_->pc_offset()); | |
213 __ push(esi); // Callee's context. | 214 __ push(esi); // Callee's context. |
214 if (info()->IsStub()) { | 215 if (info()->IsStub()) { |
215 __ push(Immediate(Smi::FromInt(StackFrame::STUB))); | 216 __ push(Immediate(Smi::FromInt(StackFrame::STUB))); |
216 } else { | 217 } else { |
217 __ push(edi); // Callee's JS function. | 218 __ push(edi); // Callee's JS function. |
218 } | 219 } |
219 } | 220 } |
220 | 221 |
221 if (info()->IsOptimizing() && | 222 if (info()->IsOptimizing() && |
222 dynamic_frame_alignment_ && | 223 dynamic_frame_alignment_ && |
(...skipping 2548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2771 if (dynamic_frame_alignment) { | 2772 if (dynamic_frame_alignment) { |
2772 __ inc(reg); // 1 more for alignment | 2773 __ inc(reg); // 1 more for alignment |
2773 } | 2774 } |
2774 __ shl(reg, kPointerSizeLog2); | 2775 __ shl(reg, kPointerSizeLog2); |
2775 __ add(esp, reg); | 2776 __ add(esp, reg); |
2776 __ jmp(return_addr_reg); | 2777 __ jmp(return_addr_reg); |
2777 } | 2778 } |
2778 } | 2779 } |
2779 | 2780 |
2780 | 2781 |
2781 void LCodeGen::DoReturn(LReturn* instr) { | 2782 void LCodeGen::DoReturn(LReturn* instr) { |
Vyacheslav Egorov (Google)
2013/06/03 13:51:03
optimized code can have arbitrary many HReturns un
yurys
2013/06/04 05:59:25
Profiler part is designed to allow multiple return
| |
2782 if (FLAG_trace && info()->IsOptimizing()) { | 2783 if (FLAG_trace && info()->IsOptimizing()) { |
2783 // 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 |
2784 // to return the value in the same register. We're leaving the code | 2785 // to return the value in the same register. We're leaving the code |
2785 // managed by the register allocator and tearing down the frame, it's | 2786 // managed by the register allocator and tearing down the frame, it's |
2786 // safe to write to the context register. | 2787 // safe to write to the context register. |
2787 __ push(eax); | 2788 __ push(eax); |
2788 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2789 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
2789 __ CallRuntime(Runtime::kTraceExit, 1); | 2790 __ CallRuntime(Runtime::kTraceExit, 1); |
2790 } | 2791 } |
2791 if (info()->saves_caller_doubles() && CpuFeatures::IsSupported(SSE2)) { | 2792 if (info()->saves_caller_doubles() && CpuFeatures::IsSupported(SSE2)) { |
2792 ASSERT(NeedsEagerFrame()); | 2793 ASSERT(NeedsEagerFrame()); |
2793 CpuFeatureScope scope(masm(), SSE2); | 2794 CpuFeatureScope scope(masm(), SSE2); |
2794 BitVector* doubles = chunk()->allocated_double_registers(); | 2795 BitVector* doubles = chunk()->allocated_double_registers(); |
2795 BitVector::Iterator save_iterator(doubles); | 2796 BitVector::Iterator save_iterator(doubles); |
2796 int count = 0; | 2797 int count = 0; |
2797 while (!save_iterator.Done()) { | 2798 while (!save_iterator.Done()) { |
2798 __ movdbl(XMMRegister::FromAllocationIndex(save_iterator.Current()), | 2799 __ movdbl(XMMRegister::FromAllocationIndex(save_iterator.Current()), |
2799 MemOperand(esp, count * kDoubleSize)); | 2800 MemOperand(esp, count * kDoubleSize)); |
2800 save_iterator.Advance(); | 2801 save_iterator.Advance(); |
2801 count++; | 2802 count++; |
2802 } | 2803 } |
2803 } | 2804 } |
2804 if (dynamic_frame_alignment_) { | 2805 if (dynamic_frame_alignment_) { |
2805 // Fetch the state of the dynamic frame alignment. | 2806 // Fetch the state of the dynamic frame alignment. |
2806 __ mov(edx, Operand(ebp, | 2807 __ mov(edx, Operand(ebp, |
2807 JavaScriptFrameConstants::kDynamicAlignmentStateOffset)); | 2808 JavaScriptFrameConstants::kDynamicAlignmentStateOffset)); |
2808 } | 2809 } |
2810 int no_frame_start = -1; | |
2809 if (NeedsEagerFrame()) { | 2811 if (NeedsEagerFrame()) { |
2810 __ mov(esp, ebp); | 2812 __ mov(esp, ebp); |
2811 __ pop(ebp); | 2813 __ pop(ebp); |
2814 no_frame_start = masm_->pc_offset(); | |
2812 } | 2815 } |
2813 if (dynamic_frame_alignment_) { | 2816 if (dynamic_frame_alignment_) { |
2814 Label no_padding; | 2817 Label no_padding; |
2815 __ cmp(edx, Immediate(kNoAlignmentPadding)); | 2818 __ cmp(edx, Immediate(kNoAlignmentPadding)); |
2816 __ j(equal, &no_padding); | 2819 __ j(equal, &no_padding); |
2817 | 2820 |
2818 EmitReturn(instr, true); | 2821 EmitReturn(instr, true); |
2819 __ bind(&no_padding); | 2822 __ bind(&no_padding); |
2820 } | 2823 } |
2821 | 2824 |
2822 EmitReturn(instr, false); | 2825 EmitReturn(instr, false); |
2826 if (no_frame_start != -1) { | |
2827 info()->AddNoFrameRange(no_frame_start, masm_->pc_offset()); | |
2828 } | |
2823 } | 2829 } |
2824 | 2830 |
2825 | 2831 |
2826 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { | 2832 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { |
2827 Register result = ToRegister(instr->result()); | 2833 Register result = ToRegister(instr->result()); |
2828 __ mov(result, Operand::Cell(instr->hydrogen()->cell())); | 2834 __ mov(result, Operand::Cell(instr->hydrogen()->cell())); |
2829 if (instr->hydrogen()->RequiresHoleCheck()) { | 2835 if (instr->hydrogen()->RequiresHoleCheck()) { |
2830 __ cmp(result, factory()->the_hole_value()); | 2836 __ cmp(result, factory()->the_hole_value()); |
2831 DeoptimizeIf(equal, instr->environment()); | 2837 DeoptimizeIf(equal, instr->environment()); |
2832 } | 2838 } |
(...skipping 3666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6499 FixedArray::kHeaderSize - kPointerSize)); | 6505 FixedArray::kHeaderSize - kPointerSize)); |
6500 __ bind(&done); | 6506 __ bind(&done); |
6501 } | 6507 } |
6502 | 6508 |
6503 | 6509 |
6504 #undef __ | 6510 #undef __ |
6505 | 6511 |
6506 } } // namespace v8::internal | 6512 } } // namespace v8::internal |
6507 | 6513 |
6508 #endif // V8_TARGET_ARCH_IA32 | 6514 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |