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

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

Issue 2142233003: Templatize AstVisitor with its subclass (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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
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_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 try_catch_depth_(0), 40 try_catch_depth_(0),
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 // in v8::internal::Context. 731 // in v8::internal::Context.
732 void LoadContextField(Register dst, int context_index); 732 void LoadContextField(Register dst, int context_index);
733 733
734 // Push the function argument for the runtime functions PushWithContext 734 // Push the function argument for the runtime functions PushWithContext
735 // and PushCatchContext. 735 // and PushCatchContext.
736 void PushFunctionArgumentForContextAllocation(); 736 void PushFunctionArgumentForContextAllocation();
737 737
738 void PushCalleeAndWithBaseObject(Call* expr); 738 void PushCalleeAndWithBaseObject(Call* expr);
739 739
740 // AST node visit functions. 740 // AST node visit functions.
741 #define DECLARE_VISIT(type) void Visit##type(type* node) override; 741 #define DECLARE_VISIT(type) void Visit##type(type* node);
742 AST_NODE_LIST(DECLARE_VISIT) 742 AST_NODE_LIST(DECLARE_VISIT)
743 #undef DECLARE_VISIT 743 #undef DECLARE_VISIT
744 744
745 void VisitComma(BinaryOperation* expr); 745 void VisitComma(BinaryOperation* expr);
746 void VisitLogicalExpression(BinaryOperation* expr); 746 void VisitLogicalExpression(BinaryOperation* expr);
747 void VisitArithmeticExpression(BinaryOperation* expr); 747 void VisitArithmeticExpression(BinaryOperation* expr);
748 748
749 void VisitForTypeofValue(Expression* expr); 749 void VisitForTypeofValue(Expression* expr);
750 750
751 void Generate(); 751 void Generate();
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 Address start_; 1056 Address start_;
1057 Address instruction_start_; 1057 Address instruction_start_;
1058 uint32_t length_; 1058 uint32_t length_;
1059 }; 1059 };
1060 1060
1061 1061
1062 } // namespace internal 1062 } // namespace internal
1063 } // namespace v8 1063 } // namespace v8
1064 1064
1065 #endif // V8_FULL_CODEGEN_FULL_CODEGEN_H_ 1065 #endif // V8_FULL_CODEGEN_FULL_CODEGEN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698