OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 input_offset -= (parameter_count * kPointerSize); | 893 input_offset -= (parameter_count * kPointerSize); |
894 | 894 |
895 // There are no translation commands for the caller's pc and fp, the | 895 // There are no translation commands for the caller's pc and fp, the |
896 // context, and the function. Synthesize their values and set them up | 896 // context, and the function. Synthesize their values and set them up |
897 // explicitly. | 897 // explicitly. |
898 // | 898 // |
899 // The caller's pc for the bottommost output frame is the same as in the | 899 // The caller's pc for the bottommost output frame is the same as in the |
900 // input frame. For all subsequent output frames, it can be read from the | 900 // input frame. For all subsequent output frames, it can be read from the |
901 // previous one. This frame's pc can be computed from the non-optimized | 901 // previous one. This frame's pc can be computed from the non-optimized |
902 // function code and AST id of the bailout. | 902 // function code and AST id of the bailout. |
903 output_offset -= kPointerSize; | 903 output_offset -= kPCOnStackSize; |
904 input_offset -= kPointerSize; | 904 input_offset -= kPCOnStackSize; |
905 intptr_t value; | 905 intptr_t value; |
906 if (is_bottommost) { | 906 if (is_bottommost) { |
907 value = input_->GetFrameSlot(input_offset); | 907 value = input_->GetFrameSlot(input_offset); |
908 } else { | 908 } else { |
909 value = output_[frame_index - 1]->GetPc(); | 909 value = output_[frame_index - 1]->GetPc(); |
910 } | 910 } |
911 output_frame->SetFrameSlot(output_offset, value); | 911 output_frame->SetCallerPc(output_offset, value); |
912 if (trace_) { | 912 if (trace_) { |
913 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 913 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
914 V8PRIxPTR " ; caller's pc\n", | 914 V8PRIxPTR " ; caller's pc\n", |
915 top_address + output_offset, output_offset, value); | 915 top_address + output_offset, output_offset, value); |
916 } | 916 } |
917 | 917 |
918 // The caller's frame pointer for the bottommost output frame is the same | 918 // The caller's frame pointer for the bottommost output frame is the same |
919 // as in the input frame. For all subsequent output frames, it can be | 919 // as in the input frame. For all subsequent output frames, it can be |
920 // read from the previous one. Also compute and set this frame's frame | 920 // read from the previous one. Also compute and set this frame's frame |
921 // pointer. | 921 // pointer. |
922 output_offset -= kPointerSize; | 922 output_offset -= kFPOnStackSize; |
923 input_offset -= kPointerSize; | 923 input_offset -= kFPOnStackSize; |
924 if (is_bottommost) { | 924 if (is_bottommost) { |
925 value = input_->GetFrameSlot(input_offset); | 925 value = input_->GetFrameSlot(input_offset); |
926 } else { | 926 } else { |
927 value = output_[frame_index - 1]->GetFp(); | 927 value = output_[frame_index - 1]->GetFp(); |
928 } | 928 } |
929 output_frame->SetFrameSlot(output_offset, value); | 929 output_frame->SetCallerFp(output_offset, value); |
930 intptr_t fp_value = top_address + output_offset; | 930 intptr_t fp_value = top_address + output_offset; |
931 ASSERT(!is_bottommost || (input_->GetRegister(fp_reg.code()) + | 931 ASSERT(!is_bottommost || (input_->GetRegister(fp_reg.code()) + |
932 has_alignment_padding_ * kPointerSize) == fp_value); | 932 has_alignment_padding_ * kPointerSize) == fp_value); |
933 output_frame->SetFp(fp_value); | 933 output_frame->SetFp(fp_value); |
934 if (is_topmost) output_frame->SetRegister(fp_reg.code(), fp_value); | 934 if (is_topmost) output_frame->SetRegister(fp_reg.code(), fp_value); |
935 if (trace_) { | 935 if (trace_) { |
936 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 936 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
937 V8PRIxPTR " ; caller's fp\n", | 937 V8PRIxPTR " ; caller's fp\n", |
938 fp_value, output_offset, value); | 938 fp_value, output_offset, value); |
939 } | 939 } |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1042 | 1042 |
1043 // Compute the incoming parameter translation. | 1043 // Compute the incoming parameter translation. |
1044 int parameter_count = height; | 1044 int parameter_count = height; |
1045 unsigned output_offset = output_frame_size; | 1045 unsigned output_offset = output_frame_size; |
1046 for (int i = 0; i < parameter_count; ++i) { | 1046 for (int i = 0; i < parameter_count; ++i) { |
1047 output_offset -= kPointerSize; | 1047 output_offset -= kPointerSize; |
1048 DoTranslateCommand(iterator, frame_index, output_offset); | 1048 DoTranslateCommand(iterator, frame_index, output_offset); |
1049 } | 1049 } |
1050 | 1050 |
1051 // Read caller's PC from the previous frame. | 1051 // Read caller's PC from the previous frame. |
1052 output_offset -= kPointerSize; | 1052 output_offset -= kPCOnStackSize; |
1053 intptr_t callers_pc = output_[frame_index - 1]->GetPc(); | 1053 intptr_t callers_pc = output_[frame_index - 1]->GetPc(); |
1054 output_frame->SetFrameSlot(output_offset, callers_pc); | 1054 output_frame->SetCallerPc(output_offset, callers_pc); |
1055 if (trace_) { | 1055 if (trace_) { |
1056 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1056 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
1057 V8PRIxPTR " ; caller's pc\n", | 1057 V8PRIxPTR " ; caller's pc\n", |
1058 top_address + output_offset, output_offset, callers_pc); | 1058 top_address + output_offset, output_offset, callers_pc); |
1059 } | 1059 } |
1060 | 1060 |
1061 // Read caller's FP from the previous frame, and set this frame's FP. | 1061 // Read caller's FP from the previous frame, and set this frame's FP. |
1062 output_offset -= kPointerSize; | 1062 output_offset -= kFPOnStackSize; |
1063 intptr_t value = output_[frame_index - 1]->GetFp(); | 1063 intptr_t value = output_[frame_index - 1]->GetFp(); |
1064 output_frame->SetFrameSlot(output_offset, value); | 1064 output_frame->SetCallerFp(output_offset, value); |
1065 intptr_t fp_value = top_address + output_offset; | 1065 intptr_t fp_value = top_address + output_offset; |
1066 output_frame->SetFp(fp_value); | 1066 output_frame->SetFp(fp_value); |
1067 if (trace_) { | 1067 if (trace_) { |
1068 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1068 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
1069 V8PRIxPTR " ; caller's fp\n", | 1069 V8PRIxPTR " ; caller's fp\n", |
1070 fp_value, output_offset, value); | 1070 fp_value, output_offset, value); |
1071 } | 1071 } |
1072 | 1072 |
1073 // A marker value is used in place of the context. | 1073 // A marker value is used in place of the context. |
1074 output_offset -= kPointerSize; | 1074 output_offset -= kPointerSize; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 | 1145 |
1146 // Compute the incoming parameter translation. | 1146 // Compute the incoming parameter translation. |
1147 int parameter_count = height; | 1147 int parameter_count = height; |
1148 unsigned output_offset = output_frame_size; | 1148 unsigned output_offset = output_frame_size; |
1149 for (int i = 0; i < parameter_count; ++i) { | 1149 for (int i = 0; i < parameter_count; ++i) { |
1150 output_offset -= kPointerSize; | 1150 output_offset -= kPointerSize; |
1151 DoTranslateCommand(iterator, frame_index, output_offset); | 1151 DoTranslateCommand(iterator, frame_index, output_offset); |
1152 } | 1152 } |
1153 | 1153 |
1154 // Read caller's PC from the previous frame. | 1154 // Read caller's PC from the previous frame. |
1155 output_offset -= kPointerSize; | 1155 output_offset -= kPCOnStackSize; |
1156 intptr_t callers_pc = output_[frame_index - 1]->GetPc(); | 1156 intptr_t callers_pc = output_[frame_index - 1]->GetPc(); |
1157 output_frame->SetFrameSlot(output_offset, callers_pc); | 1157 output_frame->SetCallerPc(output_offset, callers_pc); |
1158 if (trace_) { | 1158 if (trace_) { |
1159 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1159 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
1160 V8PRIxPTR " ; caller's pc\n", | 1160 V8PRIxPTR " ; caller's pc\n", |
1161 top_address + output_offset, output_offset, callers_pc); | 1161 top_address + output_offset, output_offset, callers_pc); |
1162 } | 1162 } |
1163 | 1163 |
1164 // Read caller's FP from the previous frame, and set this frame's FP. | 1164 // Read caller's FP from the previous frame, and set this frame's FP. |
1165 output_offset -= kPointerSize; | 1165 output_offset -= kFPOnStackSize; |
1166 intptr_t value = output_[frame_index - 1]->GetFp(); | 1166 intptr_t value = output_[frame_index - 1]->GetFp(); |
1167 output_frame->SetFrameSlot(output_offset, value); | 1167 output_frame->SetCallerFp(output_offset, value); |
1168 intptr_t fp_value = top_address + output_offset; | 1168 intptr_t fp_value = top_address + output_offset; |
1169 output_frame->SetFp(fp_value); | 1169 output_frame->SetFp(fp_value); |
1170 if (trace_) { | 1170 if (trace_) { |
1171 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1171 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
1172 V8PRIxPTR " ; caller's fp\n", | 1172 V8PRIxPTR " ; caller's fp\n", |
1173 fp_value, output_offset, value); | 1173 fp_value, output_offset, value); |
1174 } | 1174 } |
1175 | 1175 |
1176 // The context can be gotten from the previous frame. | 1176 // The context can be gotten from the previous frame. |
1177 output_offset -= kPointerSize; | 1177 output_offset -= kPointerSize; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1258 const char* kind = is_setter_stub_frame ? "setter" : "getter"; | 1258 const char* kind = is_setter_stub_frame ? "setter" : "getter"; |
1259 if (trace_) { | 1259 if (trace_) { |
1260 PrintF(" translating %s stub => height=%u\n", kind, height_in_bytes); | 1260 PrintF(" translating %s stub => height=%u\n", kind, height_in_bytes); |
1261 } | 1261 } |
1262 | 1262 |
1263 // We need 1 stack entry for the return address + 4 stack entries from | 1263 // We need 1 stack entry for the return address + 4 stack entries from |
1264 // StackFrame::INTERNAL (FP, context, frame type, code object, see | 1264 // StackFrame::INTERNAL (FP, context, frame type, code object, see |
1265 // MacroAssembler::EnterFrame). For a setter stub frame we need one additional | 1265 // MacroAssembler::EnterFrame). For a setter stub frame we need one additional |
1266 // entry for the implicit return value, see | 1266 // entry for the implicit return value, see |
1267 // StoreStubCompiler::CompileStoreViaSetter. | 1267 // StoreStubCompiler::CompileStoreViaSetter. |
1268 unsigned fixed_frame_entries = 1 + 4 + (is_setter_stub_frame ? 1 : 0); | 1268 unsigned fixed_frame_entries = (kPCOnStackSize / kPointerSize) + |
| 1269 (kFPOnStackSize / kPointerSize) + 3 + |
| 1270 (is_setter_stub_frame ? 1 : 0); |
1269 unsigned fixed_frame_size = fixed_frame_entries * kPointerSize; | 1271 unsigned fixed_frame_size = fixed_frame_entries * kPointerSize; |
1270 unsigned output_frame_size = height_in_bytes + fixed_frame_size; | 1272 unsigned output_frame_size = height_in_bytes + fixed_frame_size; |
1271 | 1273 |
1272 // Allocate and store the output frame description. | 1274 // Allocate and store the output frame description. |
1273 FrameDescription* output_frame = | 1275 FrameDescription* output_frame = |
1274 new(output_frame_size) FrameDescription(output_frame_size, accessor); | 1276 new(output_frame_size) FrameDescription(output_frame_size, accessor); |
1275 output_frame->SetFrameType(StackFrame::INTERNAL); | 1277 output_frame->SetFrameType(StackFrame::INTERNAL); |
1276 | 1278 |
1277 // A frame for an accessor stub can not be the topmost or bottommost one. | 1279 // A frame for an accessor stub can not be the topmost or bottommost one. |
1278 ASSERT(frame_index > 0 && frame_index < output_count_ - 1); | 1280 ASSERT(frame_index > 0 && frame_index < output_count_ - 1); |
1279 ASSERT(output_[frame_index] == NULL); | 1281 ASSERT(output_[frame_index] == NULL); |
1280 output_[frame_index] = output_frame; | 1282 output_[frame_index] = output_frame; |
1281 | 1283 |
1282 // The top address of the frame is computed from the previous frame's top and | 1284 // The top address of the frame is computed from the previous frame's top and |
1283 // this frame's size. | 1285 // this frame's size. |
1284 intptr_t top_address = output_[frame_index - 1]->GetTop() - output_frame_size; | 1286 intptr_t top_address = output_[frame_index - 1]->GetTop() - output_frame_size; |
1285 output_frame->SetTop(top_address); | 1287 output_frame->SetTop(top_address); |
1286 | 1288 |
1287 unsigned output_offset = output_frame_size; | 1289 unsigned output_offset = output_frame_size; |
1288 | 1290 |
1289 // Read caller's PC from the previous frame. | 1291 // Read caller's PC from the previous frame. |
1290 output_offset -= kPointerSize; | 1292 output_offset -= kPCOnStackSize; |
1291 intptr_t callers_pc = output_[frame_index - 1]->GetPc(); | 1293 intptr_t callers_pc = output_[frame_index - 1]->GetPc(); |
1292 output_frame->SetFrameSlot(output_offset, callers_pc); | 1294 output_frame->SetCallerPc(output_offset, callers_pc); |
1293 if (trace_) { | 1295 if (trace_) { |
1294 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR | 1296 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR |
1295 " ; caller's pc\n", | 1297 " ; caller's pc\n", |
1296 top_address + output_offset, output_offset, callers_pc); | 1298 top_address + output_offset, output_offset, callers_pc); |
1297 } | 1299 } |
1298 | 1300 |
1299 // Read caller's FP from the previous frame, and set this frame's FP. | 1301 // Read caller's FP from the previous frame, and set this frame's FP. |
1300 output_offset -= kPointerSize; | 1302 output_offset -= kFPOnStackSize; |
1301 intptr_t value = output_[frame_index - 1]->GetFp(); | 1303 intptr_t value = output_[frame_index - 1]->GetFp(); |
1302 output_frame->SetFrameSlot(output_offset, value); | 1304 output_frame->SetCallerFp(output_offset, value); |
1303 intptr_t fp_value = top_address + output_offset; | 1305 intptr_t fp_value = top_address + output_offset; |
1304 output_frame->SetFp(fp_value); | 1306 output_frame->SetFp(fp_value); |
1305 if (trace_) { | 1307 if (trace_) { |
1306 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR | 1308 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR |
1307 " ; caller's fp\n", | 1309 " ; caller's fp\n", |
1308 fp_value, output_offset, value); | 1310 fp_value, output_offset, value); |
1309 } | 1311 } |
1310 | 1312 |
1311 // The context can be gotten from the previous frame. | 1313 // The context can be gotten from the previous frame. |
1312 output_offset -= kPointerSize; | 1314 output_offset -= kPointerSize; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1428 | 1430 |
1429 // The top address for the output frame can be computed from the input | 1431 // The top address for the output frame can be computed from the input |
1430 // frame pointer and the output frame's height. Subtract space for the | 1432 // frame pointer and the output frame's height. Subtract space for the |
1431 // context and function slots. | 1433 // context and function slots. |
1432 Register fp_reg = StubFailureTrampolineFrame::fp_register(); | 1434 Register fp_reg = StubFailureTrampolineFrame::fp_register(); |
1433 intptr_t top_address = input_->GetRegister(fp_reg.code()) - | 1435 intptr_t top_address = input_->GetRegister(fp_reg.code()) - |
1434 (2 * kPointerSize) - height_in_bytes; | 1436 (2 * kPointerSize) - height_in_bytes; |
1435 output_frame->SetTop(top_address); | 1437 output_frame->SetTop(top_address); |
1436 | 1438 |
1437 // Read caller's PC (JSFunction continuation) from the input frame. | 1439 // Read caller's PC (JSFunction continuation) from the input frame. |
1438 unsigned input_frame_offset = input_frame_size - kPointerSize; | 1440 unsigned input_frame_offset = input_frame_size - kPCOnStackSize; |
1439 unsigned output_frame_offset = output_frame_size - kPointerSize; | 1441 unsigned output_frame_offset = output_frame_size - kFPOnStackSize; |
1440 intptr_t value = input_->GetFrameSlot(input_frame_offset); | 1442 intptr_t value = input_->GetFrameSlot(input_frame_offset); |
1441 output_frame->SetFrameSlot(output_frame_offset, value); | 1443 output_frame->SetCallerPc(output_frame_offset, value); |
1442 if (trace_) { | 1444 if (trace_) { |
1443 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1445 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
1444 V8PRIxPTR " ; caller's pc\n", | 1446 V8PRIxPTR " ; caller's pc\n", |
1445 top_address + output_frame_offset, output_frame_offset, value); | 1447 top_address + output_frame_offset, output_frame_offset, value); |
1446 } | 1448 } |
1447 | 1449 |
1448 // Read caller's FP from the input frame, and set this frame's FP. | 1450 // Read caller's FP from the input frame, and set this frame's FP. |
1449 input_frame_offset -= kPointerSize; | 1451 input_frame_offset -= kFPOnStackSize; |
1450 value = input_->GetFrameSlot(input_frame_offset); | 1452 value = input_->GetFrameSlot(input_frame_offset); |
1451 output_frame_offset -= kPointerSize; | 1453 output_frame_offset -= kFPOnStackSize; |
1452 output_frame->SetFrameSlot(output_frame_offset, value); | 1454 output_frame->SetCallerFp(output_frame_offset, value); |
1453 intptr_t frame_ptr = input_->GetRegister(fp_reg.code()); | 1455 intptr_t frame_ptr = input_->GetRegister(fp_reg.code()); |
1454 output_frame->SetRegister(fp_reg.code(), frame_ptr); | 1456 output_frame->SetRegister(fp_reg.code(), frame_ptr); |
1455 output_frame->SetFp(frame_ptr); | 1457 output_frame->SetFp(frame_ptr); |
1456 if (trace_) { | 1458 if (trace_) { |
1457 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1459 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
1458 V8PRIxPTR " ; caller's fp\n", | 1460 V8PRIxPTR " ; caller's fp\n", |
1459 top_address + output_frame_offset, output_frame_offset, value); | 1461 top_address + output_frame_offset, output_frame_offset, value); |
1460 } | 1462 } |
1461 | 1463 |
1462 // The context can be gotten from the input frame. | 1464 // The context can be gotten from the input frame. |
(...skipping 1633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3096 | 3098 |
3097 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { | 3099 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { |
3098 v->VisitPointer(BitCast<Object**>(&function_)); | 3100 v->VisitPointer(BitCast<Object**>(&function_)); |
3099 v->VisitPointers(parameters_, parameters_ + parameters_count_); | 3101 v->VisitPointers(parameters_, parameters_ + parameters_count_); |
3100 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); | 3102 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); |
3101 } | 3103 } |
3102 | 3104 |
3103 #endif // ENABLE_DEBUGGER_SUPPORT | 3105 #endif // ENABLE_DEBUGGER_SUPPORT |
3104 | 3106 |
3105 } } // namespace v8::internal | 3107 } } // namespace v8::internal |
OLD | NEW |