| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 // kind kTagged. After handlification it is always nullptr. | 125 // kind kTagged. After handlification it is always nullptr. |
| 126 Object* raw_literal_; | 126 Object* raw_literal_; |
| 127 // kind is kUInt32 or kBoolBit. | 127 // kind is kUInt32 or kBoolBit. |
| 128 uint32_t uint32_value_; | 128 uint32_t uint32_value_; |
| 129 // kind is kInt32. | 129 // kind is kInt32. |
| 130 int32_t int32_value_; | 130 int32_t int32_value_; |
| 131 // kind is kFloat | 131 // kind is kFloat |
| 132 Float32 float_value_; | 132 Float32 float_value_; |
| 133 // kind is kDouble | 133 // kind is kDouble |
| 134 Float64 double_value_; | 134 Float64 double_value_; |
| 135 // kind is kDuplicatedObject or kArgumentsObject or kCapturedObject. | 135 // kind is kDuplicatedObject or kArgumentsObject or |
| 136 // kCapturedObject. |
| 136 MaterializedObjectInfo materialization_info_; | 137 MaterializedObjectInfo materialization_info_; |
| 137 }; | 138 }; |
| 138 | 139 |
| 139 // Checked accessors for the union members. | 140 // Checked accessors for the union members. |
| 140 Object* raw_literal() const; | 141 Object* raw_literal() const; |
| 141 int32_t int32_value() const; | 142 int32_t int32_value() const; |
| 142 uint32_t uint32_value() const; | 143 uint32_t uint32_value() const; |
| 143 Float32 float_value() const; | 144 Float32 float_value() const; |
| 144 Float64 double_value() const; | 145 Float64 double_value() const; |
| 145 int object_length() const; | 146 int object_length() const; |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 | 299 |
| 299 std::vector<TranslatedFrame>& frames() { return frames_; } | 300 std::vector<TranslatedFrame>& frames() { return frames_; } |
| 300 | 301 |
| 301 TranslatedFrame* GetArgumentsInfoFromJSFrameIndex(int jsframe_index, | 302 TranslatedFrame* GetArgumentsInfoFromJSFrameIndex(int jsframe_index, |
| 302 int* arguments_count); | 303 int* arguments_count); |
| 303 | 304 |
| 304 Isolate* isolate() { return isolate_; } | 305 Isolate* isolate() { return isolate_; } |
| 305 | 306 |
| 306 void Init(Address input_frame_pointer, TranslationIterator* iterator, | 307 void Init(Address input_frame_pointer, TranslationIterator* iterator, |
| 307 FixedArray* literal_array, RegisterValues* registers, | 308 FixedArray* literal_array, RegisterValues* registers, |
| 308 FILE* trace_file); | 309 FILE* trace_file, int parameter_count); |
| 309 | 310 |
| 310 private: | 311 private: |
| 311 friend TranslatedValue; | 312 friend TranslatedValue; |
| 312 | 313 |
| 313 TranslatedFrame CreateNextTranslatedFrame(TranslationIterator* iterator, | 314 TranslatedFrame CreateNextTranslatedFrame(TranslationIterator* iterator, |
| 314 FixedArray* literal_array, | 315 FixedArray* literal_array, |
| 315 Address fp, | 316 Address fp, |
| 316 FILE* trace_file); | 317 FILE* trace_file); |
| 317 TranslatedValue CreateNextTranslatedValue(int frame_index, int value_index, | 318 int CreateNextTranslatedValue(int frame_index, TranslationIterator* iterator, |
| 318 TranslationIterator* iterator, | 319 FixedArray* literal_array, Address fp, |
| 319 FixedArray* literal_array, | 320 RegisterValues* registers, FILE* trace_file); |
| 320 Address fp, | 321 void CreateArgumentsElementsTranslatedValues(int frame_index, |
| 321 RegisterValues* registers, | 322 Address input_frame_pointer, |
| 322 FILE* trace_file); | 323 bool is_rest); |
| 323 | 324 |
| 324 void UpdateFromPreviouslyMaterializedObjects(); | 325 void UpdateFromPreviouslyMaterializedObjects(); |
| 325 Handle<Object> MaterializeAt(int frame_index, int* value_index); | 326 Handle<Object> MaterializeAt(int frame_index, int* value_index); |
| 326 Handle<Object> MaterializeObjectAt(int object_index); | 327 Handle<Object> MaterializeObjectAt(int object_index); |
| 327 class CapturedObjectMaterializer; | 328 class CapturedObjectMaterializer; |
| 328 Handle<Object> MaterializeCapturedObjectAt(TranslatedValue* slot, | 329 Handle<Object> MaterializeCapturedObjectAt(TranslatedValue* slot, |
| 329 int frame_index, int* value_index); | 330 int frame_index, int* value_index); |
| 330 bool GetAdaptedArguments(Handle<JSObject>* result, int frame_index); | 331 bool GetAdaptedArguments(Handle<JSObject>* result, int frame_index); |
| 331 | 332 |
| 332 static uint32_t GetUInt32Slot(Address fp, int slot_index); | 333 static uint32_t GetUInt32Slot(Address fp, int slot_index); |
| 333 static Float32 GetFloatSlot(Address fp, int slot_index); | 334 static Float32 GetFloatSlot(Address fp, int slot_index); |
| 334 static Float64 GetDoubleSlot(Address fp, int slot_index); | 335 static Float64 GetDoubleSlot(Address fp, int slot_index); |
| 335 | 336 |
| 336 std::vector<TranslatedFrame> frames_; | 337 std::vector<TranslatedFrame> frames_; |
| 337 Isolate* isolate_; | 338 Isolate* isolate_; |
| 338 Address stack_frame_pointer_; | 339 Address stack_frame_pointer_; |
| 339 bool has_adapted_arguments_; | 340 bool has_adapted_arguments_; |
| 341 int formal_parameter_count_; |
| 340 | 342 |
| 341 struct ObjectPosition { | 343 struct ObjectPosition { |
| 342 int frame_index_; | 344 int frame_index_; |
| 343 int value_index_; | 345 int value_index_; |
| 344 }; | 346 }; |
| 345 std::deque<ObjectPosition> object_positions_; | 347 std::deque<ObjectPosition> object_positions_; |
| 346 }; | 348 }; |
| 347 | 349 |
| 348 | 350 |
| 349 class OptimizedFunctionVisitor BASE_EMBEDDED { | 351 class OptimizedFunctionVisitor BASE_EMBEDDED { |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 V(JS_FRAME) \ | 927 V(JS_FRAME) \ |
| 926 V(INTERPRETED_FRAME) \ | 928 V(INTERPRETED_FRAME) \ |
| 927 V(CONSTRUCT_STUB_FRAME) \ | 929 V(CONSTRUCT_STUB_FRAME) \ |
| 928 V(GETTER_STUB_FRAME) \ | 930 V(GETTER_STUB_FRAME) \ |
| 929 V(SETTER_STUB_FRAME) \ | 931 V(SETTER_STUB_FRAME) \ |
| 930 V(ARGUMENTS_ADAPTOR_FRAME) \ | 932 V(ARGUMENTS_ADAPTOR_FRAME) \ |
| 931 V(TAIL_CALLER_FRAME) \ | 933 V(TAIL_CALLER_FRAME) \ |
| 932 V(COMPILED_STUB_FRAME) \ | 934 V(COMPILED_STUB_FRAME) \ |
| 933 V(DUPLICATED_OBJECT) \ | 935 V(DUPLICATED_OBJECT) \ |
| 934 V(ARGUMENTS_OBJECT) \ | 936 V(ARGUMENTS_OBJECT) \ |
| 937 V(ARGUMENTS_ELEMENTS) \ |
| 935 V(CAPTURED_OBJECT) \ | 938 V(CAPTURED_OBJECT) \ |
| 936 V(REGISTER) \ | 939 V(REGISTER) \ |
| 937 V(INT32_REGISTER) \ | 940 V(INT32_REGISTER) \ |
| 938 V(UINT32_REGISTER) \ | 941 V(UINT32_REGISTER) \ |
| 939 V(BOOL_REGISTER) \ | 942 V(BOOL_REGISTER) \ |
| 940 V(FLOAT_REGISTER) \ | 943 V(FLOAT_REGISTER) \ |
| 941 V(DOUBLE_REGISTER) \ | 944 V(DOUBLE_REGISTER) \ |
| 942 V(STACK_SLOT) \ | 945 V(STACK_SLOT) \ |
| 943 V(INT32_STACK_SLOT) \ | 946 V(INT32_STACK_SLOT) \ |
| 944 V(UINT32_STACK_SLOT) \ | 947 V(UINT32_STACK_SLOT) \ |
| (...skipping 28 matching lines...) Expand all Loading... |
| 973 void BeginInterpretedFrame(BailoutId bytecode_offset, int literal_id, | 976 void BeginInterpretedFrame(BailoutId bytecode_offset, int literal_id, |
| 974 unsigned height); | 977 unsigned height); |
| 975 void BeginCompiledStubFrame(int height); | 978 void BeginCompiledStubFrame(int height); |
| 976 void BeginArgumentsAdaptorFrame(int literal_id, unsigned height); | 979 void BeginArgumentsAdaptorFrame(int literal_id, unsigned height); |
| 977 void BeginTailCallerFrame(int literal_id); | 980 void BeginTailCallerFrame(int literal_id); |
| 978 void BeginConstructStubFrame(BailoutId bailout_id, int literal_id, | 981 void BeginConstructStubFrame(BailoutId bailout_id, int literal_id, |
| 979 unsigned height); | 982 unsigned height); |
| 980 void BeginGetterStubFrame(int literal_id); | 983 void BeginGetterStubFrame(int literal_id); |
| 981 void BeginSetterStubFrame(int literal_id); | 984 void BeginSetterStubFrame(int literal_id); |
| 982 void BeginArgumentsObject(int args_length); | 985 void BeginArgumentsObject(int args_length); |
| 986 void ArgumentsElements(bool is_rest); |
| 983 void BeginCapturedObject(int length); | 987 void BeginCapturedObject(int length); |
| 984 void DuplicateObject(int object_index); | 988 void DuplicateObject(int object_index); |
| 985 void StoreRegister(Register reg); | 989 void StoreRegister(Register reg); |
| 986 void StoreInt32Register(Register reg); | 990 void StoreInt32Register(Register reg); |
| 987 void StoreUint32Register(Register reg); | 991 void StoreUint32Register(Register reg); |
| 988 void StoreBoolRegister(Register reg); | 992 void StoreBoolRegister(Register reg); |
| 989 void StoreFloatRegister(FloatRegister reg); | 993 void StoreFloatRegister(FloatRegister reg); |
| 990 void StoreDoubleRegister(DoubleRegister reg); | 994 void StoreDoubleRegister(DoubleRegister reg); |
| 991 void StoreStackSlot(int index); | 995 void StoreStackSlot(int index); |
| 992 void StoreInt32StackSlot(int index); | 996 void StoreInt32StackSlot(int index); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 std::vector<Handle<Object> > expression_stack_; | 1103 std::vector<Handle<Object> > expression_stack_; |
| 1100 int source_position_; | 1104 int source_position_; |
| 1101 | 1105 |
| 1102 friend class Deoptimizer; | 1106 friend class Deoptimizer; |
| 1103 }; | 1107 }; |
| 1104 | 1108 |
| 1105 } // namespace internal | 1109 } // namespace internal |
| 1106 } // namespace v8 | 1110 } // namespace v8 |
| 1107 | 1111 |
| 1108 #endif // V8_DEOPTIMIZER_H_ | 1112 #endif // V8_DEOPTIMIZER_H_ |
| OLD | NEW |