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

Side by Side Diff: src/deoptimizer.h

Issue 14830009: Merged r14658 into trunk branch. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 7 years, 7 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
« no previous file with comments | « src/builtins.h ('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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 public: 91 public:
92 virtual ~OptimizedFunctionFilter() {} 92 virtual ~OptimizedFunctionFilter() {}
93 93
94 virtual bool TakeFunction(JSFunction* function) = 0; 94 virtual bool TakeFunction(JSFunction* function) = 0;
95 }; 95 };
96 96
97 97
98 class Deoptimizer; 98 class Deoptimizer;
99 99
100 100
101 class DeoptimizerData {
102 public:
103 explicit DeoptimizerData(MemoryAllocator* allocator);
104 ~DeoptimizerData();
105
106 #ifdef ENABLE_DEBUGGER_SUPPORT
107 void Iterate(ObjectVisitor* v);
108 #endif
109
110 Code* FindDeoptimizingCode(Address addr);
111 void RemoveDeoptimizingCode(Code* code);
112
113 private:
114 MemoryAllocator* allocator_;
115 int eager_deoptimization_entry_code_entries_;
116 int lazy_deoptimization_entry_code_entries_;
117 MemoryChunk* eager_deoptimization_entry_code_;
118 MemoryChunk* lazy_deoptimization_entry_code_;
119 Deoptimizer* current_;
120
121 #ifdef ENABLE_DEBUGGER_SUPPORT
122 DeoptimizedFrameInfo* deoptimized_frame_info_;
123 #endif
124
125 // List of deoptimized code which still have references from active stack
126 // frames. These code objects are needed by the deoptimizer when deoptimizing
127 // a frame for which the code object for the function function has been
128 // changed from the code present when deoptimizing was done.
129 DeoptimizingCodeListNode* deoptimizing_code_list_;
130
131 friend class Deoptimizer;
132
133 DISALLOW_COPY_AND_ASSIGN(DeoptimizerData);
134 };
135
136
137 class Deoptimizer : public Malloced { 101 class Deoptimizer : public Malloced {
138 public: 102 public:
139 enum BailoutType { 103 enum BailoutType {
140 EAGER, 104 EAGER,
141 LAZY, 105 LAZY,
106 SOFT,
142 OSR, 107 OSR,
143 // This last bailout type is not really a bailout, but used by the 108 // This last bailout type is not really a bailout, but used by the
144 // debugger to deoptimize stack frames to allow inspection. 109 // debugger to deoptimize stack frames to allow inspection.
145 DEBUGGER 110 DEBUGGER
146 }; 111 };
147 112
113 static const int kBailoutTypesWithCodeEntry = SOFT + 1;
114
115 struct JumpTableEntry {
116 inline JumpTableEntry(Address entry,
117 Deoptimizer::BailoutType type,
118 bool frame)
119 : label(),
120 address(entry),
121 bailout_type(type),
122 needs_frame(frame) { }
123 Label label;
124 Address address;
125 Deoptimizer::BailoutType bailout_type;
126 bool needs_frame;
127 };
128
148 static bool TraceEnabledFor(BailoutType deopt_type, 129 static bool TraceEnabledFor(BailoutType deopt_type,
149 StackFrame::Type frame_type); 130 StackFrame::Type frame_type);
150 static const char* MessageFor(BailoutType type); 131 static const char* MessageFor(BailoutType type);
151 132
152 int output_count() const { return output_count_; } 133 int output_count() const { return output_count_; }
153 134
154 Code::Kind compiled_code_kind() const { return compiled_code_->kind(); } 135 Code::Kind compiled_code_kind() const { return compiled_code_->kind(); }
155 136
156 // Number of created JS frames. Not all created frames are necessarily JS. 137 // Number of created JS frames. Not all created frames are necessarily JS.
157 int jsframe_count() const { return jsframe_count_; } 138 int jsframe_count() const { return jsframe_count_; }
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 intptr_t* GetFrameSlotPointer(unsigned offset) { 600 intptr_t* GetFrameSlotPointer(unsigned offset) {
620 ASSERT(offset < frame_size_); 601 ASSERT(offset < frame_size_);
621 return reinterpret_cast<intptr_t*>( 602 return reinterpret_cast<intptr_t*>(
622 reinterpret_cast<Address>(this) + frame_content_offset() + offset); 603 reinterpret_cast<Address>(this) + frame_content_offset() + offset);
623 } 604 }
624 605
625 int ComputeFixedSize(); 606 int ComputeFixedSize();
626 }; 607 };
627 608
628 609
610 class DeoptimizerData {
611 public:
612 explicit DeoptimizerData(MemoryAllocator* allocator);
613 ~DeoptimizerData();
614
615 #ifdef ENABLE_DEBUGGER_SUPPORT
616 void Iterate(ObjectVisitor* v);
617 #endif
618
619 Code* FindDeoptimizingCode(Address addr);
620 void RemoveDeoptimizingCode(Code* code);
621
622 private:
623 MemoryAllocator* allocator_;
624 int deopt_entry_code_entries_[Deoptimizer::kBailoutTypesWithCodeEntry];
625 MemoryChunk* deopt_entry_code_[Deoptimizer::kBailoutTypesWithCodeEntry];
626 Deoptimizer* current_;
627
628 #ifdef ENABLE_DEBUGGER_SUPPORT
629 DeoptimizedFrameInfo* deoptimized_frame_info_;
630 #endif
631
632 // List of deoptimized code which still have references from active stack
633 // frames. These code objects are needed by the deoptimizer when deoptimizing
634 // a frame for which the code object for the function function has been
635 // changed from the code present when deoptimizing was done.
636 DeoptimizingCodeListNode* deoptimizing_code_list_;
637
638 friend class Deoptimizer;
639
640 DISALLOW_COPY_AND_ASSIGN(DeoptimizerData);
641 };
642
643
629 class TranslationBuffer BASE_EMBEDDED { 644 class TranslationBuffer BASE_EMBEDDED {
630 public: 645 public:
631 explicit TranslationBuffer(Zone* zone) : contents_(256, zone) { } 646 explicit TranslationBuffer(Zone* zone) : contents_(256, zone) { }
632 647
633 int CurrentIndex() const { return contents_.length(); } 648 int CurrentIndex() const { return contents_.length(); }
634 void Add(int32_t value, Zone* zone); 649 void Add(int32_t value, Zone* zone);
635 650
636 Handle<ByteArray> CreateByteArray(Factory* factory); 651 Handle<ByteArray> CreateByteArray(Factory* factory);
637 652
638 private: 653 private:
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 Object** expression_stack_; 932 Object** expression_stack_;
918 int source_position_; 933 int source_position_;
919 934
920 friend class Deoptimizer; 935 friend class Deoptimizer;
921 }; 936 };
922 #endif 937 #endif
923 938
924 } } // namespace v8::internal 939 } } // namespace v8::internal
925 940
926 #endif // V8_DEOPTIMIZER_H_ 941 #endif // V8_DEOPTIMIZER_H_
OLDNEW
« no previous file with comments | « src/builtins.h ('k') | src/deoptimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698