| 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 ES2015 tail call elimination is enabled. |
| 1916 Label done; |
| 1917 ExternalReference is_tail_call_elimination_enabled = |
| 1918 ExternalReference::is_tail_call_elimination_enabled_address( |
| 1919 masm->isolate()); |
| 1920 __ movzx_b(scratch1, |
| 1921 Operand::StaticVariable(is_tail_call_elimination_enabled)); |
| 1922 __ cmp(scratch1, Immediate(0)); |
| 1923 __ j(equal, &done, Label::kNear); |
| 1924 |
| 1915 // Drop possible interpreter handler/stub frame. | 1925 // Drop possible interpreter handler/stub frame. |
| 1916 { | 1926 { |
| 1917 Label no_interpreter_frame; | 1927 Label no_interpreter_frame; |
| 1918 __ cmp(Operand(ebp, CommonFrameConstants::kContextOrFrameTypeOffset), | 1928 __ cmp(Operand(ebp, CommonFrameConstants::kContextOrFrameTypeOffset), |
| 1919 Immediate(Smi::FromInt(StackFrame::STUB))); | 1929 Immediate(Smi::FromInt(StackFrame::STUB))); |
| 1920 __ j(not_equal, &no_interpreter_frame, Label::kNear); | 1930 __ j(not_equal, &no_interpreter_frame, Label::kNear); |
| 1921 __ mov(ebp, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); | 1931 __ mov(ebp, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); |
| 1922 __ bind(&no_interpreter_frame); | 1932 __ bind(&no_interpreter_frame); |
| 1923 } | 1933 } |
| 1924 | 1934 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1945 __ mov( | 1955 __ mov( |
| 1946 caller_args_count_reg, | 1956 caller_args_count_reg, |
| 1947 FieldOperand(scratch1, SharedFunctionInfo::kFormalParameterCountOffset)); | 1957 FieldOperand(scratch1, SharedFunctionInfo::kFormalParameterCountOffset)); |
| 1948 __ SmiUntag(caller_args_count_reg); | 1958 __ SmiUntag(caller_args_count_reg); |
| 1949 | 1959 |
| 1950 __ bind(&formal_parameter_count_loaded); | 1960 __ bind(&formal_parameter_count_loaded); |
| 1951 | 1961 |
| 1952 ParameterCount callee_args_count(args_reg); | 1962 ParameterCount callee_args_count(args_reg); |
| 1953 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2, | 1963 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2, |
| 1954 scratch3, ReturnAddressState::kOnStack, 0); | 1964 scratch3, ReturnAddressState::kOnStack, 0); |
| 1965 __ bind(&done); |
| 1955 } | 1966 } |
| 1956 } // namespace | 1967 } // namespace |
| 1957 | 1968 |
| 1958 // static | 1969 // static |
| 1959 void Builtins::Generate_CallFunction(MacroAssembler* masm, | 1970 void Builtins::Generate_CallFunction(MacroAssembler* masm, |
| 1960 ConvertReceiverMode mode, | 1971 ConvertReceiverMode mode, |
| 1961 TailCallMode tail_call_mode) { | 1972 TailCallMode tail_call_mode) { |
| 1962 // ----------- S t a t e ------------- | 1973 // ----------- S t a t e ------------- |
| 1963 // -- eax : the number of arguments (not including the receiver) | 1974 // -- eax : the number of arguments (not including the receiver) |
| 1964 // -- edi : the function to call (checked to be a JSFunction) | 1975 // -- edi : the function to call (checked to be a JSFunction) |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2627 // And "return" to the OSR entry point of the function. | 2638 // And "return" to the OSR entry point of the function. |
| 2628 __ ret(0); | 2639 __ ret(0); |
| 2629 } | 2640 } |
| 2630 | 2641 |
| 2631 | 2642 |
| 2632 #undef __ | 2643 #undef __ |
| 2633 } // namespace internal | 2644 } // namespace internal |
| 2634 } // namespace v8 | 2645 } // namespace v8 |
| 2635 | 2646 |
| 2636 #endif // V8_TARGET_ARCH_X87 | 2647 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |