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_X64 | 5 #if V8_TARGET_ARCH_X64 |
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 2034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2045 // | f()'s receiver arg | 2045 // | f()'s receiver arg |
2046 // | f()'s caller pc <- sp | 2046 // | f()'s caller pc <- sp |
2047 // ---------------------- | 2047 // ---------------------- |
2048 // | 2048 // |
2049 void PrepareForTailCall(MacroAssembler* masm, Register args_reg, | 2049 void PrepareForTailCall(MacroAssembler* masm, Register args_reg, |
2050 Register scratch1, Register scratch2, | 2050 Register scratch1, Register scratch2, |
2051 Register scratch3) { | 2051 Register scratch3) { |
2052 DCHECK(!AreAliased(args_reg, scratch1, scratch2, scratch3)); | 2052 DCHECK(!AreAliased(args_reg, scratch1, scratch2, scratch3)); |
2053 Comment cmnt(masm, "[ PrepareForTailCall"); | 2053 Comment cmnt(masm, "[ PrepareForTailCall"); |
2054 | 2054 |
2055 // Prepare for tail call only if the debugger is not active. | |
2056 Label done; | |
2057 ExternalReference debug_is_active = | |
2058 ExternalReference::debug_is_active_address(masm->isolate()); | |
2059 __ Move(kScratchRegister, debug_is_active); | |
2060 __ cmpb(Operand(kScratchRegister, 0), Immediate(0)); | |
2061 __ j(not_equal, &done); | |
2062 | |
2063 // Drop possible interpreter handler/stub frame. | 2055 // Drop possible interpreter handler/stub frame. |
2064 { | 2056 { |
2065 Label no_interpreter_frame; | 2057 Label no_interpreter_frame; |
2066 __ Cmp(Operand(rbp, CommonFrameConstants::kContextOrFrameTypeOffset), | 2058 __ Cmp(Operand(rbp, CommonFrameConstants::kContextOrFrameTypeOffset), |
2067 Smi::FromInt(StackFrame::STUB)); | 2059 Smi::FromInt(StackFrame::STUB)); |
2068 __ j(not_equal, &no_interpreter_frame, Label::kNear); | 2060 __ j(not_equal, &no_interpreter_frame, Label::kNear); |
2069 __ movp(rbp, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); | 2061 __ movp(rbp, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); |
2070 __ bind(&no_interpreter_frame); | 2062 __ bind(&no_interpreter_frame); |
2071 } | 2063 } |
2072 | 2064 |
(...skipping 19 matching lines...) Expand all Loading... |
2092 FieldOperand(scratch1, JSFunction::kSharedFunctionInfoOffset)); | 2084 FieldOperand(scratch1, JSFunction::kSharedFunctionInfoOffset)); |
2093 __ LoadSharedFunctionInfoSpecialField( | 2085 __ LoadSharedFunctionInfoSpecialField( |
2094 caller_args_count_reg, scratch1, | 2086 caller_args_count_reg, scratch1, |
2095 SharedFunctionInfo::kFormalParameterCountOffset); | 2087 SharedFunctionInfo::kFormalParameterCountOffset); |
2096 | 2088 |
2097 __ bind(&formal_parameter_count_loaded); | 2089 __ bind(&formal_parameter_count_loaded); |
2098 | 2090 |
2099 ParameterCount callee_args_count(args_reg); | 2091 ParameterCount callee_args_count(args_reg); |
2100 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2, | 2092 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2, |
2101 scratch3, ReturnAddressState::kOnStack); | 2093 scratch3, ReturnAddressState::kOnStack); |
2102 __ bind(&done); | |
2103 } | 2094 } |
2104 } // namespace | 2095 } // namespace |
2105 | 2096 |
2106 // static | 2097 // static |
2107 void Builtins::Generate_CallFunction(MacroAssembler* masm, | 2098 void Builtins::Generate_CallFunction(MacroAssembler* masm, |
2108 ConvertReceiverMode mode, | 2099 ConvertReceiverMode mode, |
2109 TailCallMode tail_call_mode) { | 2100 TailCallMode tail_call_mode) { |
2110 // ----------- S t a t e ------------- | 2101 // ----------- S t a t e ------------- |
2111 // -- rax : the number of arguments (not including the receiver) | 2102 // -- rax : the number of arguments (not including the receiver) |
2112 // -- rdi : the function to call (checked to be a JSFunction) | 2103 // -- rdi : the function to call (checked to be a JSFunction) |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2674 __ ret(0); | 2665 __ ret(0); |
2675 } | 2666 } |
2676 | 2667 |
2677 | 2668 |
2678 #undef __ | 2669 #undef __ |
2679 | 2670 |
2680 } // namespace internal | 2671 } // namespace internal |
2681 } // namespace v8 | 2672 } // namespace v8 |
2682 | 2673 |
2683 #endif // V8_TARGET_ARCH_X64 | 2674 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |