| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 node->set_next(deoptimizing_code_list_); | 190 node->set_next(deoptimizing_code_list_); |
| 190 deoptimizing_code_list_ = node; | 191 deoptimizing_code_list_ = node; |
| 191 | 192 |
| 192 // Set the code for the function to non-optimized version. | 193 // Set the code for the function to non-optimized version. |
| 193 function->ReplaceCode(function->shared()->code()); | 194 function->ReplaceCode(function->shared()->code()); |
| 194 | 195 |
| 195 if (FLAG_trace_deopt) { | 196 if (FLAG_trace_deopt) { |
| 196 PrintF("[forced deoptimization: "); | 197 PrintF("[forced deoptimization: "); |
| 197 function->PrintName(); | 198 function->PrintName(); |
| 198 PrintF(" / %" V8PRIxPTR "]\n", reinterpret_cast<intptr_t>(function)); | 199 PrintF(" / %" V8PRIxPTR "]\n", reinterpret_cast<intptr_t>(function)); |
| 200 #ifdef DEBUG |
| 201 if (FLAG_print_code) { |
| 202 code->PrintLn(); |
| 203 } |
| 204 #endif |
| 199 } | 205 } |
| 200 } | 206 } |
| 201 | 207 |
| 202 | 208 |
| 203 void Deoptimizer::PatchStackCheckCodeAt(Address pc_after, | 209 void Deoptimizer::PatchStackCheckCodeAt(Address pc_after, |
| 204 Code* check_code, | 210 Code* check_code, |
| 205 Code* replacement_code) { | 211 Code* replacement_code) { |
| 206 Address call_target_address = pc_after - kIntSize; | 212 Address call_target_address = pc_after - kIntSize; |
| 207 ASSERT(check_code->entry() == | 213 ASSERT(check_code->entry() == |
| 208 Assembler::target_address_at(call_target_address)); | 214 Assembler::target_address_at(call_target_address)); |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 } | 775 } |
| 770 __ bind(&done); | 776 __ bind(&done); |
| 771 } | 777 } |
| 772 | 778 |
| 773 #undef __ | 779 #undef __ |
| 774 | 780 |
| 775 | 781 |
| 776 } } // namespace v8::internal | 782 } } // namespace v8::internal |
| 777 | 783 |
| 778 #endif // V8_TARGET_ARCH_X64 | 784 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |