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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 DeoptimizingCodeListNode* node = new DeoptimizingCodeListNode(code); | 191 DeoptimizingCodeListNode* node = new DeoptimizingCodeListNode(code); |
192 DeoptimizerData* data = isolate->deoptimizer_data(); | 192 DeoptimizerData* data = isolate->deoptimizer_data(); |
193 node->set_next(data->deoptimizing_code_list_); | 193 node->set_next(data->deoptimizing_code_list_); |
194 data->deoptimizing_code_list_ = node; | 194 data->deoptimizing_code_list_ = node; |
195 | 195 |
196 // We might be in the middle of incremental marking with compaction. | 196 // We might be in the middle of incremental marking with compaction. |
197 // Tell collector to treat this code object in a special way and | 197 // Tell collector to treat this code object in a special way and |
198 // ignore all slots that might have been recorded on it. | 198 // ignore all slots that might have been recorded on it. |
199 isolate->heap()->mark_compact_collector()->InvalidateCode(code); | 199 isolate->heap()->mark_compact_collector()->InvalidateCode(code); |
200 | 200 |
201 // Iterate over all the functions which share the same code object | 201 ReplaceCodeForRelatedFunctions(function, code); |
202 // and make them use unoptimized version. | |
203 Context* context = function->context()->native_context(); | |
204 Object* element = context->get(Context::OPTIMIZED_FUNCTIONS_LIST); | |
205 SharedFunctionInfo* shared = function->shared(); | |
206 while (!element->IsUndefined()) { | |
207 JSFunction* func = JSFunction::cast(element); | |
208 // Grab element before code replacement as ReplaceCode alters the list. | |
209 element = func->next_function_link(); | |
210 if (func->code() == code) { | |
211 func->ReplaceCode(shared->code()); | |
212 } | |
213 } | |
214 | 202 |
215 if (FLAG_trace_deopt) { | 203 if (FLAG_trace_deopt) { |
216 PrintF("[forced deoptimization: "); | 204 PrintF("[forced deoptimization: "); |
217 function->PrintName(); | 205 function->PrintName(); |
218 PrintF(" / %x]\n", reinterpret_cast<uint32_t>(function)); | 206 PrintF(" / %x]\n", reinterpret_cast<uint32_t>(function)); |
219 } | 207 } |
220 } | 208 } |
221 | 209 |
222 | 210 |
223 static const byte kJnsInstruction = 0x79; | 211 static const byte kJnsInstruction = 0x79; |
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1213 } | 1201 } |
1214 __ bind(&done); | 1202 __ bind(&done); |
1215 } | 1203 } |
1216 | 1204 |
1217 #undef __ | 1205 #undef __ |
1218 | 1206 |
1219 | 1207 |
1220 } } // namespace v8::internal | 1208 } } // namespace v8::internal |
1221 | 1209 |
1222 #endif // V8_TARGET_ARCH_IA32 | 1210 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |