Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(660)

Side by Side Diff: src/deoptimizer.h

Issue 2031873002: [deoptimizer] Support float registers and slots. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix compile. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/code-generator-impl.h ('k') | src/deoptimizer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/macro-assembler.h" 9 #include "src/macro-assembler.h"
10 10
(...skipping 21 matching lines...) Expand all
32 private: 32 private:
33 friend class TranslatedState; 33 friend class TranslatedState;
34 friend class TranslatedFrame; 34 friend class TranslatedFrame;
35 35
36 enum Kind { 36 enum Kind {
37 kInvalid, 37 kInvalid,
38 kTagged, 38 kTagged,
39 kInt32, 39 kInt32,
40 kUInt32, 40 kUInt32,
41 kBoolBit, 41 kBoolBit,
42 kFloat,
42 kDouble, 43 kDouble,
43 kCapturedObject, // Object captured by the escape analysis. 44 kCapturedObject, // Object captured by the escape analysis.
44 // The number of nested objects can be obtained 45 // The number of nested objects can be obtained
45 // with the DeferredObjectLength() method 46 // with the DeferredObjectLength() method
46 // (the values of the nested objects follow 47 // (the values of the nested objects follow
47 // this value in the depth-first order.) 48 // this value in the depth-first order.)
48 kDuplicatedObject, // Duplicated object of a deferred object. 49 kDuplicatedObject, // Duplicated object of a deferred object.
49 kArgumentsObject // Arguments object - only used to keep indexing 50 kArgumentsObject // Arguments object - only used to keep indexing
50 // in sync, it should not be materialized. 51 // in sync, it should not be materialized.
51 }; 52 };
52 53
53 TranslatedValue(TranslatedState* container, Kind kind) 54 TranslatedValue(TranslatedState* container, Kind kind)
54 : kind_(kind), container_(container) {} 55 : kind_(kind), container_(container) {}
55 Kind kind() const { return kind_; } 56 Kind kind() const { return kind_; }
56 void Handlify(); 57 void Handlify();
57 int GetChildrenCount() const; 58 int GetChildrenCount() const;
58 59
59 static TranslatedValue NewArgumentsObject(TranslatedState* container, 60 static TranslatedValue NewArgumentsObject(TranslatedState* container,
60 int length, int object_index); 61 int length, int object_index);
61 static TranslatedValue NewDeferredObject(TranslatedState* container, 62 static TranslatedValue NewDeferredObject(TranslatedState* container,
62 int length, int object_index); 63 int length, int object_index);
63 static TranslatedValue NewDuplicateObject(TranslatedState* container, int id); 64 static TranslatedValue NewDuplicateObject(TranslatedState* container, int id);
65 static TranslatedValue NewFloat(TranslatedState* container, float value);
64 static TranslatedValue NewDouble(TranslatedState* container, double value); 66 static TranslatedValue NewDouble(TranslatedState* container, double value);
65 static TranslatedValue NewInt32(TranslatedState* container, int32_t value); 67 static TranslatedValue NewInt32(TranslatedState* container, int32_t value);
66 static TranslatedValue NewUInt32(TranslatedState* container, uint32_t value); 68 static TranslatedValue NewUInt32(TranslatedState* container, uint32_t value);
67 static TranslatedValue NewBool(TranslatedState* container, uint32_t value); 69 static TranslatedValue NewBool(TranslatedState* container, uint32_t value);
68 static TranslatedValue NewTagged(TranslatedState* container, Object* literal); 70 static TranslatedValue NewTagged(TranslatedState* container, Object* literal);
69 static TranslatedValue NewInvalid(TranslatedState* container); 71 static TranslatedValue NewInvalid(TranslatedState* container);
70 72
71 Isolate* isolate() const; 73 Isolate* isolate() const;
72 void MaterializeSimple(); 74 void MaterializeSimple();
73 75
(...skipping 12 matching lines...) Expand all
86 int length_; // Applies only to kArgumentsObject or kCapturedObject kinds. 88 int length_; // Applies only to kArgumentsObject or kCapturedObject kinds.
87 }; 89 };
88 90
89 union { 91 union {
90 // kind kTagged. After handlification it is always nullptr. 92 // kind kTagged. After handlification it is always nullptr.
91 Object* raw_literal_; 93 Object* raw_literal_;
92 // kind is kUInt32 or kBoolBit. 94 // kind is kUInt32 or kBoolBit.
93 uint32_t uint32_value_; 95 uint32_t uint32_value_;
94 // kind is kInt32. 96 // kind is kInt32.
95 int32_t int32_value_; 97 int32_t int32_value_;
98 // kind is kFloat
99 float float_value_;
96 // kind is kDouble 100 // kind is kDouble
97 double double_value_; 101 double double_value_;
98 // kind is kDuplicatedObject or kArgumentsObject or kCapturedObject. 102 // kind is kDuplicatedObject or kArgumentsObject or kCapturedObject.
99 MaterializedObjectInfo materialization_info_; 103 MaterializedObjectInfo materialization_info_;
100 }; 104 };
101 105
102 // Checked accessors for the union members. 106 // Checked accessors for the union members.
103 Object* raw_literal() const; 107 Object* raw_literal() const;
104 int32_t int32_value() const; 108 int32_t int32_value() const;
105 uint32_t uint32_value() const; 109 uint32_t uint32_value() const;
110 float float_value() const;
106 double double_value() const; 111 double double_value() const;
107 int object_length() const; 112 int object_length() const;
108 int object_index() const; 113 int object_index() const;
109 }; 114 };
110 115
111 116
112 class TranslatedFrame { 117 class TranslatedFrame {
113 public: 118 public:
114 enum Kind { 119 enum Kind {
115 kFunction, 120 kFunction,
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 // improperly detects an array bounds overflow in optimized debug builds 736 // improperly detects an array bounds overflow in optimized debug builds
732 // when using a plain DCHECK. 737 // when using a plain DCHECK.
733 if (n >= arraysize(registers_)) { 738 if (n >= arraysize(registers_)) {
734 DCHECK(false); 739 DCHECK(false);
735 return 0; 740 return 0;
736 } 741 }
737 #endif 742 #endif
738 return registers_[n]; 743 return registers_[n];
739 } 744 }
740 745
746 float GetFloatRegister(unsigned n) const {
747 DCHECK(n < arraysize(float_registers_));
748 return float_registers_[n];
749 }
750
741 double GetDoubleRegister(unsigned n) const { 751 double GetDoubleRegister(unsigned n) const {
742 DCHECK(n < arraysize(double_registers_)); 752 DCHECK(n < arraysize(double_registers_));
743 return double_registers_[n]; 753 return double_registers_[n];
744 } 754 }
745 755
746 void SetRegister(unsigned n, intptr_t value) { 756 void SetRegister(unsigned n, intptr_t value) {
747 DCHECK(n < arraysize(registers_)); 757 DCHECK(n < arraysize(registers_));
748 registers_[n] = value; 758 registers_[n] = value;
749 } 759 }
750 760
761 void SetFloatRegister(unsigned n, float value) {
762 DCHECK(n < arraysize(float_registers_));
763 float_registers_[n] = value;
764 }
765
751 void SetDoubleRegister(unsigned n, double value) { 766 void SetDoubleRegister(unsigned n, double value) {
752 DCHECK(n < arraysize(double_registers_)); 767 DCHECK(n < arraysize(double_registers_));
753 double_registers_[n] = value; 768 double_registers_[n] = value;
754 } 769 }
755 770
756 intptr_t registers_[Register::kNumRegisters]; 771 intptr_t registers_[Register::kNumRegisters];
772 float float_registers_[FloatRegister::kMaxNumRegisters];
757 double double_registers_[DoubleRegister::kMaxNumRegisters]; 773 double double_registers_[DoubleRegister::kMaxNumRegisters];
758 }; 774 };
759 775
760 776
761 class FrameDescription { 777 class FrameDescription {
762 public: 778 public:
763 explicit FrameDescription(uint32_t frame_size, int parameter_count = 0); 779 explicit FrameDescription(uint32_t frame_size, int parameter_count = 0);
764 780
765 void* operator new(size_t size, uint32_t frame_size) { 781 void* operator new(size_t size, uint32_t frame_size) {
766 // Subtracts kPointerSize, as the member frame_content_ already supplies 782 // Subtracts kPointerSize, as the member frame_content_ already supplies
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 V(ARGUMENTS_ADAPTOR_FRAME) \ 986 V(ARGUMENTS_ADAPTOR_FRAME) \
971 V(TAIL_CALLER_FRAME) \ 987 V(TAIL_CALLER_FRAME) \
972 V(COMPILED_STUB_FRAME) \ 988 V(COMPILED_STUB_FRAME) \
973 V(DUPLICATED_OBJECT) \ 989 V(DUPLICATED_OBJECT) \
974 V(ARGUMENTS_OBJECT) \ 990 V(ARGUMENTS_OBJECT) \
975 V(CAPTURED_OBJECT) \ 991 V(CAPTURED_OBJECT) \
976 V(REGISTER) \ 992 V(REGISTER) \
977 V(INT32_REGISTER) \ 993 V(INT32_REGISTER) \
978 V(UINT32_REGISTER) \ 994 V(UINT32_REGISTER) \
979 V(BOOL_REGISTER) \ 995 V(BOOL_REGISTER) \
996 V(FLOAT_REGISTER) \
980 V(DOUBLE_REGISTER) \ 997 V(DOUBLE_REGISTER) \
981 V(STACK_SLOT) \ 998 V(STACK_SLOT) \
982 V(INT32_STACK_SLOT) \ 999 V(INT32_STACK_SLOT) \
983 V(UINT32_STACK_SLOT) \ 1000 V(UINT32_STACK_SLOT) \
984 V(BOOL_STACK_SLOT) \ 1001 V(BOOL_STACK_SLOT) \
1002 V(FLOAT_STACK_SLOT) \
985 V(DOUBLE_STACK_SLOT) \ 1003 V(DOUBLE_STACK_SLOT) \
986 V(LITERAL) 1004 V(LITERAL)
987 1005
988 class Translation BASE_EMBEDDED { 1006 class Translation BASE_EMBEDDED {
989 public: 1007 public:
990 #define DECLARE_TRANSLATION_OPCODE_ENUM(item) item, 1008 #define DECLARE_TRANSLATION_OPCODE_ENUM(item) item,
991 enum Opcode { 1009 enum Opcode {
992 TRANSLATION_OPCODE_LIST(DECLARE_TRANSLATION_OPCODE_ENUM) 1010 TRANSLATION_OPCODE_LIST(DECLARE_TRANSLATION_OPCODE_ENUM)
993 LAST = LITERAL 1011 LAST = LITERAL
994 }; 1012 };
(...skipping 21 matching lines...) Expand all
1016 void BeginConstructStubFrame(int literal_id, unsigned height); 1034 void BeginConstructStubFrame(int literal_id, unsigned height);
1017 void BeginGetterStubFrame(int literal_id); 1035 void BeginGetterStubFrame(int literal_id);
1018 void BeginSetterStubFrame(int literal_id); 1036 void BeginSetterStubFrame(int literal_id);
1019 void BeginArgumentsObject(int args_length); 1037 void BeginArgumentsObject(int args_length);
1020 void BeginCapturedObject(int length); 1038 void BeginCapturedObject(int length);
1021 void DuplicateObject(int object_index); 1039 void DuplicateObject(int object_index);
1022 void StoreRegister(Register reg); 1040 void StoreRegister(Register reg);
1023 void StoreInt32Register(Register reg); 1041 void StoreInt32Register(Register reg);
1024 void StoreUint32Register(Register reg); 1042 void StoreUint32Register(Register reg);
1025 void StoreBoolRegister(Register reg); 1043 void StoreBoolRegister(Register reg);
1044 void StoreFloatRegister(FloatRegister reg);
1026 void StoreDoubleRegister(DoubleRegister reg); 1045 void StoreDoubleRegister(DoubleRegister reg);
1027 void StoreStackSlot(int index); 1046 void StoreStackSlot(int index);
1028 void StoreInt32StackSlot(int index); 1047 void StoreInt32StackSlot(int index);
1029 void StoreUint32StackSlot(int index); 1048 void StoreUint32StackSlot(int index);
1030 void StoreBoolStackSlot(int index); 1049 void StoreBoolStackSlot(int index);
1050 void StoreFloatStackSlot(int index);
1031 void StoreDoubleStackSlot(int index); 1051 void StoreDoubleStackSlot(int index);
1032 void StoreLiteral(int literal_id); 1052 void StoreLiteral(int literal_id);
1033 void StoreArgumentsObject(bool args_known, int args_index, int args_length); 1053 void StoreArgumentsObject(bool args_known, int args_index, int args_length);
1034 void StoreJSFrameFunction(); 1054 void StoreJSFrameFunction();
1035 1055
1036 Zone* zone() const { return zone_; } 1056 Zone* zone() const { return zone_; }
1037 1057
1038 static int NumberOfOperandsFor(Opcode opcode); 1058 static int NumberOfOperandsFor(Opcode opcode);
1039 1059
1040 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER) 1060 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER)
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 std::vector<Handle<Object> > expression_stack_; 1154 std::vector<Handle<Object> > expression_stack_;
1135 int source_position_; 1155 int source_position_;
1136 1156
1137 friend class Deoptimizer; 1157 friend class Deoptimizer;
1138 }; 1158 };
1139 1159
1140 } // namespace internal 1160 } // namespace internal
1141 } // namespace v8 1161 } // namespace v8
1142 1162
1143 #endif // V8_DEOPTIMIZER_H_ 1163 #endif // V8_DEOPTIMIZER_H_
OLDNEW
« no previous file with comments | « src/compiler/code-generator-impl.h ('k') | src/deoptimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698