OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
221 // ok: ... | 221 // ok: ... |
222 // | 222 // |
223 // We will patch away the branch so the code is: | 223 // We will patch away the branch so the code is: |
224 // | 224 // |
225 // cmp esp, <limit> ;; Not changed | 225 // cmp esp, <limit> ;; Not changed |
226 // nop | 226 // nop |
227 // nop | 227 // nop |
228 // call <on-stack replacment> | 228 // call <on-stack replacment> |
229 // test eax, <loop nesting depth> | 229 // test eax, <loop nesting depth> |
230 // ok: | 230 // ok: |
231 ASSERT(*(call_target_address - 3) == 0x73 && // jae | 231 |
232 *(call_target_address - 2) == 0x07 && // offset | 232 if (FLAG_count_based_interrupts) { |
233 *(call_target_address - 1) == 0xe8); // call | 233 ASSERT(*(call_target_address - 3) == 0x79); // jns |
234 ASSERT(*(call_target_address - 2) == 0x11); // offset | |
Vyacheslav Egorov (Chromium)
2012/02/14 12:52:47
Please name magical constants. they are duplicated
Jakob Kummerow
2012/02/14 13:54:45
Done.
| |
235 } else { | |
236 ASSERT(*(call_target_address - 3) == 0x73); // jae | |
237 ASSERT(*(call_target_address - 2) == 0x07); // offset | |
238 } | |
239 ASSERT(*(call_target_address - 1) == 0xe8); // call | |
234 *(call_target_address - 3) = 0x66; // 2 byte nop part 1 | 240 *(call_target_address - 3) = 0x66; // 2 byte nop part 1 |
235 *(call_target_address - 2) = 0x90; // 2 byte nop part 2 | 241 *(call_target_address - 2) = 0x90; // 2 byte nop part 2 |
236 Assembler::set_target_address_at(call_target_address, | 242 Assembler::set_target_address_at(call_target_address, |
237 replacement_code->entry()); | 243 replacement_code->entry()); |
238 | 244 |
239 unoptimized_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch( | 245 unoptimized_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch( |
240 unoptimized_code, call_target_address, replacement_code); | 246 unoptimized_code, call_target_address, replacement_code); |
241 } | 247 } |
242 | 248 |
243 | 249 |
244 void Deoptimizer::RevertStackCheckCodeAt(Code* unoptimized_code, | 250 void Deoptimizer::RevertStackCheckCodeAt(Code* unoptimized_code, |
245 Address pc_after, | 251 Address pc_after, |
246 Code* check_code, | 252 Code* check_code, |
247 Code* replacement_code) { | 253 Code* replacement_code) { |
248 Address call_target_address = pc_after - kIntSize; | 254 Address call_target_address = pc_after - kIntSize; |
249 ASSERT(replacement_code->entry() == | 255 ASSERT(replacement_code->entry() == |
250 Assembler::target_address_at(call_target_address)); | 256 Assembler::target_address_at(call_target_address)); |
257 | |
251 // Replace the nops from patching (Deoptimizer::PatchStackCheckCode) to | 258 // Replace the nops from patching (Deoptimizer::PatchStackCheckCode) to |
252 // restore the conditional branch. | 259 // restore the conditional branch. |
253 ASSERT(*(call_target_address - 3) == 0x66 && // 2 byte nop part 1 | 260 ASSERT(*(call_target_address - 3) == 0x66 && // 2 byte nop part 1 |
254 *(call_target_address - 2) == 0x90 && // 2 byte nop part 2 | 261 *(call_target_address - 2) == 0x90 && // 2 byte nop part 2 |
255 *(call_target_address - 1) == 0xe8); // call | 262 *(call_target_address - 1) == 0xe8); // call |
256 *(call_target_address - 3) = 0x73; // jae | 263 if (FLAG_count_based_interrupts) { |
257 *(call_target_address - 2) = 0x07; // offset | 264 *(call_target_address - 3) = 0x79; // jns |
265 *(call_target_address - 2) = 0x11; // offset | |
266 } else { | |
267 *(call_target_address - 3) = 0x73; // jae | |
268 *(call_target_address - 2) = 0x07; // offset | |
269 } | |
258 Assembler::set_target_address_at(call_target_address, | 270 Assembler::set_target_address_at(call_target_address, |
259 check_code->entry()); | 271 check_code->entry()); |
260 | 272 |
261 check_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch( | 273 check_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch( |
262 unoptimized_code, call_target_address, check_code); | 274 unoptimized_code, call_target_address, check_code); |
263 } | 275 } |
264 | 276 |
265 | 277 |
266 static int LookupBailoutId(DeoptimizationInputData* data, unsigned ast_id) { | 278 static int LookupBailoutId(DeoptimizationInputData* data, unsigned ast_id) { |
267 ByteArray* translations = data->TranslationByteArray(); | 279 ByteArray* translations = data->TranslationByteArray(); |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
917 } | 929 } |
918 __ bind(&done); | 930 __ bind(&done); |
919 } | 931 } |
920 | 932 |
921 #undef __ | 933 #undef __ |
922 | 934 |
923 | 935 |
924 } } // namespace v8::internal | 936 } } // namespace v8::internal |
925 | 937 |
926 #endif // V8_TARGET_ARCH_IA32 | 938 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |