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

Side by Side Diff: src/liveedit.cc

Issue 11547015: Use a filter instead of a visitor to deoptimize selected functions in a context. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years 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 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 int inlined_count = data->InlinedFunctionCount()->value(); 1216 int inlined_count = data->InlinedFunctionCount()->value();
1217 for (int i = 0; i < inlined_count; ++i) { 1217 for (int i = 0; i < inlined_count; ++i) {
1218 JSFunction* inlined = JSFunction::cast(literals->get(i)); 1218 JSFunction* inlined = JSFunction::cast(literals->get(i));
1219 if (inlined->shared() == candidate) return true; 1219 if (inlined->shared() == candidate) return true;
1220 } 1220 }
1221 1221
1222 return false; 1222 return false;
1223 } 1223 }
1224 1224
1225 1225
1226 class DependentFunctionsDeoptimizingVisitor : public OptimizedFunctionVisitor { 1226 class DependentFunctionFilter : public OptimizedFunctionFilter {
1227 public: 1227 public:
1228 explicit DependentFunctionsDeoptimizingVisitor( 1228 explicit DependentFunctionFilter(
1229 SharedFunctionInfo* function_info) 1229 SharedFunctionInfo* function_info)
1230 : function_info_(function_info) {} 1230 : function_info_(function_info) {}
1231 1231
1232 virtual void EnterContext(Context* context) { 1232 virtual bool TakeFunction(JSFunction* function) {
1233 } 1233 return (function->shared() == function_info_ ||
1234 1234 IsInlined(function, function_info_));
1235 virtual void VisitFunction(JSFunction* function) {
1236 if (function->shared() == function_info_ ||
1237 IsInlined(function, function_info_)) {
1238 Deoptimizer::DeoptimizeFunction(function);
1239 }
1240 }
1241
1242 virtual void LeaveContext(Context* context) {
1243 } 1235 }
1244 1236
1245 private: 1237 private:
1246 SharedFunctionInfo* function_info_; 1238 SharedFunctionInfo* function_info_;
1247 }; 1239 };
1248 1240
1249 1241
1250 static void DeoptimizeDependentFunctions(SharedFunctionInfo* function_info) { 1242 static void DeoptimizeDependentFunctions(SharedFunctionInfo* function_info) {
1251 AssertNoAllocation no_allocation; 1243 AssertNoAllocation no_allocation;
1252 1244
1253 DependentFunctionsDeoptimizingVisitor visitor(function_info); 1245 DependentFunctionFilter filter(function_info);
1254 Deoptimizer::VisitAllOptimizedFunctions(&visitor); 1246 Deoptimizer::DeoptimizeAllFunctionsWith(&filter);
1255 } 1247 }
1256 1248
1257 1249
1258 MaybeObject* LiveEdit::ReplaceFunctionCode( 1250 MaybeObject* LiveEdit::ReplaceFunctionCode(
1259 Handle<JSArray> new_compile_info_array, 1251 Handle<JSArray> new_compile_info_array,
1260 Handle<JSArray> shared_info_array) { 1252 Handle<JSArray> shared_info_array) {
1261 HandleScope scope; 1253 HandleScope scope;
1262 Isolate* isolate = Isolate::Current(); 1254 Isolate* isolate = Isolate::Current();
1263 1255
1264 if (!SharedInfoWrapper::IsInstance(shared_info_array)) { 1256 if (!SharedInfoWrapper::IsInstance(shared_info_array)) {
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
2105 2097
2106 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { 2098 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) {
2107 return false; 2099 return false;
2108 } 2100 }
2109 2101
2110 #endif // ENABLE_DEBUGGER_SUPPORT 2102 #endif // ENABLE_DEBUGGER_SUPPORT
2111 2103
2112 2104
2113 2105
2114 } } // namespace v8::internal 2106 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698