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