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_X87 | 5 #if V8_TARGET_ARCH_X87 |
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 1894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1905 // | f()'s receiver arg | 1905 // | f()'s receiver arg |
1906 // | f()'s caller pc <- sp | 1906 // | f()'s caller pc <- sp |
1907 // ---------------------- | 1907 // ---------------------- |
1908 // | 1908 // |
1909 void PrepareForTailCall(MacroAssembler* masm, Register args_reg, | 1909 void PrepareForTailCall(MacroAssembler* masm, Register args_reg, |
1910 Register scratch1, Register scratch2, | 1910 Register scratch1, Register scratch2, |
1911 Register scratch3) { | 1911 Register scratch3) { |
1912 DCHECK(!AreAliased(args_reg, scratch1, scratch2, scratch3)); | 1912 DCHECK(!AreAliased(args_reg, scratch1, scratch2, scratch3)); |
1913 Comment cmnt(masm, "[ PrepareForTailCall"); | 1913 Comment cmnt(masm, "[ PrepareForTailCall"); |
1914 | 1914 |
1915 // Prepare for tail call only if the debugger is not active. | |
1916 Label done; | |
1917 ExternalReference debug_is_active = | |
1918 ExternalReference::debug_is_active_address(masm->isolate()); | |
1919 __ movzx_b(scratch1, Operand::StaticVariable(debug_is_active)); | |
1920 __ cmp(scratch1, Immediate(0)); | |
1921 __ j(not_equal, &done, Label::kNear); | |
1922 | |
1923 // Drop possible interpreter handler/stub frame. | 1915 // Drop possible interpreter handler/stub frame. |
1924 { | 1916 { |
1925 Label no_interpreter_frame; | 1917 Label no_interpreter_frame; |
1926 __ cmp(Operand(ebp, CommonFrameConstants::kContextOrFrameTypeOffset), | 1918 __ cmp(Operand(ebp, CommonFrameConstants::kContextOrFrameTypeOffset), |
1927 Immediate(Smi::FromInt(StackFrame::STUB))); | 1919 Immediate(Smi::FromInt(StackFrame::STUB))); |
1928 __ j(not_equal, &no_interpreter_frame, Label::kNear); | 1920 __ j(not_equal, &no_interpreter_frame, Label::kNear); |
1929 __ mov(ebp, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); | 1921 __ mov(ebp, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); |
1930 __ bind(&no_interpreter_frame); | 1922 __ bind(&no_interpreter_frame); |
1931 } | 1923 } |
1932 | 1924 |
(...skipping 20 matching lines...) Expand all Loading... |
1953 __ mov( | 1945 __ mov( |
1954 caller_args_count_reg, | 1946 caller_args_count_reg, |
1955 FieldOperand(scratch1, SharedFunctionInfo::kFormalParameterCountOffset)); | 1947 FieldOperand(scratch1, SharedFunctionInfo::kFormalParameterCountOffset)); |
1956 __ SmiUntag(caller_args_count_reg); | 1948 __ SmiUntag(caller_args_count_reg); |
1957 | 1949 |
1958 __ bind(&formal_parameter_count_loaded); | 1950 __ bind(&formal_parameter_count_loaded); |
1959 | 1951 |
1960 ParameterCount callee_args_count(args_reg); | 1952 ParameterCount callee_args_count(args_reg); |
1961 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2, | 1953 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2, |
1962 scratch3, ReturnAddressState::kOnStack, 0); | 1954 scratch3, ReturnAddressState::kOnStack, 0); |
1963 __ bind(&done); | |
1964 } | 1955 } |
1965 } // namespace | 1956 } // namespace |
1966 | 1957 |
1967 // static | 1958 // static |
1968 void Builtins::Generate_CallFunction(MacroAssembler* masm, | 1959 void Builtins::Generate_CallFunction(MacroAssembler* masm, |
1969 ConvertReceiverMode mode, | 1960 ConvertReceiverMode mode, |
1970 TailCallMode tail_call_mode) { | 1961 TailCallMode tail_call_mode) { |
1971 // ----------- S t a t e ------------- | 1962 // ----------- S t a t e ------------- |
1972 // -- eax : the number of arguments (not including the receiver) | 1963 // -- eax : the number of arguments (not including the receiver) |
1973 // -- edi : the function to call (checked to be a JSFunction) | 1964 // -- edi : the function to call (checked to be a JSFunction) |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2636 // And "return" to the OSR entry point of the function. | 2627 // And "return" to the OSR entry point of the function. |
2637 __ ret(0); | 2628 __ ret(0); |
2638 } | 2629 } |
2639 | 2630 |
2640 | 2631 |
2641 #undef __ | 2632 #undef __ |
2642 } // namespace internal | 2633 } // namespace internal |
2643 } // namespace v8 | 2634 } // namespace v8 |
2644 | 2635 |
2645 #endif // V8_TARGET_ARCH_X87 | 2636 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |