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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 node->set_next(deoptimizing_code_list_); | 126 node->set_next(deoptimizing_code_list_); |
126 deoptimizing_code_list_ = node; | 127 deoptimizing_code_list_ = node; |
127 | 128 |
128 // Set the code for the function to non-optimized version. | 129 // Set the code for the function to non-optimized version. |
129 function->ReplaceCode(function->shared()->code()); | 130 function->ReplaceCode(function->shared()->code()); |
130 | 131 |
131 if (FLAG_trace_deopt) { | 132 if (FLAG_trace_deopt) { |
132 PrintF("[forced deoptimization: "); | 133 PrintF("[forced deoptimization: "); |
133 function->PrintName(); | 134 function->PrintName(); |
134 PrintF(" / %x]\n", reinterpret_cast<uint32_t>(function)); | 135 PrintF(" / %x]\n", reinterpret_cast<uint32_t>(function)); |
| 136 #ifdef DEBUG |
| 137 if (FLAG_print_code) { |
| 138 code->PrintLn(); |
| 139 } |
| 140 #endif |
135 } | 141 } |
136 } | 142 } |
137 | 143 |
138 | 144 |
139 void Deoptimizer::PatchStackCheckCodeAt(Address pc_after, | 145 void Deoptimizer::PatchStackCheckCodeAt(Address pc_after, |
140 Code* check_code, | 146 Code* check_code, |
141 Code* replacement_code) { | 147 Code* replacement_code) { |
142 Address call_target_address = pc_after - kIntSize; | 148 Address call_target_address = pc_after - kIntSize; |
143 ASSERT(check_code->entry() == | 149 ASSERT(check_code->entry() == |
144 Assembler::target_address_at(call_target_address)); | 150 Assembler::target_address_at(call_target_address)); |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 } | 661 } |
656 __ bind(&done); | 662 __ bind(&done); |
657 } | 663 } |
658 | 664 |
659 #undef __ | 665 #undef __ |
660 | 666 |
661 | 667 |
662 } } // namespace v8::internal | 668 } } // namespace v8::internal |
663 | 669 |
664 #endif // V8_TARGET_ARCH_IA32 | 670 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |