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

Side by Side Diff: src/deoptimizer.h

Issue 6880010: Merge (7265, 7271] from bleeding_edge to experimental/gc branch.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: '' Created 9 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 virtual void EnterContext(Context* context) = 0; 86 virtual void EnterContext(Context* context) = 0;
87 87
88 virtual void VisitFunction(JSFunction* function) = 0; 88 virtual void VisitFunction(JSFunction* function) = 0;
89 89
90 // Function which is called after iteration of all optimized functions 90 // Function which is called after iteration of all optimized functions
91 // from given global context. 91 // from given global context.
92 virtual void LeaveContext(Context* context) = 0; 92 virtual void LeaveContext(Context* context) = 0;
93 }; 93 };
94 94
95 95
96 class Deoptimizer;
97
98
99 class DeoptimizerData {
100 public:
101 DeoptimizerData();
102 ~DeoptimizerData();
103
104 private:
105 MemoryChunk* eager_deoptimization_entry_code_;
106 MemoryChunk* lazy_deoptimization_entry_code_;
107 Deoptimizer* current_;
108
109 // List of deoptimized code which still have references from active stack
110 // frames. These code objects are needed by the deoptimizer when deoptimizing
111 // a frame for which the code object for the function function has been
112 // changed from the code present when deoptimizing was done.
113 DeoptimizingCodeListNode* deoptimizing_code_list_;
114
115 friend class Deoptimizer;
116
117 DISALLOW_COPY_AND_ASSIGN(DeoptimizerData);
118 };
119
120
96 class Deoptimizer : public Malloced { 121 class Deoptimizer : public Malloced {
97 public: 122 public:
98 enum BailoutType { 123 enum BailoutType {
99 EAGER, 124 EAGER,
100 LAZY, 125 LAZY,
101 OSR 126 OSR
102 }; 127 };
103 128
104 int output_count() const { return output_count_; } 129 int output_count() const { return output_count_; }
105 130
106 static Deoptimizer* New(JSFunction* function, 131 static Deoptimizer* New(JSFunction* function,
107 BailoutType type, 132 BailoutType type,
108 unsigned bailout_id, 133 unsigned bailout_id,
109 Address from, 134 Address from,
110 int fp_to_sp_delta); 135 int fp_to_sp_delta,
111 static Deoptimizer* Grab(); 136 Isolate* isolate);
137 static Deoptimizer* Grab(Isolate* isolate);
112 138
113 // Deoptimize the function now. Its current optimized code will never be run 139 // Deoptimize the function now. Its current optimized code will never be run
114 // again and any activations of the optimized code will get deoptimized when 140 // again and any activations of the optimized code will get deoptimized when
115 // execution returns. 141 // execution returns.
116 static void DeoptimizeFunction(JSFunction* function); 142 static void DeoptimizeFunction(JSFunction* function);
117 143
118 // Deoptimize all functions in the heap. 144 // Deoptimize all functions in the heap.
119 static void DeoptimizeAll(); 145 static void DeoptimizeAll();
120 146
121 static void DeoptimizeGlobalObject(JSObject* object); 147 static void DeoptimizeGlobalObject(JSObject* object);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 // Change all patched stack guard checks in the unoptimized code 179 // Change all patched stack guard checks in the unoptimized code
154 // back to a normal stack guard check. 180 // back to a normal stack guard check.
155 static void RevertStackCheckCodeAt(Address pc_after, 181 static void RevertStackCheckCodeAt(Address pc_after,
156 Code* check_code, 182 Code* check_code,
157 Code* replacement_code); 183 Code* replacement_code);
158 184
159 ~Deoptimizer(); 185 ~Deoptimizer();
160 186
161 void InsertHeapNumberValues(int index, JavaScriptFrame* frame); 187 void InsertHeapNumberValues(int index, JavaScriptFrame* frame);
162 188
163 static void ComputeOutputFrames(Deoptimizer* deoptimizer); 189 static void ComputeOutputFrames(Deoptimizer* deoptimizer, Isolate* isolate);
164 190
165 static Address GetDeoptimizationEntry(int id, BailoutType type); 191 static Address GetDeoptimizationEntry(int id, BailoutType type);
166 static int GetDeoptimizationId(Address addr, BailoutType type); 192 static int GetDeoptimizationId(Address addr, BailoutType type);
167 static int GetOutputInfo(DeoptimizationOutputData* data, 193 static int GetOutputInfo(DeoptimizationOutputData* data,
168 unsigned node_id, 194 unsigned node_id,
169 SharedFunctionInfo* shared); 195 SharedFunctionInfo* shared);
170 196
171 static void Setup();
172 static void TearDown();
173
174 // Code generation support. 197 // Code generation support.
175 static int input_offset() { return OFFSET_OF(Deoptimizer, input_); } 198 static int input_offset() { return OFFSET_OF(Deoptimizer, input_); }
176 static int output_count_offset() { 199 static int output_count_offset() {
177 return OFFSET_OF(Deoptimizer, output_count_); 200 return OFFSET_OF(Deoptimizer, output_count_);
178 } 201 }
179 static int output_offset() { return OFFSET_OF(Deoptimizer, output_); } 202 static int output_offset() { return OFFSET_OF(Deoptimizer, output_); }
180 203
181 static int GetDeoptimizedCodeCount(); 204 static int GetDeoptimizedCodeCount(Isolate* isolate);
182 205
183 static const int kNotDeoptimizationEntry = -1; 206 static const int kNotDeoptimizationEntry = -1;
184 207
185 // Generators for the deoptimization entry code. 208 // Generators for the deoptimization entry code.
186 class EntryGenerator BASE_EMBEDDED { 209 class EntryGenerator BASE_EMBEDDED {
187 public: 210 public:
188 EntryGenerator(MacroAssembler* masm, BailoutType type) 211 EntryGenerator(MacroAssembler* masm, BailoutType type)
189 : masm_(masm), type_(type) { } 212 : masm_(masm), type_(type) { }
190 virtual ~EntryGenerator() { } 213 virtual ~EntryGenerator() { }
191 214
(...skipping 20 matching lines...) Expand all
212 235
213 private: 236 private:
214 int count() const { return count_; } 237 int count() const { return count_; }
215 238
216 int count_; 239 int count_;
217 }; 240 };
218 241
219 private: 242 private:
220 static const int kNumberOfEntries = 4096; 243 static const int kNumberOfEntries = 4096;
221 244
222 Deoptimizer(JSFunction* function, 245 Deoptimizer(Isolate* isolate,
246 JSFunction* function,
223 BailoutType type, 247 BailoutType type,
224 unsigned bailout_id, 248 unsigned bailout_id,
225 Address from, 249 Address from,
226 int fp_to_sp_delta); 250 int fp_to_sp_delta);
227 void DeleteFrameDescriptions(); 251 void DeleteFrameDescriptions();
228 252
229 void DoComputeOutputFrames(); 253 void DoComputeOutputFrames();
230 void DoComputeOsrOutputFrame(); 254 void DoComputeOsrOutputFrame();
231 void DoComputeFrame(TranslationIterator* iterator, int frame_index); 255 void DoComputeFrame(TranslationIterator* iterator, int frame_index);
232 void DoTranslateCommand(TranslationIterator* iterator, 256 void DoTranslateCommand(TranslationIterator* iterator,
(...skipping 25 matching lines...) Expand all
258 static MemoryChunk* CreateCode(BailoutType type); 282 static MemoryChunk* CreateCode(BailoutType type);
259 static void GenerateDeoptimizationEntries( 283 static void GenerateDeoptimizationEntries(
260 MacroAssembler* masm, int count, BailoutType type); 284 MacroAssembler* masm, int count, BailoutType type);
261 285
262 // Weak handle callback for deoptimizing code objects. 286 // Weak handle callback for deoptimizing code objects.
263 static void HandleWeakDeoptimizedCode( 287 static void HandleWeakDeoptimizedCode(
264 v8::Persistent<v8::Value> obj, void* data); 288 v8::Persistent<v8::Value> obj, void* data);
265 static Code* FindDeoptimizingCodeFromAddress(Address addr); 289 static Code* FindDeoptimizingCodeFromAddress(Address addr);
266 static void RemoveDeoptimizingCode(Code* code); 290 static void RemoveDeoptimizingCode(Code* code);
267 291
268 static MemoryChunk* eager_deoptimization_entry_code_; 292 Isolate* isolate_;
269 static MemoryChunk* lazy_deoptimization_entry_code_;
270 static Deoptimizer* current_;
271
272 // List of deoptimized code which still have references from active stack
273 // frames. These code objects are needed by the deoptimizer when deoptimizing
274 // a frame for which the code object for the function function has been
275 // changed from the code present when deoptimizing was done.
276 static DeoptimizingCodeListNode* deoptimizing_code_list_;
277
278 JSFunction* function_; 293 JSFunction* function_;
279 Code* optimized_code_; 294 Code* optimized_code_;
280 unsigned bailout_id_; 295 unsigned bailout_id_;
281 BailoutType bailout_type_; 296 BailoutType bailout_type_;
282 Address from_; 297 Address from_;
283 int fp_to_sp_delta_; 298 int fp_to_sp_delta_;
284 299
285 // Input frame description. 300 // Input frame description.
286 FrameDescription* input_; 301 FrameDescription* input_;
287 // Number of output frames. 302 // Number of output frames.
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 Handle<Code> code_; 536 Handle<Code> code_;
522 537
523 // Next pointer for linked list. 538 // Next pointer for linked list.
524 DeoptimizingCodeListNode* next_; 539 DeoptimizingCodeListNode* next_;
525 }; 540 };
526 541
527 542
528 } } // namespace v8::internal 543 } } // namespace v8::internal
529 544
530 #endif // V8_DEOPTIMIZER_H_ 545 #endif // V8_DEOPTIMIZER_H_
OLDNEW
« no previous file with comments | « src/debug-debugger.js ('k') | src/deoptimizer.cc » ('j') | src/heap.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698