| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 public: | 124 public: |
| 125 enum BailoutType { | 125 enum BailoutType { |
| 126 EAGER, | 126 EAGER, |
| 127 LAZY, | 127 LAZY, |
| 128 SOFT, | 128 SOFT, |
| 129 // This last bailout type is not really a bailout, but used by the | 129 // This last bailout type is not really a bailout, but used by the |
| 130 // debugger to deoptimize stack frames to allow inspection. | 130 // debugger to deoptimize stack frames to allow inspection. |
| 131 DEBUGGER | 131 DEBUGGER |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 enum InterruptPatchState { | |
| 135 NOT_PATCHED, | |
| 136 PATCHED_FOR_OSR | |
| 137 }; | |
| 138 | |
| 139 static const int kBailoutTypesWithCodeEntry = SOFT + 1; | 134 static const int kBailoutTypesWithCodeEntry = SOFT + 1; |
| 140 | 135 |
| 141 struct JumpTableEntry { | 136 struct JumpTableEntry { |
| 142 inline JumpTableEntry(Address entry, | 137 inline JumpTableEntry(Address entry, |
| 143 Deoptimizer::BailoutType type, | 138 Deoptimizer::BailoutType type, |
| 144 bool frame) | 139 bool frame) |
| 145 : label(), | 140 : label(), |
| 146 address(entry), | 141 address(entry), |
| 147 bailout_type(type), | 142 bailout_type(type), |
| 148 needs_frame(frame) { } | 143 needs_frame(frame) { } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 // refer to that code. | 201 // refer to that code. |
| 207 static void DeoptimizeMarkedCode(Isolate* isolate); | 202 static void DeoptimizeMarkedCode(Isolate* isolate); |
| 208 | 203 |
| 209 // Visit all the known optimized functions in a given isolate. | 204 // Visit all the known optimized functions in a given isolate. |
| 210 static void VisitAllOptimizedFunctions( | 205 static void VisitAllOptimizedFunctions( |
| 211 Isolate* isolate, OptimizedFunctionVisitor* visitor); | 206 Isolate* isolate, OptimizedFunctionVisitor* visitor); |
| 212 | 207 |
| 213 // The size in bytes of the code required at a lazy deopt patch site. | 208 // The size in bytes of the code required at a lazy deopt patch site. |
| 214 static int patch_size(); | 209 static int patch_size(); |
| 215 | 210 |
| 216 // Patch all interrupts with allowed loop depth in the unoptimized code to | |
| 217 // unconditionally call replacement_code. | |
| 218 static void PatchInterruptCode(Isolate* isolate, | |
| 219 Code* unoptimized_code); | |
| 220 | |
| 221 // Patch the interrupt at the instruction before pc_after in | |
| 222 // the unoptimized code to unconditionally call replacement_code. | |
| 223 static void PatchInterruptCodeAt(Code* unoptimized_code, | |
| 224 Address pc_after, | |
| 225 Code* replacement_code); | |
| 226 | |
| 227 // Change all patched interrupts patched in the unoptimized code | |
| 228 // back to normal interrupts. | |
| 229 static void RevertInterruptCode(Isolate* isolate, | |
| 230 Code* unoptimized_code); | |
| 231 | |
| 232 // Change patched interrupt in the unoptimized code | |
| 233 // back to a normal interrupt. | |
| 234 static void RevertInterruptCodeAt(Code* unoptimized_code, | |
| 235 Address pc_after, | |
| 236 Code* interrupt_code); | |
| 237 | |
| 238 #ifdef DEBUG | |
| 239 static InterruptPatchState GetInterruptPatchState(Isolate* isolate, | |
| 240 Code* unoptimized_code, | |
| 241 Address pc_after); | |
| 242 | |
| 243 // Verify that all back edges of a certain loop depth are patched. | |
| 244 static bool VerifyInterruptCode(Isolate* isolate, | |
| 245 Code* unoptimized_code, | |
| 246 int loop_nesting_level); | |
| 247 #endif // DEBUG | |
| 248 | |
| 249 ~Deoptimizer(); | 211 ~Deoptimizer(); |
| 250 | 212 |
| 251 void MaterializeHeapObjects(JavaScriptFrameIterator* it); | 213 void MaterializeHeapObjects(JavaScriptFrameIterator* it); |
| 252 #ifdef ENABLE_DEBUGGER_SUPPORT | 214 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 253 void MaterializeHeapNumbersForDebuggerInspectableFrame( | 215 void MaterializeHeapNumbersForDebuggerInspectableFrame( |
| 254 Address parameters_top, | 216 Address parameters_top, |
| 255 uint32_t parameters_size, | 217 uint32_t parameters_size, |
| 256 Address expressions_top, | 218 Address expressions_top, |
| 257 uint32_t expressions_size, | 219 uint32_t expressions_size, |
| 258 DeoptimizedFrameInfo* info); | 220 DeoptimizedFrameInfo* info); |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 953 Object** expression_stack_; | 915 Object** expression_stack_; |
| 954 int source_position_; | 916 int source_position_; |
| 955 | 917 |
| 956 friend class Deoptimizer; | 918 friend class Deoptimizer; |
| 957 }; | 919 }; |
| 958 #endif | 920 #endif |
| 959 | 921 |
| 960 } } // namespace v8::internal | 922 } } // namespace v8::internal |
| 961 | 923 |
| 962 #endif // V8_DEOPTIMIZER_H_ | 924 #endif // V8_DEOPTIMIZER_H_ |
| OLD | NEW |