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

Side by Side Diff: src/deoptimizer.h

Issue 10701054: Enable stub generation using Hydrogen/Lithium (again) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merge with latest Created 8 years 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
« no previous file with comments | « src/compiler.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 // 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 EAGER, 128 EAGER,
129 LAZY, 129 LAZY,
130 OSR, 130 OSR,
131 // This last bailout type is not really a bailout, but used by the 131 // This last bailout type is not really a bailout, but used by the
132 // debugger to deoptimize stack frames to allow inspection. 132 // debugger to deoptimize stack frames to allow inspection.
133 DEBUGGER 133 DEBUGGER
134 }; 134 };
135 135
136 int output_count() const { return output_count_; } 136 int output_count() const { return output_count_; }
137 137
138 Code::Kind compiled_code_kind() const { return compiled_code_->kind(); }
139
138 // Number of created JS frames. Not all created frames are necessarily JS. 140 // Number of created JS frames. Not all created frames are necessarily JS.
139 int jsframe_count() const { return jsframe_count_; } 141 int jsframe_count() const { return jsframe_count_; }
140 142
141 static Deoptimizer* New(JSFunction* function, 143 static Deoptimizer* New(JSFunction* function,
142 BailoutType type, 144 BailoutType type,
143 unsigned bailout_id, 145 unsigned bailout_id,
144 Address from, 146 Address from,
145 int fp_to_sp_delta, 147 int fp_to_sp_delta,
146 Isolate* isolate); 148 Isolate* isolate);
147 static Deoptimizer* Grab(Isolate* isolate); 149 static Deoptimizer* Grab(Isolate* isolate);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 private: 292 private:
291 int count() const { return count_; } 293 int count() const { return count_; }
292 294
293 int count_; 295 int count_;
294 }; 296 };
295 297
296 int ConvertJSFrameIndexToFrameIndex(int jsframe_index); 298 int ConvertJSFrameIndexToFrameIndex(int jsframe_index);
297 299
298 static size_t GetMaxDeoptTableSize(); 300 static size_t GetMaxDeoptTableSize();
299 301
302 static void EnsureCodeForDeoptimizationEntry(BailoutType type,
303 int max_entry_id);
304
300 private: 305 private:
301 static const int kMinNumberOfEntries = 64; 306 static const int kMinNumberOfEntries = 64;
302 static const int kMaxNumberOfEntries = 16384; 307 static const int kMaxNumberOfEntries = 16384;
303 308
304 Deoptimizer(Isolate* isolate, 309 Deoptimizer(Isolate* isolate,
305 JSFunction* function, 310 JSFunction* function,
306 BailoutType type, 311 BailoutType type,
307 unsigned bailout_id, 312 unsigned bailout_id,
308 Address from, 313 Address from,
309 int fp_to_sp_delta, 314 int fp_to_sp_delta,
310 Code* optimized_code); 315 Code* optimized_code);
311 void DeleteFrameDescriptions(); 316 void DeleteFrameDescriptions();
312 317
313 void DoComputeOutputFrames(); 318 void DoComputeOutputFrames();
314 void DoComputeOsrOutputFrame(); 319 void DoComputeOsrOutputFrame();
315 void DoComputeJSFrame(TranslationIterator* iterator, int frame_index); 320 void DoComputeJSFrame(TranslationIterator* iterator, int frame_index);
316 void DoComputeArgumentsAdaptorFrame(TranslationIterator* iterator, 321 void DoComputeArgumentsAdaptorFrame(TranslationIterator* iterator,
317 int frame_index); 322 int frame_index);
318 void DoComputeConstructStubFrame(TranslationIterator* iterator, 323 void DoComputeConstructStubFrame(TranslationIterator* iterator,
319 int frame_index); 324 int frame_index);
320 void DoComputeAccessorStubFrame(TranslationIterator* iterator, 325 void DoComputeAccessorStubFrame(TranslationIterator* iterator,
321 int frame_index, 326 int frame_index,
322 bool is_setter_stub_frame); 327 bool is_setter_stub_frame);
328 void DoCompiledStubFrame(TranslationIterator* iterator,
329 int frame_index);
323 void DoTranslateCommand(TranslationIterator* iterator, 330 void DoTranslateCommand(TranslationIterator* iterator,
324 int frame_index, 331 int frame_index,
325 unsigned output_offset); 332 unsigned output_offset);
326 // Translate a command for OSR. Updates the input offset to be used for 333 // Translate a command for OSR. Updates the input offset to be used for
327 // the next command. Returns false if translation of the command failed 334 // the next command. Returns false if translation of the command failed
328 // (e.g., a number conversion failed) and may or may not have updated the 335 // (e.g., a number conversion failed) and may or may not have updated the
329 // input offset. 336 // input offset.
330 bool DoOsrTranslateCommand(TranslationIterator* iterator, 337 bool DoOsrTranslateCommand(TranslationIterator* iterator,
331 int* input_offset); 338 int* input_offset);
332 339
333 unsigned ComputeInputFrameSize() const; 340 unsigned ComputeInputFrameSize() const;
334 unsigned ComputeFixedSize(JSFunction* function) const; 341 unsigned ComputeFixedSize(JSFunction* function) const;
335 342
336 unsigned ComputeIncomingArgumentSize(JSFunction* function) const; 343 unsigned ComputeIncomingArgumentSize(JSFunction* function) const;
337 unsigned ComputeOutgoingArgumentSize() const; 344 unsigned ComputeOutgoingArgumentSize() const;
338 345
339 Object* ComputeLiteral(int index) const; 346 Object* ComputeLiteral(int index) const;
340 347
341 void AddArgumentsObject(intptr_t slot_address, int argc); 348 void AddArgumentsObject(intptr_t slot_address, int argc);
342 void AddArgumentsObjectValue(intptr_t value); 349 void AddArgumentsObjectValue(intptr_t value);
343 void AddDoubleValue(intptr_t slot_address, double value); 350 void AddDoubleValue(intptr_t slot_address, double value);
344 351
345 static void EnsureCodeForDeoptimizationEntry(BailoutType type,
346 int max_entry_id);
347 static void GenerateDeoptimizationEntries( 352 static void GenerateDeoptimizationEntries(
348 MacroAssembler* masm, int count, BailoutType type); 353 MacroAssembler* masm, int count, BailoutType type);
349 354
350 // Weak handle callback for deoptimizing code objects. 355 // Weak handle callback for deoptimizing code objects.
351 static void HandleWeakDeoptimizedCode( 356 static void HandleWeakDeoptimizedCode(
352 v8::Persistent<v8::Value> obj, void* data); 357 v8::Persistent<v8::Value> obj, void* data);
353 static Code* FindDeoptimizingCodeFromAddress(Address addr); 358 static Code* FindDeoptimizingCodeFromAddress(Address addr);
354 static void RemoveDeoptimizingCode(Code* code); 359 static void RemoveDeoptimizingCode(Code* code);
355 360
356 // Fill the input from from a JavaScript frame. This is used when 361 // Fill the input from from a JavaScript frame. This is used when
357 // the debugger needs to inspect an optimized frame. For normal 362 // the debugger needs to inspect an optimized frame. For normal
358 // deoptimizations the input frame is filled in generated code. 363 // deoptimizations the input frame is filled in generated code.
359 void FillInputFrame(Address tos, JavaScriptFrame* frame); 364 void FillInputFrame(Address tos, JavaScriptFrame* frame);
360 365
361 Isolate* isolate_; 366 Isolate* isolate_;
362 JSFunction* function_; 367 JSFunction* function_;
363 Code* optimized_code_; 368 Code* compiled_code_;
364 unsigned bailout_id_; 369 unsigned bailout_id_;
365 BailoutType bailout_type_; 370 BailoutType bailout_type_;
366 Address from_; 371 Address from_;
367 int fp_to_sp_delta_; 372 int fp_to_sp_delta_;
368 int has_alignment_padding_; 373 int has_alignment_padding_;
369 374
370 // Input frame description. 375 // Input frame description.
371 FrameDescription* input_; 376 FrameDescription* input_;
372 // Number of output frames. 377 // Number of output frames.
373 int output_count_; 378 int output_count_;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 528
524 private: 529 private:
525 static const uint32_t kZapUint32 = 0xbeeddead; 530 static const uint32_t kZapUint32 = 0xbeeddead;
526 531
527 // Frame_size_ must hold a uint32_t value. It is only a uintptr_t to 532 // Frame_size_ must hold a uint32_t value. It is only a uintptr_t to
528 // keep the variable-size array frame_content_ of type intptr_t at 533 // keep the variable-size array frame_content_ of type intptr_t at
529 // the end of the structure aligned. 534 // the end of the structure aligned.
530 uintptr_t frame_size_; // Number of bytes. 535 uintptr_t frame_size_; // Number of bytes.
531 JSFunction* function_; 536 JSFunction* function_;
532 intptr_t registers_[Register::kNumRegisters]; 537 intptr_t registers_[Register::kNumRegisters];
533 double double_registers_[DoubleRegister::kNumAllocatableRegisters]; 538 double double_registers_[DoubleRegister::kMaxNumAllocatableRegisters];
534 intptr_t top_; 539 intptr_t top_;
535 intptr_t pc_; 540 intptr_t pc_;
536 intptr_t fp_; 541 intptr_t fp_;
537 intptr_t context_; 542 intptr_t context_;
538 StackFrame::Type type_; 543 StackFrame::Type type_;
539 Smi* state_; 544 Smi* state_;
540 545
541 // Continuation is the PC where the execution continues after 546 // Continuation is the PC where the execution continues after
542 // deoptimizing. 547 // deoptimizing.
543 intptr_t continuation_; 548 intptr_t continuation_;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 598
594 class Translation BASE_EMBEDDED { 599 class Translation BASE_EMBEDDED {
595 public: 600 public:
596 enum Opcode { 601 enum Opcode {
597 BEGIN, 602 BEGIN,
598 JS_FRAME, 603 JS_FRAME,
599 CONSTRUCT_STUB_FRAME, 604 CONSTRUCT_STUB_FRAME,
600 GETTER_STUB_FRAME, 605 GETTER_STUB_FRAME,
601 SETTER_STUB_FRAME, 606 SETTER_STUB_FRAME,
602 ARGUMENTS_ADAPTOR_FRAME, 607 ARGUMENTS_ADAPTOR_FRAME,
608 COMPILED_STUB_FRAME,
603 REGISTER, 609 REGISTER,
604 INT32_REGISTER, 610 INT32_REGISTER,
605 UINT32_REGISTER, 611 UINT32_REGISTER,
606 DOUBLE_REGISTER, 612 DOUBLE_REGISTER,
607 STACK_SLOT, 613 STACK_SLOT,
608 INT32_STACK_SLOT, 614 INT32_STACK_SLOT,
609 UINT32_STACK_SLOT, 615 UINT32_STACK_SLOT,
610 DOUBLE_STACK_SLOT, 616 DOUBLE_STACK_SLOT,
611 LITERAL, 617 LITERAL,
612 ARGUMENTS_OBJECT, 618 ARGUMENTS_OBJECT,
(...skipping 10 matching lines...) Expand all
623 zone_(zone) { 629 zone_(zone) {
624 buffer_->Add(BEGIN, zone); 630 buffer_->Add(BEGIN, zone);
625 buffer_->Add(frame_count, zone); 631 buffer_->Add(frame_count, zone);
626 buffer_->Add(jsframe_count, zone); 632 buffer_->Add(jsframe_count, zone);
627 } 633 }
628 634
629 int index() const { return index_; } 635 int index() const { return index_; }
630 636
631 // Commands. 637 // Commands.
632 void BeginJSFrame(BailoutId node_id, int literal_id, unsigned height); 638 void BeginJSFrame(BailoutId node_id, int literal_id, unsigned height);
639 void BeginCompiledStubFrame();
633 void BeginArgumentsAdaptorFrame(int literal_id, unsigned height); 640 void BeginArgumentsAdaptorFrame(int literal_id, unsigned height);
634 void BeginConstructStubFrame(int literal_id, unsigned height); 641 void BeginConstructStubFrame(int literal_id, unsigned height);
635 void BeginGetterStubFrame(int literal_id); 642 void BeginGetterStubFrame(int literal_id);
636 void BeginSetterStubFrame(int literal_id); 643 void BeginSetterStubFrame(int literal_id);
637 void StoreRegister(Register reg); 644 void StoreRegister(Register reg);
638 void StoreInt32Register(Register reg); 645 void StoreInt32Register(Register reg);
639 void StoreUint32Register(Register reg); 646 void StoreUint32Register(Register reg);
640 void StoreDoubleRegister(DoubleRegister reg); 647 void StoreDoubleRegister(DoubleRegister reg);
641 void StoreStackSlot(int index); 648 void StoreStackSlot(int index);
642 void StoreInt32StackSlot(int index); 649 void StoreInt32StackSlot(int index);
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 Object** expression_stack_; 853 Object** expression_stack_;
847 int source_position_; 854 int source_position_;
848 855
849 friend class Deoptimizer; 856 friend class Deoptimizer;
850 }; 857 };
851 #endif 858 #endif
852 859
853 } } // namespace v8::internal 860 } } // namespace v8::internal
854 861
855 #endif // V8_DEOPTIMIZER_H_ 862 #endif // V8_DEOPTIMIZER_H_
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/deoptimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698