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

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: addressed comments 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
« no previous file with comments | « src/disassembler.cc ('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 // 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()),
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 22 matching lines...) Expand all
128 #elif V8_TARGET_ARCH_X64 128 #elif V8_TARGET_ARCH_X64
129 static const int kBackEdgeDistanceUnit = 162; 129 static const int kBackEdgeDistanceUnit = 162;
130 #elif V8_TARGET_ARCH_ARM 130 #elif V8_TARGET_ARCH_ARM
131 static const int kBackEdgeDistanceUnit = 142; 131 static const int kBackEdgeDistanceUnit = 142;
132 #elif V8_TARGET_ARCH_MIPS 132 #elif V8_TARGET_ARCH_MIPS
133 static const int kBackEdgeDistanceUnit = 142; 133 static const int kBackEdgeDistanceUnit = 142;
134 #else 134 #else
135 #error Unsupported target architecture. 135 #error Unsupported target architecture.
136 #endif 136 #endif
137 137
138 static const int kBackEdgeEntrySize = 2 * kIntSize + kOneByteSize;
138 139
139 private: 140 private:
140 class Breakable; 141 class Breakable;
141 class Iteration; 142 class Iteration;
142 143
143 class TestContext; 144 class TestContext;
144 145
145 class NestedStatement BASE_EMBEDDED { 146 class NestedStatement BASE_EMBEDDED {
146 public: 147 public:
147 explicit NestedStatement(FullCodeGenerator* codegen) : codegen_(codegen) { 148 explicit NestedStatement(FullCodeGenerator* codegen) : codegen_(codegen) {
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 // neither a with nor a catch context. 453 // neither a with nor a catch context.
453 void EmitDebugCheckDeclarationContext(Variable* variable); 454 void EmitDebugCheckDeclarationContext(Variable* variable);
454 455
455 // This is meant to be called at loop back edges, |back_edge_target| is 456 // 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 457 // the jump target of the back edge and is used to approximate the amount
457 // of code inside the loop. 458 // of code inside the loop.
458 void EmitBackEdgeBookkeeping(IterationStatement* stmt, 459 void EmitBackEdgeBookkeeping(IterationStatement* stmt,
459 Label* back_edge_target); 460 Label* back_edge_target);
460 // Record the OSR AST id corresponding to a back edge in the code. 461 // Record the OSR AST id corresponding to a back edge in the code.
461 void RecordBackEdge(BailoutId osr_ast_id); 462 void RecordBackEdge(BailoutId osr_ast_id);
462 // Emit a table of stack check ids and pcs into the code stream. Return 463 // Emit a table of back edge ids, pcs and loop depths into the code stream.
463 // the offset of the start of the table. 464 // Return the offset of the start of the table.
464 unsigned EmitStackCheckTable(); 465 unsigned EmitBackEdgeTable();
465 466
466 void EmitProfilingCounterDecrement(int delta); 467 void EmitProfilingCounterDecrement(int delta);
467 void EmitProfilingCounterReset(); 468 void EmitProfilingCounterReset();
468 469
469 // Platform-specific return sequence 470 // Platform-specific return sequence
470 void EmitReturnSequence(); 471 void EmitReturnSequence();
471 472
472 // Platform-specific code sequences for calls 473 // Platform-specific code sequences for calls
473 void EmitCallWithStub(Call* expr, CallFunctionFlags flags); 474 void EmitCallWithStub(Call* expr, CallFunctionFlags flags);
474 void EmitCallWithIC(Call* expr, Handle<Object> name, RelocInfo::Mode mode); 475 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); 618 void PopulateTypeFeedbackInfo(Handle<Code> code);
618 void PopulateTypeFeedbackCells(Handle<Code> code); 619 void PopulateTypeFeedbackCells(Handle<Code> code);
619 620
620 Handle<FixedArray> handler_table() { return handler_table_; } 621 Handle<FixedArray> handler_table() { return handler_table_; }
621 622
622 struct BailoutEntry { 623 struct BailoutEntry {
623 BailoutId id; 624 BailoutId id;
624 unsigned pc_and_state; 625 unsigned pc_and_state;
625 }; 626 };
626 627
628 struct BackEdgeEntry {
629 BailoutId id;
630 unsigned pc;
631 uint8_t loop_depth;
632 };
633
627 struct TypeFeedbackCellEntry { 634 struct TypeFeedbackCellEntry {
628 TypeFeedbackId ast_id; 635 TypeFeedbackId ast_id;
629 Handle<JSGlobalPropertyCell> cell; 636 Handle<JSGlobalPropertyCell> cell;
630 }; 637 };
631 638
632 639
633 class ExpressionContext BASE_EMBEDDED { 640 class ExpressionContext BASE_EMBEDDED {
634 public: 641 public:
635 explicit ExpressionContext(FullCodeGenerator* codegen) 642 explicit ExpressionContext(FullCodeGenerator* codegen)
636 : masm_(codegen->masm()), old_(codegen->context()), codegen_(codegen) { 643 : masm_(codegen->masm()), old_(codegen->context()), codegen_(codegen) {
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 Scope* scope_; 818 Scope* scope_;
812 Label return_label_; 819 Label return_label_;
813 NestedStatement* nesting_stack_; 820 NestedStatement* nesting_stack_;
814 int loop_depth_; 821 int loop_depth_;
815 ZoneList<Handle<Object> >* globals_; 822 ZoneList<Handle<Object> >* globals_;
816 Handle<FixedArray> modules_; 823 Handle<FixedArray> modules_;
817 int module_index_; 824 int module_index_;
818 const ExpressionContext* context_; 825 const ExpressionContext* context_;
819 ZoneList<BailoutEntry> bailout_entries_; 826 ZoneList<BailoutEntry> bailout_entries_;
820 GrowableBitVector prepared_bailout_ids_; 827 GrowableBitVector prepared_bailout_ids_;
821 // TODO(svenpanne) Rename this to something like back_edges_ and rename 828 ZoneList<BackEdgeEntry> back_edges_;
822 // related functions accordingly.
823 ZoneList<BailoutEntry> stack_checks_;
824 ZoneList<TypeFeedbackCellEntry> type_feedback_cells_; 829 ZoneList<TypeFeedbackCellEntry> type_feedback_cells_;
825 int ic_total_count_; 830 int ic_total_count_;
826 Handle<FixedArray> handler_table_; 831 Handle<FixedArray> handler_table_;
827 Handle<JSGlobalPropertyCell> profiling_counter_; 832 Handle<JSGlobalPropertyCell> profiling_counter_;
828 bool generate_debug_code_; 833 bool generate_debug_code_;
829 Zone* zone_; 834 Zone* zone_;
830 835
831 friend class NestedStatement; 836 friend class NestedStatement;
832 837
833 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); 838 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
(...skipping 19 matching lines...) Expand all
853 } 858 }
854 859
855 private: 860 private:
856 Zone* zone_; 861 Zone* zone_;
857 }; 862 };
858 863
859 864
860 } } // namespace v8::internal 865 } } // namespace v8::internal
861 866
862 #endif // V8_FULL_CODEGEN_H_ 867 #endif // V8_FULL_CODEGEN_H_
OLDNEW
« no previous file with comments | « src/disassembler.cc ('k') | src/full-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698