Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/deoptimizer.cc

Issue 19483007: Revert "Addressed danno's comments" and "Introduce kRegisterSize, kPCOnStackSize and kFPOnStackSize… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/deoptimizer.h ('k') | src/frames.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 -= kPCOnStackSize; 903 output_offset -= kPointerSize;
904 input_offset -= kPCOnStackSize; 904 input_offset -= kPointerSize;
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->SetCallerPc(output_offset, value); 911 output_frame->SetFrameSlot(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 -= kFPOnStackSize; 922 output_offset -= kPointerSize;
923 input_offset -= kFPOnStackSize; 923 input_offset -= kPointerSize;
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->SetCallerFp(output_offset, value); 929 output_frame->SetFrameSlot(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
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 -= kPCOnStackSize; 1052 output_offset -= kPointerSize;
1053 intptr_t callers_pc = output_[frame_index - 1]->GetPc(); 1053 intptr_t callers_pc = output_[frame_index - 1]->GetPc();
1054 output_frame->SetCallerPc(output_offset, callers_pc); 1054 output_frame->SetFrameSlot(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 -= kFPOnStackSize; 1062 output_offset -= kPointerSize;
1063 intptr_t value = output_[frame_index - 1]->GetFp(); 1063 intptr_t value = output_[frame_index - 1]->GetFp();
1064 output_frame->SetCallerFp(output_offset, value); 1064 output_frame->SetFrameSlot(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
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 -= kPCOnStackSize; 1155 output_offset -= kPointerSize;
1156 intptr_t callers_pc = output_[frame_index - 1]->GetPc(); 1156 intptr_t callers_pc = output_[frame_index - 1]->GetPc();
1157 output_frame->SetCallerPc(output_offset, callers_pc); 1157 output_frame->SetFrameSlot(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 -= kFPOnStackSize; 1165 output_offset -= kPointerSize;
1166 intptr_t value = output_[frame_index - 1]->GetFp(); 1166 intptr_t value = output_[frame_index - 1]->GetFp();
1167 output_frame->SetCallerFp(output_offset, value); 1167 output_frame->SetFrameSlot(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
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 = (kPCOnStackSize / kPointerSize) + 1268 unsigned fixed_frame_entries = 1 + 4 + (is_setter_stub_frame ? 1 : 0);
1269 (kFPOnStackSize / kPointerSize) + 3 +
1270 (is_setter_stub_frame ? 1 : 0);
1271 unsigned fixed_frame_size = fixed_frame_entries * kPointerSize; 1269 unsigned fixed_frame_size = fixed_frame_entries * kPointerSize;
1272 unsigned output_frame_size = height_in_bytes + fixed_frame_size; 1270 unsigned output_frame_size = height_in_bytes + fixed_frame_size;
1273 1271
1274 // Allocate and store the output frame description. 1272 // Allocate and store the output frame description.
1275 FrameDescription* output_frame = 1273 FrameDescription* output_frame =
1276 new(output_frame_size) FrameDescription(output_frame_size, accessor); 1274 new(output_frame_size) FrameDescription(output_frame_size, accessor);
1277 output_frame->SetFrameType(StackFrame::INTERNAL); 1275 output_frame->SetFrameType(StackFrame::INTERNAL);
1278 1276
1279 // A frame for an accessor stub can not be the topmost or bottommost one. 1277 // A frame for an accessor stub can not be the topmost or bottommost one.
1280 ASSERT(frame_index > 0 && frame_index < output_count_ - 1); 1278 ASSERT(frame_index > 0 && frame_index < output_count_ - 1);
1281 ASSERT(output_[frame_index] == NULL); 1279 ASSERT(output_[frame_index] == NULL);
1282 output_[frame_index] = output_frame; 1280 output_[frame_index] = output_frame;
1283 1281
1284 // The top address of the frame is computed from the previous frame's top and 1282 // The top address of the frame is computed from the previous frame's top and
1285 // this frame's size. 1283 // this frame's size.
1286 intptr_t top_address = output_[frame_index - 1]->GetTop() - output_frame_size; 1284 intptr_t top_address = output_[frame_index - 1]->GetTop() - output_frame_size;
1287 output_frame->SetTop(top_address); 1285 output_frame->SetTop(top_address);
1288 1286
1289 unsigned output_offset = output_frame_size; 1287 unsigned output_offset = output_frame_size;
1290 1288
1291 // Read caller's PC from the previous frame. 1289 // Read caller's PC from the previous frame.
1292 output_offset -= kPCOnStackSize; 1290 output_offset -= kPointerSize;
1293 intptr_t callers_pc = output_[frame_index - 1]->GetPc(); 1291 intptr_t callers_pc = output_[frame_index - 1]->GetPc();
1294 output_frame->SetCallerPc(output_offset, callers_pc); 1292 output_frame->SetFrameSlot(output_offset, callers_pc);
1295 if (trace_) { 1293 if (trace_) {
1296 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR 1294 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
1297 " ; caller's pc\n", 1295 " ; caller's pc\n",
1298 top_address + output_offset, output_offset, callers_pc); 1296 top_address + output_offset, output_offset, callers_pc);
1299 } 1297 }
1300 1298
1301 // Read caller's FP from the previous frame, and set this frame's FP. 1299 // Read caller's FP from the previous frame, and set this frame's FP.
1302 output_offset -= kFPOnStackSize; 1300 output_offset -= kPointerSize;
1303 intptr_t value = output_[frame_index - 1]->GetFp(); 1301 intptr_t value = output_[frame_index - 1]->GetFp();
1304 output_frame->SetCallerFp(output_offset, value); 1302 output_frame->SetFrameSlot(output_offset, value);
1305 intptr_t fp_value = top_address + output_offset; 1303 intptr_t fp_value = top_address + output_offset;
1306 output_frame->SetFp(fp_value); 1304 output_frame->SetFp(fp_value);
1307 if (trace_) { 1305 if (trace_) {
1308 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR 1306 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
1309 " ; caller's fp\n", 1307 " ; caller's fp\n",
1310 fp_value, output_offset, value); 1308 fp_value, output_offset, value);
1311 } 1309 }
1312 1310
1313 // The context can be gotten from the previous frame. 1311 // The context can be gotten from the previous frame.
1314 output_offset -= kPointerSize; 1312 output_offset -= kPointerSize;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 1428
1431 // The top address for the output frame can be computed from the input 1429 // The top address for the output frame can be computed from the input
1432 // frame pointer and the output frame's height. Subtract space for the 1430 // frame pointer and the output frame's height. Subtract space for the
1433 // context and function slots. 1431 // context and function slots.
1434 Register fp_reg = StubFailureTrampolineFrame::fp_register(); 1432 Register fp_reg = StubFailureTrampolineFrame::fp_register();
1435 intptr_t top_address = input_->GetRegister(fp_reg.code()) - 1433 intptr_t top_address = input_->GetRegister(fp_reg.code()) -
1436 (2 * kPointerSize) - height_in_bytes; 1434 (2 * kPointerSize) - height_in_bytes;
1437 output_frame->SetTop(top_address); 1435 output_frame->SetTop(top_address);
1438 1436
1439 // Read caller's PC (JSFunction continuation) from the input frame. 1437 // Read caller's PC (JSFunction continuation) from the input frame.
1440 unsigned input_frame_offset = input_frame_size - kPCOnStackSize; 1438 unsigned input_frame_offset = input_frame_size - kPointerSize;
1441 unsigned output_frame_offset = output_frame_size - kFPOnStackSize; 1439 unsigned output_frame_offset = output_frame_size - kPointerSize;
1442 intptr_t value = input_->GetFrameSlot(input_frame_offset); 1440 intptr_t value = input_->GetFrameSlot(input_frame_offset);
1443 output_frame->SetCallerPc(output_frame_offset, value); 1441 output_frame->SetFrameSlot(output_frame_offset, value);
1444 if (trace_) { 1442 if (trace_) {
1445 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" 1443 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
1446 V8PRIxPTR " ; caller's pc\n", 1444 V8PRIxPTR " ; caller's pc\n",
1447 top_address + output_frame_offset, output_frame_offset, value); 1445 top_address + output_frame_offset, output_frame_offset, value);
1448 } 1446 }
1449 1447
1450 // Read caller's FP from the input frame, and set this frame's FP. 1448 // Read caller's FP from the input frame, and set this frame's FP.
1451 input_frame_offset -= kFPOnStackSize; 1449 input_frame_offset -= kPointerSize;
1452 value = input_->GetFrameSlot(input_frame_offset); 1450 value = input_->GetFrameSlot(input_frame_offset);
1453 output_frame_offset -= kFPOnStackSize; 1451 output_frame_offset -= kPointerSize;
1454 output_frame->SetCallerFp(output_frame_offset, value); 1452 output_frame->SetFrameSlot(output_frame_offset, value);
1455 intptr_t frame_ptr = input_->GetRegister(fp_reg.code()); 1453 intptr_t frame_ptr = input_->GetRegister(fp_reg.code());
1456 output_frame->SetRegister(fp_reg.code(), frame_ptr); 1454 output_frame->SetRegister(fp_reg.code(), frame_ptr);
1457 output_frame->SetFp(frame_ptr); 1455 output_frame->SetFp(frame_ptr);
1458 if (trace_) { 1456 if (trace_) {
1459 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" 1457 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
1460 V8PRIxPTR " ; caller's fp\n", 1458 V8PRIxPTR " ; caller's fp\n",
1461 top_address + output_frame_offset, output_frame_offset, value); 1459 top_address + output_frame_offset, output_frame_offset, value);
1462 } 1460 }
1463 1461
1464 // The context can be gotten from the input frame. 1462 // The context can be gotten from the input frame.
(...skipping 1633 matching lines...) Expand 10 before | Expand all | Expand 10 after
3098 3096
3099 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { 3097 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) {
3100 v->VisitPointer(BitCast<Object**>(&function_)); 3098 v->VisitPointer(BitCast<Object**>(&function_));
3101 v->VisitPointers(parameters_, parameters_ + parameters_count_); 3099 v->VisitPointers(parameters_, parameters_ + parameters_count_);
3102 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); 3100 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_);
3103 } 3101 }
3104 3102
3105 #endif // ENABLE_DEBUGGER_SUPPORT 3103 #endif // ENABLE_DEBUGGER_SUPPORT
3106 3104
3107 } } // namespace v8::internal 3105 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/deoptimizer.h ('k') | src/frames.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698