OLD | NEW |
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 NO_REGISTERS, | 76 NO_REGISTERS, |
77 TOS_REG | 77 TOS_REG |
78 }; | 78 }; |
79 | 79 |
80 explicit FullCodeGenerator(MacroAssembler* masm) | 80 explicit FullCodeGenerator(MacroAssembler* masm) |
81 : masm_(masm), | 81 : masm_(masm), |
82 info_(NULL), | 82 info_(NULL), |
83 scope_(NULL), | 83 scope_(NULL), |
84 nesting_stack_(NULL), | 84 nesting_stack_(NULL), |
85 loop_depth_(0), | 85 loop_depth_(0), |
| 86 global_count_(0), |
86 context_(NULL), | 87 context_(NULL), |
87 bailout_entries_(0), | 88 bailout_entries_(0), |
88 stack_checks_(2), // There's always at least one. | 89 stack_checks_(2), // There's always at least one. |
89 type_feedback_cells_(0) { | 90 type_feedback_cells_(0) { |
90 } | 91 } |
91 | 92 |
92 static bool MakeCode(CompilationInfo* info); | 93 static bool MakeCode(CompilationInfo* info); |
93 | 94 |
94 void Generate(CompilationInfo* info); | 95 void Generate(CompilationInfo* info); |
95 void PopulateDeoptimizationData(Handle<Code> code); | 96 void PopulateDeoptimizationData(Handle<Code> code); |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 // canonical JS true value so we will insert a (dead) test against true at | 410 // canonical JS true value so we will insert a (dead) test against true at |
410 // the actual bailout target from the optimized code. If not | 411 // the actual bailout target from the optimized code. If not |
411 // should_normalize, the true and false labels are ignored. | 412 // should_normalize, the true and false labels are ignored. |
412 void PrepareForBailoutBeforeSplit(Expression* expr, | 413 void PrepareForBailoutBeforeSplit(Expression* expr, |
413 bool should_normalize, | 414 bool should_normalize, |
414 Label* if_true, | 415 Label* if_true, |
415 Label* if_false); | 416 Label* if_false); |
416 | 417 |
417 // Platform-specific code for a variable, constant, or function | 418 // Platform-specific code for a variable, constant, or function |
418 // declaration. Functions have an initial value. | 419 // declaration. Functions have an initial value. |
| 420 // Increments global_count_ for unallocated variables. |
419 void EmitDeclaration(VariableProxy* proxy, | 421 void EmitDeclaration(VariableProxy* proxy, |
420 VariableMode mode, | 422 VariableMode mode, |
421 FunctionLiteral* function, | 423 FunctionLiteral* function); |
422 int* global_count); | |
423 | 424 |
424 // Platform-specific code for checking the stack limit at the back edge of | 425 // Platform-specific code for checking the stack limit at the back edge of |
425 // a loop. | 426 // a loop. |
426 void EmitStackCheck(IterationStatement* stmt); | 427 void EmitStackCheck(IterationStatement* stmt); |
427 // Record the OSR AST id corresponding to a stack check in the code. | 428 // Record the OSR AST id corresponding to a stack check in the code. |
428 void RecordStackCheck(unsigned osr_ast_id); | 429 void RecordStackCheck(unsigned osr_ast_id); |
429 // Emit a table of stack check ids and pcs into the code stream. Return | 430 // Emit a table of stack check ids and pcs into the code stream. Return |
430 // the offset of the start of the table. | 431 // the offset of the start of the table. |
431 unsigned EmitStackCheckTable(); | 432 unsigned EmitStackCheckTable(); |
432 | 433 |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 Label** fall_through) const; | 761 Label** fall_through) const; |
761 virtual bool IsEffect() const { return true; } | 762 virtual bool IsEffect() const { return true; } |
762 }; | 763 }; |
763 | 764 |
764 MacroAssembler* masm_; | 765 MacroAssembler* masm_; |
765 CompilationInfo* info_; | 766 CompilationInfo* info_; |
766 Scope* scope_; | 767 Scope* scope_; |
767 Label return_label_; | 768 Label return_label_; |
768 NestedStatement* nesting_stack_; | 769 NestedStatement* nesting_stack_; |
769 int loop_depth_; | 770 int loop_depth_; |
| 771 int global_count_; |
770 const ExpressionContext* context_; | 772 const ExpressionContext* context_; |
771 ZoneList<BailoutEntry> bailout_entries_; | 773 ZoneList<BailoutEntry> bailout_entries_; |
772 ZoneList<BailoutEntry> stack_checks_; | 774 ZoneList<BailoutEntry> stack_checks_; |
773 ZoneList<TypeFeedbackCellEntry> type_feedback_cells_; | 775 ZoneList<TypeFeedbackCellEntry> type_feedback_cells_; |
774 Handle<FixedArray> handler_table_; | 776 Handle<FixedArray> handler_table_; |
775 | 777 |
776 friend class NestedStatement; | 778 friend class NestedStatement; |
777 | 779 |
778 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); | 780 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); |
779 }; | 781 }; |
780 | 782 |
781 | 783 |
782 } } // namespace v8::internal | 784 } } // namespace v8::internal |
783 | 785 |
784 #endif // V8_FULL_CODEGEN_H_ | 786 #endif // V8_FULL_CODEGEN_H_ |
OLD | NEW |