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

Side by Side Diff: src/deoptimizer.cc

Issue 18014003: Add X32 port into V8 (Closed) Base URL: http://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
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 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 // There are no translation commands for the caller's pc and fp, the 890 // There are no translation commands for the caller's pc and fp, the
891 // context, and the function. Synthesize their values and set them up 891 // context, and the function. Synthesize their values and set them up
892 // explicitly. 892 // explicitly.
893 // 893 //
894 // The caller's pc for the bottommost output frame is the same as in the 894 // The caller's pc for the bottommost output frame is the same as in the
895 // input frame. For all subsequent output frames, it can be read from the 895 // input frame. For all subsequent output frames, it can be read from the
896 // previous one. This frame's pc can be computed from the non-optimized 896 // previous one. This frame's pc can be computed from the non-optimized
897 // function code and AST id of the bailout. 897 // function code and AST id of the bailout.
898 output_offset -= kPointerSize; 898 output_offset -= kPointerSize;
899 input_offset -= kPointerSize; 899 input_offset -= kPointerSize;
900 #if V8_TARGET_ARCH_X32
danno 2013/07/17 13:33:21 No platform-specific code should be here. Please f
901 // Set high 32-bit of PC 0.
902 output_frame->SetFrameSlot(output_offset, 0);
903 output_offset -= kPointerSize;
904 input_offset -= kPointerSize;
905 #endif
900 intptr_t value; 906 intptr_t value;
901 if (is_bottommost) { 907 if (is_bottommost) {
902 value = input_->GetFrameSlot(input_offset); 908 value = input_->GetFrameSlot(input_offset);
903 } else { 909 } else {
904 value = output_[frame_index - 1]->GetPc(); 910 value = output_[frame_index - 1]->GetPc();
905 } 911 }
906 output_frame->SetFrameSlot(output_offset, value); 912 output_frame->SetFrameSlot(output_offset, value);
907 if (trace_) { 913 if (trace_) {
908 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" 914 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
909 V8PRIxPTR " ; caller's pc\n", 915 V8PRIxPTR " ; caller's pc\n",
910 top_address + output_offset, output_offset, value); 916 top_address + output_offset, output_offset, value);
911 } 917 }
912 918
913 // The caller's frame pointer for the bottommost output frame is the same 919 // The caller's frame pointer for the bottommost output frame is the same
914 // as in the input frame. For all subsequent output frames, it can be 920 // as in the input frame. For all subsequent output frames, it can be
915 // read from the previous one. Also compute and set this frame's frame 921 // read from the previous one. Also compute and set this frame's frame
916 // pointer. 922 // pointer.
917 output_offset -= kPointerSize; 923 output_offset -= kPointerSize;
918 input_offset -= kPointerSize; 924 input_offset -= kPointerSize;
925 #if V8_TARGET_ARCH_X32
926 // Set high 32-bit of FP 0.
927 output_frame->SetFrameSlot(output_offset, 0);
928 output_offset -= kPointerSize;
929 input_offset -= kPointerSize;
930 #endif
919 if (is_bottommost) { 931 if (is_bottommost) {
920 value = input_->GetFrameSlot(input_offset); 932 value = input_->GetFrameSlot(input_offset);
921 } else { 933 } else {
922 value = output_[frame_index - 1]->GetFp(); 934 value = output_[frame_index - 1]->GetFp();
923 } 935 }
924 output_frame->SetFrameSlot(output_offset, value); 936 output_frame->SetFrameSlot(output_offset, value);
925 intptr_t fp_value = top_address + output_offset; 937 intptr_t fp_value = top_address + output_offset;
926 ASSERT(!is_bottommost || (input_->GetRegister(fp_reg.code()) + 938 ASSERT(!is_bottommost || (input_->GetRegister(fp_reg.code()) +
927 has_alignment_padding_ * kPointerSize) == fp_value); 939 has_alignment_padding_ * kPointerSize) == fp_value);
928 output_frame->SetFp(fp_value); 940 output_frame->SetFp(fp_value);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 // Compute the incoming parameter translation. 1050 // Compute the incoming parameter translation.
1039 int parameter_count = height; 1051 int parameter_count = height;
1040 unsigned output_offset = output_frame_size; 1052 unsigned output_offset = output_frame_size;
1041 for (int i = 0; i < parameter_count; ++i) { 1053 for (int i = 0; i < parameter_count; ++i) {
1042 output_offset -= kPointerSize; 1054 output_offset -= kPointerSize;
1043 DoTranslateCommand(iterator, frame_index, output_offset); 1055 DoTranslateCommand(iterator, frame_index, output_offset);
1044 } 1056 }
1045 1057
1046 // Read caller's PC from the previous frame. 1058 // Read caller's PC from the previous frame.
1047 output_offset -= kPointerSize; 1059 output_offset -= kPointerSize;
1060 #if V8_TARGET_ARCH_X32
1061 // Set high 32-bit of PC 0.
1062 output_frame->SetFrameSlot(output_offset, 0);
1063 output_offset -= kPointerSize;
1064 #endif
1048 intptr_t callers_pc = output_[frame_index - 1]->GetPc(); 1065 intptr_t callers_pc = output_[frame_index - 1]->GetPc();
1049 output_frame->SetFrameSlot(output_offset, callers_pc); 1066 output_frame->SetFrameSlot(output_offset, callers_pc);
1050 if (trace_) { 1067 if (trace_) {
1051 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" 1068 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
1052 V8PRIxPTR " ; caller's pc\n", 1069 V8PRIxPTR " ; caller's pc\n",
1053 top_address + output_offset, output_offset, callers_pc); 1070 top_address + output_offset, output_offset, callers_pc);
1054 } 1071 }
1055 1072
1056 // Read caller's FP from the previous frame, and set this frame's FP. 1073 // Read caller's FP from the previous frame, and set this frame's FP.
1057 output_offset -= kPointerSize; 1074 output_offset -= kPointerSize;
1075 #if V8_TARGET_ARCH_X32
1076 // Set high 32-bit of FP 0.
1077 output_frame->SetFrameSlot(output_offset, 0);
1078 output_offset -= kPointerSize;
1079 #endif
1058 intptr_t value = output_[frame_index - 1]->GetFp(); 1080 intptr_t value = output_[frame_index - 1]->GetFp();
1059 output_frame->SetFrameSlot(output_offset, value); 1081 output_frame->SetFrameSlot(output_offset, value);
1060 intptr_t fp_value = top_address + output_offset; 1082 intptr_t fp_value = top_address + output_offset;
1061 output_frame->SetFp(fp_value); 1083 output_frame->SetFp(fp_value);
1062 if (trace_) { 1084 if (trace_) {
1063 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" 1085 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
1064 V8PRIxPTR " ; caller's fp\n", 1086 V8PRIxPTR " ; caller's fp\n",
1065 fp_value, output_offset, value); 1087 fp_value, output_offset, value);
1066 } 1088 }
1067 1089
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 // Compute the incoming parameter translation. 1163 // Compute the incoming parameter translation.
1142 int parameter_count = height; 1164 int parameter_count = height;
1143 unsigned output_offset = output_frame_size; 1165 unsigned output_offset = output_frame_size;
1144 for (int i = 0; i < parameter_count; ++i) { 1166 for (int i = 0; i < parameter_count; ++i) {
1145 output_offset -= kPointerSize; 1167 output_offset -= kPointerSize;
1146 DoTranslateCommand(iterator, frame_index, output_offset); 1168 DoTranslateCommand(iterator, frame_index, output_offset);
1147 } 1169 }
1148 1170
1149 // Read caller's PC from the previous frame. 1171 // Read caller's PC from the previous frame.
1150 output_offset -= kPointerSize; 1172 output_offset -= kPointerSize;
1173 #if V8_TARGET_ARCH_X32
1174 // Set high 32-bit of PC 0.
1175 output_frame->SetFrameSlot(output_offset, 0);
1176 output_offset -= kPointerSize;
1177 #endif
1151 intptr_t callers_pc = output_[frame_index - 1]->GetPc(); 1178 intptr_t callers_pc = output_[frame_index - 1]->GetPc();
1152 output_frame->SetFrameSlot(output_offset, callers_pc); 1179 output_frame->SetFrameSlot(output_offset, callers_pc);
1153 if (trace_) { 1180 if (trace_) {
1154 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" 1181 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
1155 V8PRIxPTR " ; caller's pc\n", 1182 V8PRIxPTR " ; caller's pc\n",
1156 top_address + output_offset, output_offset, callers_pc); 1183 top_address + output_offset, output_offset, callers_pc);
1157 } 1184 }
1158 1185
1159 // Read caller's FP from the previous frame, and set this frame's FP. 1186 // Read caller's FP from the previous frame, and set this frame's FP.
1160 output_offset -= kPointerSize; 1187 output_offset -= kPointerSize;
1188 #if V8_TARGET_ARCH_X32
1189 // Set high 32-bit of FP 0.
1190 output_frame->SetFrameSlot(output_offset, 0);
1191 output_offset -= kPointerSize;
1192 #endif
1161 intptr_t value = output_[frame_index - 1]->GetFp(); 1193 intptr_t value = output_[frame_index - 1]->GetFp();
1162 output_frame->SetFrameSlot(output_offset, value); 1194 output_frame->SetFrameSlot(output_offset, value);
1163 intptr_t fp_value = top_address + output_offset; 1195 intptr_t fp_value = top_address + output_offset;
1164 output_frame->SetFp(fp_value); 1196 output_frame->SetFp(fp_value);
1165 if (trace_) { 1197 if (trace_) {
1166 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" 1198 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
1167 V8PRIxPTR " ; caller's fp\n", 1199 V8PRIxPTR " ; caller's fp\n",
1168 fp_value, output_offset, value); 1200 fp_value, output_offset, value);
1169 } 1201 }
1170 1202
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1253 const char* kind = is_setter_stub_frame ? "setter" : "getter"; 1285 const char* kind = is_setter_stub_frame ? "setter" : "getter";
1254 if (trace_) { 1286 if (trace_) {
1255 PrintF(" translating %s stub => height=%u\n", kind, height_in_bytes); 1287 PrintF(" translating %s stub => height=%u\n", kind, height_in_bytes);
1256 } 1288 }
1257 1289
1258 // We need 1 stack entry for the return address + 4 stack entries from 1290 // We need 1 stack entry for the return address + 4 stack entries from
1259 // StackFrame::INTERNAL (FP, context, frame type, code object, see 1291 // StackFrame::INTERNAL (FP, context, frame type, code object, see
1260 // MacroAssembler::EnterFrame). For a setter stub frame we need one additional 1292 // MacroAssembler::EnterFrame). For a setter stub frame we need one additional
1261 // entry for the implicit return value, see 1293 // entry for the implicit return value, see
1262 // StoreStubCompiler::CompileStoreViaSetter. 1294 // StoreStubCompiler::CompileStoreViaSetter.
1295 #ifndef V8_TARGET_ARCH_X32
1263 unsigned fixed_frame_entries = 1 + 4 + (is_setter_stub_frame ? 1 : 0); 1296 unsigned fixed_frame_entries = 1 + 4 + (is_setter_stub_frame ? 1 : 0);
1297 #else
1298 unsigned fixed_frame_entries = 2 * (kHWRegSize/kPointerSize) + 3 +
danno 2013/07/17 13:33:21 I think you can remove the special case here if yo
1299 (is_setter_stub_frame ? 1 : 0);
1300 #endif
1264 unsigned fixed_frame_size = fixed_frame_entries * kPointerSize; 1301 unsigned fixed_frame_size = fixed_frame_entries * kPointerSize;
1265 unsigned output_frame_size = height_in_bytes + fixed_frame_size; 1302 unsigned output_frame_size = height_in_bytes + fixed_frame_size;
1266 1303
1267 // Allocate and store the output frame description. 1304 // Allocate and store the output frame description.
1268 FrameDescription* output_frame = 1305 FrameDescription* output_frame =
1269 new(output_frame_size) FrameDescription(output_frame_size, accessor); 1306 new(output_frame_size) FrameDescription(output_frame_size, accessor);
1270 output_frame->SetFrameType(StackFrame::INTERNAL); 1307 output_frame->SetFrameType(StackFrame::INTERNAL);
1271 1308
1272 // A frame for an accessor stub can not be the topmost or bottommost one. 1309 // A frame for an accessor stub can not be the topmost or bottommost one.
1273 ASSERT(frame_index > 0 && frame_index < output_count_ - 1); 1310 ASSERT(frame_index > 0 && frame_index < output_count_ - 1);
1274 ASSERT(output_[frame_index] == NULL); 1311 ASSERT(output_[frame_index] == NULL);
1275 output_[frame_index] = output_frame; 1312 output_[frame_index] = output_frame;
1276 1313
1277 // The top address of the frame is computed from the previous frame's top and 1314 // The top address of the frame is computed from the previous frame's top and
1278 // this frame's size. 1315 // this frame's size.
1279 intptr_t top_address = output_[frame_index - 1]->GetTop() - output_frame_size; 1316 intptr_t top_address = output_[frame_index - 1]->GetTop() - output_frame_size;
1280 output_frame->SetTop(top_address); 1317 output_frame->SetTop(top_address);
1281 1318
1282 unsigned output_offset = output_frame_size; 1319 unsigned output_offset = output_frame_size;
1283 1320
1284 // Read caller's PC from the previous frame. 1321 // Read caller's PC from the previous frame.
1285 output_offset -= kPointerSize; 1322 output_offset -= kPointerSize;
1323 #if V8_TARGET_ARCH_X32
1324 // Set high 32-bit of PC 0.
1325 output_frame->SetFrameSlot(output_offset, 0);
1326 output_offset -= kPointerSize;
1327 #endif
1286 intptr_t callers_pc = output_[frame_index - 1]->GetPc(); 1328 intptr_t callers_pc = output_[frame_index - 1]->GetPc();
1287 output_frame->SetFrameSlot(output_offset, callers_pc); 1329 output_frame->SetFrameSlot(output_offset, callers_pc);
1288 if (trace_) { 1330 if (trace_) {
1289 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR 1331 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
1290 " ; caller's pc\n", 1332 " ; caller's pc\n",
1291 top_address + output_offset, output_offset, callers_pc); 1333 top_address + output_offset, output_offset, callers_pc);
1292 } 1334 }
1293 1335
1294 // Read caller's FP from the previous frame, and set this frame's FP. 1336 // Read caller's FP from the previous frame, and set this frame's FP.
1295 output_offset -= kPointerSize; 1337 output_offset -= kPointerSize;
1338 #if V8_TARGET_ARCH_X32
1339 // Set high 32-bit of FP 0.
1340 output_frame->SetFrameSlot(output_offset, 0);
danno 2013/07/17 13:33:21 Similar to return address handling, you need somet
1341 output_offset -= kPointerSize;
1342 #endif
1296 intptr_t value = output_[frame_index - 1]->GetFp(); 1343 intptr_t value = output_[frame_index - 1]->GetFp();
1297 output_frame->SetFrameSlot(output_offset, value); 1344 output_frame->SetFrameSlot(output_offset, value);
1298 intptr_t fp_value = top_address + output_offset; 1345 intptr_t fp_value = top_address + output_offset;
1299 output_frame->SetFp(fp_value); 1346 output_frame->SetFp(fp_value);
1300 if (trace_) { 1347 if (trace_) {
1301 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR 1348 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
1302 " ; caller's fp\n", 1349 " ; caller's fp\n",
1303 fp_value, output_offset, value); 1350 fp_value, output_offset, value);
1304 } 1351 }
1305 1352
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1425 // frame pointer and the output frame's height. Subtract space for the 1472 // frame pointer and the output frame's height. Subtract space for the
1426 // context and function slots. 1473 // context and function slots.
1427 Register fp_reg = StubFailureTrampolineFrame::fp_register(); 1474 Register fp_reg = StubFailureTrampolineFrame::fp_register();
1428 intptr_t top_address = input_->GetRegister(fp_reg.code()) - 1475 intptr_t top_address = input_->GetRegister(fp_reg.code()) -
1429 (2 * kPointerSize) - height_in_bytes; 1476 (2 * kPointerSize) - height_in_bytes;
1430 output_frame->SetTop(top_address); 1477 output_frame->SetTop(top_address);
1431 1478
1432 // Read caller's PC (JSFunction continuation) from the input frame. 1479 // Read caller's PC (JSFunction continuation) from the input frame.
1433 unsigned input_frame_offset = input_frame_size - kPointerSize; 1480 unsigned input_frame_offset = input_frame_size - kPointerSize;
1434 unsigned output_frame_offset = output_frame_size - kPointerSize; 1481 unsigned output_frame_offset = output_frame_size - kPointerSize;
1482 #if V8_TARGET_ARCH_X32
1483 // Set high 32-bit of PC 0.
1484 output_frame->SetFrameSlot(output_frame_offset, 0);
1485 output_frame_offset -= kPointerSize;
1486 input_frame_offset -= kPointerSize;
1487 #endif
1435 intptr_t value = input_->GetFrameSlot(input_frame_offset); 1488 intptr_t value = input_->GetFrameSlot(input_frame_offset);
1436 output_frame->SetFrameSlot(output_frame_offset, value); 1489 output_frame->SetFrameSlot(output_frame_offset, value);
1437 if (trace_) { 1490 if (trace_) {
1438 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" 1491 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
1439 V8PRIxPTR " ; caller's pc\n", 1492 V8PRIxPTR " ; caller's pc\n",
1440 top_address + output_frame_offset, output_frame_offset, value); 1493 top_address + output_frame_offset, output_frame_offset, value);
1441 } 1494 }
1442 1495
1443 // Read caller's FP from the input frame, and set this frame's FP. 1496 // Read caller's FP from the input frame, and set this frame's FP.
1444 input_frame_offset -= kPointerSize; 1497 input_frame_offset -= kPointerSize;
1498 #if V8_TARGET_ARCH_X32
1499 input_frame_offset -= kPointerSize;
1500 #endif
1445 value = input_->GetFrameSlot(input_frame_offset); 1501 value = input_->GetFrameSlot(input_frame_offset);
1446 output_frame_offset -= kPointerSize; 1502 output_frame_offset -= kPointerSize;
1503 #if V8_TARGET_ARCH_X32
1504 output_frame->SetFrameSlot(output_frame_offset, 0);
1505 output_frame_offset -= kPointerSize;
1506 #endif
1447 output_frame->SetFrameSlot(output_frame_offset, value); 1507 output_frame->SetFrameSlot(output_frame_offset, value);
1448 intptr_t frame_ptr = input_->GetRegister(fp_reg.code()); 1508 intptr_t frame_ptr = input_->GetRegister(fp_reg.code());
1449 output_frame->SetRegister(fp_reg.code(), frame_ptr); 1509 output_frame->SetRegister(fp_reg.code(), frame_ptr);
1450 output_frame->SetFp(frame_ptr); 1510 output_frame->SetFp(frame_ptr);
1451 if (trace_) { 1511 if (trace_) {
1452 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" 1512 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
1453 V8PRIxPTR " ; caller's fp\n", 1513 V8PRIxPTR " ; caller's fp\n",
1454 top_address + output_frame_offset, output_frame_offset, value); 1514 top_address + output_frame_offset, output_frame_offset, value);
1455 } 1515 }
1456 1516
(...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after
3093 3153
3094 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { 3154 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) {
3095 v->VisitPointer(BitCast<Object**>(&function_)); 3155 v->VisitPointer(BitCast<Object**>(&function_));
3096 v->VisitPointers(parameters_, parameters_ + parameters_count_); 3156 v->VisitPointers(parameters_, parameters_ + parameters_count_);
3097 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); 3157 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_);
3098 } 3158 }
3099 3159
3100 #endif // ENABLE_DEBUGGER_SUPPORT 3160 #endif // ENABLE_DEBUGGER_SUPPORT
3101 3161
3102 } } // namespace v8::internal 3162 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698