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

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: Fix Jaros comment. 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 private: 171 private:
172 friend class TranslatedState; 172 friend class TranslatedState;
173 173
174 // Constructor static methods. 174 // Constructor static methods.
175 static TranslatedFrame JSFrame(BailoutId node_id, JSFunction* function, 175 static TranslatedFrame JSFrame(BailoutId node_id,
176 int height); 176 SharedFunctionInfo* shared_info, int height);
177 static TranslatedFrame AccessorFrame(Kind kind, JSFunction* function); 177 static TranslatedFrame AccessorFrame(Kind kind,
178 static TranslatedFrame ArgumentsAdaptorFrame(JSFunction* function, 178 SharedFunctionInfo* shared_info);
179 static TranslatedFrame ArgumentsAdaptorFrame(SharedFunctionInfo* shared_info,
179 int height); 180 int height);
180 static TranslatedFrame ConstructStubFrame(JSFunction* function, int height); 181 static TranslatedFrame ConstructStubFrame(SharedFunctionInfo* shared_info,
182 int height);
181 static TranslatedFrame CompiledStubFrame(int height, Isolate* isolate) { 183 static TranslatedFrame CompiledStubFrame(int height, Isolate* isolate) {
182 return TranslatedFrame(kCompiledStub, isolate, nullptr, height); 184 return TranslatedFrame(kCompiledStub, isolate, nullptr, height);
183 } 185 }
184 static TranslatedFrame InvalidFrame() { 186 static TranslatedFrame InvalidFrame() {
185 return TranslatedFrame(kInvalid, nullptr); 187 return TranslatedFrame(kInvalid, nullptr);
186 } 188 }
187 189
188 static void AdvanceIterator(std::deque<TranslatedValue>::iterator* iter); 190 static void AdvanceIterator(std::deque<TranslatedValue>::iterator* iter);
189 191
190 TranslatedFrame(Kind kind, Isolate* isolate, JSFunction* function = nullptr, 192 TranslatedFrame(Kind kind, Isolate* isolate,
191 int height = 0) 193 SharedFunctionInfo* shared_info = nullptr, int height = 0)
192 : kind_(kind), 194 : kind_(kind),
193 node_id_(BailoutId::None()), 195 node_id_(BailoutId::None()),
194 raw_function_(function), 196 raw_shared_info_(shared_info),
195 height_(height), 197 height_(height),
196 isolate_(isolate) {} 198 isolate_(isolate) {}
197 199
198 200
199 void Add(const TranslatedValue& value) { values_.push_back(value); } 201 void Add(const TranslatedValue& value) { values_.push_back(value); }
200 void Handlify(Isolate* isolate); 202 void Handlify();
201 203
202 Kind kind_; 204 Kind kind_;
203 BailoutId node_id_; 205 BailoutId node_id_;
204 JSFunction* raw_function_; 206 SharedFunctionInfo* raw_shared_info_;
205 Handle<JSFunction> function_; 207 Handle<SharedFunctionInfo> shared_info_;
206 int height_; 208 int height_;
207 Isolate* isolate_; 209 Isolate* isolate_;
208 210
209 typedef std::deque<TranslatedValue> ValuesContainer; 211 typedef std::deque<TranslatedValue> ValuesContainer;
210 212
211 ValuesContainer values_; 213 ValuesContainer values_;
212 }; 214 };
213 215
214 216
215 // Auxiliary class for translating deoptimization values. 217 // Auxiliary class for translating deoptimization values.
(...skipping 14 matching lines...) Expand all
230 class TranslatedState { 232 class TranslatedState {
231 public: 233 public:
232 TranslatedState(); 234 TranslatedState();
233 explicit TranslatedState(JavaScriptFrame* frame); 235 explicit TranslatedState(JavaScriptFrame* frame);
234 236
235 void Prepare(bool has_adapted_arguments, Address stack_frame_pointer); 237 void Prepare(bool has_adapted_arguments, Address stack_frame_pointer);
236 238
237 // Store newly materialized values into the isolate. 239 // Store newly materialized values into the isolate.
238 void StoreMaterializedValuesAndDeopt(); 240 void StoreMaterializedValuesAndDeopt();
239 241
242 typedef std::vector<TranslatedFrame>::iterator iterator;
243 iterator begin() { return frames_.begin(); }
244 iterator end() { return frames_.end(); }
245
240 typedef std::vector<TranslatedFrame>::const_iterator const_iterator; 246 typedef std::vector<TranslatedFrame>::const_iterator const_iterator;
241 const_iterator begin() const { return frames_.begin(); } 247 const_iterator begin() const { return frames_.begin(); }
242 const_iterator end() const { return frames_.end(); } 248 const_iterator end() const { return frames_.end(); }
243 249
244 std::vector<TranslatedFrame>& frames() { return frames_; } 250 std::vector<TranslatedFrame>& frames() { return frames_; }
245 251
246 TranslatedFrame* GetArgumentsInfoFromJSFrameIndex(int jsframe_index, 252 TranslatedFrame* GetArgumentsInfoFromJSFrameIndex(int jsframe_index,
247 int* arguments_count); 253 int* arguments_count);
248 254
249 Isolate* isolate() { return isolate_; } 255 Isolate* isolate() { return isolate_; }
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 V(REGISTER) \ 1014 V(REGISTER) \
1009 V(INT32_REGISTER) \ 1015 V(INT32_REGISTER) \
1010 V(UINT32_REGISTER) \ 1016 V(UINT32_REGISTER) \
1011 V(BOOL_REGISTER) \ 1017 V(BOOL_REGISTER) \
1012 V(DOUBLE_REGISTER) \ 1018 V(DOUBLE_REGISTER) \
1013 V(STACK_SLOT) \ 1019 V(STACK_SLOT) \
1014 V(INT32_STACK_SLOT) \ 1020 V(INT32_STACK_SLOT) \
1015 V(UINT32_STACK_SLOT) \ 1021 V(UINT32_STACK_SLOT) \
1016 V(BOOL_STACK_SLOT) \ 1022 V(BOOL_STACK_SLOT) \
1017 V(DOUBLE_STACK_SLOT) \ 1023 V(DOUBLE_STACK_SLOT) \
1018 V(LITERAL) 1024 V(LITERAL) \
1025 V(JS_FRAME_FUNCTION)
1019 1026
1020 1027
1021 class Translation BASE_EMBEDDED { 1028 class Translation BASE_EMBEDDED {
1022 public: 1029 public:
1023 #define DECLARE_TRANSLATION_OPCODE_ENUM(item) item, 1030 #define DECLARE_TRANSLATION_OPCODE_ENUM(item) item,
1024 enum Opcode { 1031 enum Opcode {
1025 TRANSLATION_OPCODE_LIST(DECLARE_TRANSLATION_OPCODE_ENUM) 1032 TRANSLATION_OPCODE_LIST(DECLARE_TRANSLATION_OPCODE_ENUM)
1026 LAST = LITERAL 1033 LAST = LITERAL
1027 }; 1034 };
1028 #undef DECLARE_TRANSLATION_OPCODE_ENUM 1035 #undef DECLARE_TRANSLATION_OPCODE_ENUM
(...skipping 25 matching lines...) Expand all
1054 void StoreUint32Register(Register reg); 1061 void StoreUint32Register(Register reg);
1055 void StoreBoolRegister(Register reg); 1062 void StoreBoolRegister(Register reg);
1056 void StoreDoubleRegister(DoubleRegister reg); 1063 void StoreDoubleRegister(DoubleRegister reg);
1057 void StoreStackSlot(int index); 1064 void StoreStackSlot(int index);
1058 void StoreInt32StackSlot(int index); 1065 void StoreInt32StackSlot(int index);
1059 void StoreUint32StackSlot(int index); 1066 void StoreUint32StackSlot(int index);
1060 void StoreBoolStackSlot(int index); 1067 void StoreBoolStackSlot(int index);
1061 void StoreDoubleStackSlot(int index); 1068 void StoreDoubleStackSlot(int index);
1062 void StoreLiteral(int literal_id); 1069 void StoreLiteral(int literal_id);
1063 void StoreArgumentsObject(bool args_known, int args_index, int args_length); 1070 void StoreArgumentsObject(bool args_known, int args_index, int args_length);
1071 void StoreJSFrameFunction();
1064 1072
1065 Zone* zone() const { return zone_; } 1073 Zone* zone() const { return zone_; }
1066 1074
1067 static int NumberOfOperandsFor(Opcode opcode); 1075 static int NumberOfOperandsFor(Opcode opcode);
1068 1076
1069 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER) 1077 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER)
1070 static const char* StringFor(Opcode opcode); 1078 static const char* StringFor(Opcode opcode);
1071 #endif 1079 #endif
1072 1080
1073 // A literal id which refers to the JSFunction itself.
1074 static const int kSelfLiteralId = -239;
1075
1076 private: 1081 private:
1077 TranslationBuffer* buffer_; 1082 TranslationBuffer* buffer_;
1078 int index_; 1083 int index_;
1079 Zone* zone_; 1084 Zone* zone_;
1080 }; 1085 };
1081 1086
1082 1087
1083 class MaterializedObjectStore { 1088 class MaterializedObjectStore {
1084 public: 1089 public:
1085 explicit MaterializedObjectStore(Isolate* isolate) : isolate_(isolate) { 1090 explicit MaterializedObjectStore(Isolate* isolate) : isolate_(isolate) {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 Object** expression_stack_; 1181 Object** expression_stack_;
1177 int source_position_; 1182 int source_position_;
1178 1183
1179 friend class Deoptimizer; 1184 friend class Deoptimizer;
1180 }; 1185 };
1181 1186
1182 } // namespace internal 1187 } // namespace internal
1183 } // namespace v8 1188 } // namespace v8
1184 1189
1185 #endif // V8_DEOPTIMIZER_H_ 1190 #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