OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_DEOPTIMIZER_H_ | 5 #ifndef V8_DEOPTIMIZER_H_ |
6 #define V8_DEOPTIMIZER_H_ | 6 #define V8_DEOPTIMIZER_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/deoptimize-reason.h" | 9 #include "src/deoptimize-reason.h" |
10 #include "src/macro-assembler.h" | 10 #include "src/macro-assembler.h" |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 int frame_index_; | 346 int frame_index_; |
347 int value_index_; | 347 int value_index_; |
348 }; | 348 }; |
349 std::deque<ObjectPosition> object_positions_; | 349 std::deque<ObjectPosition> object_positions_; |
350 }; | 350 }; |
351 | 351 |
352 | 352 |
353 class OptimizedFunctionVisitor BASE_EMBEDDED { | 353 class OptimizedFunctionVisitor BASE_EMBEDDED { |
354 public: | 354 public: |
355 virtual ~OptimizedFunctionVisitor() {} | 355 virtual ~OptimizedFunctionVisitor() {} |
356 | |
357 // Function which is called before iteration of any optimized functions | |
358 // from given native context. | |
359 virtual void EnterContext(Context* context) = 0; | |
360 | |
361 virtual void VisitFunction(JSFunction* function) = 0; | 356 virtual void VisitFunction(JSFunction* function) = 0; |
362 | |
363 // Function which is called after iteration of all optimized functions | |
364 // from given native context. | |
365 virtual void LeaveContext(Context* context) = 0; | |
366 }; | 357 }; |
367 | 358 |
368 class Deoptimizer : public Malloced { | 359 class Deoptimizer : public Malloced { |
369 public: | 360 public: |
370 enum BailoutType { EAGER, LAZY, SOFT, kLastBailoutType = SOFT }; | 361 enum BailoutType { EAGER, LAZY, SOFT, kLastBailoutType = SOFT }; |
371 | 362 |
372 enum class BailoutState { | 363 enum class BailoutState { |
373 NO_REGISTERS, | 364 NO_REGISTERS, |
374 TOS_REGISTER, | 365 TOS_REGISTER, |
375 }; | 366 }; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 | 460 |
470 // Deoptimizes all optimized code that has been previously marked | 461 // Deoptimizes all optimized code that has been previously marked |
471 // (via code->set_marked_for_deoptimization) and unlinks all functions that | 462 // (via code->set_marked_for_deoptimization) and unlinks all functions that |
472 // refer to that code. | 463 // refer to that code. |
473 static void DeoptimizeMarkedCode(Isolate* isolate); | 464 static void DeoptimizeMarkedCode(Isolate* isolate); |
474 | 465 |
475 // Visit all the known optimized functions in a given isolate. | 466 // Visit all the known optimized functions in a given isolate. |
476 static void VisitAllOptimizedFunctions( | 467 static void VisitAllOptimizedFunctions( |
477 Isolate* isolate, OptimizedFunctionVisitor* visitor); | 468 Isolate* isolate, OptimizedFunctionVisitor* visitor); |
478 | 469 |
| 470 static void UnlinkOptimizedCode(Code* code, Context* native_context); |
| 471 |
479 // The size in bytes of the code required at a lazy deopt patch site. | 472 // The size in bytes of the code required at a lazy deopt patch site. |
480 static int patch_size(); | 473 static int patch_size(); |
481 | 474 |
482 ~Deoptimizer(); | 475 ~Deoptimizer(); |
483 | 476 |
484 void MaterializeHeapObjects(JavaScriptFrameIterator* it); | 477 void MaterializeHeapObjects(JavaScriptFrameIterator* it); |
485 | 478 |
486 static void ComputeOutputFrames(Deoptimizer* deoptimizer); | 479 static void ComputeOutputFrames(Deoptimizer* deoptimizer); |
487 | 480 |
488 | 481 |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 std::vector<Handle<Object> > expression_stack_; | 1100 std::vector<Handle<Object> > expression_stack_; |
1108 int source_position_; | 1101 int source_position_; |
1109 | 1102 |
1110 friend class Deoptimizer; | 1103 friend class Deoptimizer; |
1111 }; | 1104 }; |
1112 | 1105 |
1113 } // namespace internal | 1106 } // namespace internal |
1114 } // namespace v8 | 1107 } // namespace v8 |
1115 | 1108 |
1116 #endif // V8_DEOPTIMIZER_H_ | 1109 #endif // V8_DEOPTIMIZER_H_ |
OLD | NEW |