| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 116 |
| 117 void Deoptimizer::DeoptimizeFunctionWithPreparedFunctionList( | 117 void Deoptimizer::DeoptimizeFunctionWithPreparedFunctionList( |
| 118 JSFunction* function) { | 118 JSFunction* function) { |
| 119 Isolate* isolate = function->GetIsolate(); | 119 Isolate* isolate = function->GetIsolate(); |
| 120 HandleScope scope(isolate); | 120 HandleScope scope(isolate); |
| 121 AssertNoAllocation no_allocation; | 121 AssertNoAllocation no_allocation; |
| 122 | 122 |
| 123 ASSERT(function->IsOptimized()); | 123 ASSERT(function->IsOptimized()); |
| 124 ASSERT(function->FunctionsInFunctionListShareSameCode()); | 124 ASSERT(function->FunctionsInFunctionListShareSameCode()); |
| 125 | 125 |
| 126 // The optimized code is going to be patched, so we cannot use it | |
| 127 // any more. Play safe and reset the whole cache. | |
| 128 function->shared()->ClearOptimizedCodeMap("deoptimized function"); | |
| 129 | |
| 130 // Get the optimized code. | 126 // Get the optimized code. |
| 131 Code* code = function->code(); | 127 Code* code = function->code(); |
| 132 Address code_start_address = code->instruction_start(); | 128 Address code_start_address = code->instruction_start(); |
| 133 | 129 |
| 130 // The optimized code is going to be patched, so we cannot use it any more. |
| 131 function->shared()->EvictFromOptimizedCodeMap(code, "deoptimized function"); |
| 132 |
| 134 // We will overwrite the code's relocation info in-place. Relocation info | 133 // We will overwrite the code's relocation info in-place. Relocation info |
| 135 // is written backward. The relocation info is the payload of a byte | 134 // is written backward. The relocation info is the payload of a byte |
| 136 // array. Later on we will slide this to the start of the byte array and | 135 // array. Later on we will slide this to the start of the byte array and |
| 137 // create a filler object in the remaining space. | 136 // create a filler object in the remaining space. |
| 138 ByteArray* reloc_info = code->relocation_info(); | 137 ByteArray* reloc_info = code->relocation_info(); |
| 139 Address reloc_end_address = reloc_info->address() + reloc_info->Size(); | 138 Address reloc_end_address = reloc_info->address() + reloc_info->Size(); |
| 140 RelocInfoWriter reloc_info_writer(reloc_end_address, code_start_address); | 139 RelocInfoWriter reloc_info_writer(reloc_end_address, code_start_address); |
| 141 | 140 |
| 142 // For each LLazyBailout instruction insert a call to the corresponding | 141 // For each LLazyBailout instruction insert a call to the corresponding |
| 143 // deoptimization entry. | 142 // deoptimization entry. |
| (...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 } | 920 } |
| 922 __ bind(&done); | 921 __ bind(&done); |
| 923 } | 922 } |
| 924 | 923 |
| 925 #undef __ | 924 #undef __ |
| 926 | 925 |
| 927 | 926 |
| 928 } } // namespace v8::internal | 927 } } // namespace v8::internal |
| 929 | 928 |
| 930 #endif // V8_TARGET_ARCH_IA32 | 929 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |