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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 // the values eagerly. | 247 // the values eagerly. |
248 | 248 |
249 class TranslatedState { | 249 class TranslatedState { |
250 public: | 250 public: |
251 TranslatedState(); | 251 TranslatedState(); |
252 explicit TranslatedState(JavaScriptFrame* frame); | 252 explicit TranslatedState(JavaScriptFrame* frame); |
253 | 253 |
254 void Prepare(bool has_adapted_arguments, Address stack_frame_pointer); | 254 void Prepare(bool has_adapted_arguments, Address stack_frame_pointer); |
255 | 255 |
256 // Store newly materialized values into the isolate. | 256 // Store newly materialized values into the isolate. |
257 void StoreMaterializedValuesAndDeopt(); | 257 void StoreMaterializedValuesAndDeopt(JavaScriptFrame* frame); |
258 | 258 |
259 typedef std::vector<TranslatedFrame>::iterator iterator; | 259 typedef std::vector<TranslatedFrame>::iterator iterator; |
260 iterator begin() { return frames_.begin(); } | 260 iterator begin() { return frames_.begin(); } |
261 iterator end() { return frames_.end(); } | 261 iterator end() { return frames_.end(); } |
262 | 262 |
263 typedef std::vector<TranslatedFrame>::const_iterator const_iterator; | 263 typedef std::vector<TranslatedFrame>::const_iterator const_iterator; |
264 const_iterator begin() const { return frames_.begin(); } | 264 const_iterator begin() const { return frames_.begin(); } |
265 const_iterator end() const { return frames_.end(); } | 265 const_iterator end() const { return frames_.end(); } |
266 | 266 |
267 std::vector<TranslatedFrame>& frames() { return frames_; } | 267 std::vector<TranslatedFrame>& frames() { return frames_; } |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 | 412 |
413 // Makes sure that there is enough room in the relocation | 413 // Makes sure that there is enough room in the relocation |
414 // information of a code object to perform lazy deoptimization | 414 // information of a code object to perform lazy deoptimization |
415 // patching. If there is not enough room a new relocation | 415 // patching. If there is not enough room a new relocation |
416 // information object is allocated and comments are added until it | 416 // information object is allocated and comments are added until it |
417 // is big enough. | 417 // is big enough. |
418 static void EnsureRelocSpaceForLazyDeoptimization(Handle<Code> code); | 418 static void EnsureRelocSpaceForLazyDeoptimization(Handle<Code> code); |
419 | 419 |
420 // Deoptimize the function now. Its current optimized code will never be run | 420 // Deoptimize the function now. Its current optimized code will never be run |
421 // again and any activations of the optimized code will get deoptimized when | 421 // again and any activations of the optimized code will get deoptimized when |
422 // execution returns. | 422 // execution returns. If {code} is specified then the given code is targeted |
423 static void DeoptimizeFunction(JSFunction* function); | 423 // instead of the function code (e.g. OSR code not installed on function). |
| 424 static void DeoptimizeFunction(JSFunction* function, Code* code = nullptr); |
424 | 425 |
425 // Deoptimize all code in the given isolate. | 426 // Deoptimize all code in the given isolate. |
426 static void DeoptimizeAll(Isolate* isolate); | 427 static void DeoptimizeAll(Isolate* isolate); |
427 | 428 |
428 // Deoptimizes all optimized code that has been previously marked | 429 // Deoptimizes all optimized code that has been previously marked |
429 // (via code->set_marked_for_deoptimization) and unlinks all functions that | 430 // (via code->set_marked_for_deoptimization) and unlinks all functions that |
430 // refer to that code. | 431 // refer to that code. |
431 static void DeoptimizeMarkedCode(Isolate* isolate); | 432 static void DeoptimizeMarkedCode(Isolate* isolate); |
432 | 433 |
433 // Visit all the known optimized functions in a given isolate. | 434 // Visit all the known optimized functions in a given isolate. |
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 std::vector<Handle<Object> > expression_stack_; | 1056 std::vector<Handle<Object> > expression_stack_; |
1056 int source_position_; | 1057 int source_position_; |
1057 | 1058 |
1058 friend class Deoptimizer; | 1059 friend class Deoptimizer; |
1059 }; | 1060 }; |
1060 | 1061 |
1061 } // namespace internal | 1062 } // namespace internal |
1062 } // namespace v8 | 1063 } // namespace v8 |
1063 | 1064 |
1064 #endif // V8_DEOPTIMIZER_H_ | 1065 #endif // V8_DEOPTIMIZER_H_ |
OLD | NEW |