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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 #endif | 113 #endif |
114 } | 114 } |
115 } | 115 } |
116 | 116 |
117 | 117 |
118 void Deoptimizer::PatchStackCheckCodeAt(Code* unoptimized_code, | 118 void Deoptimizer::PatchStackCheckCodeAt(Code* unoptimized_code, |
119 Address pc_after, | 119 Address pc_after, |
120 Code* check_code, | 120 Code* check_code, |
121 Code* replacement_code) { | 121 Code* replacement_code) { |
122 const int kInstrSize = Assembler::kInstrSize; | 122 const int kInstrSize = Assembler::kInstrSize; |
123 // This structure comes from FullCodeGenerator::EmitStackCheck. | 123 // This structure comes from FullCodeGenerator::EmitBackEdgeBookkeeping. |
124 // The call of the stack guard check has the following form: | 124 // The call of the stack guard check has the following form: |
125 // sltu at, sp, t0 / slt at, a3, zero_reg (in case of count based interrupts) | 125 // sltu at, sp, t0 / slt at, a3, zero_reg (in case of count based interrupts) |
126 // beq at, zero_reg, ok | 126 // beq at, zero_reg, ok |
127 // lui t9, <stack guard address> upper | 127 // lui t9, <stack guard address> upper |
128 // ori t9, <stack guard address> lower | 128 // ori t9, <stack guard address> lower |
129 // jalr t9 | 129 // jalr t9 |
130 // nop | 130 // nop |
131 // ----- pc_after points here | 131 // ----- pc_after points here |
132 | 132 |
133 ASSERT(Assembler::IsBeq(Assembler::instr_at(pc_after - 5 * kInstrSize))); | 133 ASSERT(Assembler::IsBeq(Assembler::instr_at(pc_after - 5 * kInstrSize))); |
(...skipping 29 matching lines...) Expand all Loading... |
163 Code* check_code, | 163 Code* check_code, |
164 Code* replacement_code) { | 164 Code* replacement_code) { |
165 // Exact opposite of the function above. | 165 // Exact opposite of the function above. |
166 const int kInstrSize = Assembler::kInstrSize; | 166 const int kInstrSize = Assembler::kInstrSize; |
167 ASSERT(Assembler::IsAddImmediate( | 167 ASSERT(Assembler::IsAddImmediate( |
168 Assembler::instr_at(pc_after - 6 * kInstrSize))); | 168 Assembler::instr_at(pc_after - 6 * kInstrSize))); |
169 ASSERT(Assembler::IsBeq(Assembler::instr_at(pc_after - 5 * kInstrSize))); | 169 ASSERT(Assembler::IsBeq(Assembler::instr_at(pc_after - 5 * kInstrSize))); |
170 | 170 |
171 // Restore the sltu instruction so beq can be taken again. | 171 // Restore the sltu instruction so beq can be taken again. |
172 CodePatcher patcher(pc_after - 6 * kInstrSize, 1); | 172 CodePatcher patcher(pc_after - 6 * kInstrSize, 1); |
173 if (FLAG_count_based_interrupts) { | 173 patcher.masm()->slt(at, a3, zero_reg); |
174 patcher.masm()->slt(at, a3, zero_reg); | |
175 } else { | |
176 patcher.masm()->sltu(at, sp, t0); | |
177 } | |
178 | 174 |
179 // Replace the on-stack replacement address in the load-immediate (lui/ori | 175 // Replace the on-stack replacement address in the load-immediate (lui/ori |
180 // pair) with the entry address of the normal stack-check code. | 176 // pair) with the entry address of the normal stack-check code. |
181 ASSERT(reinterpret_cast<uint32_t>( | 177 ASSERT(reinterpret_cast<uint32_t>( |
182 Assembler::target_address_at(pc_after - 4 * kInstrSize)) == | 178 Assembler::target_address_at(pc_after - 4 * kInstrSize)) == |
183 reinterpret_cast<uint32_t>(replacement_code->entry())); | 179 reinterpret_cast<uint32_t>(replacement_code->entry())); |
184 Assembler::set_target_address_at(pc_after - 4 * kInstrSize, | 180 Assembler::set_target_address_at(pc_after - 4 * kInstrSize, |
185 check_code->entry()); | 181 check_code->entry()); |
186 | 182 |
187 check_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch( | 183 check_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch( |
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 } | 1117 } |
1122 | 1118 |
1123 ASSERT_EQ(masm()->SizeOfCodeGeneratedSince(&table_start), | 1119 ASSERT_EQ(masm()->SizeOfCodeGeneratedSince(&table_start), |
1124 count() * table_entry_size_); | 1120 count() * table_entry_size_); |
1125 } | 1121 } |
1126 | 1122 |
1127 #undef __ | 1123 #undef __ |
1128 | 1124 |
1129 | 1125 |
1130 } } // namespace v8::internal | 1126 } } // namespace v8::internal |
OLD | NEW |