OLD | NEW |
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_FULL_CODEGEN_H_ | 5 #ifndef V8_FULL_CODEGEN_FULL_CODEGEN_H_ |
6 #define V8_FULL_CODEGEN_FULL_CODEGEN_H_ | 6 #define V8_FULL_CODEGEN_FULL_CODEGEN_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/assert-scope.h" | 9 #include "src/assert-scope.h" |
10 #include "src/ast/ast.h" | 10 #include "src/ast/ast.h" |
11 #include "src/ast/scopes.h" | 11 #include "src/ast/scopes.h" |
12 #include "src/bit-vector.h" | 12 #include "src/bit-vector.h" |
13 #include "src/code-factory.h" | 13 #include "src/code-factory.h" |
14 #include "src/code-stubs.h" | 14 #include "src/code-stubs.h" |
15 #include "src/codegen.h" | 15 #include "src/codegen.h" |
16 #include "src/compiler.h" | 16 #include "src/compiler.h" |
17 #include "src/deoptimizer.h" | 17 #include "src/deoptimizer.h" |
18 #include "src/globals.h" | 18 #include "src/globals.h" |
19 #include "src/objects.h" | 19 #include "src/objects.h" |
20 | 20 |
21 namespace v8 { | 21 namespace v8 { |
22 namespace internal { | 22 namespace internal { |
23 | 23 |
24 // Forward declarations. | 24 // Forward declarations. |
25 class JumpPatchSite; | 25 class JumpPatchSite; |
26 | 26 |
27 // ----------------------------------------------------------------------------- | 27 // ----------------------------------------------------------------------------- |
28 // Full code generator. | 28 // Full code generator. |
29 | 29 |
30 class FullCodeGenerator: public AstVisitor { | 30 class FullCodeGenerator final : public AstVisitor<FullCodeGenerator> { |
31 public: | 31 public: |
32 FullCodeGenerator(MacroAssembler* masm, CompilationInfo* info) | 32 FullCodeGenerator(MacroAssembler* masm, CompilationInfo* info) |
33 : masm_(masm), | 33 : masm_(masm), |
34 info_(info), | 34 info_(info), |
35 isolate_(info->isolate()), | 35 isolate_(info->isolate()), |
36 zone_(info->zone()), | 36 zone_(info->zone()), |
37 scope_(info->scope()), | 37 scope_(info->scope()), |
38 nesting_stack_(NULL), | 38 nesting_stack_(NULL), |
39 loop_depth_(0), | 39 loop_depth_(0), |
40 operand_stack_depth_(0), | 40 operand_stack_depth_(0), |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 if (FLAG_verify_operand_stack_depth) EmitOperandStackDepthCheck(); | 380 if (FLAG_verify_operand_stack_depth) EmitOperandStackDepthCheck(); |
381 TestContext context(this, expr, if_true, if_false, fall_through); | 381 TestContext context(this, expr, if_true, if_false, fall_through); |
382 Visit(expr); | 382 Visit(expr); |
383 // For test contexts, we prepare for bailout before branching, not at | 383 // For test contexts, we prepare for bailout before branching, not at |
384 // the end of the entire expression. This happens as part of visiting | 384 // the end of the entire expression. This happens as part of visiting |
385 // the expression. | 385 // the expression. |
386 } | 386 } |
387 | 387 |
388 void VisitInDuplicateContext(Expression* expr); | 388 void VisitInDuplicateContext(Expression* expr); |
389 | 389 |
390 void VisitDeclarations(ZoneList<Declaration*>* declarations) override; | 390 void VisitDeclarations(ZoneList<Declaration*>* declarations); |
391 void DeclareGlobals(Handle<FixedArray> pairs); | 391 void DeclareGlobals(Handle<FixedArray> pairs); |
392 int DeclareGlobalsFlags(); | 392 int DeclareGlobalsFlags(); |
393 | 393 |
394 // Push, pop or drop values onto/from the operand stack. | 394 // Push, pop or drop values onto/from the operand stack. |
395 void PushOperand(Register reg); | 395 void PushOperand(Register reg); |
396 void PopOperand(Register reg); | 396 void PopOperand(Register reg); |
397 void DropOperands(int count); | 397 void DropOperands(int count); |
398 | 398 |
399 // Convenience helpers for pushing onto the operand stack. | 399 // Convenience helpers for pushing onto the operand stack. |
400 void PushOperand(MemOperand operand); | 400 void PushOperand(MemOperand operand); |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 // in v8::internal::Context. | 730 // in v8::internal::Context. |
731 void LoadContextField(Register dst, int context_index); | 731 void LoadContextField(Register dst, int context_index); |
732 | 732 |
733 // Push the function argument for the runtime functions PushWithContext | 733 // Push the function argument for the runtime functions PushWithContext |
734 // and PushCatchContext. | 734 // and PushCatchContext. |
735 void PushFunctionArgumentForContextAllocation(); | 735 void PushFunctionArgumentForContextAllocation(); |
736 | 736 |
737 void PushCalleeAndWithBaseObject(Call* expr); | 737 void PushCalleeAndWithBaseObject(Call* expr); |
738 | 738 |
739 // AST node visit functions. | 739 // AST node visit functions. |
740 #define DECLARE_VISIT(type) void Visit##type(type* node) override; | 740 #define DECLARE_VISIT(type) void Visit##type(type* node); |
741 AST_NODE_LIST(DECLARE_VISIT) | 741 AST_NODE_LIST(DECLARE_VISIT) |
742 #undef DECLARE_VISIT | 742 #undef DECLARE_VISIT |
743 | 743 |
744 void VisitComma(BinaryOperation* expr); | 744 void VisitComma(BinaryOperation* expr); |
745 void VisitLogicalExpression(BinaryOperation* expr); | 745 void VisitLogicalExpression(BinaryOperation* expr); |
746 void VisitArithmeticExpression(BinaryOperation* expr); | 746 void VisitArithmeticExpression(BinaryOperation* expr); |
747 | 747 |
748 void VisitForTypeofValue(Expression* expr); | 748 void VisitForTypeofValue(Expression* expr); |
749 | 749 |
750 void Generate(); | 750 void Generate(); |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 Address start_; | 1054 Address start_; |
1055 Address instruction_start_; | 1055 Address instruction_start_; |
1056 uint32_t length_; | 1056 uint32_t length_; |
1057 }; | 1057 }; |
1058 | 1058 |
1059 | 1059 |
1060 } // namespace internal | 1060 } // namespace internal |
1061 } // namespace v8 | 1061 } // namespace v8 |
1062 | 1062 |
1063 #endif // V8_FULL_CODEGEN_FULL_CODEGEN_H_ | 1063 #endif // V8_FULL_CODEGEN_FULL_CODEGEN_H_ |
OLD | NEW |