| 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 // test rax, <loop nesting depth> | 244 // test rax, <loop nesting depth> |
| 245 // ok: | 245 // ok: |
| 246 // | 246 // |
| 247 ASSERT(*(call_target_address - 3) == 0x73 && // jae | 247 ASSERT(*(call_target_address - 3) == 0x73 && // jae |
| 248 *(call_target_address - 2) == 0x07 && // offset | 248 *(call_target_address - 2) == 0x07 && // offset |
| 249 *(call_target_address - 1) == 0xe8); // call | 249 *(call_target_address - 1) == 0xe8); // call |
| 250 *(call_target_address - 3) = 0x90; // nop | 250 *(call_target_address - 3) = 0x90; // nop |
| 251 *(call_target_address - 2) = 0x90; // nop | 251 *(call_target_address - 2) = 0x90; // nop |
| 252 Assembler::set_target_address_at(call_target_address, | 252 Assembler::set_target_address_at(call_target_address, |
| 253 replacement_code->entry()); | 253 replacement_code->entry()); |
| 254 |
| 255 RelocInfo rinfo(call_target_address, |
| 256 RelocInfo::CODE_TARGET, |
| 257 NULL, |
| 258 unoptimized_code); |
| 259 unoptimized_code->GetHeap()->incremental_marking()->RecordWriteIntoCode( |
| 260 unoptimized_code, &rinfo, replacement_code); |
| 254 } | 261 } |
| 255 | 262 |
| 256 | 263 |
| 257 void Deoptimizer::RevertStackCheckCodeAt(Address pc_after, | 264 void Deoptimizer::RevertStackCheckCodeAt(Address pc_after, |
| 258 Code* check_code, | 265 Code* check_code, |
| 259 Code* replacement_code) { | 266 Code* replacement_code) { |
| 260 Address call_target_address = pc_after - kIntSize; | 267 Address call_target_address = pc_after - kIntSize; |
| 261 ASSERT(replacement_code->entry() == | 268 ASSERT(replacement_code->entry() == |
| 262 Assembler::target_address_at(call_target_address)); | 269 Assembler::target_address_at(call_target_address)); |
| 263 // Replace the nops from patching (Deoptimizer::PatchStackCheckCode) to | 270 // Replace the nops from patching (Deoptimizer::PatchStackCheckCode) to |
| 264 // restore the conditional branch. | 271 // restore the conditional branch. |
| 265 ASSERT(*(call_target_address - 3) == 0x90 && // nop | 272 ASSERT(*(call_target_address - 3) == 0x90 && // nop |
| 266 *(call_target_address - 2) == 0x90 && // nop | 273 *(call_target_address - 2) == 0x90 && // nop |
| 267 *(call_target_address - 1) == 0xe8); // call | 274 *(call_target_address - 1) == 0xe8); // call |
| 268 *(call_target_address - 3) = 0x73; // jae | 275 *(call_target_address - 3) = 0x73; // jae |
| 269 *(call_target_address - 2) = 0x07; // offset | 276 *(call_target_address - 2) = 0x07; // offset |
| 270 Assembler::set_target_address_at(call_target_address, | 277 Assembler::set_target_address_at(call_target_address, |
| 271 check_code->entry()); | 278 check_code->entry()); |
| 279 check_code->GetHeap()->incremental_marking()-> |
| 280 RecordCodeTargetPatch(call_target_address, check_code); |
| 272 } | 281 } |
| 273 | 282 |
| 274 | 283 |
| 275 static int LookupBailoutId(DeoptimizationInputData* data, unsigned ast_id) { | 284 static int LookupBailoutId(DeoptimizationInputData* data, unsigned ast_id) { |
| 276 ByteArray* translations = data->TranslationByteArray(); | 285 ByteArray* translations = data->TranslationByteArray(); |
| 277 int length = data->DeoptCount(); | 286 int length = data->DeoptCount(); |
| 278 for (int i = 0; i < length; i++) { | 287 for (int i = 0; i < length; i++) { |
| 279 if (static_cast<unsigned>(data->AstId(i)->value()) == ast_id) { | 288 if (static_cast<unsigned>(data->AstId(i)->value()) == ast_id) { |
| 280 TranslationIterator it(translations, data->TranslationIndex(i)->value()); | 289 TranslationIterator it(translations, data->TranslationIndex(i)->value()); |
| 281 int value = it.Next(); | 290 int value = it.Next(); |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 } | 848 } |
| 840 __ bind(&done); | 849 __ bind(&done); |
| 841 } | 850 } |
| 842 | 851 |
| 843 #undef __ | 852 #undef __ |
| 844 | 853 |
| 845 | 854 |
| 846 } } // namespace v8::internal | 855 } } // namespace v8::internal |
| 847 | 856 |
| 848 #endif // V8_TARGET_ARCH_X64 | 857 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |