| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 #ifdef DEBUG | 49 #ifdef DEBUG |
| 50 ASSERT(start <= end); | 50 ASSERT(start <= end); |
| 51 int size = end - start; | 51 int size = end - start; |
| 52 CodePatcher destroyer(start, size); | 52 CodePatcher destroyer(start, size); |
| 53 while (size-- > 0) destroyer.masm()->int3(); | 53 while (size-- > 0) destroyer.masm()->int3(); |
| 54 #endif | 54 #endif |
| 55 } | 55 } |
| 56 | 56 |
| 57 | 57 |
| 58 void Deoptimizer::DeoptimizeFunction(JSFunction* function) { | 58 void Deoptimizer::DeoptimizeFunction(JSFunction* function) { |
| 59 HandleScope scope; |
| 59 AssertNoAllocation no_allocation; | 60 AssertNoAllocation no_allocation; |
| 60 | 61 |
| 61 if (!function->IsOptimized()) return; | 62 if (!function->IsOptimized()) return; |
| 62 | 63 |
| 63 // Get the optimized code. | 64 // Get the optimized code. |
| 64 Code* code = function->code(); | 65 Code* code = function->code(); |
| 65 Address code_start_address = code->instruction_start(); | 66 Address code_start_address = code->instruction_start(); |
| 66 | 67 |
| 67 // We will overwrite the code's relocation info in-place. Relocation info | 68 // We will overwrite the code's relocation info in-place. Relocation info |
| 68 // is written backward. The relocation info is the payload of a byte | 69 // is written backward. The relocation info is the payload of a byte |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 node->set_next(data->deoptimizing_code_list_); | 127 node->set_next(data->deoptimizing_code_list_); |
| 127 data->deoptimizing_code_list_ = node; | 128 data->deoptimizing_code_list_ = node; |
| 128 | 129 |
| 129 // Set the code for the function to non-optimized version. | 130 // Set the code for the function to non-optimized version. |
| 130 function->ReplaceCode(function->shared()->code()); | 131 function->ReplaceCode(function->shared()->code()); |
| 131 | 132 |
| 132 if (FLAG_trace_deopt) { | 133 if (FLAG_trace_deopt) { |
| 133 PrintF("[forced deoptimization: "); | 134 PrintF("[forced deoptimization: "); |
| 134 function->PrintName(); | 135 function->PrintName(); |
| 135 PrintF(" / %x]\n", reinterpret_cast<uint32_t>(function)); | 136 PrintF(" / %x]\n", reinterpret_cast<uint32_t>(function)); |
| 137 #ifdef DEBUG |
| 138 if (FLAG_print_code) { |
| 139 code->PrintLn(); |
| 140 } |
| 141 #endif |
| 136 } | 142 } |
| 137 } | 143 } |
| 138 | 144 |
| 139 | 145 |
| 140 void Deoptimizer::PatchStackCheckCodeAt(Address pc_after, | 146 void Deoptimizer::PatchStackCheckCodeAt(Address pc_after, |
| 141 Code* check_code, | 147 Code* check_code, |
| 142 Code* replacement_code) { | 148 Code* replacement_code) { |
| 143 Address call_target_address = pc_after - kIntSize; | 149 Address call_target_address = pc_after - kIntSize; |
| 144 ASSERT(check_code->entry() == | 150 ASSERT(check_code->entry() == |
| 145 Assembler::target_address_at(call_target_address)); | 151 Assembler::target_address_at(call_target_address)); |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 } | 664 } |
| 659 __ bind(&done); | 665 __ bind(&done); |
| 660 } | 666 } |
| 661 | 667 |
| 662 #undef __ | 668 #undef __ |
| 663 | 669 |
| 664 | 670 |
| 665 } } // namespace v8::internal | 671 } } // namespace v8::internal |
| 666 | 672 |
| 667 #endif // V8_TARGET_ARCH_IA32 | 673 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |