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(" / %x]\n", reinterpret_cast<uint32_t>(function)); | 112 PrintF(" / %x]\n", reinterpret_cast<uint32_t>(function)); |
125 } | 113 } |
126 } | 114 } |
127 | 115 |
128 | 116 |
129 static const int32_t kBranchBeforeStackCheck = 0x2a000001; | 117 static const int32_t kBranchBeforeStackCheck = 0x2a000001; |
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 __ push(ip); | 1110 __ push(ip); |
1123 __ b(&done); | 1111 __ b(&done); |
1124 ASSERT(masm()->pc_offset() - start == table_entry_size_); | 1112 ASSERT(masm()->pc_offset() - start == table_entry_size_); |
1125 } | 1113 } |
1126 __ bind(&done); | 1114 __ bind(&done); |
1127 } | 1115 } |
1128 | 1116 |
1129 #undef __ | 1117 #undef __ |
1130 | 1118 |
1131 } } // namespace v8::internal | 1119 } } // namespace v8::internal |
OLD | NEW |