Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Side by Side Diff: src/liveedit.cc

Issue 23444029: Add OptimizedCodeList and DeoptimizedCodeList to native contexts. Both lists are weak. This makes i… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed final comments. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/mark-compact.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 class DependentFunctionFilter : public OptimizedFunctionFilter { 1250 static void DeoptimizeDependentFunctions(SharedFunctionInfo* function_info) {
1251 public: 1251 // Marks code that shares the same shared function info or has inlined
1252 explicit DependentFunctionFilter( 1252 // code that shares the same function info.
1253 SharedFunctionInfo* function_info) 1253 class DependentFunctionMarker: public OptimizedFunctionVisitor {
1254 : function_info_(function_info) {} 1254 public:
1255 SharedFunctionInfo* shared_info_;
1256 bool found_;
1255 1257
1256 virtual bool TakeFunction(JSFunction* function) { 1258 explicit DependentFunctionMarker(SharedFunctionInfo* shared_info)
1257 return (function->shared() == function_info_ || 1259 : shared_info_(shared_info), found_(false) { }
1258 IsInlined(function, function_info_));
1259 }
1260 1260
1261 private: 1261 virtual void EnterContext(Context* context) { } // Don't care.
1262 SharedFunctionInfo* function_info_; 1262 virtual void LeaveContext(Context* context) { } // Don't care.
1263 }; 1263 virtual void VisitFunction(JSFunction* function) {
1264 // It should be guaranteed by the iterator that everything is optimized.
1265 ASSERT(function->code()->kind() == Code::OPTIMIZED_FUNCTION);
1266 if (shared_info_ == function->shared() ||
1267 IsInlined(function, shared_info_)) {
1268 // mark the code for deoptimization
1269 function->code()->set_marked_for_deoptimization(true);
1270 found_ = true;
1271 }
1272 }
1273 };
1264 1274
1265 1275
1266 static void DeoptimizeDependentFunctions(SharedFunctionInfo* function_info) {
1267 DisallowHeapAllocation no_allocation; 1276 DisallowHeapAllocation no_allocation;
1277 DependentFunctionMarker marker(function_info);
1278 // TODO(titzer): need to traverse all optimized code to find OSR code here.
1279 Deoptimizer::VisitAllOptimizedFunctions(function_info->GetIsolate(), &marker);
1268 1280
1269 DependentFunctionFilter filter(function_info); 1281 if (marker.found_) {
1270 Deoptimizer::DeoptimizeAllFunctionsWith(function_info->GetIsolate(), &filter); 1282 // Only go through with the deoptimization if something was found.
1283 Deoptimizer::DeoptimizeMarkedCode(function_info->GetIsolate());
1284 }
1271 } 1285 }
1272 1286
1273 1287
1274 MaybeObject* LiveEdit::ReplaceFunctionCode( 1288 MaybeObject* LiveEdit::ReplaceFunctionCode(
1275 Handle<JSArray> new_compile_info_array, 1289 Handle<JSArray> new_compile_info_array,
1276 Handle<JSArray> shared_info_array) { 1290 Handle<JSArray> shared_info_array) {
1277 Isolate* isolate = new_compile_info_array->GetIsolate(); 1291 Isolate* isolate = new_compile_info_array->GetIsolate();
1278 HandleScope scope(isolate); 1292 HandleScope scope(isolate);
1279 1293
1280 if (!SharedInfoWrapper::IsInstance(shared_info_array)) { 1294 if (!SharedInfoWrapper::IsInstance(shared_info_array)) {
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
2138 2152
2139 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { 2153 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) {
2140 return false; 2154 return false;
2141 } 2155 }
2142 2156
2143 #endif // ENABLE_DEBUGGER_SUPPORT 2157 #endif // ENABLE_DEBUGGER_SUPPORT
2144 2158
2145 2159
2146 2160
2147 } } // namespace v8::internal 2161 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/mark-compact.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698