OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 output_frame_offset -= kPointerSize; | 519 output_frame_offset -= kPointerSize; |
520 value = reinterpret_cast<intptr_t>( | 520 value = reinterpret_cast<intptr_t>( |
521 Smi::FromInt(StackFrame::STUB_FAILURE_TRAMPOLINE)); | 521 Smi::FromInt(StackFrame::STUB_FAILURE_TRAMPOLINE)); |
522 output_frame->SetFrameSlot(output_frame_offset, value); | 522 output_frame->SetFrameSlot(output_frame_offset, value); |
523 | 523 |
524 for (int i = 0; i < descriptor->register_param_count_; ++i) { | 524 for (int i = 0; i < descriptor->register_param_count_; ++i) { |
525 output_frame_offset -= kPointerSize; | 525 output_frame_offset -= kPointerSize; |
526 DoTranslateCommand(iterator, 0, output_frame_offset); | 526 DoTranslateCommand(iterator, 0, output_frame_offset); |
527 } | 527 } |
528 | 528 |
| 529 for (int i = 0; i < DoubleRegister::kMaxNumRegisters; ++i) { |
| 530 double double_value = input_->GetDoubleRegister(i); |
| 531 output_frame->SetDoubleRegister(i, double_value); |
| 532 } |
| 533 |
529 value = input_->GetRegister(fp.code()); | 534 value = input_->GetRegister(fp.code()); |
530 output_frame->SetRegister(fp.code(), value); | 535 output_frame->SetRegister(fp.code(), value); |
531 output_frame->SetFp(value); | 536 output_frame->SetFp(value); |
532 | 537 |
533 ApiFunction function(descriptor->deoptimization_handler_); | 538 ApiFunction function(descriptor->deoptimization_handler_); |
534 ExternalReference xref(&function, ExternalReference::BUILTIN_CALL, isolate_); | 539 ExternalReference xref(&function, ExternalReference::BUILTIN_CALL, isolate_); |
535 intptr_t handler = reinterpret_cast<intptr_t>(xref.address()); | 540 intptr_t handler = reinterpret_cast<intptr_t>(xref.address()); |
536 output_frame->SetRegister(s0.code(), descriptor->register_param_count_); | 541 output_frame->SetRegister(s0.code(), descriptor->register_param_count_); |
537 output_frame->SetRegister(s1.code(), | 542 output_frame->SetRegister(s1.code(), |
538 (descriptor->register_param_count_ - 1) * kPointerSize); | 543 (descriptor->register_param_count_ - 1) * kPointerSize); |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 int offset = (i * kPointerSize) + FrameDescription::registers_offset(); | 1074 int offset = (i * kPointerSize) + FrameDescription::registers_offset(); |
1070 if ((saved_regs & (1 << i)) != 0) { | 1075 if ((saved_regs & (1 << i)) != 0) { |
1071 __ lw(a2, MemOperand(sp, i * kPointerSize)); | 1076 __ lw(a2, MemOperand(sp, i * kPointerSize)); |
1072 __ sw(a2, MemOperand(a1, offset)); | 1077 __ sw(a2, MemOperand(a1, offset)); |
1073 } else if (FLAG_debug_code) { | 1078 } else if (FLAG_debug_code) { |
1074 __ li(a2, kDebugZapValue); | 1079 __ li(a2, kDebugZapValue); |
1075 __ sw(a2, MemOperand(a1, offset)); | 1080 __ sw(a2, MemOperand(a1, offset)); |
1076 } | 1081 } |
1077 } | 1082 } |
1078 | 1083 |
| 1084 int double_regs_offset = FrameDescription::double_registers_offset(); |
1079 if (CpuFeatures::IsSupported(FPU)) { | 1085 if (CpuFeatures::IsSupported(FPU)) { |
1080 CpuFeatures::Scope scope(FPU); | 1086 CpuFeatures::Scope scope(FPU); |
1081 // Copy FPU registers to | 1087 // Copy FPU registers to |
1082 // double_registers_[DoubleRegister::kNumAllocatableRegisters] | 1088 // double_registers_[DoubleRegister::kNumAllocatableRegisters] |
1083 int double_regs_offset = FrameDescription::double_registers_offset(); | |
1084 for (int i = 0; i < FPURegister::NumAllocatableRegisters(); ++i) { | 1089 for (int i = 0; i < FPURegister::NumAllocatableRegisters(); ++i) { |
1085 int dst_offset = i * kDoubleSize + double_regs_offset; | 1090 int dst_offset = i * kDoubleSize + double_regs_offset; |
1086 int src_offset = i * kDoubleSize + kNumberOfRegisters * kPointerSize; | 1091 int src_offset = i * kDoubleSize + kNumberOfRegisters * kPointerSize; |
1087 __ ldc1(f0, MemOperand(sp, src_offset)); | 1092 __ ldc1(f0, MemOperand(sp, src_offset)); |
1088 __ sdc1(f0, MemOperand(a1, dst_offset)); | 1093 __ sdc1(f0, MemOperand(a1, dst_offset)); |
1089 } | 1094 } |
1090 } | 1095 } |
1091 | 1096 |
1092 // Remove the bailout id, eventually return address, and the saved registers | 1097 // Remove the bailout id, eventually return address, and the saved registers |
1093 // from the stack. | 1098 // from the stack. |
(...skipping 30 matching lines...) Expand all Loading... |
1124 { | 1129 { |
1125 AllowExternalCallThatCantCauseGC scope(masm()); | 1130 AllowExternalCallThatCantCauseGC scope(masm()); |
1126 __ CallCFunction( | 1131 __ CallCFunction( |
1127 ExternalReference::compute_output_frames_function(isolate), 1); | 1132 ExternalReference::compute_output_frames_function(isolate), 1); |
1128 } | 1133 } |
1129 __ pop(a0); // Restore deoptimizer object (class Deoptimizer). | 1134 __ pop(a0); // Restore deoptimizer object (class Deoptimizer). |
1130 | 1135 |
1131 // Replace the current (input) frame with the output frames. | 1136 // Replace the current (input) frame with the output frames. |
1132 Label outer_push_loop, inner_push_loop, | 1137 Label outer_push_loop, inner_push_loop, |
1133 outer_loop_header, inner_loop_header; | 1138 outer_loop_header, inner_loop_header; |
1134 // Outer loop state: a0 = current "FrameDescription** output_", | 1139 // Outer loop state: t0 = current "FrameDescription** output_", |
1135 // a1 = one past the last FrameDescription**. | 1140 // a1 = one past the last FrameDescription**. |
1136 __ lw(a1, MemOperand(a0, Deoptimizer::output_count_offset())); | 1141 __ lw(a1, MemOperand(a0, Deoptimizer::output_count_offset())); |
1137 __ lw(a0, MemOperand(a0, Deoptimizer::output_offset())); // a0 is output_. | 1142 __ lw(t0, MemOperand(a0, Deoptimizer::output_offset())); // t0 is output_. |
1138 __ sll(a1, a1, kPointerSizeLog2); // Count to offset. | 1143 __ sll(a1, a1, kPointerSizeLog2); // Count to offset. |
1139 __ addu(a1, a0, a1); // a1 = one past the last FrameDescription**. | 1144 __ addu(a1, t0, a1); // a1 = one past the last FrameDescription**. |
1140 __ jmp(&outer_loop_header); | 1145 __ jmp(&outer_loop_header); |
1141 __ bind(&outer_push_loop); | 1146 __ bind(&outer_push_loop); |
1142 // Inner loop state: a2 = current FrameDescription*, a3 = loop index. | 1147 // Inner loop state: a2 = current FrameDescription*, a3 = loop index. |
1143 __ lw(a2, MemOperand(a0, 0)); // output_[ix] | 1148 __ lw(a2, MemOperand(t0, 0)); // output_[ix] |
1144 __ lw(a3, MemOperand(a2, FrameDescription::frame_size_offset())); | 1149 __ lw(a3, MemOperand(a2, FrameDescription::frame_size_offset())); |
1145 __ jmp(&inner_loop_header); | 1150 __ jmp(&inner_loop_header); |
1146 __ bind(&inner_push_loop); | 1151 __ bind(&inner_push_loop); |
1147 __ Subu(a3, a3, Operand(sizeof(uint32_t))); | 1152 __ Subu(a3, a3, Operand(sizeof(uint32_t))); |
1148 __ Addu(t2, a2, Operand(a3)); | 1153 __ Addu(t2, a2, Operand(a3)); |
1149 __ lw(t3, MemOperand(t2, FrameDescription::frame_content_offset())); | 1154 __ lw(t3, MemOperand(t2, FrameDescription::frame_content_offset())); |
1150 __ push(t3); | 1155 __ push(t3); |
1151 __ bind(&inner_loop_header); | 1156 __ bind(&inner_loop_header); |
1152 __ Branch(&inner_push_loop, ne, a3, Operand(zero_reg)); | 1157 __ Branch(&inner_push_loop, ne, a3, Operand(zero_reg)); |
1153 | 1158 |
1154 __ Addu(a0, a0, Operand(kPointerSize)); | 1159 __ Addu(t0, t0, Operand(kPointerSize)); |
1155 __ bind(&outer_loop_header); | 1160 __ bind(&outer_loop_header); |
1156 __ Branch(&outer_push_loop, lt, a0, Operand(a1)); | 1161 __ Branch(&outer_push_loop, lt, t0, Operand(a1)); |
1157 | 1162 |
| 1163 if (CpuFeatures::IsSupported(FPU)) { |
| 1164 CpuFeatures::Scope scope(FPU); |
| 1165 |
| 1166 __ lw(a1, MemOperand(a0, Deoptimizer::input_offset())); |
| 1167 for (int i = 0; i < FPURegister::kMaxNumAllocatableRegisters; ++i) { |
| 1168 const FPURegister fpu_reg = FPURegister::FromAllocationIndex(i); |
| 1169 int src_offset = i * kDoubleSize + double_regs_offset; |
| 1170 __ ldc1(fpu_reg, MemOperand(a1, src_offset)); |
| 1171 } |
| 1172 } |
1158 | 1173 |
1159 // Push state, pc, and continuation from the last output frame. | 1174 // Push state, pc, and continuation from the last output frame. |
1160 if (type() != OSR) { | 1175 if (type() != OSR) { |
1161 __ lw(t2, MemOperand(a2, FrameDescription::state_offset())); | 1176 __ lw(t2, MemOperand(a2, FrameDescription::state_offset())); |
1162 __ push(t2); | 1177 __ push(t2); |
1163 } | 1178 } |
1164 | 1179 |
1165 __ lw(t2, MemOperand(a2, FrameDescription::pc_offset())); | 1180 __ lw(t2, MemOperand(a2, FrameDescription::pc_offset())); |
1166 __ push(t2); | 1181 __ push(t2); |
1167 __ lw(t2, MemOperand(a2, FrameDescription::continuation_offset())); | 1182 __ lw(t2, MemOperand(a2, FrameDescription::continuation_offset())); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1228 } | 1243 } |
1229 | 1244 |
1230 ASSERT_EQ(masm()->SizeOfCodeGeneratedSince(&table_start), | 1245 ASSERT_EQ(masm()->SizeOfCodeGeneratedSince(&table_start), |
1231 count() * table_entry_size_); | 1246 count() * table_entry_size_); |
1232 } | 1247 } |
1233 | 1248 |
1234 #undef __ | 1249 #undef __ |
1235 | 1250 |
1236 | 1251 |
1237 } } // namespace v8::internal | 1252 } } // namespace v8::internal |
OLD | NEW |