| 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/deoptimizer.h" | 5 #include "src/deoptimizer.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
| 10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
| (...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 output_frame->SetTop(top_address); | 884 output_frame->SetTop(top_address); |
| 885 | 885 |
| 886 // Compute the incoming parameter translation. | 886 // Compute the incoming parameter translation. |
| 887 unsigned output_offset = output_frame_size; | 887 unsigned output_offset = output_frame_size; |
| 888 for (int i = 0; i < parameter_count; ++i) { | 888 for (int i = 0; i < parameter_count; ++i) { |
| 889 output_offset -= kPointerSize; | 889 output_offset -= kPointerSize; |
| 890 WriteTranslatedValueToOutput(&value_iterator, &input_index, frame_index, | 890 WriteTranslatedValueToOutput(&value_iterator, &input_index, frame_index, |
| 891 output_offset); | 891 output_offset); |
| 892 } | 892 } |
| 893 | 893 |
| 894 if (trace_scope_ != nullptr) { |
| 895 PrintF(trace_scope_->file(), " -------------------------\n"); |
| 896 } |
| 897 |
| 894 // There are no translation commands for the caller's pc and fp, the | 898 // There are no translation commands for the caller's pc and fp, the |
| 895 // context, and the function. Synthesize their values and set them up | 899 // context, and the function. Synthesize their values and set them up |
| 896 // explicitly. | 900 // explicitly. |
| 897 // | 901 // |
| 898 // The caller's pc for the bottommost output frame is the same as in the | 902 // The caller's pc for the bottommost output frame is the same as in the |
| 899 // input frame. For all subsequent output frames, it can be read from the | 903 // input frame. For all subsequent output frames, it can be read from the |
| 900 // previous one. This frame's pc can be computed from the non-optimized | 904 // previous one. This frame's pc can be computed from the non-optimized |
| 901 // function code and AST id of the bailout. | 905 // function code and AST id of the bailout. |
| 902 output_offset -= kPCOnStackSize; | 906 output_offset -= kPCOnStackSize; |
| 903 intptr_t value; | 907 intptr_t value; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 983 values_to_materialize_.push_back({output_address, context_pos}); | 987 values_to_materialize_.push_back({output_address, context_pos}); |
| 984 } | 988 } |
| 985 value_iterator++; | 989 value_iterator++; |
| 986 input_index++; | 990 input_index++; |
| 987 | 991 |
| 988 // The function was mentioned explicitly in the BEGIN_FRAME. | 992 // The function was mentioned explicitly in the BEGIN_FRAME. |
| 989 output_offset -= kPointerSize; | 993 output_offset -= kPointerSize; |
| 990 value = reinterpret_cast<intptr_t>(function); | 994 value = reinterpret_cast<intptr_t>(function); |
| 991 WriteValueToOutput(function, 0, frame_index, output_offset, "function "); | 995 WriteValueToOutput(function, 0, frame_index, output_offset, "function "); |
| 992 | 996 |
| 997 if (trace_scope_ != nullptr) { |
| 998 PrintF(trace_scope_->file(), " -------------------------\n"); |
| 999 } |
| 1000 |
| 993 // Translate the rest of the frame. | 1001 // Translate the rest of the frame. |
| 994 for (unsigned i = 0; i < height; ++i) { | 1002 for (unsigned i = 0; i < height; ++i) { |
| 995 output_offset -= kPointerSize; | 1003 output_offset -= kPointerSize; |
| 996 WriteTranslatedValueToOutput(&value_iterator, &input_index, frame_index, | 1004 WriteTranslatedValueToOutput(&value_iterator, &input_index, frame_index, |
| 997 output_offset); | 1005 output_offset); |
| 998 } | 1006 } |
| 999 if (goto_catch_handler) { | 1007 if (goto_catch_handler) { |
| 1000 // Write out the exception for the catch handler. | 1008 // Write out the exception for the catch handler. |
| 1001 output_offset -= kPointerSize; | 1009 output_offset -= kPointerSize; |
| 1002 Object* exception_obj = reinterpret_cast<Object*>( | 1010 Object* exception_obj = reinterpret_cast<Object*>( |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1116 output_frame->SetTop(top_address); | 1124 output_frame->SetTop(top_address); |
| 1117 | 1125 |
| 1118 // Compute the incoming parameter translation. | 1126 // Compute the incoming parameter translation. |
| 1119 unsigned output_offset = output_frame_size; | 1127 unsigned output_offset = output_frame_size; |
| 1120 for (int i = 0; i < parameter_count; ++i) { | 1128 for (int i = 0; i < parameter_count; ++i) { |
| 1121 output_offset -= kPointerSize; | 1129 output_offset -= kPointerSize; |
| 1122 WriteTranslatedValueToOutput(&value_iterator, &input_index, frame_index, | 1130 WriteTranslatedValueToOutput(&value_iterator, &input_index, frame_index, |
| 1123 output_offset); | 1131 output_offset); |
| 1124 } | 1132 } |
| 1125 | 1133 |
| 1134 if (trace_scope_ != nullptr) { |
| 1135 PrintF(trace_scope_->file(), " -------------------------\n"); |
| 1136 } |
| 1137 |
| 1126 // There are no translation commands for the caller's pc and fp, the | 1138 // There are no translation commands for the caller's pc and fp, the |
| 1127 // context, the function, new.target and the bytecode offset. Synthesize | 1139 // context, the function, new.target and the bytecode offset. Synthesize |
| 1128 // their values and set them up | 1140 // their values and set them up |
| 1129 // explicitly. | 1141 // explicitly. |
| 1130 // | 1142 // |
| 1131 // The caller's pc for the bottommost output frame is the same as in the | 1143 // The caller's pc for the bottommost output frame is the same as in the |
| 1132 // input frame. For all subsequent output frames, it can be read from the | 1144 // input frame. For all subsequent output frames, it can be read from the |
| 1133 // previous one. This frame's pc can be computed from the non-optimized | 1145 // previous one. This frame's pc can be computed from the non-optimized |
| 1134 // function code and AST id of the bailout. | 1146 // function code and AST id of the bailout. |
| 1135 output_offset -= kPCOnStackSize; | 1147 output_offset -= kPCOnStackSize; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1227 "bytecode array "); | 1239 "bytecode array "); |
| 1228 | 1240 |
| 1229 // The bytecode offset was mentioned explicitly in the BEGIN_FRAME. | 1241 // The bytecode offset was mentioned explicitly in the BEGIN_FRAME. |
| 1230 output_offset -= kPointerSize; | 1242 output_offset -= kPointerSize; |
| 1231 int raw_bytecode_offset = | 1243 int raw_bytecode_offset = |
| 1232 BytecodeArray::kHeaderSize - kHeapObjectTag + bytecode_offset; | 1244 BytecodeArray::kHeaderSize - kHeapObjectTag + bytecode_offset; |
| 1233 Smi* smi_bytecode_offset = Smi::FromInt(raw_bytecode_offset); | 1245 Smi* smi_bytecode_offset = Smi::FromInt(raw_bytecode_offset); |
| 1234 WriteValueToOutput(smi_bytecode_offset, 0, frame_index, output_offset, | 1246 WriteValueToOutput(smi_bytecode_offset, 0, frame_index, output_offset, |
| 1235 "bytecode offset "); | 1247 "bytecode offset "); |
| 1236 | 1248 |
| 1249 if (trace_scope_ != nullptr) { |
| 1250 PrintF(trace_scope_->file(), " -------------------------\n"); |
| 1251 } |
| 1252 |
| 1237 // Translate the rest of the interpreter registers in the frame. | 1253 // Translate the rest of the interpreter registers in the frame. |
| 1238 for (unsigned i = 0; i < height - 1; ++i) { | 1254 for (unsigned i = 0; i < height - 1; ++i) { |
| 1239 output_offset -= kPointerSize; | 1255 output_offset -= kPointerSize; |
| 1240 WriteTranslatedValueToOutput(&value_iterator, &input_index, frame_index, | 1256 WriteTranslatedValueToOutput(&value_iterator, &input_index, frame_index, |
| 1241 output_offset); | 1257 output_offset); |
| 1242 } | 1258 } |
| 1243 | 1259 |
| 1244 // Translate the accumulator register (depending on frame position). | 1260 // Translate the accumulator register (depending on frame position). |
| 1245 if (is_topmost) { | 1261 if (is_topmost) { |
| 1246 // For topmost frmae, p ut the accumulator on the stack. The bailout state | 1262 // For topmost frmae, p ut the accumulator on the stack. The bailout state |
| (...skipping 2757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4004 CHECK(value_info->IsMaterializedObject()); | 4020 CHECK(value_info->IsMaterializedObject()); |
| 4005 | 4021 |
| 4006 value_info->value_ = | 4022 value_info->value_ = |
| 4007 Handle<Object>(previously_materialized_objects->get(i), isolate_); | 4023 Handle<Object>(previously_materialized_objects->get(i), isolate_); |
| 4008 } | 4024 } |
| 4009 } | 4025 } |
| 4010 } | 4026 } |
| 4011 | 4027 |
| 4012 } // namespace internal | 4028 } // namespace internal |
| 4013 } // namespace v8 | 4029 } // namespace v8 |
| OLD | NEW |