| 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 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1240 int inlined_count = data->InlinedFunctionCount()->value(); | 1240 int inlined_count = data->InlinedFunctionCount()->value(); |
| 1241 for (int i = 0; i < inlined_count; ++i) { | 1241 for (int i = 0; i < inlined_count; ++i) { |
| 1242 JSFunction* inlined = JSFunction::cast(literals->get(i)); | 1242 JSFunction* inlined = JSFunction::cast(literals->get(i)); |
| 1243 if (inlined->shared() == candidate) return true; | 1243 if (inlined->shared() == candidate) return true; |
| 1244 } | 1244 } |
| 1245 | 1245 |
| 1246 return false; | 1246 return false; |
| 1247 } | 1247 } |
| 1248 | 1248 |
| 1249 | 1249 |
| 1250 static void DeoptimizeDependentFunctions(SharedFunctionInfo* function_info) { | 1250 // Marks code that shares the same shared function info or has inlined |
| 1251 // Marks code that shares the same shared function info or has inlined | 1251 // code that shares the same function info. |
| 1252 // code that shares the same function info. | 1252 class DependentFunctionMarker: public OptimizedFunctionVisitor { |
| 1253 class DependentFunctionMarker: public OptimizedFunctionVisitor { | 1253 public: |
| 1254 public: | 1254 SharedFunctionInfo* shared_info_; |
| 1255 SharedFunctionInfo* shared_info_; | 1255 bool found_; |
| 1256 bool found_; | |
| 1257 | 1256 |
| 1258 explicit DependentFunctionMarker(SharedFunctionInfo* shared_info) | 1257 explicit DependentFunctionMarker(SharedFunctionInfo* shared_info) |
| 1259 : shared_info_(shared_info), found_(false) { } | 1258 : shared_info_(shared_info), found_(false) { } |
| 1260 | 1259 |
| 1261 virtual void EnterContext(Context* context) { } // Don't care. | 1260 virtual void EnterContext(Context* context) { } // Don't care. |
| 1262 virtual void LeaveContext(Context* context) { } // Don't care. | 1261 virtual void LeaveContext(Context* context) { } // Don't care. |
| 1263 virtual void VisitFunction(JSFunction* function) { | 1262 virtual void VisitFunction(JSFunction* function) { |
| 1264 // It should be guaranteed by the iterator that everything is optimized. | 1263 // It should be guaranteed by the iterator that everything is optimized. |
| 1265 ASSERT(function->code()->kind() == Code::OPTIMIZED_FUNCTION); | 1264 ASSERT(function->code()->kind() == Code::OPTIMIZED_FUNCTION); |
| 1266 if (shared_info_ == function->shared() || | 1265 if (shared_info_ == function->shared() || |
| 1267 IsInlined(function, shared_info_)) { | 1266 IsInlined(function, shared_info_)) { |
| 1268 // mark the code for deoptimization | 1267 // Mark the code for deoptimization. |
| 1269 function->code()->set_marked_for_deoptimization(true); | 1268 function->code()->set_marked_for_deoptimization(true); |
| 1270 found_ = true; | 1269 found_ = true; |
| 1271 } | |
| 1272 } | 1270 } |
| 1273 }; | 1271 } |
| 1272 }; |
| 1274 | 1273 |
| 1275 | 1274 |
| 1275 static void DeoptimizeDependentFunctions(SharedFunctionInfo* function_info) { |
| 1276 DisallowHeapAllocation no_allocation; | 1276 DisallowHeapAllocation no_allocation; |
| 1277 DependentFunctionMarker marker(function_info); | 1277 DependentFunctionMarker marker(function_info); |
| 1278 // TODO(titzer): need to traverse all optimized code to find OSR code here. | 1278 // TODO(titzer): need to traverse all optimized code to find OSR code here. |
| 1279 Deoptimizer::VisitAllOptimizedFunctions(function_info->GetIsolate(), &marker); | 1279 Deoptimizer::VisitAllOptimizedFunctions(function_info->GetIsolate(), &marker); |
| 1280 | 1280 |
| 1281 if (marker.found_) { | 1281 if (marker.found_) { |
| 1282 // Only go through with the deoptimization if something was found. | 1282 // Only go through with the deoptimization if something was found. |
| 1283 Deoptimizer::DeoptimizeMarkedCode(function_info->GetIsolate()); | 1283 Deoptimizer::DeoptimizeMarkedCode(function_info->GetIsolate()); |
| 1284 } | 1284 } |
| 1285 } | 1285 } |
| (...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2152 | 2152 |
| 2153 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { | 2153 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { |
| 2154 return false; | 2154 return false; |
| 2155 } | 2155 } |
| 2156 | 2156 |
| 2157 #endif // ENABLE_DEBUGGER_SUPPORT | 2157 #endif // ENABLE_DEBUGGER_SUPPORT |
| 2158 | 2158 |
| 2159 | 2159 |
| 2160 | 2160 |
| 2161 } } // namespace v8::internal | 2161 } } // namespace v8::internal |
| OLD | NEW |