| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // Index of next deoptimization entry. If negative after calling | 95 // Index of next deoptimization entry. If negative after calling |
| 96 // FindNextIndex, there are no more, and Next will return an invalid | 96 // FindNextIndex, there are no more, and Next will return an invalid |
| 97 // SafepointEntry. | 97 // SafepointEntry. |
| 98 int index_; | 98 int index_; |
| 99 // Table length. | 99 // Table length. |
| 100 int limit_; | 100 int limit_; |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 | 103 |
| 104 void Deoptimizer::DeoptimizeFunction(JSFunction* function) { | 104 void Deoptimizer::DeoptimizeFunction(JSFunction* function) { |
| 105 HandleScope scope; |
| 105 AssertNoAllocation no_allocation; | 106 AssertNoAllocation no_allocation; |
| 106 | 107 |
| 107 if (!function->IsOptimized()) return; | 108 if (!function->IsOptimized()) return; |
| 108 | 109 |
| 109 // Get the optimized code. | 110 // Get the optimized code. |
| 110 Code* code = function->code(); | 111 Code* code = function->code(); |
| 111 | 112 |
| 112 // Invalidate the relocation information, as it will become invalid by the | 113 // Invalidate the relocation information, as it will become invalid by the |
| 113 // code patching below, and is not needed any more. | 114 // code patching below, and is not needed any more. |
| 114 code->InvalidateRelocation(); | 115 code->InvalidateRelocation(); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 node->set_next(data->deoptimizing_code_list_); | 191 node->set_next(data->deoptimizing_code_list_); |
| 191 data->deoptimizing_code_list_ = node; | 192 data->deoptimizing_code_list_ = node; |
| 192 | 193 |
| 193 // Set the code for the function to non-optimized version. | 194 // Set the code for the function to non-optimized version. |
| 194 function->ReplaceCode(function->shared()->code()); | 195 function->ReplaceCode(function->shared()->code()); |
| 195 | 196 |
| 196 if (FLAG_trace_deopt) { | 197 if (FLAG_trace_deopt) { |
| 197 PrintF("[forced deoptimization: "); | 198 PrintF("[forced deoptimization: "); |
| 198 function->PrintName(); | 199 function->PrintName(); |
| 199 PrintF(" / %" V8PRIxPTR "]\n", reinterpret_cast<intptr_t>(function)); | 200 PrintF(" / %" V8PRIxPTR "]\n", reinterpret_cast<intptr_t>(function)); |
| 201 #ifdef DEBUG |
| 202 if (FLAG_print_code) { |
| 203 code->PrintLn(); |
| 204 } |
| 205 #endif |
| 200 } | 206 } |
| 201 } | 207 } |
| 202 | 208 |
| 203 | 209 |
| 204 void Deoptimizer::PatchStackCheckCodeAt(Address pc_after, | 210 void Deoptimizer::PatchStackCheckCodeAt(Address pc_after, |
| 205 Code* check_code, | 211 Code* check_code, |
| 206 Code* replacement_code) { | 212 Code* replacement_code) { |
| 207 Address call_target_address = pc_after - kIntSize; | 213 Address call_target_address = pc_after - kIntSize; |
| 208 ASSERT(check_code->entry() == | 214 ASSERT(check_code->entry() == |
| 209 Assembler::target_address_at(call_target_address)); | 215 Assembler::target_address_at(call_target_address)); |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 } | 778 } |
| 773 __ bind(&done); | 779 __ bind(&done); |
| 774 } | 780 } |
| 775 | 781 |
| 776 #undef __ | 782 #undef __ |
| 777 | 783 |
| 778 | 784 |
| 779 } } // namespace v8::internal | 785 } } // namespace v8::internal |
| 780 | 786 |
| 781 #endif // V8_TARGET_ARCH_X64 | 787 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |