| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 DeoptimizingCodeListNode* node = new DeoptimizingCodeListNode(code); | 97 DeoptimizingCodeListNode* node = new DeoptimizingCodeListNode(code); |
| 98 DeoptimizerData* data = isolate->deoptimizer_data(); | 98 DeoptimizerData* data = isolate->deoptimizer_data(); |
| 99 node->set_next(data->deoptimizing_code_list_); | 99 node->set_next(data->deoptimizing_code_list_); |
| 100 data->deoptimizing_code_list_ = node; | 100 data->deoptimizing_code_list_ = node; |
| 101 | 101 |
| 102 // We might be in the middle of incremental marking with compaction. | 102 // We might be in the middle of incremental marking with compaction. |
| 103 // Tell collector to treat this code object in a special way and | 103 // Tell collector to treat this code object in a special way and |
| 104 // ignore all slots that might have been recorded on it. | 104 // ignore all slots that might have been recorded on it. |
| 105 isolate->heap()->mark_compact_collector()->InvalidateCode(code); | 105 isolate->heap()->mark_compact_collector()->InvalidateCode(code); |
| 106 | 106 |
| 107 // Iterate over all the functions which share the same code object | 107 ReplaceCodeForRelatedFunctions(function, code); |
| 108 // and make them use unoptimized version. | |
| 109 Context* context = function->context()->native_context(); | |
| 110 Object* element = context->get(Context::OPTIMIZED_FUNCTIONS_LIST); | |
| 111 SharedFunctionInfo* shared = function->shared(); | |
| 112 while (!element->IsUndefined()) { | |
| 113 JSFunction* func = JSFunction::cast(element); | |
| 114 // Grab element before code replacement as ReplaceCode alters the list. | |
| 115 element = func->next_function_link(); | |
| 116 if (func->code() == code) { | |
| 117 func->ReplaceCode(shared->code()); | |
| 118 } | |
| 119 } | |
| 120 | 108 |
| 121 if (FLAG_trace_deopt) { | 109 if (FLAG_trace_deopt) { |
| 122 PrintF("[forced deoptimization: "); | 110 PrintF("[forced deoptimization: "); |
| 123 function->PrintName(); | 111 function->PrintName(); |
| 124 PrintF(" / %" V8PRIxPTR "]\n", reinterpret_cast<intptr_t>(function)); | 112 PrintF(" / %" V8PRIxPTR "]\n", reinterpret_cast<intptr_t>(function)); |
| 125 } | 113 } |
| 126 } | 114 } |
| 127 | 115 |
| 128 | 116 |
| 129 static const byte kJnsInstruction = 0x79; | 117 static const byte kJnsInstruction = 0x79; |
| (...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 } | 1105 } |
| 1118 __ bind(&done); | 1106 __ bind(&done); |
| 1119 } | 1107 } |
| 1120 | 1108 |
| 1121 #undef __ | 1109 #undef __ |
| 1122 | 1110 |
| 1123 | 1111 |
| 1124 } } // namespace v8::internal | 1112 } } // namespace v8::internal |
| 1125 | 1113 |
| 1126 #endif // V8_TARGET_ARCH_X64 | 1114 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |