| 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/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| 11 #include "src/macro-assembler.h" | 11 #include "src/macro-assembler.h" |
| 12 | 12 |
| 13 | 13 |
| 14 namespace v8 { | 14 namespace v8 { |
| 15 namespace internal { | 15 namespace internal { |
| 16 | 16 |
| 17 class FrameDescription; | 17 class FrameDescription; |
| 18 class TranslationIterator; | 18 class TranslationIterator; |
| 19 class DeoptimizedFrameInfo; | 19 class DeoptimizedFrameInfo; |
| 20 class TranslatedState; | 20 class TranslatedState; |
| 21 class RegisterValues; | 21 class RegisterValues; |
| 22 | 22 |
| 23 class TranslatedValue BASE_EMBEDDED { | 23 class TranslatedValue { |
| 24 public: | 24 public: |
| 25 // Allocation-less getter of the value. | 25 // Allocation-less getter of the value. |
| 26 // Returns heap()->arguments_marker() if allocation would be | 26 // Returns heap()->arguments_marker() if allocation would be |
| 27 // necessary to get the value. | 27 // necessary to get the value. |
| 28 Object* GetRawValue() const; | 28 Object* GetRawValue() const; |
| 29 Handle<Object> GetValue(); | 29 Handle<Object> GetValue(); |
| 30 | 30 |
| 31 bool IsMaterializedObject() const; | 31 bool IsMaterializedObject() const; |
| 32 | 32 |
| 33 private: | 33 private: |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 Address stack_frame_pointer_; | 287 Address stack_frame_pointer_; |
| 288 bool has_adapted_arguments_; | 288 bool has_adapted_arguments_; |
| 289 | 289 |
| 290 struct ObjectPosition { | 290 struct ObjectPosition { |
| 291 int frame_index_; | 291 int frame_index_; |
| 292 int value_index_; | 292 int value_index_; |
| 293 }; | 293 }; |
| 294 std::deque<ObjectPosition> object_positions_; | 294 std::deque<ObjectPosition> object_positions_; |
| 295 }; | 295 }; |
| 296 | 296 |
| 297 template<typename T> | |
| 298 class HeapNumberMaterializationDescriptor BASE_EMBEDDED { | |
| 299 public: | |
| 300 HeapNumberMaterializationDescriptor(T destination, double value) | |
| 301 : destination_(destination), value_(value) { } | |
| 302 | |
| 303 T destination() const { return destination_; } | |
| 304 double value() const { return value_; } | |
| 305 | |
| 306 private: | |
| 307 T destination_; | |
| 308 double value_; | |
| 309 }; | |
| 310 | |
| 311 | |
| 312 class ObjectMaterializationDescriptor BASE_EMBEDDED { | |
| 313 public: | |
| 314 ObjectMaterializationDescriptor( | |
| 315 Address slot_address, int frame, int length, int duplicate, bool is_args) | |
| 316 : slot_address_(slot_address), | |
| 317 jsframe_index_(frame), | |
| 318 object_length_(length), | |
| 319 duplicate_object_(duplicate), | |
| 320 is_arguments_(is_args) { } | |
| 321 | |
| 322 Address slot_address() const { return slot_address_; } | |
| 323 int jsframe_index() const { return jsframe_index_; } | |
| 324 int object_length() const { return object_length_; } | |
| 325 int duplicate_object() const { return duplicate_object_; } | |
| 326 bool is_arguments() const { return is_arguments_; } | |
| 327 | |
| 328 // Only used for allocated receivers in DoComputeConstructStubFrame. | |
| 329 void patch_slot_address(intptr_t slot) { | |
| 330 slot_address_ = reinterpret_cast<Address>(slot); | |
| 331 } | |
| 332 | |
| 333 private: | |
| 334 Address slot_address_; | |
| 335 int jsframe_index_; | |
| 336 int object_length_; | |
| 337 int duplicate_object_; | |
| 338 bool is_arguments_; | |
| 339 }; | |
| 340 | |
| 341 | 297 |
| 342 class OptimizedFunctionVisitor BASE_EMBEDDED { | 298 class OptimizedFunctionVisitor BASE_EMBEDDED { |
| 343 public: | 299 public: |
| 344 virtual ~OptimizedFunctionVisitor() {} | 300 virtual ~OptimizedFunctionVisitor() {} |
| 345 | 301 |
| 346 // Function which is called before iteration of any optimized functions | 302 // Function which is called before iteration of any optimized functions |
| 347 // from given native context. | 303 // from given native context. |
| 348 virtual void EnterContext(Context* context) = 0; | 304 virtual void EnterContext(Context* context) = 0; |
| 349 | 305 |
| 350 virtual void VisitFunction(JSFunction* function) = 0; | 306 virtual void VisitFunction(JSFunction* function) = 0; |
| (...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1185 Object** expression_stack_; | 1141 Object** expression_stack_; |
| 1186 int source_position_; | 1142 int source_position_; |
| 1187 | 1143 |
| 1188 friend class Deoptimizer; | 1144 friend class Deoptimizer; |
| 1189 }; | 1145 }; |
| 1190 | 1146 |
| 1191 } // namespace internal | 1147 } // namespace internal |
| 1192 } // namespace v8 | 1148 } // namespace v8 |
| 1193 | 1149 |
| 1194 #endif // V8_DEOPTIMIZER_H_ | 1150 #endif // V8_DEOPTIMIZER_H_ |
| OLD | NEW |