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

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: 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
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 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 int inlined_count = data->InlinedFunctionCount()->value(); 1235 int inlined_count = data->InlinedFunctionCount()->value();
1236 for (int i = 0; i < inlined_count; ++i) { 1236 for (int i = 0; i < inlined_count; ++i) {
1237 JSFunction* inlined = JSFunction::cast(literals->get(i)); 1237 JSFunction* inlined = JSFunction::cast(literals->get(i));
1238 if (inlined->shared() == candidate) return true; 1238 if (inlined->shared() == candidate) return true;
1239 } 1239 }
1240 1240
1241 return false; 1241 return false;
1242 } 1242 }
1243 1243
1244 1244
1245 class DependentFunctionFilter : public OptimizedFunctionFilter { 1245 static void DeoptimizeDependentFunctions(SharedFunctionInfo* function_info) {
1246 public: 1246 // Marks code that shares the same shared function info or has inlined
1247 explicit DependentFunctionFilter( 1247 // code that shares the same function info.
1248 SharedFunctionInfo* function_info) 1248 class DependentFunctionMarker: public OptimizedFunctionVisitor {
1249 : function_info_(function_info) {} 1249 public:
1250 SharedFunctionInfo* shared_info_;
1251 bool found_;
1250 1252
1251 virtual bool TakeFunction(JSFunction* function) { 1253 explicit DependentFunctionMarker(SharedFunctionInfo* shared_info)
1252 return (function->shared() == function_info_ || 1254 : shared_info_(shared_info), found_(false) { }
1253 IsInlined(function, function_info_));
1254 }
1255 1255
1256 private: 1256 virtual void EnterContext(Context* context) { } // Don't care.
1257 SharedFunctionInfo* function_info_; 1257 virtual void LeaveContext(Context* context) { } // Don't care.
1258 }; 1258 virtual void VisitFunction(JSFunction* function) {
1259 // It should be guaranteed by the iterator that everything is optimized.
1260 ASSERT(function->code()->kind() == Code::OPTIMIZED_FUNCTION);
1261 if (shared_info_ == function->shared() ||
1262 IsInlined(function, shared_info_)) {
1263 // mark the code for deoptimization
1264 function->code()->set_marked_for_deoptimization(true);
1265 found_ = true;
1266 }
1267 }
1268 };
1259 1269
1260 1270
1261 static void DeoptimizeDependentFunctions(SharedFunctionInfo* function_info) {
1262 DisallowHeapAllocation no_allocation; 1271 DisallowHeapAllocation no_allocation;
1272 DependentFunctionMarker marker(function_info);
1273 // TODO(titzer): need to traverse all optimized code to find OSR code here.
1274 Deoptimizer::VisitAllOptimizedFunctions(function_info->GetIsolate(), &marker);
1263 1275
1264 DependentFunctionFilter filter(function_info); 1276 if (marker.found_) {
1265 Deoptimizer::DeoptimizeAllFunctionsWith(function_info->GetIsolate(), &filter); 1277 // Only go through with the deoptimization if something was found.
1278 Deoptimizer::DeoptimizeMarkedCode(function_info->GetIsolate());
1279 }
1266 } 1280 }
1267 1281
1268 1282
1269 MaybeObject* LiveEdit::ReplaceFunctionCode( 1283 MaybeObject* LiveEdit::ReplaceFunctionCode(
1270 Handle<JSArray> new_compile_info_array, 1284 Handle<JSArray> new_compile_info_array,
1271 Handle<JSArray> shared_info_array) { 1285 Handle<JSArray> shared_info_array) {
1272 Isolate* isolate = Isolate::Current(); 1286 Isolate* isolate = Isolate::Current();
1273 HandleScope scope(isolate); 1287 HandleScope scope(isolate);
1274 1288
1275 if (!SharedInfoWrapper::IsInstance(shared_info_array)) { 1289 if (!SharedInfoWrapper::IsInstance(shared_info_array)) {
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
2128 2142
2129 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { 2143 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) {
2130 return false; 2144 return false;
2131 } 2145 }
2132 2146
2133 #endif // ENABLE_DEBUGGER_SUPPORT 2147 #endif // ENABLE_DEBUGGER_SUPPORT
2134 2148
2135 2149
2136 2150
2137 } } // namespace v8::internal 2151 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698