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 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 // is removed. Subtract 2 * kPointerSize for the context and function slots. | 922 // is removed. Subtract 2 * kPointerSize for the context and function slots. |
923 top_address = input_->GetRegister(fp_reg.code()) - | 923 top_address = input_->GetRegister(fp_reg.code()) - |
924 StandardFrameConstants::kFixedFrameSizeFromFp - | 924 StandardFrameConstants::kFixedFrameSizeFromFp - |
925 height_in_bytes + has_alignment_padding_ * kPointerSize; | 925 height_in_bytes + has_alignment_padding_ * kPointerSize; |
926 } else { | 926 } else { |
927 top_address = output_[frame_index - 1]->GetTop() - output_frame_size; | 927 top_address = output_[frame_index - 1]->GetTop() - output_frame_size; |
928 } | 928 } |
929 output_frame->SetTop(top_address); | 929 output_frame->SetTop(top_address); |
930 | 930 |
931 // Compute the incoming parameter translation. | 931 // Compute the incoming parameter translation. |
932 int parameter_count = function->shared()->formal_parameter_count() + 1; | 932 int parameter_count = |
| 933 function->shared()->internal_formal_parameter_count() + 1; |
933 unsigned output_offset = output_frame_size; | 934 unsigned output_offset = output_frame_size; |
934 unsigned input_offset = input_frame_size; | 935 unsigned input_offset = input_frame_size; |
935 for (int i = 0; i < parameter_count; ++i) { | 936 for (int i = 0; i < parameter_count; ++i) { |
936 output_offset -= kPointerSize; | 937 output_offset -= kPointerSize; |
937 DoTranslateCommand(iterator, frame_index, output_offset); | 938 DoTranslateCommand(iterator, frame_index, output_offset); |
938 } | 939 } |
939 input_offset -= (parameter_count * kPointerSize); | 940 input_offset -= (parameter_count * kPointerSize); |
940 | 941 |
941 // There are no translation commands for the caller's pc and fp, the | 942 // There are no translation commands for the caller's pc and fp, the |
942 // context, and the function. Synthesize their values and set them up | 943 // context, and the function. Synthesize their values and set them up |
(...skipping 1776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2719 } | 2720 } |
2720 | 2721 |
2721 | 2722 |
2722 unsigned Deoptimizer::ComputeIncomingArgumentSize(JSFunction* function) const { | 2723 unsigned Deoptimizer::ComputeIncomingArgumentSize(JSFunction* function) const { |
2723 // The incoming arguments is the values for formal parameters and | 2724 // The incoming arguments is the values for formal parameters and |
2724 // the receiver. Every slot contains a pointer. | 2725 // the receiver. Every slot contains a pointer. |
2725 if (function->IsSmi()) { | 2726 if (function->IsSmi()) { |
2726 CHECK_EQ(Smi::cast(function), Smi::FromInt(StackFrame::STUB)); | 2727 CHECK_EQ(Smi::cast(function), Smi::FromInt(StackFrame::STUB)); |
2727 return 0; | 2728 return 0; |
2728 } | 2729 } |
2729 unsigned arguments = function->shared()->formal_parameter_count() + 1; | 2730 unsigned arguments = |
| 2731 function->shared()->internal_formal_parameter_count() + 1; |
2730 return arguments * kPointerSize; | 2732 return arguments * kPointerSize; |
2731 } | 2733 } |
2732 | 2734 |
2733 | 2735 |
2734 unsigned Deoptimizer::ComputeOutgoingArgumentSize() const { | 2736 unsigned Deoptimizer::ComputeOutgoingArgumentSize() const { |
2735 DeoptimizationInputData* data = DeoptimizationInputData::cast( | 2737 DeoptimizationInputData* data = DeoptimizationInputData::cast( |
2736 compiled_code_->deoptimization_data()); | 2738 compiled_code_->deoptimization_data()); |
2737 unsigned height = data->ArgumentsStackHeight(bailout_id_)->value(); | 2739 unsigned height = data->ArgumentsStackHeight(bailout_id_)->value(); |
2738 return height * kPointerSize; | 2740 return height * kPointerSize; |
2739 } | 2741 } |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2856 int arg_size = (ComputeParametersCount() + 1) * kPointerSize; | 2858 int arg_size = (ComputeParametersCount() + 1) * kPointerSize; |
2857 unsigned base = GetFrameSize() - arg_size; | 2859 unsigned base = GetFrameSize() - arg_size; |
2858 return base - ((slot_index + 1) * kPointerSize); | 2860 return base - ((slot_index + 1) * kPointerSize); |
2859 } | 2861 } |
2860 } | 2862 } |
2861 | 2863 |
2862 | 2864 |
2863 int FrameDescription::ComputeParametersCount() { | 2865 int FrameDescription::ComputeParametersCount() { |
2864 switch (type_) { | 2866 switch (type_) { |
2865 case StackFrame::JAVA_SCRIPT: | 2867 case StackFrame::JAVA_SCRIPT: |
2866 return function_->shared()->formal_parameter_count(); | 2868 return function_->shared()->internal_formal_parameter_count(); |
2867 case StackFrame::ARGUMENTS_ADAPTOR: { | 2869 case StackFrame::ARGUMENTS_ADAPTOR: { |
2868 // Last slot contains number of incomming arguments as a smi. | 2870 // Last slot contains number of incomming arguments as a smi. |
2869 // Can't use GetExpression(0) because it would cause infinite recursion. | 2871 // Can't use GetExpression(0) because it would cause infinite recursion. |
2870 return reinterpret_cast<Smi*>(*GetFrameSlotPointer(0))->value(); | 2872 return reinterpret_cast<Smi*>(*GetFrameSlotPointer(0))->value(); |
2871 } | 2873 } |
2872 case StackFrame::STUB: | 2874 case StackFrame::STUB: |
2873 return -1; // Minus receiver. | 2875 return -1; // Minus receiver. |
2874 default: | 2876 default: |
2875 FATAL("Unexpected stack frame type"); | 2877 FATAL("Unexpected stack frame type"); |
2876 return 0; | 2878 return 0; |
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3631 | 3633 |
3632 const char* Deoptimizer::GetDeoptReason(DeoptReason deopt_reason) { | 3634 const char* Deoptimizer::GetDeoptReason(DeoptReason deopt_reason) { |
3633 DCHECK(deopt_reason < kLastDeoptReason); | 3635 DCHECK(deopt_reason < kLastDeoptReason); |
3634 #define DEOPT_MESSAGES_TEXTS(C, T) T, | 3636 #define DEOPT_MESSAGES_TEXTS(C, T) T, |
3635 static const char* deopt_messages_[] = { | 3637 static const char* deopt_messages_[] = { |
3636 DEOPT_MESSAGES_LIST(DEOPT_MESSAGES_TEXTS)}; | 3638 DEOPT_MESSAGES_LIST(DEOPT_MESSAGES_TEXTS)}; |
3637 #undef DEOPT_MESSAGES_TEXTS | 3639 #undef DEOPT_MESSAGES_TEXTS |
3638 return deopt_messages_[deopt_reason]; | 3640 return deopt_messages_[deopt_reason]; |
3639 } | 3641 } |
3640 } } // namespace v8::internal | 3642 } } // namespace v8::internal |
OLD | NEW |