OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/disasm.h" | 10 #include "src/disasm.h" |
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 // is removed. Subtract 2 * kPointerSize for the context and function slots. | 920 // is removed. Subtract 2 * kPointerSize for the context and function slots. |
921 top_address = input_->GetRegister(fp_reg.code()) - | 921 top_address = input_->GetRegister(fp_reg.code()) - |
922 StandardFrameConstants::kFixedFrameSizeFromFp - | 922 StandardFrameConstants::kFixedFrameSizeFromFp - |
923 height_in_bytes + has_alignment_padding_ * kPointerSize; | 923 height_in_bytes + has_alignment_padding_ * kPointerSize; |
924 } else { | 924 } else { |
925 top_address = output_[frame_index - 1]->GetTop() - output_frame_size; | 925 top_address = output_[frame_index - 1]->GetTop() - output_frame_size; |
926 } | 926 } |
927 output_frame->SetTop(top_address); | 927 output_frame->SetTop(top_address); |
928 | 928 |
929 // Compute the incoming parameter translation. | 929 // Compute the incoming parameter translation. |
930 int parameter_count = | 930 int parameter_count = function->shared()->formal_parameter_count() + 1; |
931 function->shared()->internal_formal_parameter_count() + 1; | |
932 unsigned output_offset = output_frame_size; | 931 unsigned output_offset = output_frame_size; |
933 unsigned input_offset = input_frame_size; | 932 unsigned input_offset = input_frame_size; |
934 for (int i = 0; i < parameter_count; ++i) { | 933 for (int i = 0; i < parameter_count; ++i) { |
935 output_offset -= kPointerSize; | 934 output_offset -= kPointerSize; |
936 DoTranslateCommand(iterator, frame_index, output_offset); | 935 DoTranslateCommand(iterator, frame_index, output_offset); |
937 } | 936 } |
938 input_offset -= (parameter_count * kPointerSize); | 937 input_offset -= (parameter_count * kPointerSize); |
939 | 938 |
940 // There are no translation commands for the caller's pc and fp, the | 939 // There are no translation commands for the caller's pc and fp, the |
941 // context, and the function. Synthesize their values and set them up | 940 // context, and the function. Synthesize their values and set them up |
(...skipping 1776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2718 } | 2717 } |
2719 | 2718 |
2720 | 2719 |
2721 unsigned Deoptimizer::ComputeIncomingArgumentSize(JSFunction* function) const { | 2720 unsigned Deoptimizer::ComputeIncomingArgumentSize(JSFunction* function) const { |
2722 // The incoming arguments is the values for formal parameters and | 2721 // The incoming arguments is the values for formal parameters and |
2723 // the receiver. Every slot contains a pointer. | 2722 // the receiver. Every slot contains a pointer. |
2724 if (function->IsSmi()) { | 2723 if (function->IsSmi()) { |
2725 CHECK_EQ(Smi::cast(function), Smi::FromInt(StackFrame::STUB)); | 2724 CHECK_EQ(Smi::cast(function), Smi::FromInt(StackFrame::STUB)); |
2726 return 0; | 2725 return 0; |
2727 } | 2726 } |
2728 unsigned arguments = | 2727 unsigned arguments = function->shared()->formal_parameter_count() + 1; |
2729 function->shared()->internal_formal_parameter_count() + 1; | |
2730 return arguments * kPointerSize; | 2728 return arguments * kPointerSize; |
2731 } | 2729 } |
2732 | 2730 |
2733 | 2731 |
2734 unsigned Deoptimizer::ComputeOutgoingArgumentSize() const { | 2732 unsigned Deoptimizer::ComputeOutgoingArgumentSize() const { |
2735 DeoptimizationInputData* data = DeoptimizationInputData::cast( | 2733 DeoptimizationInputData* data = DeoptimizationInputData::cast( |
2736 compiled_code_->deoptimization_data()); | 2734 compiled_code_->deoptimization_data()); |
2737 unsigned height = data->ArgumentsStackHeight(bailout_id_)->value(); | 2735 unsigned height = data->ArgumentsStackHeight(bailout_id_)->value(); |
2738 return height * kPointerSize; | 2736 return height * kPointerSize; |
2739 } | 2737 } |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2856 int arg_size = (ComputeParametersCount() + 1) * kPointerSize; | 2854 int arg_size = (ComputeParametersCount() + 1) * kPointerSize; |
2857 unsigned base = GetFrameSize() - arg_size; | 2855 unsigned base = GetFrameSize() - arg_size; |
2858 return base - ((slot_index + 1) * kPointerSize); | 2856 return base - ((slot_index + 1) * kPointerSize); |
2859 } | 2857 } |
2860 } | 2858 } |
2861 | 2859 |
2862 | 2860 |
2863 int FrameDescription::ComputeParametersCount() { | 2861 int FrameDescription::ComputeParametersCount() { |
2864 switch (type_) { | 2862 switch (type_) { |
2865 case StackFrame::JAVA_SCRIPT: | 2863 case StackFrame::JAVA_SCRIPT: |
2866 return function_->shared()->internal_formal_parameter_count(); | 2864 return function_->shared()->formal_parameter_count(); |
2867 case StackFrame::ARGUMENTS_ADAPTOR: { | 2865 case StackFrame::ARGUMENTS_ADAPTOR: { |
2868 // Last slot contains number of incomming arguments as a smi. | 2866 // Last slot contains number of incomming arguments as a smi. |
2869 // Can't use GetExpression(0) because it would cause infinite recursion. | 2867 // Can't use GetExpression(0) because it would cause infinite recursion. |
2870 return reinterpret_cast<Smi*>(*GetFrameSlotPointer(0))->value(); | 2868 return reinterpret_cast<Smi*>(*GetFrameSlotPointer(0))->value(); |
2871 } | 2869 } |
2872 case StackFrame::STUB: | 2870 case StackFrame::STUB: |
2873 return -1; // Minus receiver. | 2871 return -1; // Minus receiver. |
2874 default: | 2872 default: |
2875 FATAL("Unexpected stack frame type"); | 2873 FATAL("Unexpected stack frame type"); |
2876 return 0; | 2874 return 0; |
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3663 Deoptimizer::GetDeoptimizationId(isolate, info->target_address(), | 3661 Deoptimizer::GetDeoptimizationId(isolate, info->target_address(), |
3664 Deoptimizer::LAZY))) { | 3662 Deoptimizer::LAZY))) { |
3665 CHECK(RelocInfo::IsRuntimeEntry(info->rmode())); | 3663 CHECK(RelocInfo::IsRuntimeEntry(info->rmode())); |
3666 return DeoptInfo(last_position, NULL, last_reason); | 3664 return DeoptInfo(last_position, NULL, last_reason); |
3667 } | 3665 } |
3668 } | 3666 } |
3669 } | 3667 } |
3670 return DeoptInfo(0, NULL, Deoptimizer::kNoReason); | 3668 return DeoptInfo(0, NULL, Deoptimizer::kNoReason); |
3671 } | 3669 } |
3672 } } // namespace v8::internal | 3670 } } // namespace v8::internal |
OLD | NEW |