| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 DeoptimizingCodeListNode* node = new DeoptimizingCodeListNode(code); | 93 DeoptimizingCodeListNode* node = new DeoptimizingCodeListNode(code); |
| 94 DeoptimizerData* data = isolate->deoptimizer_data(); | 94 DeoptimizerData* data = isolate->deoptimizer_data(); |
| 95 node->set_next(data->deoptimizing_code_list_); | 95 node->set_next(data->deoptimizing_code_list_); |
| 96 data->deoptimizing_code_list_ = node; | 96 data->deoptimizing_code_list_ = node; |
| 97 | 97 |
| 98 // We might be in the middle of incremental marking with compaction. | 98 // We might be in the middle of incremental marking with compaction. |
| 99 // Tell collector to treat this code object in a special way and | 99 // Tell collector to treat this code object in a special way and |
| 100 // ignore all slots that might have been recorded on it. | 100 // ignore all slots that might have been recorded on it. |
| 101 isolate->heap()->mark_compact_collector()->InvalidateCode(code); | 101 isolate->heap()->mark_compact_collector()->InvalidateCode(code); |
| 102 | 102 |
| 103 // Iterate over all the functions which share the same code object | 103 ReplaceCodeForRelatedFunctions(function, code); |
| 104 // and make them use unoptimized version. | |
| 105 Context* context = function->context()->native_context(); | |
| 106 Object* element = context->get(Context::OPTIMIZED_FUNCTIONS_LIST); | |
| 107 SharedFunctionInfo* shared = function->shared(); | |
| 108 while (!element->IsUndefined()) { | |
| 109 JSFunction* func = JSFunction::cast(element); | |
| 110 // Grab element before code replacement as ReplaceCode alters the list. | |
| 111 element = func->next_function_link(); | |
| 112 if (func->code() == code) { | |
| 113 func->ReplaceCode(shared->code()); | |
| 114 } | |
| 115 } | |
| 116 | 104 |
| 117 if (FLAG_trace_deopt) { | 105 if (FLAG_trace_deopt) { |
| 118 PrintF("[forced deoptimization: "); | 106 PrintF("[forced deoptimization: "); |
| 119 function->PrintName(); | 107 function->PrintName(); |
| 120 PrintF(" / %x]\n", reinterpret_cast<uint32_t>(function)); | 108 PrintF(" / %x]\n", reinterpret_cast<uint32_t>(function)); |
| 121 #ifdef DEBUG | 109 #ifdef DEBUG |
| 122 if (FLAG_print_code) { | 110 if (FLAG_print_code) { |
| 123 code->PrintLn(); | 111 code->PrintLn(); |
| 124 } | 112 } |
| 125 #endif | 113 #endif |
| (...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1133 } | 1121 } |
| 1134 | 1122 |
| 1135 ASSERT_EQ(masm()->SizeOfCodeGeneratedSince(&table_start), | 1123 ASSERT_EQ(masm()->SizeOfCodeGeneratedSince(&table_start), |
| 1136 count() * table_entry_size_); | 1124 count() * table_entry_size_); |
| 1137 } | 1125 } |
| 1138 | 1126 |
| 1139 #undef __ | 1127 #undef __ |
| 1140 | 1128 |
| 1141 | 1129 |
| 1142 } } // namespace v8::internal | 1130 } } // namespace v8::internal |
| OLD | NEW |