| OLD | NEW |
| 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 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 | 36 |
| 37 namespace v8 { | 37 namespace v8 { |
| 38 namespace internal { | 38 namespace internal { |
| 39 | 39 |
| 40 class FrameDescription; | 40 class FrameDescription; |
| 41 class TranslationIterator; | 41 class TranslationIterator; |
| 42 class DeoptimizingCodeListNode; | 42 class DeoptimizingCodeListNode; |
| 43 | 43 |
| 44 | 44 |
| 45 class ValueDescription BASE_EMBEDDED { | 45 class HeapNumberMaterializationDescriptor BASE_EMBEDDED { |
| 46 public: | 46 public: |
| 47 explicit ValueDescription(int index) : stack_index_(index) { } | 47 HeapNumberMaterializationDescriptor(Address slot_address, double val) |
| 48 int stack_index() const { return stack_index_; } | 48 : slot_address_(slot_address), val_(val) { } |
| 49 |
| 50 Address slot_address() const { return slot_address_; } |
| 51 double value() const { return val_; } |
| 49 | 52 |
| 50 private: | 53 private: |
| 51 // Offset relative to the top of the stack. | 54 Address slot_address_; |
| 52 int stack_index_; | 55 double val_; |
| 53 }; | |
| 54 | |
| 55 | |
| 56 class ValueDescriptionInteger32: public ValueDescription { | |
| 57 public: | |
| 58 ValueDescriptionInteger32(int index, int32_t value) | |
| 59 : ValueDescription(index), int32_value_(value) { } | |
| 60 int32_t int32_value() const { return int32_value_; } | |
| 61 | |
| 62 private: | |
| 63 // Raw value. | |
| 64 int32_t int32_value_; | |
| 65 }; | |
| 66 | |
| 67 | |
| 68 class ValueDescriptionDouble: public ValueDescription { | |
| 69 public: | |
| 70 ValueDescriptionDouble(int index, double value) | |
| 71 : ValueDescription(index), double_value_(value) { } | |
| 72 double double_value() const { return double_value_; } | |
| 73 | |
| 74 private: | |
| 75 // Raw value. | |
| 76 double double_value_; | |
| 77 }; | 56 }; |
| 78 | 57 |
| 79 | 58 |
| 80 class OptimizedFunctionVisitor BASE_EMBEDDED { | 59 class OptimizedFunctionVisitor BASE_EMBEDDED { |
| 81 public: | 60 public: |
| 82 virtual ~OptimizedFunctionVisitor() {} | 61 virtual ~OptimizedFunctionVisitor() {} |
| 83 | 62 |
| 84 // Function which is called before iteration of any optimized functions | 63 // Function which is called before iteration of any optimized functions |
| 85 // from given global context. | 64 // from given global context. |
| 86 virtual void EnterContext(Context* context) = 0; | 65 virtual void EnterContext(Context* context) = 0; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 Code* replacement_code); | 136 Code* replacement_code); |
| 158 | 137 |
| 159 // Change all patched stack guard checks in the unoptimized code | 138 // Change all patched stack guard checks in the unoptimized code |
| 160 // back to a normal stack guard check. | 139 // back to a normal stack guard check. |
| 161 static void RevertStackCheckCodeAt(Address pc_after, | 140 static void RevertStackCheckCodeAt(Address pc_after, |
| 162 Code* check_code, | 141 Code* check_code, |
| 163 Code* replacement_code); | 142 Code* replacement_code); |
| 164 | 143 |
| 165 ~Deoptimizer(); | 144 ~Deoptimizer(); |
| 166 | 145 |
| 167 void InsertHeapNumberValues(int index, JavaScriptFrame* frame); | 146 void MaterializeHeapNumbers(); |
| 168 | 147 |
| 169 static void ComputeOutputFrames(Deoptimizer* deoptimizer); | 148 static void ComputeOutputFrames(Deoptimizer* deoptimizer); |
| 170 | 149 |
| 171 static Address GetDeoptimizationEntry(int id, BailoutType type); | 150 static Address GetDeoptimizationEntry(int id, BailoutType type); |
| 172 static int GetDeoptimizationId(Address addr, BailoutType type); | 151 static int GetDeoptimizationId(Address addr, BailoutType type); |
| 173 static int GetOutputInfo(DeoptimizationOutputData* data, | 152 static int GetOutputInfo(DeoptimizationOutputData* data, |
| 174 unsigned node_id, | 153 unsigned node_id, |
| 175 SharedFunctionInfo* shared); | 154 SharedFunctionInfo* shared); |
| 176 | 155 |
| 177 static void Setup(); | 156 static void Setup(); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 int* input_offset); | 225 int* input_offset); |
| 247 | 226 |
| 248 unsigned ComputeInputFrameSize() const; | 227 unsigned ComputeInputFrameSize() const; |
| 249 unsigned ComputeFixedSize(JSFunction* function) const; | 228 unsigned ComputeFixedSize(JSFunction* function) const; |
| 250 | 229 |
| 251 unsigned ComputeIncomingArgumentSize(JSFunction* function) const; | 230 unsigned ComputeIncomingArgumentSize(JSFunction* function) const; |
| 252 unsigned ComputeOutgoingArgumentSize() const; | 231 unsigned ComputeOutgoingArgumentSize() const; |
| 253 | 232 |
| 254 Object* ComputeLiteral(int index) const; | 233 Object* ComputeLiteral(int index) const; |
| 255 | 234 |
| 256 void InsertHeapNumberValue(JavaScriptFrame* frame, | 235 void AddDoubleValue(intptr_t slot_address, double value); |
| 257 int stack_index, | |
| 258 double val, | |
| 259 int extra_slot_count); | |
| 260 | |
| 261 void AddInteger32Value(int frame_index, int slot_index, int32_t value); | |
| 262 void AddDoubleValue(int frame_index, int slot_index, double value); | |
| 263 | 236 |
| 264 static LargeObjectChunk* CreateCode(BailoutType type); | 237 static LargeObjectChunk* CreateCode(BailoutType type); |
| 265 static void GenerateDeoptimizationEntries( | 238 static void GenerateDeoptimizationEntries( |
| 266 MacroAssembler* masm, int count, BailoutType type); | 239 MacroAssembler* masm, int count, BailoutType type); |
| 267 | 240 |
| 268 // Weak handle callback for deoptimizing code objects. | 241 // Weak handle callback for deoptimizing code objects. |
| 269 static void HandleWeakDeoptimizedCode( | 242 static void HandleWeakDeoptimizedCode( |
| 270 v8::Persistent<v8::Value> obj, void* data); | 243 v8::Persistent<v8::Value> obj, void* data); |
| 271 static Code* FindDeoptimizingCodeFromAddress(Address addr); | 244 static Code* FindDeoptimizingCodeFromAddress(Address addr); |
| 272 static void RemoveDeoptimizingCode(Code* code); | 245 static void RemoveDeoptimizingCode(Code* code); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 288 Address from_; | 261 Address from_; |
| 289 int fp_to_sp_delta_; | 262 int fp_to_sp_delta_; |
| 290 | 263 |
| 291 // Input frame description. | 264 // Input frame description. |
| 292 FrameDescription* input_; | 265 FrameDescription* input_; |
| 293 // Number of output frames. | 266 // Number of output frames. |
| 294 int output_count_; | 267 int output_count_; |
| 295 // Array of output frame descriptions. | 268 // Array of output frame descriptions. |
| 296 FrameDescription** output_; | 269 FrameDescription** output_; |
| 297 | 270 |
| 298 List<ValueDescriptionInteger32>* integer32_values_; | 271 List<HeapNumberMaterializationDescriptor> deferred_heap_numbers_; |
| 299 List<ValueDescriptionDouble>* double_values_; | |
| 300 | 272 |
| 301 static int table_entry_size_; | 273 static int table_entry_size_; |
| 302 | 274 |
| 303 friend class FrameDescription; | 275 friend class FrameDescription; |
| 304 friend class DeoptimizingCodeListNode; | 276 friend class DeoptimizingCodeListNode; |
| 305 }; | 277 }; |
| 306 | 278 |
| 307 | 279 |
| 308 class FrameDescription { | 280 class FrameDescription { |
| 309 public: | 281 public: |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 Handle<Code> code_; | 499 Handle<Code> code_; |
| 528 | 500 |
| 529 // Next pointer for linked list. | 501 // Next pointer for linked list. |
| 530 DeoptimizingCodeListNode* next_; | 502 DeoptimizingCodeListNode* next_; |
| 531 }; | 503 }; |
| 532 | 504 |
| 533 | 505 |
| 534 } } // namespace v8::internal | 506 } } // namespace v8::internal |
| 535 | 507 |
| 536 #endif // V8_DEOPTIMIZER_H_ | 508 #endif // V8_DEOPTIMIZER_H_ |
| OLD | NEW |