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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 enum BailoutType { | 137 enum BailoutType { |
| 138 EAGER, | 138 EAGER, |
| 139 LAZY, | 139 LAZY, |
| 140 SOFT, | 140 SOFT, |
| 141 OSR, | 141 OSR, |
| 142 // This last bailout type is not really a bailout, but used by the | 142 // This last bailout type is not really a bailout, but used by the |
| 143 // debugger to deoptimize stack frames to allow inspection. | 143 // debugger to deoptimize stack frames to allow inspection. |
| 144 DEBUGGER | 144 DEBUGGER |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 enum InterruptPatchState { | |
| 148 NOT_PATCHED, | |
| 149 PATCHED_FOR_OSR | |
| 150 }; | |
| 151 | |
| 147 static const int kBailoutTypesWithCodeEntry = SOFT + 1; | 152 static const int kBailoutTypesWithCodeEntry = SOFT + 1; |
| 148 | 153 |
| 149 struct JumpTableEntry { | 154 struct JumpTableEntry { |
| 150 inline JumpTableEntry(Address entry, | 155 inline JumpTableEntry(Address entry, |
| 151 Deoptimizer::BailoutType type, | 156 Deoptimizer::BailoutType type, |
| 152 bool frame) | 157 bool frame) |
| 153 : label(), | 158 : label(), |
| 154 address(entry), | 159 address(entry), |
| 155 bailout_type(type), | 160 bailout_type(type), |
| 156 needs_frame(frame) { } | 161 needs_frame(frame) { } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 224 Context* context, OptimizedFunctionVisitor* visitor); | 229 Context* context, OptimizedFunctionVisitor* visitor); |
| 225 | 230 |
| 226 static void VisitAllOptimizedFunctions(Isolate* isolate, | 231 static void VisitAllOptimizedFunctions(Isolate* isolate, |
| 227 OptimizedFunctionVisitor* visitor); | 232 OptimizedFunctionVisitor* visitor); |
| 228 | 233 |
| 229 // The size in bytes of the code required at a lazy deopt patch site. | 234 // The size in bytes of the code required at a lazy deopt patch site. |
| 230 static int patch_size(); | 235 static int patch_size(); |
| 231 | 236 |
| 232 // Patch all interrupts with allowed loop depth in the unoptimized code to | 237 // Patch all interrupts with allowed loop depth in the unoptimized code to |
| 233 // unconditionally call replacement_code. | 238 // unconditionally call replacement_code. |
| 234 static void PatchInterruptCode(Code* unoptimized_code, | 239 static void PatchInterruptCode(Isolate* isolate, |
| 235 Code* interrupt_code, | 240 Code* unoptimized_code); |
| 236 Code* replacement_code); | |
| 237 | 241 |
| 238 // Patch the interrupt at the instruction before pc_after in | 242 // Patch the interrupt at the instruction before pc_after in |
| 239 // the unoptimized code to unconditionally call replacement_code. | 243 // the unoptimized code to unconditionally call replacement_code. |
| 240 static void PatchInterruptCodeAt(Code* unoptimized_code, | 244 static void PatchInterruptCodeAt(Code* unoptimized_code, |
| 241 Address pc_after, | 245 Address pc_after, |
| 242 Code* interrupt_code, | |
| 243 Code* replacement_code); | 246 Code* replacement_code); |
| 244 | 247 |
| 245 // Change all patched interrupts patched in the unoptimized code | 248 // Change all patched interrupts patched in the unoptimized code |
| 246 // back to normal interrupts. | 249 // back to normal interrupts. |
| 247 static void RevertInterruptCode(Code* unoptimized_code, | 250 static void RevertInterruptCode(Isolate* isolate, |
| 248 Code* interrupt_code, | 251 Code* unoptimized_code); |
| 249 Code* replacement_code); | |
| 250 | 252 |
| 251 // Change patched interrupt in the unoptimized code | 253 // Change patched interrupt in the unoptimized code |
| 252 // back to a normal interrupt. | 254 // back to a normal interrupt. |
| 253 static void RevertInterruptCodeAt(Code* unoptimized_code, | 255 static void RevertInterruptCodeAt(Code* unoptimized_code, |
| 254 Address pc_after, | 256 Address pc_after, |
| 255 Code* interrupt_code, | 257 Code* interrupt_code); |
| 256 Code* replacement_code); | |
| 257 | 258 |
| 258 #ifdef DEBUG | 259 #ifdef DEBUG |
| 259 static bool InterruptCodeIsPatched(Code* unoptimized_code, | 260 static InterruptPatchState GetInterruptPatchState(Isolate* isolate, |
| 260 Address pc_after, | 261 Code* unoptimized_code, |
| 261 Code* interrupt_code, | 262 Address pc_after); |
| 262 Code* replacement_code); | |
| 263 | 263 |
| 264 // Verify that all back edges of a certain loop depth are patched. | 264 // Verify that all back edges of a certain loop depth are patched. |
| 265 static void VerifyInterruptCode(Code* unoptimized_code, | 265 static void VerifyInterruptCode(Isolate* isolate, |
|
titzer
2013/08/28 12:32:55
Maybe this should take a patch state to check agai
Yang
2013/08/28 12:41:58
Again, this was with the assumption that we want t
| |
| 266 Code* interrupt_code, | 266 Code* unoptimized_code, |
| 267 Code* replacement_code, | |
| 268 int loop_nesting_level); | 267 int loop_nesting_level); |
| 269 #endif // DEBUG | 268 #endif // DEBUG |
| 270 | 269 |
| 271 ~Deoptimizer(); | 270 ~Deoptimizer(); |
| 272 | 271 |
| 273 void MaterializeHeapObjects(JavaScriptFrameIterator* it); | 272 void MaterializeHeapObjects(JavaScriptFrameIterator* it); |
| 274 #ifdef ENABLE_DEBUGGER_SUPPORT | 273 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 275 void MaterializeHeapNumbersForDebuggerInspectableFrame( | 274 void MaterializeHeapNumbersForDebuggerInspectableFrame( |
| 276 Address parameters_top, | 275 Address parameters_top, |
| 277 uint32_t parameters_size, | 276 uint32_t parameters_size, |
| (...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1005 Object** expression_stack_; | 1004 Object** expression_stack_; |
| 1006 int source_position_; | 1005 int source_position_; |
| 1007 | 1006 |
| 1008 friend class Deoptimizer; | 1007 friend class Deoptimizer; |
| 1009 }; | 1008 }; |
| 1010 #endif | 1009 #endif |
| 1011 | 1010 |
| 1012 } } // namespace v8::internal | 1011 } } // namespace v8::internal |
| 1013 | 1012 |
| 1014 #endif // V8_DEOPTIMIZER_H_ | 1013 #endif // V8_DEOPTIMIZER_H_ |
| OLD | NEW |