| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 115 |
| 116 class Deoptimizer; | 116 class Deoptimizer; |
| 117 | 117 |
| 118 | 118 |
| 119 class Deoptimizer : public Malloced { | 119 class Deoptimizer : public Malloced { |
| 120 public: | 120 public: |
| 121 enum BailoutType { | 121 enum BailoutType { |
| 122 EAGER, | 122 EAGER, |
| 123 LAZY, | 123 LAZY, |
| 124 SOFT, | 124 SOFT, |
| 125 OSR, | |
| 126 // This last bailout type is not really a bailout, but used by the | 125 // This last bailout type is not really a bailout, but used by the |
| 127 // debugger to deoptimize stack frames to allow inspection. | 126 // debugger to deoptimize stack frames to allow inspection. |
| 128 DEBUGGER | 127 DEBUGGER |
| 129 }; | 128 }; |
| 130 | 129 |
| 131 static const int kBailoutTypesWithCodeEntry = SOFT + 1; | 130 static const int kBailoutTypesWithCodeEntry = SOFT + 1; |
| 132 | 131 |
| 133 struct JumpTableEntry { | 132 struct JumpTableEntry { |
| 134 inline JumpTableEntry(Address entry, | 133 inline JumpTableEntry(Address entry, |
| 135 Deoptimizer::BailoutType type, | 134 Deoptimizer::BailoutType type, |
| 136 bool frame) | 135 bool frame) |
| 137 : label(), | 136 : label(), |
| 138 address(entry), | 137 address(entry), |
| 139 bailout_type(type), | 138 bailout_type(type), |
| 140 needs_frame(frame) { } | 139 needs_frame(frame) { } |
| 141 Label label; | 140 Label label; |
| 142 Address address; | 141 Address address; |
| 143 Deoptimizer::BailoutType bailout_type; | 142 Deoptimizer::BailoutType bailout_type; |
| 144 bool needs_frame; | 143 bool needs_frame; |
| 145 }; | 144 }; |
| 146 | 145 |
| 147 static bool TraceEnabledFor(BailoutType deopt_type, | 146 static bool TraceEnabledFor(BailoutType deopt_type, |
| 148 StackFrame::Type frame_type); | 147 StackFrame::Type frame_type); |
| 149 static const char* MessageFor(BailoutType type); | 148 static const char* MessageFor(BailoutType type); |
| 150 | 149 |
| 151 int output_count() const { return output_count_; } | 150 int output_count() const { return output_count_; } |
| 152 | 151 |
| 153 Code::Kind compiled_code_kind() const { return compiled_code_->kind(); } | 152 Code* compiled_code() const { return compiled_code_; } |
| 153 JSFunction* function() const { return function_; } |
| 154 | 154 |
| 155 // Number of created JS frames. Not all created frames are necessarily JS. | 155 // Number of created JS frames. Not all created frames are necessarily JS. |
| 156 int jsframe_count() const { return jsframe_count_; } | 156 int jsframe_count() const { return jsframe_count_; } |
| 157 | 157 |
| 158 static Deoptimizer* New(JSFunction* function, | 158 static Deoptimizer* New(JSFunction* function, |
| 159 BailoutType type, | 159 BailoutType type, |
| 160 unsigned bailout_id, | 160 unsigned bailout_id, |
| 161 Address from, | 161 Address from, |
| 162 int fp_to_sp_delta, | 162 int fp_to_sp_delta, |
| 163 Isolate* isolate); | 163 Isolate* isolate); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 BailoutType type, | 352 BailoutType type, |
| 353 unsigned bailout_id, | 353 unsigned bailout_id, |
| 354 Address from, | 354 Address from, |
| 355 int fp_to_sp_delta, | 355 int fp_to_sp_delta, |
| 356 Code* optimized_code); | 356 Code* optimized_code); |
| 357 Code* FindOptimizedCode(JSFunction* function, Code* optimized_code); | 357 Code* FindOptimizedCode(JSFunction* function, Code* optimized_code); |
| 358 void PrintFunctionName(); | 358 void PrintFunctionName(); |
| 359 void DeleteFrameDescriptions(); | 359 void DeleteFrameDescriptions(); |
| 360 | 360 |
| 361 void DoComputeOutputFrames(); | 361 void DoComputeOutputFrames(); |
| 362 void DoComputeOsrOutputFrame(); | |
| 363 void DoComputeJSFrame(TranslationIterator* iterator, int frame_index); | 362 void DoComputeJSFrame(TranslationIterator* iterator, int frame_index); |
| 364 void DoComputeArgumentsAdaptorFrame(TranslationIterator* iterator, | 363 void DoComputeArgumentsAdaptorFrame(TranslationIterator* iterator, |
| 365 int frame_index); | 364 int frame_index); |
| 366 void DoComputeConstructStubFrame(TranslationIterator* iterator, | 365 void DoComputeConstructStubFrame(TranslationIterator* iterator, |
| 367 int frame_index); | 366 int frame_index); |
| 368 void DoComputeAccessorStubFrame(TranslationIterator* iterator, | 367 void DoComputeAccessorStubFrame(TranslationIterator* iterator, |
| 369 int frame_index, | 368 int frame_index, |
| 370 bool is_setter_stub_frame); | 369 bool is_setter_stub_frame); |
| 371 void DoComputeCompiledStubFrame(TranslationIterator* iterator, | 370 void DoComputeCompiledStubFrame(TranslationIterator* iterator, |
| 372 int frame_index); | 371 int frame_index); |
| 373 | 372 |
| 374 void DoTranslateObject(TranslationIterator* iterator, | 373 void DoTranslateObject(TranslationIterator* iterator, |
| 375 int object_opcode, | 374 int object_opcode, |
| 376 int field_index); | 375 int field_index); |
| 377 | 376 |
| 378 enum DeoptimizerTranslatedValueType { | 377 enum DeoptimizerTranslatedValueType { |
| 379 TRANSLATED_VALUE_IS_NATIVE, | 378 TRANSLATED_VALUE_IS_NATIVE, |
| 380 TRANSLATED_VALUE_IS_TAGGED | 379 TRANSLATED_VALUE_IS_TAGGED |
| 381 }; | 380 }; |
| 382 | 381 |
| 383 void DoTranslateCommand(TranslationIterator* iterator, | 382 void DoTranslateCommand(TranslationIterator* iterator, |
| 384 int frame_index, | 383 int frame_index, |
| 385 unsigned output_offset, | 384 unsigned output_offset, |
| 386 DeoptimizerTranslatedValueType value_type = TRANSLATED_VALUE_IS_TAGGED); | 385 DeoptimizerTranslatedValueType value_type = TRANSLATED_VALUE_IS_TAGGED); |
| 387 | 386 |
| 388 // Translate a command for OSR. Updates the input offset to be used for | |
| 389 // the next command. Returns false if translation of the command failed | |
| 390 // (e.g., a number conversion failed) and may or may not have updated the | |
| 391 // input offset. | |
| 392 bool DoOsrTranslateCommand(TranslationIterator* iterator, | |
| 393 int* input_offset); | |
| 394 | |
| 395 unsigned ComputeInputFrameSize() const; | 387 unsigned ComputeInputFrameSize() const; |
| 396 unsigned ComputeFixedSize(JSFunction* function) const; | 388 unsigned ComputeFixedSize(JSFunction* function) const; |
| 397 | 389 |
| 398 unsigned ComputeIncomingArgumentSize(JSFunction* function) const; | 390 unsigned ComputeIncomingArgumentSize(JSFunction* function) const; |
| 399 unsigned ComputeOutgoingArgumentSize() const; | 391 unsigned ComputeOutgoingArgumentSize() const; |
| 400 | 392 |
| 401 Object* ComputeLiteral(int index) const; | 393 Object* ComputeLiteral(int index) const; |
| 402 | 394 |
| 403 void AddObjectStart(intptr_t slot_address, int argc); | 395 void AddObjectStart(intptr_t slot_address, int argc); |
| 404 void AddObjectTaggedValue(intptr_t value); | 396 void AddObjectTaggedValue(intptr_t value); |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 Object** expression_stack_; | 946 Object** expression_stack_; |
| 955 int source_position_; | 947 int source_position_; |
| 956 | 948 |
| 957 friend class Deoptimizer; | 949 friend class Deoptimizer; |
| 958 }; | 950 }; |
| 959 #endif | 951 #endif |
| 960 | 952 |
| 961 } } // namespace v8::internal | 953 } } // namespace v8::internal |
| 962 | 954 |
| 963 #endif // V8_DEOPTIMIZER_H_ | 955 #endif // V8_DEOPTIMIZER_H_ |
| OLD | NEW |