| 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/cpu-profiler.h" | 9 #include "src/cpu-profiler.h" |
| 10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
| (...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 &(translated_state_.frames()[frame_index]); | 830 &(translated_state_.frames()[frame_index]); |
| 831 TranslatedFrame::iterator value_iterator = translated_frame->begin(); | 831 TranslatedFrame::iterator value_iterator = translated_frame->begin(); |
| 832 int input_index = 0; | 832 int input_index = 0; |
| 833 | 833 |
| 834 BailoutId node_id = translated_frame->node_id(); | 834 BailoutId node_id = translated_frame->node_id(); |
| 835 unsigned height = | 835 unsigned height = |
| 836 translated_frame->height() - 1; // Do not count the context. | 836 translated_frame->height() - 1; // Do not count the context. |
| 837 unsigned height_in_bytes = height * kPointerSize; | 837 unsigned height_in_bytes = height * kPointerSize; |
| 838 JSFunction* function = JSFunction::cast(value_iterator->GetRawValue()); | 838 JSFunction* function = JSFunction::cast(value_iterator->GetRawValue()); |
| 839 value_iterator++; | 839 value_iterator++; |
| 840 input_index++; |
| 840 if (trace_scope_ != NULL) { | 841 if (trace_scope_ != NULL) { |
| 841 PrintF(trace_scope_->file(), " translating frame "); | 842 PrintF(trace_scope_->file(), " translating frame "); |
| 842 function->PrintName(trace_scope_->file()); | 843 function->PrintName(trace_scope_->file()); |
| 843 PrintF(trace_scope_->file(), | 844 PrintF(trace_scope_->file(), |
| 844 " => node=%d, height=%d\n", node_id.ToInt(), height_in_bytes); | 845 " => node=%d, height=%d\n", node_id.ToInt(), height_in_bytes); |
| 845 } | 846 } |
| 846 | 847 |
| 847 // The 'fixed' part of the frame consists of the incoming parameters and | 848 // The 'fixed' part of the frame consists of the incoming parameters and |
| 848 // the part described by JavaScriptFrameConstants. | 849 // the part described by JavaScriptFrameConstants. |
| 849 unsigned fixed_frame_size = ComputeFixedSize(function); | 850 unsigned fixed_frame_size = ComputeFixedSize(function); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 885 } | 886 } |
| 886 output_frame->SetTop(top_address); | 887 output_frame->SetTop(top_address); |
| 887 | 888 |
| 888 // Compute the incoming parameter translation. | 889 // Compute the incoming parameter translation. |
| 889 int parameter_count = | 890 int parameter_count = |
| 890 function->shared()->internal_formal_parameter_count() + 1; | 891 function->shared()->internal_formal_parameter_count() + 1; |
| 891 unsigned output_offset = output_frame_size; | 892 unsigned output_offset = output_frame_size; |
| 892 unsigned input_offset = input_frame_size; | 893 unsigned input_offset = input_frame_size; |
| 893 for (int i = 0; i < parameter_count; ++i) { | 894 for (int i = 0; i < parameter_count; ++i) { |
| 894 output_offset -= kPointerSize; | 895 output_offset -= kPointerSize; |
| 895 WriteValueToOutput(&value_iterator, &input_index, frame_index, | 896 WriteTranslatedValueToOutput(&value_iterator, &input_index, frame_index, |
| 896 output_offset); | 897 output_offset); |
| 897 } | 898 } |
| 898 input_offset -= (parameter_count * kPointerSize); | 899 input_offset -= (parameter_count * kPointerSize); |
| 899 | 900 |
| 900 // There are no translation commands for the caller's pc and fp, the | 901 // There are no translation commands for the caller's pc and fp, the |
| 901 // context, and the function. Synthesize their values and set them up | 902 // context, and the function. Synthesize their values and set them up |
| 902 // explicitly. | 903 // explicitly. |
| 903 // | 904 // |
| 904 // The caller's pc for the bottommost output frame is the same as in the | 905 // The caller's pc for the bottommost output frame is the same as in the |
| 905 // input frame. For all subsequent output frames, it can be read from the | 906 // input frame. For all subsequent output frames, it can be read from the |
| 906 // previous one. This frame's pc can be computed from the non-optimized | 907 // previous one. This frame's pc can be computed from the non-optimized |
| 907 // function code and AST id of the bailout. | 908 // function code and AST id of the bailout. |
| 908 output_offset -= kPCOnStackSize; | 909 output_offset -= kPCOnStackSize; |
| 909 input_offset -= kPCOnStackSize; | 910 input_offset -= kPCOnStackSize; |
| 910 intptr_t value; | 911 intptr_t value; |
| 911 if (is_bottommost) { | 912 if (is_bottommost) { |
| 912 value = input_->GetFrameSlot(input_offset); | 913 value = input_->GetFrameSlot(input_offset); |
| 913 } else { | 914 } else { |
| 914 value = output_[frame_index - 1]->GetPc(); | 915 value = output_[frame_index - 1]->GetPc(); |
| 915 } | 916 } |
| 916 output_frame->SetCallerPc(output_offset, value); | 917 output_frame->SetCallerPc(output_offset, value); |
| 917 if (trace_scope_ != NULL) { | 918 DebugPrintOutputSlot(value, frame_index, output_offset, "caller's pc\n"); |
| 918 PrintF(trace_scope_->file(), | |
| 919 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | |
| 920 V8PRIxPTR " ; caller's pc\n", | |
| 921 top_address + output_offset, output_offset, value); | |
| 922 } | |
| 923 | 919 |
| 924 // The caller's frame pointer for the bottommost output frame is the same | 920 // The caller's frame pointer for the bottommost output frame is the same |
| 925 // as in the input frame. For all subsequent output frames, it can be | 921 // as in the input frame. For all subsequent output frames, it can be |
| 926 // read from the previous one. Also compute and set this frame's frame | 922 // read from the previous one. Also compute and set this frame's frame |
| 927 // pointer. | 923 // pointer. |
| 928 output_offset -= kFPOnStackSize; | 924 output_offset -= kFPOnStackSize; |
| 929 input_offset -= kFPOnStackSize; | 925 input_offset -= kFPOnStackSize; |
| 930 if (is_bottommost) { | 926 if (is_bottommost) { |
| 931 value = input_->GetFrameSlot(input_offset); | 927 value = input_->GetFrameSlot(input_offset); |
| 932 } else { | 928 } else { |
| 933 value = output_[frame_index - 1]->GetFp(); | 929 value = output_[frame_index - 1]->GetFp(); |
| 934 } | 930 } |
| 935 output_frame->SetCallerFp(output_offset, value); | 931 output_frame->SetCallerFp(output_offset, value); |
| 936 intptr_t fp_value = top_address + output_offset; | 932 intptr_t fp_value = top_address + output_offset; |
| 937 DCHECK(!is_bottommost || (input_->GetRegister(fp_reg.code()) + | 933 DCHECK(!is_bottommost || (input_->GetRegister(fp_reg.code()) + |
| 938 has_alignment_padding_ * kPointerSize) == fp_value); | 934 has_alignment_padding_ * kPointerSize) == fp_value); |
| 939 output_frame->SetFp(fp_value); | 935 output_frame->SetFp(fp_value); |
| 940 if (is_topmost) output_frame->SetRegister(fp_reg.code(), fp_value); | 936 if (is_topmost) output_frame->SetRegister(fp_reg.code(), fp_value); |
| 941 if (trace_scope_ != NULL) { | 937 DebugPrintOutputSlot(value, frame_index, output_offset, "caller's fp\n"); |
| 942 PrintF(trace_scope_->file(), | |
| 943 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | |
| 944 V8PRIxPTR " ; caller's fp\n", | |
| 945 fp_value, output_offset, value); | |
| 946 } | |
| 947 DCHECK(!is_bottommost || !has_alignment_padding_ || | 938 DCHECK(!is_bottommost || !has_alignment_padding_ || |
| 948 (fp_value & kPointerSize) != 0); | 939 (fp_value & kPointerSize) != 0); |
| 949 | 940 |
| 950 if (FLAG_enable_embedded_constant_pool) { | 941 if (FLAG_enable_embedded_constant_pool) { |
| 951 // For the bottommost output frame the constant pool pointer can be gotten | 942 // For the bottommost output frame the constant pool pointer can be gotten |
| 952 // from the input frame. For subsequent output frames, it can be read from | 943 // from the input frame. For subsequent output frames, it can be read from |
| 953 // the previous frame. | 944 // the previous frame. |
| 954 output_offset -= kPointerSize; | 945 output_offset -= kPointerSize; |
| 955 input_offset -= kPointerSize; | 946 input_offset -= kPointerSize; |
| 956 if (is_bottommost) { | 947 if (is_bottommost) { |
| 957 value = input_->GetFrameSlot(input_offset); | 948 value = input_->GetFrameSlot(input_offset); |
| 958 } else { | 949 } else { |
| 959 value = output_[frame_index - 1]->GetConstantPool(); | 950 value = output_[frame_index - 1]->GetConstantPool(); |
| 960 } | 951 } |
| 961 output_frame->SetCallerConstantPool(output_offset, value); | 952 output_frame->SetCallerConstantPool(output_offset, value); |
| 962 if (trace_scope_) { | 953 DebugPrintOutputSlot(value, frame_index, output_offset, |
| 963 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 954 "caller's constant_pool\n"); |
| 964 V8PRIxPTR "; caller's constant_pool\n", | |
| 965 top_address + output_offset, output_offset, value); | |
| 966 } | |
| 967 } | 955 } |
| 968 | 956 |
| 969 // For the bottommost output frame the context can be gotten from the input | 957 // For the bottommost output frame the context can be gotten from the input |
| 970 // frame. For all subsequent output frames it can be gotten from the function | 958 // frame. For all subsequent output frames it can be gotten from the function |
| 971 // so long as we don't inline functions that need local contexts. | 959 // so long as we don't inline functions that need local contexts. |
| 972 Register context_reg = JavaScriptFrame::context_register(); | 960 Register context_reg = JavaScriptFrame::context_register(); |
| 973 output_offset -= kPointerSize; | 961 output_offset -= kPointerSize; |
| 974 input_offset -= kPointerSize; | 962 input_offset -= kPointerSize; |
| 975 // Read the context from the translations. | 963 // Read the context from the translations. |
| 976 WriteValueToOutput(&value_iterator, &input_index, frame_index, output_offset); | 964 Object* context = value_iterator->GetRawValue(); |
| 977 value = output_frame->GetFrameSlot(output_offset); | |
| 978 // The context should not be a placeholder for a materialized object. | 965 // The context should not be a placeholder for a materialized object. |
| 979 CHECK(value != | 966 CHECK(context != isolate_->heap()->arguments_marker()); |
| 980 reinterpret_cast<intptr_t>(isolate_->heap()->arguments_marker())); | 967 if (context == isolate_->heap()->undefined_value()) { |
| 981 if (value == | |
| 982 reinterpret_cast<intptr_t>(isolate_->heap()->undefined_value())) { | |
| 983 // If the context was optimized away, just use the context from | 968 // If the context was optimized away, just use the context from |
| 984 // the activation. This should only apply to Crankshaft code. | 969 // the activation. This should only apply to Crankshaft code. |
| 985 CHECK(!compiled_code_->is_turbofanned()); | 970 CHECK(!compiled_code_->is_turbofanned()); |
| 986 if (is_bottommost) { | 971 context = |
| 987 value = input_->GetFrameSlot(input_offset); | 972 is_bottommost |
| 988 } else { | 973 ? reinterpret_cast<Object*>(input_->GetFrameSlot(input_offset)) |
| 989 value = reinterpret_cast<intptr_t>(function->context()); | 974 : function->context(); |
| 990 } | |
| 991 output_frame->SetFrameSlot(output_offset, value); | |
| 992 } | 975 } |
| 976 value = reinterpret_cast<intptr_t>(context); |
| 993 output_frame->SetContext(value); | 977 output_frame->SetContext(value); |
| 994 if (is_topmost) output_frame->SetRegister(context_reg.code(), value); | 978 if (is_topmost) output_frame->SetRegister(context_reg.code(), value); |
| 995 if (trace_scope_ != NULL) { | 979 WriteValueToOutput(context, input_index, frame_index, output_offset, |
| 996 PrintF(trace_scope_->file(), | 980 "context "); |
| 997 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 981 value_iterator++; |
| 998 V8PRIxPTR "; context\n", | 982 input_index++; |
| 999 top_address + output_offset, output_offset, value); | |
| 1000 } | |
| 1001 | 983 |
| 1002 // The function was mentioned explicitly in the BEGIN_FRAME. | 984 // The function was mentioned explicitly in the BEGIN_FRAME. |
| 1003 output_offset -= kPointerSize; | 985 output_offset -= kPointerSize; |
| 1004 input_offset -= kPointerSize; | 986 input_offset -= kPointerSize; |
| 1005 value = reinterpret_cast<intptr_t>(function); | 987 value = reinterpret_cast<intptr_t>(function); |
| 1006 // The function for the bottommost output frame should also agree with the | 988 // The function for the bottommost output frame should also agree with the |
| 1007 // input frame. | 989 // input frame. |
| 1008 DCHECK(!is_bottommost || input_->GetFrameSlot(input_offset) == value); | 990 DCHECK(!is_bottommost || input_->GetFrameSlot(input_offset) == value); |
| 1009 output_frame->SetFrameSlot(output_offset, value); | 991 WriteValueToOutput(function, 0, frame_index, output_offset, "function "); |
| 1010 if (trace_scope_ != NULL) { | |
| 1011 PrintF(trace_scope_->file(), | |
| 1012 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | |
| 1013 V8PRIxPTR "; function\n", | |
| 1014 top_address + output_offset, output_offset, value); | |
| 1015 } | |
| 1016 | 992 |
| 1017 // Translate the rest of the frame. | 993 // Translate the rest of the frame. |
| 1018 for (unsigned i = 0; i < height; ++i) { | 994 for (unsigned i = 0; i < height; ++i) { |
| 1019 output_offset -= kPointerSize; | 995 output_offset -= kPointerSize; |
| 1020 WriteValueToOutput(&value_iterator, &input_index, frame_index, | 996 WriteTranslatedValueToOutput(&value_iterator, &input_index, frame_index, |
| 1021 output_offset); | 997 output_offset); |
| 1022 } | 998 } |
| 1023 CHECK_EQ(0u, output_offset); | 999 CHECK_EQ(0u, output_offset); |
| 1024 | 1000 |
| 1025 // Compute this frame's PC, state, and continuation. | 1001 // Compute this frame's PC, state, and continuation. |
| 1026 Code* non_optimized_code = function->shared()->code(); | 1002 Code* non_optimized_code = function->shared()->code(); |
| 1027 FixedArray* raw_data = non_optimized_code->deoptimization_data(); | 1003 FixedArray* raw_data = non_optimized_code->deoptimization_data(); |
| 1028 DeoptimizationOutputData* data = DeoptimizationOutputData::cast(raw_data); | 1004 DeoptimizationOutputData* data = DeoptimizationOutputData::cast(raw_data); |
| 1029 Address start = non_optimized_code->instruction_start(); | 1005 Address start = non_optimized_code->instruction_start(); |
| 1030 unsigned pc_and_state = GetOutputInfo(data, node_id, function->shared()); | 1006 unsigned pc_and_state = GetOutputInfo(data, node_id, function->shared()); |
| 1031 unsigned pc_offset = FullCodeGenerator::PcField::decode(pc_and_state); | 1007 unsigned pc_offset = FullCodeGenerator::PcField::decode(pc_and_state); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1069 int frame_index) { | 1045 int frame_index) { |
| 1070 TranslatedFrame* translated_frame = | 1046 TranslatedFrame* translated_frame = |
| 1071 &(translated_state_.frames()[frame_index]); | 1047 &(translated_state_.frames()[frame_index]); |
| 1072 TranslatedFrame::iterator value_iterator = translated_frame->begin(); | 1048 TranslatedFrame::iterator value_iterator = translated_frame->begin(); |
| 1073 int input_index = 0; | 1049 int input_index = 0; |
| 1074 | 1050 |
| 1075 unsigned height = translated_frame->height(); | 1051 unsigned height = translated_frame->height(); |
| 1076 unsigned height_in_bytes = height * kPointerSize; | 1052 unsigned height_in_bytes = height * kPointerSize; |
| 1077 JSFunction* function = JSFunction::cast(value_iterator->GetRawValue()); | 1053 JSFunction* function = JSFunction::cast(value_iterator->GetRawValue()); |
| 1078 value_iterator++; | 1054 value_iterator++; |
| 1055 input_index++; |
| 1079 if (trace_scope_ != NULL) { | 1056 if (trace_scope_ != NULL) { |
| 1080 PrintF(trace_scope_->file(), | 1057 PrintF(trace_scope_->file(), |
| 1081 " translating arguments adaptor => height=%d\n", height_in_bytes); | 1058 " translating arguments adaptor => height=%d\n", height_in_bytes); |
| 1082 } | 1059 } |
| 1083 | 1060 |
| 1084 unsigned fixed_frame_size = ArgumentsAdaptorFrameConstants::kFrameSize; | 1061 unsigned fixed_frame_size = ArgumentsAdaptorFrameConstants::kFrameSize; |
| 1085 unsigned output_frame_size = height_in_bytes + fixed_frame_size; | 1062 unsigned output_frame_size = height_in_bytes + fixed_frame_size; |
| 1086 | 1063 |
| 1087 // Allocate and store the output frame description. | 1064 // Allocate and store the output frame description. |
| 1088 FrameDescription* output_frame = | 1065 FrameDescription* output_frame = |
| 1089 new(output_frame_size) FrameDescription(output_frame_size, function); | 1066 new(output_frame_size) FrameDescription(output_frame_size, function); |
| 1090 output_frame->SetFrameType(StackFrame::ARGUMENTS_ADAPTOR); | 1067 output_frame->SetFrameType(StackFrame::ARGUMENTS_ADAPTOR); |
| 1091 | 1068 |
| 1092 // Arguments adaptor can not be topmost or bottommost. | 1069 // Arguments adaptor can not be topmost or bottommost. |
| 1093 CHECK(frame_index > 0 && frame_index < output_count_ - 1); | 1070 CHECK(frame_index > 0 && frame_index < output_count_ - 1); |
| 1094 CHECK(output_[frame_index] == NULL); | 1071 CHECK(output_[frame_index] == NULL); |
| 1095 output_[frame_index] = output_frame; | 1072 output_[frame_index] = output_frame; |
| 1096 | 1073 |
| 1097 // The top address of the frame is computed from the previous | 1074 // The top address of the frame is computed from the previous |
| 1098 // frame's top and this frame's size. | 1075 // frame's top and this frame's size. |
| 1099 intptr_t top_address; | 1076 intptr_t top_address; |
| 1100 top_address = output_[frame_index - 1]->GetTop() - output_frame_size; | 1077 top_address = output_[frame_index - 1]->GetTop() - output_frame_size; |
| 1101 output_frame->SetTop(top_address); | 1078 output_frame->SetTop(top_address); |
| 1102 | 1079 |
| 1103 // Compute the incoming parameter translation. | 1080 // Compute the incoming parameter translation. |
| 1104 int parameter_count = height; | 1081 int parameter_count = height; |
| 1105 unsigned output_offset = output_frame_size; | 1082 unsigned output_offset = output_frame_size; |
| 1106 for (int i = 0; i < parameter_count; ++i) { | 1083 for (int i = 0; i < parameter_count; ++i) { |
| 1107 output_offset -= kPointerSize; | 1084 output_offset -= kPointerSize; |
| 1108 WriteValueToOutput(&value_iterator, &input_index, frame_index, | 1085 WriteTranslatedValueToOutput(&value_iterator, &input_index, frame_index, |
| 1109 output_offset); | 1086 output_offset); |
| 1110 } | 1087 } |
| 1111 | 1088 |
| 1112 // Read caller's PC from the previous frame. | 1089 // Read caller's PC from the previous frame. |
| 1113 output_offset -= kPCOnStackSize; | 1090 output_offset -= kPCOnStackSize; |
| 1114 intptr_t callers_pc = output_[frame_index - 1]->GetPc(); | 1091 intptr_t callers_pc = output_[frame_index - 1]->GetPc(); |
| 1115 output_frame->SetCallerPc(output_offset, callers_pc); | 1092 output_frame->SetCallerPc(output_offset, callers_pc); |
| 1116 if (trace_scope_ != NULL) { | 1093 DebugPrintOutputSlot(callers_pc, frame_index, output_offset, "caller's pc\n"); |
| 1117 PrintF(trace_scope_->file(), | |
| 1118 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | |
| 1119 V8PRIxPTR " ; caller's pc\n", | |
| 1120 top_address + output_offset, output_offset, callers_pc); | |
| 1121 } | |
| 1122 | 1094 |
| 1123 // Read caller's FP from the previous frame, and set this frame's FP. | 1095 // Read caller's FP from the previous frame, and set this frame's FP. |
| 1124 output_offset -= kFPOnStackSize; | 1096 output_offset -= kFPOnStackSize; |
| 1125 intptr_t value = output_[frame_index - 1]->GetFp(); | 1097 intptr_t value = output_[frame_index - 1]->GetFp(); |
| 1126 output_frame->SetCallerFp(output_offset, value); | 1098 output_frame->SetCallerFp(output_offset, value); |
| 1127 intptr_t fp_value = top_address + output_offset; | 1099 intptr_t fp_value = top_address + output_offset; |
| 1128 output_frame->SetFp(fp_value); | 1100 output_frame->SetFp(fp_value); |
| 1129 if (trace_scope_ != NULL) { | 1101 DebugPrintOutputSlot(value, frame_index, output_offset, "caller's fp\n"); |
| 1130 PrintF(trace_scope_->file(), | |
| 1131 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | |
| 1132 V8PRIxPTR " ; caller's fp\n", | |
| 1133 fp_value, output_offset, value); | |
| 1134 } | |
| 1135 | 1102 |
| 1136 if (FLAG_enable_embedded_constant_pool) { | 1103 if (FLAG_enable_embedded_constant_pool) { |
| 1137 // Read the caller's constant pool from the previous frame. | 1104 // Read the caller's constant pool from the previous frame. |
| 1138 output_offset -= kPointerSize; | 1105 output_offset -= kPointerSize; |
| 1139 value = output_[frame_index - 1]->GetConstantPool(); | 1106 value = output_[frame_index - 1]->GetConstantPool(); |
| 1140 output_frame->SetCallerConstantPool(output_offset, value); | 1107 output_frame->SetCallerConstantPool(output_offset, value); |
| 1141 if (trace_scope_) { | 1108 DebugPrintOutputSlot(value, frame_index, output_offset, |
| 1142 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1109 "caller's constant_pool\n"); |
| 1143 V8PRIxPTR "; caller's constant_pool\n", | |
| 1144 top_address + output_offset, output_offset, value); | |
| 1145 } | |
| 1146 } | 1110 } |
| 1147 | 1111 |
| 1148 // A marker value is used in place of the context. | 1112 // A marker value is used in place of the context. |
| 1149 output_offset -= kPointerSize; | 1113 output_offset -= kPointerSize; |
| 1150 intptr_t context = reinterpret_cast<intptr_t>( | 1114 intptr_t context = reinterpret_cast<intptr_t>( |
| 1151 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); | 1115 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); |
| 1152 output_frame->SetFrameSlot(output_offset, context); | 1116 output_frame->SetFrameSlot(output_offset, context); |
| 1153 if (trace_scope_ != NULL) { | 1117 DebugPrintOutputSlot(context, frame_index, output_offset, |
| 1154 PrintF(trace_scope_->file(), | 1118 "context (adaptor sentinel)\n"); |
| 1155 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | |
| 1156 V8PRIxPTR " ; context (adaptor sentinel)\n", | |
| 1157 top_address + output_offset, output_offset, context); | |
| 1158 } | |
| 1159 | 1119 |
| 1160 // The function was mentioned explicitly in the ARGUMENTS_ADAPTOR_FRAME. | 1120 // The function was mentioned explicitly in the ARGUMENTS_ADAPTOR_FRAME. |
| 1161 output_offset -= kPointerSize; | 1121 output_offset -= kPointerSize; |
| 1162 value = reinterpret_cast<intptr_t>(function); | 1122 value = reinterpret_cast<intptr_t>(function); |
| 1163 output_frame->SetFrameSlot(output_offset, value); | 1123 WriteValueToOutput(function, 0, frame_index, output_offset, "function "); |
| 1164 if (trace_scope_ != NULL) { | |
| 1165 PrintF(trace_scope_->file(), | |
| 1166 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | |
| 1167 V8PRIxPTR " ; function\n", | |
| 1168 top_address + output_offset, output_offset, value); | |
| 1169 } | |
| 1170 | 1124 |
| 1171 // Number of incoming arguments. | 1125 // Number of incoming arguments. |
| 1172 output_offset -= kPointerSize; | 1126 output_offset -= kPointerSize; |
| 1173 value = reinterpret_cast<intptr_t>(Smi::FromInt(height - 1)); | 1127 value = reinterpret_cast<intptr_t>(Smi::FromInt(height - 1)); |
| 1174 output_frame->SetFrameSlot(output_offset, value); | 1128 output_frame->SetFrameSlot(output_offset, value); |
| 1175 if (trace_scope_ != NULL) { | 1129 DebugPrintOutputSlot(value, frame_index, output_offset, "argc "); |
| 1176 PrintF(trace_scope_->file(), | 1130 if (trace_scope_ != nullptr) { |
| 1177 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1131 PrintF(trace_scope_->file(), "(%d)\n", height - 1); |
| 1178 V8PRIxPTR " ; argc (%d)\n", | |
| 1179 top_address + output_offset, output_offset, value, height - 1); | |
| 1180 } | 1132 } |
| 1181 | 1133 |
| 1182 DCHECK(0 == output_offset); | 1134 DCHECK(0 == output_offset); |
| 1183 | 1135 |
| 1184 Builtins* builtins = isolate_->builtins(); | 1136 Builtins* builtins = isolate_->builtins(); |
| 1185 Code* adaptor_trampoline = | 1137 Code* adaptor_trampoline = |
| 1186 builtins->builtin(Builtins::kArgumentsAdaptorTrampoline); | 1138 builtins->builtin(Builtins::kArgumentsAdaptorTrampoline); |
| 1187 intptr_t pc_value = reinterpret_cast<intptr_t>( | 1139 intptr_t pc_value = reinterpret_cast<intptr_t>( |
| 1188 adaptor_trampoline->instruction_start() + | 1140 adaptor_trampoline->instruction_start() + |
| 1189 isolate_->heap()->arguments_adaptor_deopt_pc_offset()->value()); | 1141 isolate_->heap()->arguments_adaptor_deopt_pc_offset()->value()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1202 &(translated_state_.frames()[frame_index]); | 1154 &(translated_state_.frames()[frame_index]); |
| 1203 TranslatedFrame::iterator value_iterator = translated_frame->begin(); | 1155 TranslatedFrame::iterator value_iterator = translated_frame->begin(); |
| 1204 int input_index = 0; | 1156 int input_index = 0; |
| 1205 | 1157 |
| 1206 Builtins* builtins = isolate_->builtins(); | 1158 Builtins* builtins = isolate_->builtins(); |
| 1207 Code* construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric); | 1159 Code* construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric); |
| 1208 unsigned height = translated_frame->height(); | 1160 unsigned height = translated_frame->height(); |
| 1209 unsigned height_in_bytes = height * kPointerSize; | 1161 unsigned height_in_bytes = height * kPointerSize; |
| 1210 JSFunction* function = JSFunction::cast(value_iterator->GetRawValue()); | 1162 JSFunction* function = JSFunction::cast(value_iterator->GetRawValue()); |
| 1211 value_iterator++; | 1163 value_iterator++; |
| 1164 input_index++; |
| 1212 if (trace_scope_ != NULL) { | 1165 if (trace_scope_ != NULL) { |
| 1213 PrintF(trace_scope_->file(), | 1166 PrintF(trace_scope_->file(), |
| 1214 " translating construct stub => height=%d\n", height_in_bytes); | 1167 " translating construct stub => height=%d\n", height_in_bytes); |
| 1215 } | 1168 } |
| 1216 | 1169 |
| 1217 unsigned fixed_frame_size = ConstructFrameConstants::kFrameSize; | 1170 unsigned fixed_frame_size = ConstructFrameConstants::kFrameSize; |
| 1218 unsigned output_frame_size = height_in_bytes + fixed_frame_size; | 1171 unsigned output_frame_size = height_in_bytes + fixed_frame_size; |
| 1219 | 1172 |
| 1220 // Allocate and store the output frame description. | 1173 // Allocate and store the output frame description. |
| 1221 FrameDescription* output_frame = | 1174 FrameDescription* output_frame = |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1234 output_frame->SetTop(top_address); | 1187 output_frame->SetTop(top_address); |
| 1235 | 1188 |
| 1236 // Compute the incoming parameter translation. | 1189 // Compute the incoming parameter translation. |
| 1237 int parameter_count = height; | 1190 int parameter_count = height; |
| 1238 unsigned output_offset = output_frame_size; | 1191 unsigned output_offset = output_frame_size; |
| 1239 for (int i = 0; i < parameter_count; ++i) { | 1192 for (int i = 0; i < parameter_count; ++i) { |
| 1240 output_offset -= kPointerSize; | 1193 output_offset -= kPointerSize; |
| 1241 // The allocated receiver of a construct stub frame is passed as the | 1194 // The allocated receiver of a construct stub frame is passed as the |
| 1242 // receiver parameter through the translation. It might be encoding | 1195 // receiver parameter through the translation. It might be encoding |
| 1243 // a captured object, override the slot address for a captured object. | 1196 // a captured object, override the slot address for a captured object. |
| 1244 WriteValueToOutput( | 1197 WriteTranslatedValueToOutput( |
| 1245 &value_iterator, &input_index, frame_index, output_offset, | 1198 &value_iterator, &input_index, frame_index, output_offset, nullptr, |
| 1246 (i == 0) ? reinterpret_cast<Address>(top_address) : nullptr); | 1199 (i == 0) ? reinterpret_cast<Address>(top_address) : nullptr); |
| 1247 } | 1200 } |
| 1248 | 1201 |
| 1249 // Read caller's PC from the previous frame. | 1202 // Read caller's PC from the previous frame. |
| 1250 output_offset -= kPCOnStackSize; | 1203 output_offset -= kPCOnStackSize; |
| 1251 intptr_t callers_pc = output_[frame_index - 1]->GetPc(); | 1204 intptr_t callers_pc = output_[frame_index - 1]->GetPc(); |
| 1252 output_frame->SetCallerPc(output_offset, callers_pc); | 1205 output_frame->SetCallerPc(output_offset, callers_pc); |
| 1253 if (trace_scope_ != NULL) { | 1206 DebugPrintOutputSlot(callers_pc, frame_index, output_offset, "caller's pc\n"); |
| 1254 PrintF(trace_scope_->file(), | |
| 1255 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | |
| 1256 V8PRIxPTR " ; caller's pc\n", | |
| 1257 top_address + output_offset, output_offset, callers_pc); | |
| 1258 } | |
| 1259 | 1207 |
| 1260 // Read caller's FP from the previous frame, and set this frame's FP. | 1208 // Read caller's FP from the previous frame, and set this frame's FP. |
| 1261 output_offset -= kFPOnStackSize; | 1209 output_offset -= kFPOnStackSize; |
| 1262 intptr_t value = output_[frame_index - 1]->GetFp(); | 1210 intptr_t value = output_[frame_index - 1]->GetFp(); |
| 1263 output_frame->SetCallerFp(output_offset, value); | 1211 output_frame->SetCallerFp(output_offset, value); |
| 1264 intptr_t fp_value = top_address + output_offset; | 1212 intptr_t fp_value = top_address + output_offset; |
| 1265 output_frame->SetFp(fp_value); | 1213 output_frame->SetFp(fp_value); |
| 1266 if (trace_scope_ != NULL) { | 1214 DebugPrintOutputSlot(value, frame_index, output_offset, "caller's fp\n"); |
| 1267 PrintF(trace_scope_->file(), | |
| 1268 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | |
| 1269 V8PRIxPTR " ; caller's fp\n", | |
| 1270 fp_value, output_offset, value); | |
| 1271 } | |
| 1272 | 1215 |
| 1273 if (FLAG_enable_embedded_constant_pool) { | 1216 if (FLAG_enable_embedded_constant_pool) { |
| 1274 // Read the caller's constant pool from the previous frame. | 1217 // Read the caller's constant pool from the previous frame. |
| 1275 output_offset -= kPointerSize; | 1218 output_offset -= kPointerSize; |
| 1276 value = output_[frame_index - 1]->GetConstantPool(); | 1219 value = output_[frame_index - 1]->GetConstantPool(); |
| 1277 output_frame->SetCallerConstantPool(output_offset, value); | 1220 output_frame->SetCallerConstantPool(output_offset, value); |
| 1278 if (trace_scope_) { | 1221 DebugPrintOutputSlot(value, frame_index, output_offset, |
| 1279 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1222 "caller's constant_pool\n"); |
| 1280 V8PRIxPTR " ; caller's constant pool\n", | |
| 1281 top_address + output_offset, output_offset, value); | |
| 1282 } | |
| 1283 } | 1223 } |
| 1284 | 1224 |
| 1285 // The context can be gotten from the previous frame. | 1225 // The context can be gotten from the previous frame. |
| 1286 output_offset -= kPointerSize; | 1226 output_offset -= kPointerSize; |
| 1287 value = output_[frame_index - 1]->GetContext(); | 1227 value = output_[frame_index - 1]->GetContext(); |
| 1288 output_frame->SetFrameSlot(output_offset, value); | 1228 output_frame->SetFrameSlot(output_offset, value); |
| 1289 if (trace_scope_ != NULL) { | 1229 DebugPrintOutputSlot(value, frame_index, output_offset, "context\n"); |
| 1290 PrintF(trace_scope_->file(), | |
| 1291 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | |
| 1292 V8PRIxPTR " ; context\n", | |
| 1293 top_address + output_offset, output_offset, value); | |
| 1294 } | |
| 1295 | 1230 |
| 1296 // A marker value is used in place of the function. | 1231 // A marker value is used in place of the function. |
| 1297 output_offset -= kPointerSize; | 1232 output_offset -= kPointerSize; |
| 1298 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::CONSTRUCT)); | 1233 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::CONSTRUCT)); |
| 1299 output_frame->SetFrameSlot(output_offset, value); | 1234 output_frame->SetFrameSlot(output_offset, value); |
| 1300 if (trace_scope_ != NULL) { | 1235 DebugPrintOutputSlot(value, frame_index, output_offset, |
| 1301 PrintF(trace_scope_->file(), | 1236 "function (construct sentinel)\n"); |
| 1302 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | |
| 1303 V8PRIxPTR " ; function (construct sentinel)\n", | |
| 1304 top_address + output_offset, output_offset, value); | |
| 1305 } | |
| 1306 | 1237 |
| 1307 // The output frame reflects a JSConstructStubGeneric frame. | 1238 // The output frame reflects a JSConstructStubGeneric frame. |
| 1308 output_offset -= kPointerSize; | 1239 output_offset -= kPointerSize; |
| 1309 value = reinterpret_cast<intptr_t>(construct_stub); | 1240 value = reinterpret_cast<intptr_t>(construct_stub); |
| 1310 output_frame->SetFrameSlot(output_offset, value); | 1241 output_frame->SetFrameSlot(output_offset, value); |
| 1311 if (trace_scope_ != NULL) { | 1242 DebugPrintOutputSlot(value, frame_index, output_offset, "code object\n"); |
| 1312 PrintF(trace_scope_->file(), | |
| 1313 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | |
| 1314 V8PRIxPTR " ; code object\n", | |
| 1315 top_address + output_offset, output_offset, value); | |
| 1316 } | |
| 1317 | 1243 |
| 1318 // Number of incoming arguments. | 1244 // Number of incoming arguments. |
| 1319 output_offset -= kPointerSize; | 1245 output_offset -= kPointerSize; |
| 1320 value = reinterpret_cast<intptr_t>(Smi::FromInt(height - 1)); | 1246 value = reinterpret_cast<intptr_t>(Smi::FromInt(height - 1)); |
| 1321 output_frame->SetFrameSlot(output_offset, value); | 1247 output_frame->SetFrameSlot(output_offset, value); |
| 1322 if (trace_scope_ != NULL) { | 1248 DebugPrintOutputSlot(value, frame_index, output_offset, "argc "); |
| 1323 PrintF(trace_scope_->file(), | 1249 if (trace_scope_ != nullptr) { |
| 1324 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1250 PrintF(trace_scope_->file(), "(%d)\n", height - 1); |
| 1325 V8PRIxPTR " ; argc (%d)\n", | |
| 1326 top_address + output_offset, output_offset, value, height - 1); | |
| 1327 } | 1251 } |
| 1328 | 1252 |
| 1329 // Constructor function being invoked by the stub (only present on some | 1253 // Constructor function being invoked by the stub (only present on some |
| 1330 // architectures, indicated by kConstructorOffset). | 1254 // architectures, indicated by kConstructorOffset). |
| 1331 if (ConstructFrameConstants::kConstructorOffset != kMinInt) { | 1255 if (ConstructFrameConstants::kConstructorOffset != kMinInt) { |
| 1332 output_offset -= kPointerSize; | 1256 output_offset -= kPointerSize; |
| 1333 value = reinterpret_cast<intptr_t>(function); | 1257 WriteValueToOutput(function, 0, frame_index, output_offset, |
| 1334 output_frame->SetFrameSlot(output_offset, value); | 1258 "constructor function "); |
| 1335 if (trace_scope_ != NULL) { | |
| 1336 PrintF(trace_scope_->file(), | |
| 1337 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | |
| 1338 V8PRIxPTR " ; constructor function\n", | |
| 1339 top_address + output_offset, output_offset, value); | |
| 1340 } | |
| 1341 } | 1259 } |
| 1342 | 1260 |
| 1343 // The newly allocated object was passed as receiver in the artificial | 1261 // The newly allocated object was passed as receiver in the artificial |
| 1344 // constructor stub environment created by HEnvironment::CopyForInlining(). | 1262 // constructor stub environment created by HEnvironment::CopyForInlining(). |
| 1345 output_offset -= kPointerSize; | 1263 output_offset -= kPointerSize; |
| 1346 value = output_frame->GetFrameSlot(output_frame_size - kPointerSize); | 1264 value = output_frame->GetFrameSlot(output_frame_size - kPointerSize); |
| 1347 output_frame->SetFrameSlot(output_offset, value); | 1265 output_frame->SetFrameSlot(output_offset, value); |
| 1348 if (trace_scope_ != NULL) { | 1266 DebugPrintOutputSlot(value, frame_index, output_offset, |
| 1349 PrintF(trace_scope_->file(), | 1267 "allocated receiver\n"); |
| 1350 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | |
| 1351 V8PRIxPTR " ; allocated receiver\n", | |
| 1352 top_address + output_offset, output_offset, value); | |
| 1353 } | |
| 1354 | 1268 |
| 1355 CHECK_EQ(0u, output_offset); | 1269 CHECK_EQ(0u, output_offset); |
| 1356 | 1270 |
| 1357 intptr_t pc = reinterpret_cast<intptr_t>( | 1271 intptr_t pc = reinterpret_cast<intptr_t>( |
| 1358 construct_stub->instruction_start() + | 1272 construct_stub->instruction_start() + |
| 1359 isolate_->heap()->construct_stub_deopt_pc_offset()->value()); | 1273 isolate_->heap()->construct_stub_deopt_pc_offset()->value()); |
| 1360 output_frame->SetPc(pc); | 1274 output_frame->SetPc(pc); |
| 1361 if (FLAG_enable_embedded_constant_pool) { | 1275 if (FLAG_enable_embedded_constant_pool) { |
| 1362 intptr_t constant_pool_value = | 1276 intptr_t constant_pool_value = |
| 1363 reinterpret_cast<intptr_t>(construct_stub->constant_pool()); | 1277 reinterpret_cast<intptr_t>(construct_stub->constant_pool()); |
| 1364 output_frame->SetConstantPool(constant_pool_value); | 1278 output_frame->SetConstantPool(constant_pool_value); |
| 1365 } | 1279 } |
| 1366 } | 1280 } |
| 1367 | 1281 |
| 1368 | 1282 |
| 1369 void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator, | 1283 void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator, |
| 1370 int frame_index, | 1284 int frame_index, |
| 1371 bool is_setter_stub_frame) { | 1285 bool is_setter_stub_frame) { |
| 1372 TranslatedFrame* translated_frame = | 1286 TranslatedFrame* translated_frame = |
| 1373 &(translated_state_.frames()[frame_index]); | 1287 &(translated_state_.frames()[frame_index]); |
| 1374 TranslatedFrame::iterator value_iterator = translated_frame->begin(); | 1288 TranslatedFrame::iterator value_iterator = translated_frame->begin(); |
| 1375 int input_index = 0; | 1289 int input_index = 0; |
| 1376 | 1290 |
| 1377 JSFunction* accessor = JSFunction::cast(value_iterator->GetRawValue()); | 1291 JSFunction* accessor = JSFunction::cast(value_iterator->GetRawValue()); |
| 1378 value_iterator++; | 1292 value_iterator++; |
| 1293 input_index++; |
| 1379 // The receiver (and the implicit return value, if any) are expected in | 1294 // The receiver (and the implicit return value, if any) are expected in |
| 1380 // registers by the LoadIC/StoreIC, so they don't belong to the output stack | 1295 // registers by the LoadIC/StoreIC, so they don't belong to the output stack |
| 1381 // frame. This means that we have to use a height of 0. | 1296 // frame. This means that we have to use a height of 0. |
| 1382 unsigned height = 0; | 1297 unsigned height = 0; |
| 1383 unsigned height_in_bytes = height * kPointerSize; | 1298 unsigned height_in_bytes = height * kPointerSize; |
| 1384 const char* kind = is_setter_stub_frame ? "setter" : "getter"; | 1299 const char* kind = is_setter_stub_frame ? "setter" : "getter"; |
| 1385 if (trace_scope_ != NULL) { | 1300 if (trace_scope_ != NULL) { |
| 1386 PrintF(trace_scope_->file(), | 1301 PrintF(trace_scope_->file(), |
| 1387 " translating %s stub => height=%u\n", kind, height_in_bytes); | 1302 " translating %s stub => height=%u\n", kind, height_in_bytes); |
| 1388 } | 1303 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1412 // this frame's size. | 1327 // this frame's size. |
| 1413 intptr_t top_address = output_[frame_index - 1]->GetTop() - output_frame_size; | 1328 intptr_t top_address = output_[frame_index - 1]->GetTop() - output_frame_size; |
| 1414 output_frame->SetTop(top_address); | 1329 output_frame->SetTop(top_address); |
| 1415 | 1330 |
| 1416 unsigned output_offset = output_frame_size; | 1331 unsigned output_offset = output_frame_size; |
| 1417 | 1332 |
| 1418 // Read caller's PC from the previous frame. | 1333 // Read caller's PC from the previous frame. |
| 1419 output_offset -= kPCOnStackSize; | 1334 output_offset -= kPCOnStackSize; |
| 1420 intptr_t callers_pc = output_[frame_index - 1]->GetPc(); | 1335 intptr_t callers_pc = output_[frame_index - 1]->GetPc(); |
| 1421 output_frame->SetCallerPc(output_offset, callers_pc); | 1336 output_frame->SetCallerPc(output_offset, callers_pc); |
| 1422 if (trace_scope_ != NULL) { | 1337 DebugPrintOutputSlot(callers_pc, frame_index, output_offset, "caller's pc\n"); |
| 1423 PrintF(trace_scope_->file(), | |
| 1424 " 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR | |
| 1425 " ; caller's pc\n", | |
| 1426 top_address + output_offset, output_offset, callers_pc); | |
| 1427 } | |
| 1428 | 1338 |
| 1429 // Read caller's FP from the previous frame, and set this frame's FP. | 1339 // Read caller's FP from the previous frame, and set this frame's FP. |
| 1430 output_offset -= kFPOnStackSize; | 1340 output_offset -= kFPOnStackSize; |
| 1431 intptr_t value = output_[frame_index - 1]->GetFp(); | 1341 intptr_t value = output_[frame_index - 1]->GetFp(); |
| 1432 output_frame->SetCallerFp(output_offset, value); | 1342 output_frame->SetCallerFp(output_offset, value); |
| 1433 intptr_t fp_value = top_address + output_offset; | 1343 intptr_t fp_value = top_address + output_offset; |
| 1434 output_frame->SetFp(fp_value); | 1344 output_frame->SetFp(fp_value); |
| 1435 if (trace_scope_ != NULL) { | 1345 DebugPrintOutputSlot(value, frame_index, output_offset, "caller's fp\n"); |
| 1436 PrintF(trace_scope_->file(), | |
| 1437 " 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR | |
| 1438 " ; caller's fp\n", | |
| 1439 fp_value, output_offset, value); | |
| 1440 } | |
| 1441 | 1346 |
| 1442 if (FLAG_enable_embedded_constant_pool) { | 1347 if (FLAG_enable_embedded_constant_pool) { |
| 1443 // Read the caller's constant pool from the previous frame. | 1348 // Read the caller's constant pool from the previous frame. |
| 1444 output_offset -= kPointerSize; | 1349 output_offset -= kPointerSize; |
| 1445 value = output_[frame_index - 1]->GetConstantPool(); | 1350 value = output_[frame_index - 1]->GetConstantPool(); |
| 1446 output_frame->SetCallerConstantPool(output_offset, value); | 1351 output_frame->SetCallerConstantPool(output_offset, value); |
| 1447 if (trace_scope_) { | 1352 DebugPrintOutputSlot(value, frame_index, output_offset, |
| 1448 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1353 "caller's constant_pool\n"); |
| 1449 V8PRIxPTR " ; caller's constant pool\n", | |
| 1450 top_address + output_offset, output_offset, value); | |
| 1451 } | |
| 1452 } | 1354 } |
| 1453 | 1355 |
| 1454 // The context can be gotten from the previous frame. | 1356 // The context can be gotten from the previous frame. |
| 1455 output_offset -= kPointerSize; | 1357 output_offset -= kPointerSize; |
| 1456 value = output_[frame_index - 1]->GetContext(); | 1358 value = output_[frame_index - 1]->GetContext(); |
| 1457 output_frame->SetFrameSlot(output_offset, value); | 1359 output_frame->SetFrameSlot(output_offset, value); |
| 1458 if (trace_scope_ != NULL) { | 1360 DebugPrintOutputSlot(value, frame_index, output_offset, "context\n"); |
| 1459 PrintF(trace_scope_->file(), | |
| 1460 " 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR | |
| 1461 " ; context\n", | |
| 1462 top_address + output_offset, output_offset, value); | |
| 1463 } | |
| 1464 | 1361 |
| 1465 // A marker value is used in place of the function. | 1362 // A marker value is used in place of the function. |
| 1466 output_offset -= kPointerSize; | 1363 output_offset -= kPointerSize; |
| 1467 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::INTERNAL)); | 1364 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::INTERNAL)); |
| 1468 output_frame->SetFrameSlot(output_offset, value); | 1365 output_frame->SetFrameSlot(output_offset, value); |
| 1469 if (trace_scope_ != NULL) { | 1366 DebugPrintOutputSlot(value, frame_index, output_offset, "function "); |
| 1470 PrintF(trace_scope_->file(), | 1367 if (trace_scope_ != nullptr) { |
| 1471 " 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR | 1368 PrintF(trace_scope_->file(), "(%s sentinel)\n", kind); |
| 1472 " ; function (%s sentinel)\n", | |
| 1473 top_address + output_offset, output_offset, value, kind); | |
| 1474 } | 1369 } |
| 1475 | 1370 |
| 1476 // Get Code object from accessor stub. | 1371 // Get Code object from accessor stub. |
| 1477 output_offset -= kPointerSize; | 1372 output_offset -= kPointerSize; |
| 1478 Builtins::Name name = is_setter_stub_frame ? | 1373 Builtins::Name name = is_setter_stub_frame ? |
| 1479 Builtins::kStoreIC_Setter_ForDeopt : | 1374 Builtins::kStoreIC_Setter_ForDeopt : |
| 1480 Builtins::kLoadIC_Getter_ForDeopt; | 1375 Builtins::kLoadIC_Getter_ForDeopt; |
| 1481 Code* accessor_stub = isolate_->builtins()->builtin(name); | 1376 Code* accessor_stub = isolate_->builtins()->builtin(name); |
| 1482 value = reinterpret_cast<intptr_t>(accessor_stub); | 1377 value = reinterpret_cast<intptr_t>(accessor_stub); |
| 1483 output_frame->SetFrameSlot(output_offset, value); | 1378 output_frame->SetFrameSlot(output_offset, value); |
| 1484 if (trace_scope_ != NULL) { | 1379 DebugPrintOutputSlot(value, frame_index, output_offset, "code object\n"); |
| 1485 PrintF(trace_scope_->file(), | |
| 1486 " 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR | |
| 1487 " ; code object\n", | |
| 1488 top_address + output_offset, output_offset, value); | |
| 1489 } | |
| 1490 | 1380 |
| 1491 // Skip receiver. | 1381 // Skip receiver. |
| 1492 value_iterator++; | 1382 value_iterator++; |
| 1383 input_index++; |
| 1493 | 1384 |
| 1494 if (is_setter_stub_frame) { | 1385 if (is_setter_stub_frame) { |
| 1495 // The implicit return value was part of the artificial setter stub | 1386 // The implicit return value was part of the artificial setter stub |
| 1496 // environment. | 1387 // environment. |
| 1497 output_offset -= kPointerSize; | 1388 output_offset -= kPointerSize; |
| 1498 WriteValueToOutput(&value_iterator, &input_index, frame_index, | 1389 WriteTranslatedValueToOutput(&value_iterator, &input_index, frame_index, |
| 1499 output_offset); | 1390 output_offset); |
| 1500 } | 1391 } |
| 1501 | 1392 |
| 1502 CHECK_EQ(0u, output_offset); | 1393 CHECK_EQ(0u, output_offset); |
| 1503 | 1394 |
| 1504 Smi* offset = is_setter_stub_frame ? | 1395 Smi* offset = is_setter_stub_frame ? |
| 1505 isolate_->heap()->setter_stub_deopt_pc_offset() : | 1396 isolate_->heap()->setter_stub_deopt_pc_offset() : |
| 1506 isolate_->heap()->getter_stub_deopt_pc_offset(); | 1397 isolate_->heap()->getter_stub_deopt_pc_offset(); |
| 1507 intptr_t pc = reinterpret_cast<intptr_t>( | 1398 intptr_t pc = reinterpret_cast<intptr_t>( |
| 1508 accessor_stub->instruction_start() + offset->value()); | 1399 accessor_stub->instruction_start() + offset->value()); |
| 1509 output_frame->SetPc(pc); | 1400 output_frame->SetPc(pc); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1591 Register fp_reg = StubFailureTrampolineFrame::fp_register(); | 1482 Register fp_reg = StubFailureTrampolineFrame::fp_register(); |
| 1592 intptr_t top_address = input_->GetRegister(fp_reg.code()) - | 1483 intptr_t top_address = input_->GetRegister(fp_reg.code()) - |
| 1593 StandardFrameConstants::kFixedFrameSizeFromFp - height_in_bytes; | 1484 StandardFrameConstants::kFixedFrameSizeFromFp - height_in_bytes; |
| 1594 output_frame->SetTop(top_address); | 1485 output_frame->SetTop(top_address); |
| 1595 | 1486 |
| 1596 // Read caller's PC (JSFunction continuation) from the input frame. | 1487 // Read caller's PC (JSFunction continuation) from the input frame. |
| 1597 unsigned input_frame_offset = input_frame_size - kPCOnStackSize; | 1488 unsigned input_frame_offset = input_frame_size - kPCOnStackSize; |
| 1598 unsigned output_frame_offset = output_frame_size - kFPOnStackSize; | 1489 unsigned output_frame_offset = output_frame_size - kFPOnStackSize; |
| 1599 intptr_t value = input_->GetFrameSlot(input_frame_offset); | 1490 intptr_t value = input_->GetFrameSlot(input_frame_offset); |
| 1600 output_frame->SetCallerPc(output_frame_offset, value); | 1491 output_frame->SetCallerPc(output_frame_offset, value); |
| 1601 if (trace_scope_ != NULL) { | 1492 DebugPrintOutputSlot(value, frame_index, output_frame_offset, |
| 1602 PrintF(trace_scope_->file(), | 1493 "caller's pc\n"); |
| 1603 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | |
| 1604 V8PRIxPTR " ; caller's pc\n", | |
| 1605 top_address + output_frame_offset, output_frame_offset, value); | |
| 1606 } | |
| 1607 | 1494 |
| 1608 // Read caller's FP from the input frame, and set this frame's FP. | 1495 // Read caller's FP from the input frame, and set this frame's FP. |
| 1609 input_frame_offset -= kFPOnStackSize; | 1496 input_frame_offset -= kFPOnStackSize; |
| 1610 value = input_->GetFrameSlot(input_frame_offset); | 1497 value = input_->GetFrameSlot(input_frame_offset); |
| 1611 output_frame_offset -= kFPOnStackSize; | 1498 output_frame_offset -= kFPOnStackSize; |
| 1612 output_frame->SetCallerFp(output_frame_offset, value); | 1499 output_frame->SetCallerFp(output_frame_offset, value); |
| 1613 intptr_t frame_ptr = input_->GetRegister(fp_reg.code()); | 1500 intptr_t frame_ptr = input_->GetRegister(fp_reg.code()); |
| 1614 output_frame->SetRegister(fp_reg.code(), frame_ptr); | 1501 output_frame->SetRegister(fp_reg.code(), frame_ptr); |
| 1615 output_frame->SetFp(frame_ptr); | 1502 output_frame->SetFp(frame_ptr); |
| 1616 if (trace_scope_ != NULL) { | 1503 DebugPrintOutputSlot(value, frame_index, output_frame_offset, |
| 1617 PrintF(trace_scope_->file(), | 1504 "caller's fp\n"); |
| 1618 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | |
| 1619 V8PRIxPTR " ; caller's fp\n", | |
| 1620 top_address + output_frame_offset, output_frame_offset, value); | |
| 1621 } | |
| 1622 | 1505 |
| 1623 if (FLAG_enable_embedded_constant_pool) { | 1506 if (FLAG_enable_embedded_constant_pool) { |
| 1624 // Read the caller's constant pool from the input frame. | 1507 // Read the caller's constant pool from the input frame. |
| 1625 input_frame_offset -= kPointerSize; | 1508 input_frame_offset -= kPointerSize; |
| 1626 value = input_->GetFrameSlot(input_frame_offset); | 1509 value = input_->GetFrameSlot(input_frame_offset); |
| 1627 output_frame_offset -= kPointerSize; | 1510 output_frame_offset -= kPointerSize; |
| 1628 output_frame->SetCallerConstantPool(output_frame_offset, value); | 1511 output_frame->SetCallerConstantPool(output_frame_offset, value); |
| 1629 if (trace_scope_) { | 1512 DebugPrintOutputSlot(value, frame_index, output_frame_offset, |
| 1630 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1513 "caller's constant_pool\n"); |
| 1631 V8PRIxPTR " ; caller's constant_pool\n", | |
| 1632 top_address + output_frame_offset, output_frame_offset, value); | |
| 1633 } | |
| 1634 } | 1514 } |
| 1635 | 1515 |
| 1636 // The context can be gotten from the input frame. | 1516 // The context can be gotten from the input frame. |
| 1637 Register context_reg = StubFailureTrampolineFrame::context_register(); | 1517 Register context_reg = StubFailureTrampolineFrame::context_register(); |
| 1638 input_frame_offset -= kPointerSize; | 1518 input_frame_offset -= kPointerSize; |
| 1639 value = input_->GetFrameSlot(input_frame_offset); | 1519 value = input_->GetFrameSlot(input_frame_offset); |
| 1640 output_frame->SetRegister(context_reg.code(), value); | 1520 output_frame->SetRegister(context_reg.code(), value); |
| 1641 output_frame_offset -= kPointerSize; | 1521 output_frame_offset -= kPointerSize; |
| 1642 output_frame->SetFrameSlot(output_frame_offset, value); | 1522 output_frame->SetFrameSlot(output_frame_offset, value); |
| 1643 CHECK(reinterpret_cast<Object*>(value)->IsContext()); | 1523 CHECK(reinterpret_cast<Object*>(value)->IsContext()); |
| 1644 if (trace_scope_ != NULL) { | 1524 DebugPrintOutputSlot(value, frame_index, output_frame_offset, "context\n"); |
| 1645 PrintF(trace_scope_->file(), | |
| 1646 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | |
| 1647 V8PRIxPTR " ; context\n", | |
| 1648 top_address + output_frame_offset, output_frame_offset, value); | |
| 1649 } | |
| 1650 | 1525 |
| 1651 // A marker value is used in place of the function. | 1526 // A marker value is used in place of the function. |
| 1652 output_frame_offset -= kPointerSize; | 1527 output_frame_offset -= kPointerSize; |
| 1653 value = reinterpret_cast<intptr_t>( | 1528 value = reinterpret_cast<intptr_t>( |
| 1654 Smi::FromInt(StackFrame::STUB_FAILURE_TRAMPOLINE)); | 1529 Smi::FromInt(StackFrame::STUB_FAILURE_TRAMPOLINE)); |
| 1655 output_frame->SetFrameSlot(output_frame_offset, value); | 1530 output_frame->SetFrameSlot(output_frame_offset, value); |
| 1656 if (trace_scope_ != NULL) { | 1531 DebugPrintOutputSlot(value, frame_index, output_frame_offset, |
| 1657 PrintF(trace_scope_->file(), | 1532 "function (stub failure sentinel)\n"); |
| 1658 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | |
| 1659 V8PRIxPTR " ; function (stub failure sentinel)\n", | |
| 1660 top_address + output_frame_offset, output_frame_offset, value); | |
| 1661 } | |
| 1662 | 1533 |
| 1663 intptr_t caller_arg_count = 0; | 1534 intptr_t caller_arg_count = 0; |
| 1664 bool arg_count_known = !descriptor.stack_parameter_count().is_valid(); | 1535 bool arg_count_known = !descriptor.stack_parameter_count().is_valid(); |
| 1665 | 1536 |
| 1666 // Build the Arguments object for the caller's parameters and a pointer to it. | 1537 // Build the Arguments object for the caller's parameters and a pointer to it. |
| 1667 output_frame_offset -= kPointerSize; | 1538 output_frame_offset -= kPointerSize; |
| 1668 int args_arguments_offset = output_frame_offset; | 1539 int args_arguments_offset = output_frame_offset; |
| 1669 intptr_t the_hole = reinterpret_cast<intptr_t>( | 1540 intptr_t the_hole = reinterpret_cast<intptr_t>( |
| 1670 isolate_->heap()->the_hole_value()); | 1541 isolate_->heap()->the_hole_value()); |
| 1671 if (arg_count_known) { | 1542 if (arg_count_known) { |
| 1672 value = frame_ptr + StandardFrameConstants::kCallerSPOffset + | 1543 value = frame_ptr + StandardFrameConstants::kCallerSPOffset + |
| 1673 (caller_arg_count - 1) * kPointerSize; | 1544 (caller_arg_count - 1) * kPointerSize; |
| 1674 } else { | 1545 } else { |
| 1675 value = the_hole; | 1546 value = the_hole; |
| 1676 } | 1547 } |
| 1677 | 1548 |
| 1678 output_frame->SetFrameSlot(args_arguments_offset, value); | 1549 output_frame->SetFrameSlot(args_arguments_offset, value); |
| 1679 if (trace_scope_ != NULL) { | 1550 DebugPrintOutputSlot( |
| 1680 PrintF(trace_scope_->file(), | 1551 value, frame_index, args_arguments_offset, |
| 1681 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1552 arg_count_known ? "args.arguments\n" : "args.arguments (the hole)\n"); |
| 1682 V8PRIxPTR " ; args.arguments %s\n", | |
| 1683 top_address + args_arguments_offset, args_arguments_offset, value, | |
| 1684 arg_count_known ? "" : "(the hole)"); | |
| 1685 } | |
| 1686 | 1553 |
| 1687 output_frame_offset -= kPointerSize; | 1554 output_frame_offset -= kPointerSize; |
| 1688 int length_frame_offset = output_frame_offset; | 1555 int length_frame_offset = output_frame_offset; |
| 1689 value = arg_count_known ? caller_arg_count : the_hole; | 1556 value = arg_count_known ? caller_arg_count : the_hole; |
| 1690 output_frame->SetFrameSlot(length_frame_offset, value); | 1557 output_frame->SetFrameSlot(length_frame_offset, value); |
| 1691 if (trace_scope_ != NULL) { | 1558 DebugPrintOutputSlot( |
| 1692 PrintF(trace_scope_->file(), | 1559 value, frame_index, length_frame_offset, |
| 1693 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1560 arg_count_known ? "args.length\n" : "args.length (the hole)\n"); |
| 1694 V8PRIxPTR " ; args.length %s\n", | |
| 1695 top_address + length_frame_offset, length_frame_offset, value, | |
| 1696 arg_count_known ? "" : "(the hole)"); | |
| 1697 } | |
| 1698 | 1561 |
| 1699 output_frame_offset -= kPointerSize; | 1562 output_frame_offset -= kPointerSize; |
| 1700 value = frame_ptr + StandardFrameConstants::kCallerSPOffset - | 1563 value = frame_ptr + StandardFrameConstants::kCallerSPOffset - |
| 1701 (output_frame_size - output_frame_offset) + kPointerSize; | 1564 (output_frame_size - output_frame_offset) + kPointerSize; |
| 1702 output_frame->SetFrameSlot(output_frame_offset, value); | 1565 output_frame->SetFrameSlot(output_frame_offset, value); |
| 1703 if (trace_scope_ != NULL) { | 1566 DebugPrintOutputSlot(value, frame_index, output_frame_offset, "args*\n"); |
| 1704 PrintF(trace_scope_->file(), | |
| 1705 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | |
| 1706 V8PRIxPTR " ; args*\n", | |
| 1707 top_address + output_frame_offset, output_frame_offset, value); | |
| 1708 } | |
| 1709 | 1567 |
| 1710 // Copy the register parameters to the failure frame. | 1568 // Copy the register parameters to the failure frame. |
| 1711 int arguments_length_offset = -1; | 1569 int arguments_length_offset = -1; |
| 1712 for (int i = 0; i < param_count; ++i) { | 1570 for (int i = 0; i < param_count; ++i) { |
| 1713 output_frame_offset -= kPointerSize; | 1571 output_frame_offset -= kPointerSize; |
| 1714 WriteValueToOutput(&value_iterator, &input_index, 0, output_frame_offset); | 1572 WriteTranslatedValueToOutput(&value_iterator, &input_index, 0, |
| 1573 output_frame_offset); |
| 1715 | 1574 |
| 1716 if (!arg_count_known && descriptor.IsEnvironmentParameterCountRegister(i)) { | 1575 if (!arg_count_known && descriptor.IsEnvironmentParameterCountRegister(i)) { |
| 1717 arguments_length_offset = output_frame_offset; | 1576 arguments_length_offset = output_frame_offset; |
| 1718 } | 1577 } |
| 1719 } | 1578 } |
| 1720 | 1579 |
| 1721 CHECK_EQ(0u, output_frame_offset); | 1580 CHECK_EQ(0u, output_frame_offset); |
| 1722 | 1581 |
| 1723 if (!arg_count_known) { | 1582 if (!arg_count_known) { |
| 1724 CHECK_GE(arguments_length_offset, 0); | 1583 CHECK_GE(arguments_length_offset, 0); |
| 1725 // We know it's a smi because 1) the code stub guarantees the stack | 1584 // We know it's a smi because 1) the code stub guarantees the stack |
| 1726 // parameter count is in smi range, and 2) the DoTranslateCommand in the | 1585 // parameter count is in smi range, and 2) the DoTranslateCommand in the |
| 1727 // parameter loop above translated that to a tagged value. | 1586 // parameter loop above translated that to a tagged value. |
| 1728 Smi* smi_caller_arg_count = reinterpret_cast<Smi*>( | 1587 Smi* smi_caller_arg_count = reinterpret_cast<Smi*>( |
| 1729 output_frame->GetFrameSlot(arguments_length_offset)); | 1588 output_frame->GetFrameSlot(arguments_length_offset)); |
| 1730 caller_arg_count = smi_caller_arg_count->value(); | 1589 caller_arg_count = smi_caller_arg_count->value(); |
| 1731 output_frame->SetFrameSlot(length_frame_offset, caller_arg_count); | 1590 output_frame->SetFrameSlot(length_frame_offset, caller_arg_count); |
| 1732 if (trace_scope_ != NULL) { | 1591 DebugPrintOutputSlot(caller_arg_count, frame_index, length_frame_offset, |
| 1733 PrintF(trace_scope_->file(), | 1592 "args.length\n"); |
| 1734 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | |
| 1735 V8PRIxPTR " ; args.length\n", | |
| 1736 top_address + length_frame_offset, length_frame_offset, | |
| 1737 caller_arg_count); | |
| 1738 } | |
| 1739 value = frame_ptr + StandardFrameConstants::kCallerSPOffset + | 1593 value = frame_ptr + StandardFrameConstants::kCallerSPOffset + |
| 1740 (caller_arg_count - 1) * kPointerSize; | 1594 (caller_arg_count - 1) * kPointerSize; |
| 1741 output_frame->SetFrameSlot(args_arguments_offset, value); | 1595 output_frame->SetFrameSlot(args_arguments_offset, value); |
| 1742 if (trace_scope_ != NULL) { | 1596 DebugPrintOutputSlot(value, frame_index, args_arguments_offset, |
| 1743 PrintF(trace_scope_->file(), | 1597 "args.arguments"); |
| 1744 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | |
| 1745 V8PRIxPTR " ; args.arguments\n", | |
| 1746 top_address + args_arguments_offset, args_arguments_offset, | |
| 1747 value); | |
| 1748 } | |
| 1749 } | 1598 } |
| 1750 | 1599 |
| 1751 // Copy the double registers from the input into the output frame. | 1600 // Copy the double registers from the input into the output frame. |
| 1752 CopyDoubleRegisters(output_frame); | 1601 CopyDoubleRegisters(output_frame); |
| 1753 | 1602 |
| 1754 // Fill registers containing handler and number of parameters. | 1603 // Fill registers containing handler and number of parameters. |
| 1755 SetPlatformCompiledStubRegisters(output_frame, &descriptor); | 1604 SetPlatformCompiledStubRegisters(output_frame, &descriptor); |
| 1756 | 1605 |
| 1757 // Compute this frame's PC, state, and continuation. | 1606 // Compute this frame's PC, state, and continuation. |
| 1758 Code* trampoline = NULL; | 1607 Code* trampoline = NULL; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1849 } | 1698 } |
| 1850 | 1699 |
| 1851 for (int i = 0; i < expression_count; i++, iter++) { | 1700 for (int i = 0; i < expression_count; i++, iter++) { |
| 1852 if (!iter->IsMaterializedObject()) { | 1701 if (!iter->IsMaterializedObject()) { |
| 1853 info->SetExpression(i, *(iter->GetValue())); | 1702 info->SetExpression(i, *(iter->GetValue())); |
| 1854 } | 1703 } |
| 1855 } | 1704 } |
| 1856 } | 1705 } |
| 1857 | 1706 |
| 1858 | 1707 |
| 1859 void Deoptimizer::WriteValueToOutput( | 1708 void Deoptimizer::WriteTranslatedValueToOutput( |
| 1860 TranslatedFrame::iterator* iterator, int* input_index, int frame_index, | 1709 TranslatedFrame::iterator* iterator, int* input_index, int frame_index, |
| 1861 unsigned output_offset, Address output_address_for_materialization) { | 1710 unsigned output_offset, const char* debug_hint_string, |
| 1711 Address output_address_for_materialization) { |
| 1862 Object* value = (*iterator)->GetRawValue(); | 1712 Object* value = (*iterator)->GetRawValue(); |
| 1863 output_[frame_index]->SetFrameSlot(output_offset, | |
| 1864 reinterpret_cast<intptr_t>(value)); | |
| 1865 | 1713 |
| 1866 Address output_address = | 1714 WriteValueToOutput(value, *input_index, frame_index, output_offset, |
| 1867 reinterpret_cast<Address>(output_[frame_index]->GetTop()) + output_offset; | 1715 debug_hint_string); |
| 1868 if (trace_scope_ != nullptr) { | |
| 1869 PrintF(trace_scope_->file(), | |
| 1870 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" V8PRIxPTR " ; ", | |
| 1871 reinterpret_cast<intptr_t>(output_address), output_offset, | |
| 1872 reinterpret_cast<intptr_t>(value)); | |
| 1873 value->ShortPrint(trace_scope_->file()); | |
| 1874 PrintF(trace_scope_->file(), " (input #%d)\n", *input_index); | |
| 1875 } | |
| 1876 | 1716 |
| 1877 if (value == isolate_->heap()->arguments_marker()) { | 1717 if (value == isolate_->heap()->arguments_marker()) { |
| 1718 Address output_address = |
| 1719 reinterpret_cast<Address>(output_[frame_index]->GetTop()) + |
| 1720 output_offset; |
| 1878 if (output_address_for_materialization == nullptr) { | 1721 if (output_address_for_materialization == nullptr) { |
| 1879 output_address_for_materialization = output_address; | 1722 output_address_for_materialization = output_address; |
| 1880 } | 1723 } |
| 1881 values_to_materialize_.push_back( | 1724 values_to_materialize_.push_back( |
| 1882 {output_address_for_materialization, *iterator}); | 1725 {output_address_for_materialization, *iterator}); |
| 1883 } | 1726 } |
| 1884 | 1727 |
| 1885 (*iterator)++; | 1728 (*iterator)++; |
| 1886 (*input_index)++; | 1729 (*input_index)++; |
| 1887 } | 1730 } |
| 1888 | 1731 |
| 1889 | 1732 |
| 1733 void Deoptimizer::WriteValueToOutput(Object* value, int input_index, |
| 1734 int frame_index, unsigned output_offset, |
| 1735 const char* debug_hint_string) { |
| 1736 output_[frame_index]->SetFrameSlot(output_offset, |
| 1737 reinterpret_cast<intptr_t>(value)); |
| 1738 |
| 1739 if (trace_scope_ != nullptr) { |
| 1740 DebugPrintOutputSlot(reinterpret_cast<intptr_t>(value), frame_index, |
| 1741 output_offset, debug_hint_string); |
| 1742 value->ShortPrint(trace_scope_->file()); |
| 1743 PrintF(trace_scope_->file(), " (input #%d)\n", input_index); |
| 1744 } |
| 1745 } |
| 1746 |
| 1747 |
| 1748 void Deoptimizer::DebugPrintOutputSlot(intptr_t value, int frame_index, |
| 1749 unsigned output_offset, |
| 1750 const char* debug_hint_string) { |
| 1751 if (trace_scope_ != nullptr) { |
| 1752 Address output_address = |
| 1753 reinterpret_cast<Address>(output_[frame_index]->GetTop()) + |
| 1754 output_offset; |
| 1755 PrintF(trace_scope_->file(), |
| 1756 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" V8PRIxPTR " ; %s", |
| 1757 reinterpret_cast<intptr_t>(output_address), output_offset, value, |
| 1758 debug_hint_string == nullptr ? "" : debug_hint_string); |
| 1759 } |
| 1760 } |
| 1761 |
| 1762 |
| 1890 unsigned Deoptimizer::ComputeInputFrameSize() const { | 1763 unsigned Deoptimizer::ComputeInputFrameSize() const { |
| 1891 unsigned fixed_size = ComputeFixedSize(function_); | 1764 unsigned fixed_size = ComputeFixedSize(function_); |
| 1892 // The fp-to-sp delta already takes the context, constant pool pointer and the | 1765 // The fp-to-sp delta already takes the context, constant pool pointer and the |
| 1893 // function into account so we have to avoid double counting them. | 1766 // function into account so we have to avoid double counting them. |
| 1894 unsigned result = fixed_size + fp_to_sp_delta_ - | 1767 unsigned result = fixed_size + fp_to_sp_delta_ - |
| 1895 StandardFrameConstants::kFixedFrameSizeFromFp; | 1768 StandardFrameConstants::kFixedFrameSizeFromFp; |
| 1896 if (compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) { | 1769 if (compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) { |
| 1897 unsigned stack_slots = compiled_code_->stack_slots(); | 1770 unsigned stack_slots = compiled_code_->stack_slots(); |
| 1898 unsigned outgoing_size = ComputeOutgoingArgumentSize(); | 1771 unsigned outgoing_size = ComputeOutgoingArgumentSize(); |
| 1899 CHECK(result == fixed_size + (stack_slots * kPointerSize) + outgoing_size); | 1772 CHECK(result == fixed_size + (stack_slots * kPointerSize) + outgoing_size); |
| (...skipping 1626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3526 DCHECK(value_info->IsMaterializedObject()); | 3399 DCHECK(value_info->IsMaterializedObject()); |
| 3527 | 3400 |
| 3528 value_info->value_ = | 3401 value_info->value_ = |
| 3529 Handle<Object>(previously_materialized_objects->get(i), isolate_); | 3402 Handle<Object>(previously_materialized_objects->get(i), isolate_); |
| 3530 } | 3403 } |
| 3531 } | 3404 } |
| 3532 } | 3405 } |
| 3533 | 3406 |
| 3534 } // namespace internal | 3407 } // namespace internal |
| 3535 } // namespace v8 | 3408 } // namespace v8 |
| OLD | NEW |