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

Side by Side Diff: src/deoptimizer.h

Issue 1169103004: [deoptimizer] Basic support inlining based on SharedFunctionInfo. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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/js-typed-lowering.cc ('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/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 kArgumentsAdaptor, 119 kArgumentsAdaptor,
120 kConstructStub, 120 kConstructStub,
121 kCompiledStub, 121 kCompiledStub,
122 kInvalid 122 kInvalid
123 }; 123 };
124 124
125 int GetValueCount(); 125 int GetValueCount();
126 126
127 Kind kind() const { return kind_; } 127 Kind kind() const { return kind_; }
128 BailoutId node_id() const { return node_id_; } 128 BailoutId node_id() const { return node_id_; }
129 JSFunction* raw_function() const { return raw_function_; } 129 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
130 Handle<JSFunction> function() const { return function_; }
131 int height() const { return height_; } 130 int height() const { return height_; }
132 131
133 class iterator { 132 class iterator {
134 public: 133 public:
135 iterator& operator++() { 134 iterator& operator++() {
136 AdvanceIterator(&position_); 135 AdvanceIterator(&position_);
137 return *this; 136 return *this;
138 } 137 }
139 138
140 iterator operator++(int) { 139 iterator operator++(int) {
(...skipping 17 matching lines...) Expand all
158 : position_(position) {} 157 : position_(position) {}
159 158
160 std::deque<TranslatedValue>::iterator position_; 159 std::deque<TranslatedValue>::iterator position_;
161 }; 160 };
162 161
163 typedef TranslatedValue& reference; 162 typedef TranslatedValue& reference;
164 typedef TranslatedValue const& const_reference; 163 typedef TranslatedValue const& const_reference;
165 164
166 iterator begin() { return iterator(values_.begin()); } 165 iterator begin() { return iterator(values_.begin()); }
167 iterator end() { return iterator(values_.end()); } 166 iterator end() { return iterator(values_.end()); }
167
168 reference front() { return values_.front(); } 168 reference front() { return values_.front(); }
169 const_reference front() const { return values_.front(); } 169 const_reference front() const { return values_.front(); }
170 170
171 reference operator[](size_t index) { return values_[index]; }
172 const_reference operator[](size_t index) const { return values_[index]; }
Jarin 2015/06/10 11:15:04 As discussed offline, we should not expose the val
Benedikt Meurer 2015/06/10 11:19:50 Done.
173
174 size_t size() const { return values_.size(); }
Jarin 2015/06/10 11:15:04 Remove this. You should use the GetValueCount meth
Benedikt Meurer 2015/06/10 11:19:50 Done.
175
171 private: 176 private:
172 friend class TranslatedState; 177 friend class TranslatedState;
173 178
174 // Constructor static methods. 179 // Constructor static methods.
175 static TranslatedFrame JSFrame(BailoutId node_id, JSFunction* function, 180 static TranslatedFrame JSFrame(BailoutId node_id,
176 int height); 181 SharedFunctionInfo* shared_info, int height);
177 static TranslatedFrame AccessorFrame(Kind kind, JSFunction* function); 182 static TranslatedFrame AccessorFrame(Kind kind,
178 static TranslatedFrame ArgumentsAdaptorFrame(JSFunction* function, 183 SharedFunctionInfo* shared_info);
184 static TranslatedFrame ArgumentsAdaptorFrame(SharedFunctionInfo* shared_info,
179 int height); 185 int height);
180 static TranslatedFrame ConstructStubFrame(JSFunction* function, int height); 186 static TranslatedFrame ConstructStubFrame(SharedFunctionInfo* shared_info,
187 int height);
181 static TranslatedFrame CompiledStubFrame(int height, Isolate* isolate) { 188 static TranslatedFrame CompiledStubFrame(int height, Isolate* isolate) {
182 return TranslatedFrame(kCompiledStub, isolate, nullptr, height); 189 return TranslatedFrame(kCompiledStub, isolate, nullptr, height);
183 } 190 }
184 static TranslatedFrame InvalidFrame() { 191 static TranslatedFrame InvalidFrame() {
185 return TranslatedFrame(kInvalid, nullptr); 192 return TranslatedFrame(kInvalid, nullptr);
186 } 193 }
187 194
188 static void AdvanceIterator(std::deque<TranslatedValue>::iterator* iter); 195 static void AdvanceIterator(std::deque<TranslatedValue>::iterator* iter);
189 196
190 TranslatedFrame(Kind kind, Isolate* isolate, JSFunction* function = nullptr, 197 TranslatedFrame(Kind kind, Isolate* isolate,
191 int height = 0) 198 SharedFunctionInfo* shared_info = nullptr, int height = 0)
192 : kind_(kind), 199 : kind_(kind),
193 node_id_(BailoutId::None()), 200 node_id_(BailoutId::None()),
194 raw_function_(function), 201 raw_shared_info_(shared_info),
195 height_(height), 202 height_(height),
196 isolate_(isolate) {} 203 isolate_(isolate) {}
197 204
198 205
199 void Add(const TranslatedValue& value) { values_.push_back(value); } 206 void Add(const TranslatedValue& value) { values_.push_back(value); }
200 void Handlify(Isolate* isolate); 207 void Handlify();
201 208
202 Kind kind_; 209 Kind kind_;
203 BailoutId node_id_; 210 BailoutId node_id_;
204 JSFunction* raw_function_; 211 SharedFunctionInfo* raw_shared_info_;
205 Handle<JSFunction> function_; 212 Handle<SharedFunctionInfo> shared_info_;
206 int height_; 213 int height_;
207 Isolate* isolate_; 214 Isolate* isolate_;
208 215
209 typedef std::deque<TranslatedValue> ValuesContainer; 216 typedef std::deque<TranslatedValue> ValuesContainer;
210 217
211 ValuesContainer values_; 218 ValuesContainer values_;
212 }; 219 };
213 220
214 221
215 // Auxiliary class for translating deoptimization values. 222 // Auxiliary class for translating deoptimization values.
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 V(REGISTER) \ 1015 V(REGISTER) \
1009 V(INT32_REGISTER) \ 1016 V(INT32_REGISTER) \
1010 V(UINT32_REGISTER) \ 1017 V(UINT32_REGISTER) \
1011 V(BOOL_REGISTER) \ 1018 V(BOOL_REGISTER) \
1012 V(DOUBLE_REGISTER) \ 1019 V(DOUBLE_REGISTER) \
1013 V(STACK_SLOT) \ 1020 V(STACK_SLOT) \
1014 V(INT32_STACK_SLOT) \ 1021 V(INT32_STACK_SLOT) \
1015 V(UINT32_STACK_SLOT) \ 1022 V(UINT32_STACK_SLOT) \
1016 V(BOOL_STACK_SLOT) \ 1023 V(BOOL_STACK_SLOT) \
1017 V(DOUBLE_STACK_SLOT) \ 1024 V(DOUBLE_STACK_SLOT) \
1018 V(LITERAL) 1025 V(LITERAL) \
1026 V(JS_FRAME_FUNCTION)
1019 1027
1020 1028
1021 class Translation BASE_EMBEDDED { 1029 class Translation BASE_EMBEDDED {
1022 public: 1030 public:
1023 #define DECLARE_TRANSLATION_OPCODE_ENUM(item) item, 1031 #define DECLARE_TRANSLATION_OPCODE_ENUM(item) item,
1024 enum Opcode { 1032 enum Opcode {
1025 TRANSLATION_OPCODE_LIST(DECLARE_TRANSLATION_OPCODE_ENUM) 1033 TRANSLATION_OPCODE_LIST(DECLARE_TRANSLATION_OPCODE_ENUM)
1026 LAST = LITERAL 1034 LAST = LITERAL
1027 }; 1035 };
1028 #undef DECLARE_TRANSLATION_OPCODE_ENUM 1036 #undef DECLARE_TRANSLATION_OPCODE_ENUM
(...skipping 25 matching lines...) Expand all
1054 void StoreUint32Register(Register reg); 1062 void StoreUint32Register(Register reg);
1055 void StoreBoolRegister(Register reg); 1063 void StoreBoolRegister(Register reg);
1056 void StoreDoubleRegister(DoubleRegister reg); 1064 void StoreDoubleRegister(DoubleRegister reg);
1057 void StoreStackSlot(int index); 1065 void StoreStackSlot(int index);
1058 void StoreInt32StackSlot(int index); 1066 void StoreInt32StackSlot(int index);
1059 void StoreUint32StackSlot(int index); 1067 void StoreUint32StackSlot(int index);
1060 void StoreBoolStackSlot(int index); 1068 void StoreBoolStackSlot(int index);
1061 void StoreDoubleStackSlot(int index); 1069 void StoreDoubleStackSlot(int index);
1062 void StoreLiteral(int literal_id); 1070 void StoreLiteral(int literal_id);
1063 void StoreArgumentsObject(bool args_known, int args_index, int args_length); 1071 void StoreArgumentsObject(bool args_known, int args_index, int args_length);
1072 void StoreJSFrameFunction();
1064 1073
1065 Zone* zone() const { return zone_; } 1074 Zone* zone() const { return zone_; }
1066 1075
1067 static int NumberOfOperandsFor(Opcode opcode); 1076 static int NumberOfOperandsFor(Opcode opcode);
1068 1077
1069 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER) 1078 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER)
1070 static const char* StringFor(Opcode opcode); 1079 static const char* StringFor(Opcode opcode);
1071 #endif 1080 #endif
1072 1081
1073 // A literal id which refers to the JSFunction itself.
1074 static const int kSelfLiteralId = -239;
1075
1076 private: 1082 private:
1077 TranslationBuffer* buffer_; 1083 TranslationBuffer* buffer_;
1078 int index_; 1084 int index_;
1079 Zone* zone_; 1085 Zone* zone_;
1080 }; 1086 };
1081 1087
1082 1088
1083 class MaterializedObjectStore { 1089 class MaterializedObjectStore {
1084 public: 1090 public:
1085 explicit MaterializedObjectStore(Isolate* isolate) : isolate_(isolate) { 1091 explicit MaterializedObjectStore(Isolate* isolate) : isolate_(isolate) {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 Object** expression_stack_; 1182 Object** expression_stack_;
1177 int source_position_; 1183 int source_position_;
1178 1184
1179 friend class Deoptimizer; 1185 friend class Deoptimizer;
1180 }; 1186 };
1181 1187
1182 } // namespace internal 1188 } // namespace internal
1183 } // namespace v8 1189 } // namespace v8
1184 1190
1185 #endif // V8_DEOPTIMIZER_H_ 1191 #endif // V8_DEOPTIMIZER_H_
OLDNEW
« no previous file with comments | « src/compiler/js-typed-lowering.cc ('k') | src/deoptimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698