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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 reloc_info_writer.Write(&rinfo); | 107 reloc_info_writer.Write(&rinfo); |
108 ASSERT(RelocInfo::kMinRelocCommentSize == | 108 ASSERT(RelocInfo::kMinRelocCommentSize == |
109 pos_before - reloc_info_writer.pos()); | 109 pos_before - reloc_info_writer.pos()); |
110 } | 110 } |
111 // Replace relocation information on the code object. | 111 // Replace relocation information on the code object. |
112 code->set_relocation_info(*new_reloc); | 112 code->set_relocation_info(*new_reloc); |
113 } | 113 } |
114 } | 114 } |
115 | 115 |
116 | 116 |
117 void Deoptimizer::DeoptimizeFunction(JSFunction* function) { | 117 void Deoptimizer::DeoptimizeFunctionWithPreparedFunctionList( |
118 if (!function->IsOptimized()) return; | 118 JSFunction* function) { |
| 119 Isolate* isolate = function->GetIsolate(); |
| 120 HandleScope scope(isolate); |
| 121 AssertNoAllocation no_allocation; |
| 122 |
| 123 ASSERT(function->IsOptimized()); |
| 124 ASSERT(function->FunctionsInFunctionListShareSameCode()); |
119 | 125 |
120 // The optimized code is going to be patched, so we cannot use it | 126 // The optimized code is going to be patched, so we cannot use it |
121 // any more. Play safe and reset the whole cache. | 127 // any more. Play safe and reset the whole cache. |
122 function->shared()->ClearOptimizedCodeMap(); | 128 function->shared()->ClearOptimizedCodeMap(); |
123 | 129 |
124 Isolate* isolate = function->GetIsolate(); | |
125 HandleScope scope(isolate); | |
126 AssertNoAllocation no_allocation; | |
127 | |
128 // Get the optimized code. | 130 // Get the optimized code. |
129 Code* code = function->code(); | 131 Code* code = function->code(); |
130 Address code_start_address = code->instruction_start(); | 132 Address code_start_address = code->instruction_start(); |
131 | 133 |
132 // We will overwrite the code's relocation info in-place. Relocation info | 134 // We will overwrite the code's relocation info in-place. Relocation info |
133 // is written backward. The relocation info is the payload of a byte | 135 // is written backward. The relocation info is the payload of a byte |
134 // array. Later on we will slide this to the start of the byte array and | 136 // array. Later on we will slide this to the start of the byte array and |
135 // create a filler object in the remaining space. | 137 // create a filler object in the remaining space. |
136 ByteArray* reloc_info = code->relocation_info(); | 138 ByteArray* reloc_info = code->relocation_info(); |
137 Address reloc_end_address = reloc_info->address() + reloc_info->Size(); | 139 Address reloc_end_address = reloc_info->address() + reloc_info->Size(); |
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 } | 1191 } |
1190 __ bind(&done); | 1192 __ bind(&done); |
1191 } | 1193 } |
1192 | 1194 |
1193 #undef __ | 1195 #undef __ |
1194 | 1196 |
1195 | 1197 |
1196 } } // namespace v8::internal | 1198 } } // namespace v8::internal |
1197 | 1199 |
1198 #endif // V8_TARGET_ARCH_IA32 | 1200 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |