| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_CRANKSHAFT_TYPING_H_ | 5 #ifndef V8_CRANKSHAFT_TYPING_H_ |
| 6 #define V8_CRANKSHAFT_TYPING_H_ | 6 #define V8_CRANKSHAFT_TYPING_H_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/ast/ast-type-bounds.h" | 9 #include "src/ast/ast-type-bounds.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/effects.h" | 12 #include "src/effects.h" |
| 13 #include "src/type-info.h" | 13 #include "src/type-info.h" |
| 14 #include "src/types.h" | 14 #include "src/types.h" |
| 15 #include "src/zone.h" | 15 #include "src/zone.h" |
| 16 | 16 |
| 17 namespace v8 { | 17 namespace v8 { |
| 18 namespace internal { | 18 namespace internal { |
| 19 | 19 |
| 20 class AstTyper: public AstVisitor { | 20 class AstTyper final : public AstVisitor<AstTyper> { |
| 21 public: | 21 public: |
| 22 AstTyper(Isolate* isolate, Zone* zone, Handle<JSFunction> closure, | 22 AstTyper(Isolate* isolate, Zone* zone, Handle<JSFunction> closure, |
| 23 Scope* scope, BailoutId osr_ast_id, FunctionLiteral* root, | 23 Scope* scope, BailoutId osr_ast_id, FunctionLiteral* root, |
| 24 AstTypeBounds* bounds); | 24 AstTypeBounds* bounds); |
| 25 void Run(); | 25 void Run(); |
| 26 | 26 |
| 27 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | 27 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
| 28 | 28 |
| 29 private: | 29 private: |
| 30 Effect ObservedOnStack(Object* value); | 30 Effect ObservedOnStack(Object* value); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 int stack_local_index(int index) { return index; } | 64 int stack_local_index(int index) { return index; } |
| 65 | 65 |
| 66 int variable_index(Variable* var) { | 66 int variable_index(Variable* var) { |
| 67 // Stack locals have the range [0 .. l] | 67 // Stack locals have the range [0 .. l] |
| 68 // Parameters have the range [-1 .. p] | 68 // Parameters have the range [-1 .. p] |
| 69 // We map this to [-p-2 .. -1, 0 .. l] | 69 // We map this to [-p-2 .. -1, 0 .. l] |
| 70 return var->IsStackLocal() ? stack_local_index(var->index()) : | 70 return var->IsStackLocal() ? stack_local_index(var->index()) : |
| 71 var->IsParameter() ? parameter_index(var->index()) : kNoVar; | 71 var->IsParameter() ? parameter_index(var->index()) : kNoVar; |
| 72 } | 72 } |
| 73 | 73 |
| 74 void VisitDeclarations(ZoneList<Declaration*>* declarations) override; | 74 void VisitDeclarations(ZoneList<Declaration*>* declarations); |
| 75 void VisitStatements(ZoneList<Statement*>* statements) override; | 75 void VisitStatements(ZoneList<Statement*>* statements); |
| 76 | 76 |
| 77 #define DECLARE_VISIT(type) void Visit##type(type* node) override; | 77 #define DECLARE_VISIT(type) void Visit##type(type* node); |
| 78 AST_NODE_LIST(DECLARE_VISIT) | 78 AST_NODE_LIST(DECLARE_VISIT) |
| 79 #undef DECLARE_VISIT | 79 #undef DECLARE_VISIT |
| 80 | 80 |
| 81 DISALLOW_COPY_AND_ASSIGN(AstTyper); | 81 DISALLOW_COPY_AND_ASSIGN(AstTyper); |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 } // namespace internal | 84 } // namespace internal |
| 85 } // namespace v8 | 85 } // namespace v8 |
| 86 | 86 |
| 87 #endif // V8_CRANKSHAFT_TYPING_H_ | 87 #endif // V8_CRANKSHAFT_TYPING_H_ |
| OLD | NEW |