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

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

Issue 13811014: Fix OSR for nested loops. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 : masm_(masm), 85 : masm_(masm),
86 info_(info), 86 info_(info),
87 scope_(info->scope()), 87 scope_(info->scope()),
88 nesting_stack_(NULL), 88 nesting_stack_(NULL),
89 loop_depth_(0), 89 loop_depth_(0),
90 globals_(NULL), 90 globals_(NULL),
91 context_(NULL), 91 context_(NULL),
92 bailout_entries_(info->HasDeoptimizationSupport() 92 bailout_entries_(info->HasDeoptimizationSupport()
93 ? info->function()->ast_node_count() : 0, 93 ? info->function()->ast_node_count() : 0,
94 info->zone()), 94 info->zone()),
95 stack_checks_(2, info->zone()), // There's always at least one. 95 back_edges_(2, info->zone()), // There's always at least one.
Jakob Kummerow 2013/04/09 17:23:25 nit: the comment is outdated, just remove it. (The
Yang 2013/04/10 08:08:30 Done.
96 type_feedback_cells_(info->HasDeoptimizationSupport() 96 type_feedback_cells_(info->HasDeoptimizationSupport()
97 ? info->function()->ast_node_count() : 0, 97 ? info->function()->ast_node_count() : 0,
98 info->zone()), 98 info->zone()),
99 ic_total_count_(0), 99 ic_total_count_(0),
100 zone_(info->zone()) { 100 zone_(info->zone()) {
101 Initialize(); 101 Initialize();
102 } 102 }
103 103
104 void Initialize(); 104 void Initialize();
105 105
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 454
455 // This is meant to be called at loop back edges, |back_edge_target| is 455 // This is meant to be called at loop back edges, |back_edge_target| is
456 // the jump target of the back edge and is used to approximate the amount 456 // the jump target of the back edge and is used to approximate the amount
457 // of code inside the loop. 457 // of code inside the loop.
458 void EmitBackEdgeBookkeeping(IterationStatement* stmt, 458 void EmitBackEdgeBookkeeping(IterationStatement* stmt,
459 Label* back_edge_target); 459 Label* back_edge_target);
460 // Record the OSR AST id corresponding to a back edge in the code. 460 // Record the OSR AST id corresponding to a back edge in the code.
461 void RecordBackEdge(BailoutId osr_ast_id); 461 void RecordBackEdge(BailoutId osr_ast_id);
462 // Emit a table of stack check ids and pcs into the code stream. Return 462 // Emit a table of stack check ids and pcs into the code stream. Return
463 // the offset of the start of the table. 463 // the offset of the start of the table.
464 unsigned EmitStackCheckTable(); 464 unsigned EmitBackEdgeTable();
465 465
466 void EmitProfilingCounterDecrement(int delta); 466 void EmitProfilingCounterDecrement(int delta);
467 void EmitProfilingCounterReset(); 467 void EmitProfilingCounterReset();
468 468
469 // Platform-specific return sequence 469 // Platform-specific return sequence
470 void EmitReturnSequence(); 470 void EmitReturnSequence();
471 471
472 // Platform-specific code sequences for calls 472 // Platform-specific code sequences for calls
473 void EmitCallWithStub(Call* expr, CallFunctionFlags flags); 473 void EmitCallWithStub(Call* expr, CallFunctionFlags flags);
474 void EmitCallWithIC(Call* expr, Handle<Object> name, RelocInfo::Mode mode); 474 void EmitCallWithIC(Call* expr, Handle<Object> name, RelocInfo::Mode mode);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 void PopulateTypeFeedbackInfo(Handle<Code> code); 617 void PopulateTypeFeedbackInfo(Handle<Code> code);
618 void PopulateTypeFeedbackCells(Handle<Code> code); 618 void PopulateTypeFeedbackCells(Handle<Code> code);
619 619
620 Handle<FixedArray> handler_table() { return handler_table_; } 620 Handle<FixedArray> handler_table() { return handler_table_; }
621 621
622 struct BailoutEntry { 622 struct BailoutEntry {
623 BailoutId id; 623 BailoutId id;
624 unsigned pc_and_state; 624 unsigned pc_and_state;
625 }; 625 };
626 626
627 struct BackEdgeEntry {
628 BailoutId id;
629 unsigned pc;
630 uint8_t loop_depth;
631 };
632
627 struct TypeFeedbackCellEntry { 633 struct TypeFeedbackCellEntry {
628 TypeFeedbackId ast_id; 634 TypeFeedbackId ast_id;
629 Handle<JSGlobalPropertyCell> cell; 635 Handle<JSGlobalPropertyCell> cell;
630 }; 636 };
631 637
632 638
633 class ExpressionContext BASE_EMBEDDED { 639 class ExpressionContext BASE_EMBEDDED {
634 public: 640 public:
635 explicit ExpressionContext(FullCodeGenerator* codegen) 641 explicit ExpressionContext(FullCodeGenerator* codegen)
636 : masm_(codegen->masm()), old_(codegen->context()), codegen_(codegen) { 642 : masm_(codegen->masm()), old_(codegen->context()), codegen_(codegen) {
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 Scope* scope_; 817 Scope* scope_;
812 Label return_label_; 818 Label return_label_;
813 NestedStatement* nesting_stack_; 819 NestedStatement* nesting_stack_;
814 int loop_depth_; 820 int loop_depth_;
815 ZoneList<Handle<Object> >* globals_; 821 ZoneList<Handle<Object> >* globals_;
816 Handle<FixedArray> modules_; 822 Handle<FixedArray> modules_;
817 int module_index_; 823 int module_index_;
818 const ExpressionContext* context_; 824 const ExpressionContext* context_;
819 ZoneList<BailoutEntry> bailout_entries_; 825 ZoneList<BailoutEntry> bailout_entries_;
820 GrowableBitVector prepared_bailout_ids_; 826 GrowableBitVector prepared_bailout_ids_;
821 // TODO(svenpanne) Rename this to something like back_edges_ and rename 827 // TODO(svenpanne) Rename this to something like back_edges_ and rename
Jakob Kummerow 2013/04/09 17:23:25 You can remove this TODO, since it describes exact
Yang 2013/04/10 08:08:30 Done.
822 // related functions accordingly. 828 // related functions accordingly.
823 ZoneList<BailoutEntry> stack_checks_; 829 ZoneList<BackEdgeEntry> back_edges_;
824 ZoneList<TypeFeedbackCellEntry> type_feedback_cells_; 830 ZoneList<TypeFeedbackCellEntry> type_feedback_cells_;
825 int ic_total_count_; 831 int ic_total_count_;
826 Handle<FixedArray> handler_table_; 832 Handle<FixedArray> handler_table_;
827 Handle<JSGlobalPropertyCell> profiling_counter_; 833 Handle<JSGlobalPropertyCell> profiling_counter_;
828 bool generate_debug_code_; 834 bool generate_debug_code_;
829 Zone* zone_; 835 Zone* zone_;
830 836
831 friend class NestedStatement; 837 friend class NestedStatement;
832 838
833 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); 839 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
(...skipping 19 matching lines...) Expand all
853 } 859 }
854 860
855 private: 861 private:
856 Zone* zone_; 862 Zone* zone_;
857 }; 863 };
858 864
859 865
860 } } // namespace v8::internal 866 } } // namespace v8::internal
861 867
862 #endif // V8_FULL_CODEGEN_H_ 868 #endif // V8_FULL_CODEGEN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698