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

Side by Side Diff: src/full-codegen.h

Issue 1010883002: Switch full-codegen from StackHandlers to handler table. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_cleanup-isolate-dead-code
Patch Set: Fix debugger-pause-on-promise-rejection. Created 5 years, 9 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/frames-inl.h ('k') | src/full-codegen.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_FULL_CODEGEN_H_ 5 #ifndef V8_FULL_CODEGEN_H_
6 #define V8_FULL_CODEGEN_H_ 6 #define V8_FULL_CODEGEN_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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // Notify the statement that we are exiting it via break, continue, or 149 // Notify the statement that we are exiting it via break, continue, or
150 // return and give it a chance to generate cleanup code. Return the 150 // return and give it a chance to generate cleanup code. Return the
151 // next outer statement in the nesting stack. We accumulate in 151 // next outer statement in the nesting stack. We accumulate in
152 // *stack_depth the amount to drop the stack and in *context_length the 152 // *stack_depth the amount to drop the stack and in *context_length the
153 // number of context chain links to unwind as we traverse the nesting 153 // number of context chain links to unwind as we traverse the nesting
154 // stack from an exit to its target. 154 // stack from an exit to its target.
155 virtual NestedStatement* Exit(int* stack_depth, int* context_length) { 155 virtual NestedStatement* Exit(int* stack_depth, int* context_length) {
156 return previous_; 156 return previous_;
157 } 157 }
158 158
159 // Like the Exit() method above, but limited to accumulating stack depth.
160 virtual NestedStatement* AccumulateDepth(int* stack_depth) {
161 return previous_;
162 }
163
159 protected: 164 protected:
160 MacroAssembler* masm() { return codegen_->masm(); } 165 MacroAssembler* masm() { return codegen_->masm(); }
161 166
162 FullCodeGenerator* codegen_; 167 FullCodeGenerator* codegen_;
163 NestedStatement* previous_; 168 NestedStatement* previous_;
164 169
165 private: 170 private:
166 DISALLOW_COPY_AND_ASSIGN(NestedStatement); 171 DISALLOW_COPY_AND_ASSIGN(NestedStatement);
167 }; 172 };
168 173
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 if (statement()->AsBlock()->scope() != NULL) { 223 if (statement()->AsBlock()->scope() != NULL) {
219 ++(*context_length); 224 ++(*context_length);
220 } 225 }
221 return previous_; 226 return previous_;
222 } 227 }
223 }; 228 };
224 229
225 // The try block of a try/catch statement. 230 // The try block of a try/catch statement.
226 class TryCatch : public NestedStatement { 231 class TryCatch : public NestedStatement {
227 public: 232 public:
228 explicit TryCatch(FullCodeGenerator* codegen) : NestedStatement(codegen) { 233 static const int kElementCount = TryBlockConstant::kElementCount;
229 } 234
235 explicit TryCatch(FullCodeGenerator* codegen) : NestedStatement(codegen) {}
230 virtual ~TryCatch() {} 236 virtual ~TryCatch() {}
231 237
232 virtual NestedStatement* Exit(int* stack_depth, int* context_length); 238 virtual NestedStatement* Exit(int* stack_depth, int* context_length) {
239 *stack_depth += kElementCount;
240 return previous_;
241 }
242 virtual NestedStatement* AccumulateDepth(int* stack_depth) {
243 *stack_depth += kElementCount;
244 return previous_;
245 }
233 }; 246 };
234 247
235 // The try block of a try/finally statement. 248 // The try block of a try/finally statement.
236 class TryFinally : public NestedStatement { 249 class TryFinally : public NestedStatement {
237 public: 250 public:
251 static const int kElementCount = TryBlockConstant::kElementCount;
252
238 TryFinally(FullCodeGenerator* codegen, Label* finally_entry) 253 TryFinally(FullCodeGenerator* codegen, Label* finally_entry)
239 : NestedStatement(codegen), finally_entry_(finally_entry) { 254 : NestedStatement(codegen), finally_entry_(finally_entry) {
240 } 255 }
241 virtual ~TryFinally() {} 256 virtual ~TryFinally() {}
242 257
243 virtual NestedStatement* Exit(int* stack_depth, int* context_length); 258 virtual NestedStatement* Exit(int* stack_depth, int* context_length);
259 virtual NestedStatement* AccumulateDepth(int* stack_depth) {
260 *stack_depth += kElementCount;
261 return previous_;
262 }
244 263
245 private: 264 private:
246 Label* finally_entry_; 265 Label* finally_entry_;
247 }; 266 };
248 267
249 // The finally block of a try/finally statement. 268 // The finally block of a try/finally statement.
250 class Finally : public NestedStatement { 269 class Finally : public NestedStatement {
251 public: 270 public:
252 static const int kElementCount = 3; 271 static const int kElementCount = 3;
253 272
254 explicit Finally(FullCodeGenerator* codegen) : NestedStatement(codegen) { } 273 explicit Finally(FullCodeGenerator* codegen) : NestedStatement(codegen) {}
255 virtual ~Finally() {} 274 virtual ~Finally() {}
256 275
257 virtual NestedStatement* Exit(int* stack_depth, int* context_length) { 276 virtual NestedStatement* Exit(int* stack_depth, int* context_length) {
258 *stack_depth += kElementCount; 277 *stack_depth += kElementCount;
259 return previous_; 278 return previous_;
260 } 279 }
280 virtual NestedStatement* AccumulateDepth(int* stack_depth) {
281 *stack_depth += kElementCount;
282 return previous_;
283 }
261 }; 284 };
262 285
263 // The body of a for/in loop. 286 // The body of a for/in loop.
264 class ForIn : public Iteration { 287 class ForIn : public Iteration {
265 public: 288 public:
266 static const int kElementCount = 5; 289 static const int kElementCount = 5;
267 290
268 ForIn(FullCodeGenerator* codegen, ForInStatement* statement) 291 ForIn(FullCodeGenerator* codegen, ForInStatement* statement)
269 : Iteration(codegen, statement) { 292 : Iteration(codegen, statement) {
270 } 293 }
271 virtual ~ForIn() {} 294 virtual ~ForIn() {}
272 295
273 virtual NestedStatement* Exit(int* stack_depth, int* context_length) { 296 virtual NestedStatement* Exit(int* stack_depth, int* context_length) {
274 *stack_depth += kElementCount; 297 *stack_depth += kElementCount;
275 return previous_; 298 return previous_;
276 } 299 }
300 virtual NestedStatement* AccumulateDepth(int* stack_depth) {
301 *stack_depth += kElementCount;
302 return previous_;
303 }
277 }; 304 };
278 305
279 306
280 // The body of a with or catch. 307 // The body of a with or catch.
281 class WithOrCatch : public NestedStatement { 308 class WithOrCatch : public NestedStatement {
282 public: 309 public:
283 explicit WithOrCatch(FullCodeGenerator* codegen) 310 explicit WithOrCatch(FullCodeGenerator* codegen)
284 : NestedStatement(codegen) { 311 : NestedStatement(codegen) {
285 } 312 }
286 virtual ~WithOrCatch() {} 313 virtual ~WithOrCatch() {}
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 void CallGlobalLoadIC(Handle<String> name); 695 void CallGlobalLoadIC(Handle<String> name);
669 void CallStoreIC(TypeFeedbackId id = TypeFeedbackId::None()); 696 void CallStoreIC(TypeFeedbackId id = TypeFeedbackId::None());
670 697
671 void SetFunctionPosition(FunctionLiteral* fun); 698 void SetFunctionPosition(FunctionLiteral* fun);
672 void SetReturnPosition(FunctionLiteral* fun); 699 void SetReturnPosition(FunctionLiteral* fun);
673 void SetStatementPosition(Statement* stmt); 700 void SetStatementPosition(Statement* stmt);
674 void SetExpressionPosition(Expression* expr); 701 void SetExpressionPosition(Expression* expr);
675 void SetSourcePosition(int pos); 702 void SetSourcePosition(int pos);
676 703
677 // Non-local control flow support. 704 // Non-local control flow support.
705 void EnterTryBlock(int handler_index, Label* handler);
706 void ExitTryBlock(int handler_index);
678 void EnterFinallyBlock(); 707 void EnterFinallyBlock();
679 void ExitFinallyBlock(); 708 void ExitFinallyBlock();
680 709
681 // Loop nesting counter. 710 // Loop nesting counter.
682 int loop_depth() { return loop_depth_; } 711 int loop_depth() { return loop_depth_; }
683 void increment_loop_depth() { loop_depth_++; } 712 void increment_loop_depth() { loop_depth_++; }
684 void decrement_loop_depth() { 713 void decrement_loop_depth() {
685 DCHECK(loop_depth_ > 0); 714 DCHECK(loop_depth_ > 0);
686 loop_depth_--; 715 loop_depth_--;
687 } 716 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 void VisitComma(BinaryOperation* expr); 752 void VisitComma(BinaryOperation* expr);
724 void VisitLogicalExpression(BinaryOperation* expr); 753 void VisitLogicalExpression(BinaryOperation* expr);
725 void VisitArithmeticExpression(BinaryOperation* expr); 754 void VisitArithmeticExpression(BinaryOperation* expr);
726 755
727 void VisitForTypeofValue(Expression* expr); 756 void VisitForTypeofValue(Expression* expr);
728 757
729 void Generate(); 758 void Generate();
730 void PopulateDeoptimizationData(Handle<Code> code); 759 void PopulateDeoptimizationData(Handle<Code> code);
731 void PopulateTypeFeedbackInfo(Handle<Code> code); 760 void PopulateTypeFeedbackInfo(Handle<Code> code);
732 761
733 Handle<FixedArray> handler_table() { return handler_table_; } 762 Handle<HandlerTable> handler_table() { return handler_table_; }
734 763
735 struct BailoutEntry { 764 struct BailoutEntry {
736 BailoutId id; 765 BailoutId id;
737 unsigned pc_and_state; 766 unsigned pc_and_state;
738 }; 767 };
739 768
740 struct BackEdgeEntry { 769 struct BackEdgeEntry {
741 BailoutId id; 770 BailoutId id;
742 unsigned pc; 771 unsigned pc;
743 uint32_t loop_depth; 772 uint32_t loop_depth;
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 Label return_label_; 970 Label return_label_;
942 NestedStatement* nesting_stack_; 971 NestedStatement* nesting_stack_;
943 int loop_depth_; 972 int loop_depth_;
944 ZoneList<Handle<Object> >* globals_; 973 ZoneList<Handle<Object> >* globals_;
945 Handle<FixedArray> modules_; 974 Handle<FixedArray> modules_;
946 int module_index_; 975 int module_index_;
947 const ExpressionContext* context_; 976 const ExpressionContext* context_;
948 ZoneList<BailoutEntry> bailout_entries_; 977 ZoneList<BailoutEntry> bailout_entries_;
949 ZoneList<BackEdgeEntry> back_edges_; 978 ZoneList<BackEdgeEntry> back_edges_;
950 int ic_total_count_; 979 int ic_total_count_;
951 Handle<FixedArray> handler_table_; 980 Handle<HandlerTable> handler_table_;
952 Handle<Cell> profiling_counter_; 981 Handle<Cell> profiling_counter_;
953 bool generate_debug_code_; 982 bool generate_debug_code_;
954 983
955 friend class NestedStatement; 984 friend class NestedStatement;
956 985
957 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); 986 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
958 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); 987 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator);
959 }; 988 };
960 989
961 990
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 1089
1061 Address start_; 1090 Address start_;
1062 Address instruction_start_; 1091 Address instruction_start_;
1063 uint32_t length_; 1092 uint32_t length_;
1064 }; 1093 };
1065 1094
1066 1095
1067 } } // namespace v8::internal 1096 } } // namespace v8::internal
1068 1097
1069 #endif // V8_FULL_CODEGEN_H_ 1098 #endif // V8_FULL_CODEGEN_H_
OLDNEW
« no previous file with comments | « src/frames-inl.h ('k') | src/full-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698