Chromium Code Reviews| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 virtual void EnterContext(Context* context) = 0; | 80 virtual void EnterContext(Context* context) = 0; |
| 81 | 81 |
| 82 virtual void VisitFunction(JSFunction* function) = 0; | 82 virtual void VisitFunction(JSFunction* function) = 0; |
| 83 | 83 |
| 84 // Function which is called after iteration of all optimized functions | 84 // Function which is called after iteration of all optimized functions |
| 85 // from given native context. | 85 // from given native context. |
| 86 virtual void LeaveContext(Context* context) = 0; | 86 virtual void LeaveContext(Context* context) = 0; |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 | 89 |
| 90 class OptimizedFunctionFilter BASE_EMBEDDED { | |
|
Sven Panne
2012/12/12 14:31:48
This is what is commonly called a predicate (even
Michael Starzinger
2012/12/12 14:39:42
I am fine with both solutions (a templetized filte
ulan_google
2012/12/12 15:00:46
After offline discussion, I am leaving this as it
| |
| 91 public: | |
| 92 virtual ~OptimizedFunctionFilter() {} | |
| 93 | |
| 94 virtual bool TakeFunction(JSFunction* function) = 0; | |
| 95 }; | |
| 96 | |
| 97 | |
| 90 class Deoptimizer; | 98 class Deoptimizer; |
| 91 | 99 |
| 92 | 100 |
| 93 class DeoptimizerData { | 101 class DeoptimizerData { |
| 94 public: | 102 public: |
| 95 DeoptimizerData(); | 103 DeoptimizerData(); |
| 96 ~DeoptimizerData(); | 104 ~DeoptimizerData(); |
| 97 | 105 |
| 98 #ifdef ENABLE_DEBUGGER_SUPPORT | 106 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 99 void Iterate(ObjectVisitor* v); | 107 void Iterate(ObjectVisitor* v); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 | 178 |
| 171 // Iterate over all the functions which share the same code object | 179 // Iterate over all the functions which share the same code object |
| 172 // and make them use unoptimized version. | 180 // and make them use unoptimized version. |
| 173 static void ReplaceCodeForRelatedFunctions(JSFunction* function, Code* code); | 181 static void ReplaceCodeForRelatedFunctions(JSFunction* function, Code* code); |
| 174 | 182 |
| 175 // Deoptimize all functions in the heap. | 183 // Deoptimize all functions in the heap. |
| 176 static void DeoptimizeAll(); | 184 static void DeoptimizeAll(); |
| 177 | 185 |
| 178 static void DeoptimizeGlobalObject(JSObject* object); | 186 static void DeoptimizeGlobalObject(JSObject* object); |
| 179 | 187 |
| 188 static void DeoptimizeAllFunctionsWith(OptimizedFunctionFilter* filter); | |
| 189 | |
| 190 static void DeoptimizeAllFunctionsForContext( | |
| 191 Context* context, OptimizedFunctionFilter* filter); | |
| 192 | |
| 180 static void VisitAllOptimizedFunctionsForContext( | 193 static void VisitAllOptimizedFunctionsForContext( |
| 181 Context* context, OptimizedFunctionVisitor* visitor); | 194 Context* context, OptimizedFunctionVisitor* visitor); |
| 182 | 195 |
| 183 static void VisitAllOptimizedFunctionsForGlobalObject( | |
| 184 JSObject* object, OptimizedFunctionVisitor* visitor); | |
| 185 | |
| 186 static void VisitAllOptimizedFunctions(OptimizedFunctionVisitor* visitor); | 196 static void VisitAllOptimizedFunctions(OptimizedFunctionVisitor* visitor); |
| 187 | 197 |
| 188 // The size in bytes of the code required at a lazy deopt patch site. | 198 // The size in bytes of the code required at a lazy deopt patch site. |
| 189 static int patch_size(); | 199 static int patch_size(); |
| 190 | 200 |
| 191 // Patch all stack guard checks in the unoptimized code to | 201 // Patch all stack guard checks in the unoptimized code to |
| 192 // unconditionally call replacement_code. | 202 // unconditionally call replacement_code. |
| 193 static void PatchStackCheckCode(Code* unoptimized_code, | 203 static void PatchStackCheckCode(Code* unoptimized_code, |
| 194 Code* check_code, | 204 Code* check_code, |
| 195 Code* replacement_code); | 205 Code* replacement_code); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 346 int max_entry_id); | 356 int max_entry_id); |
| 347 static void GenerateDeoptimizationEntries( | 357 static void GenerateDeoptimizationEntries( |
| 348 MacroAssembler* masm, int count, BailoutType type); | 358 MacroAssembler* masm, int count, BailoutType type); |
| 349 | 359 |
| 350 // Weak handle callback for deoptimizing code objects. | 360 // Weak handle callback for deoptimizing code objects. |
| 351 static void HandleWeakDeoptimizedCode( | 361 static void HandleWeakDeoptimizedCode( |
| 352 v8::Persistent<v8::Value> obj, void* data); | 362 v8::Persistent<v8::Value> obj, void* data); |
| 353 static Code* FindDeoptimizingCodeFromAddress(Address addr); | 363 static Code* FindDeoptimizingCodeFromAddress(Address addr); |
| 354 static void RemoveDeoptimizingCode(Code* code); | 364 static void RemoveDeoptimizingCode(Code* code); |
| 355 | 365 |
| 366 // Deoptimize function assuming that function->next_function_link() points | |
| 367 // to a list that contains all functions that share the same optimized code. | |
| 368 static void DeoptimizeFunctionWithPreparedFunctionList(JSFunction* function); | |
| 369 | |
| 356 // Fill the input from from a JavaScript frame. This is used when | 370 // Fill the input from from a JavaScript frame. This is used when |
| 357 // the debugger needs to inspect an optimized frame. For normal | 371 // the debugger needs to inspect an optimized frame. For normal |
| 358 // deoptimizations the input frame is filled in generated code. | 372 // deoptimizations the input frame is filled in generated code. |
| 359 void FillInputFrame(Address tos, JavaScriptFrame* frame); | 373 void FillInputFrame(Address tos, JavaScriptFrame* frame); |
| 360 | 374 |
| 361 Isolate* isolate_; | 375 Isolate* isolate_; |
| 362 JSFunction* function_; | 376 JSFunction* function_; |
| 363 Code* optimized_code_; | 377 Code* optimized_code_; |
| 364 unsigned bailout_id_; | 378 unsigned bailout_id_; |
| 365 BailoutType bailout_type_; | 379 BailoutType bailout_type_; |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 846 Object** expression_stack_; | 860 Object** expression_stack_; |
| 847 int source_position_; | 861 int source_position_; |
| 848 | 862 |
| 849 friend class Deoptimizer; | 863 friend class Deoptimizer; |
| 850 }; | 864 }; |
| 851 #endif | 865 #endif |
| 852 | 866 |
| 853 } } // namespace v8::internal | 867 } } // namespace v8::internal |
| 854 | 868 |
| 855 #endif // V8_DEOPTIMIZER_H_ | 869 #endif // V8_DEOPTIMIZER_H_ |
| OLD | NEW |