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 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 1868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1879 // | f()'s receiver arg | 1879 // | f()'s receiver arg |
1880 // | f()'s caller pc <- sp | 1880 // | f()'s caller pc <- sp |
1881 // ---------------------- | 1881 // ---------------------- |
1882 // | 1882 // |
1883 void PrepareForTailCall(MacroAssembler* masm, Register args_reg, | 1883 void PrepareForTailCall(MacroAssembler* masm, Register args_reg, |
1884 Register scratch1, Register scratch2, | 1884 Register scratch1, Register scratch2, |
1885 Register scratch3) { | 1885 Register scratch3) { |
1886 DCHECK(!AreAliased(args_reg, scratch1, scratch2, scratch3)); | 1886 DCHECK(!AreAliased(args_reg, scratch1, scratch2, scratch3)); |
1887 Comment cmnt(masm, "[ PrepareForTailCall"); | 1887 Comment cmnt(masm, "[ PrepareForTailCall"); |
1888 | 1888 |
1889 // Prepare for tail call only if the debugger is not active. | |
1890 Label done; | |
1891 ExternalReference debug_is_active = | |
1892 ExternalReference::debug_is_active_address(masm->isolate()); | |
1893 __ movzx_b(scratch1, Operand::StaticVariable(debug_is_active)); | |
1894 __ cmp(scratch1, Immediate(0)); | |
1895 __ j(not_equal, &done, Label::kNear); | |
1896 | |
1897 // Drop possible interpreter handler/stub frame. | 1889 // Drop possible interpreter handler/stub frame. |
1898 { | 1890 { |
1899 Label no_interpreter_frame; | 1891 Label no_interpreter_frame; |
1900 __ cmp(Operand(ebp, CommonFrameConstants::kContextOrFrameTypeOffset), | 1892 __ cmp(Operand(ebp, CommonFrameConstants::kContextOrFrameTypeOffset), |
1901 Immediate(Smi::FromInt(StackFrame::STUB))); | 1893 Immediate(Smi::FromInt(StackFrame::STUB))); |
1902 __ j(not_equal, &no_interpreter_frame, Label::kNear); | 1894 __ j(not_equal, &no_interpreter_frame, Label::kNear); |
1903 __ mov(ebp, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); | 1895 __ mov(ebp, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); |
1904 __ bind(&no_interpreter_frame); | 1896 __ bind(&no_interpreter_frame); |
1905 } | 1897 } |
1906 | 1898 |
(...skipping 20 matching lines...) Expand all Loading... |
1927 __ mov( | 1919 __ mov( |
1928 caller_args_count_reg, | 1920 caller_args_count_reg, |
1929 FieldOperand(scratch1, SharedFunctionInfo::kFormalParameterCountOffset)); | 1921 FieldOperand(scratch1, SharedFunctionInfo::kFormalParameterCountOffset)); |
1930 __ SmiUntag(caller_args_count_reg); | 1922 __ SmiUntag(caller_args_count_reg); |
1931 | 1923 |
1932 __ bind(&formal_parameter_count_loaded); | 1924 __ bind(&formal_parameter_count_loaded); |
1933 | 1925 |
1934 ParameterCount callee_args_count(args_reg); | 1926 ParameterCount callee_args_count(args_reg); |
1935 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2, | 1927 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2, |
1936 scratch3, ReturnAddressState::kOnStack, 0); | 1928 scratch3, ReturnAddressState::kOnStack, 0); |
1937 __ bind(&done); | |
1938 } | 1929 } |
1939 } // namespace | 1930 } // namespace |
1940 | 1931 |
1941 // static | 1932 // static |
1942 void Builtins::Generate_CallFunction(MacroAssembler* masm, | 1933 void Builtins::Generate_CallFunction(MacroAssembler* masm, |
1943 ConvertReceiverMode mode, | 1934 ConvertReceiverMode mode, |
1944 TailCallMode tail_call_mode) { | 1935 TailCallMode tail_call_mode) { |
1945 // ----------- S t a t e ------------- | 1936 // ----------- S t a t e ------------- |
1946 // -- eax : the number of arguments (not including the receiver) | 1937 // -- eax : the number of arguments (not including the receiver) |
1947 // -- edi : the function to call (checked to be a JSFunction) | 1938 // -- edi : the function to call (checked to be a JSFunction) |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2609 // And "return" to the OSR entry point of the function. | 2600 // And "return" to the OSR entry point of the function. |
2610 __ ret(0); | 2601 __ ret(0); |
2611 } | 2602 } |
2612 | 2603 |
2613 | 2604 |
2614 #undef __ | 2605 #undef __ |
2615 } // namespace internal | 2606 } // namespace internal |
2616 } // namespace v8 | 2607 } // namespace v8 |
2617 | 2608 |
2618 #endif // V8_TARGET_ARCH_IA32 | 2609 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |