| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 // Copyright 2015 the V8 project authors. All rights reserved. | 
|  | 2 // Use of this source code is governed by a BSD-style license that can be | 
|  | 3 // found in the LICENSE file. | 
|  | 4 | 
|  | 5 #ifndef V8_TYPING_ASM_H_ | 
|  | 6 #define V8_TYPING_ASM_H_ | 
|  | 7 | 
|  | 8 #include "src/allocation.h" | 
|  | 9 #include "src/ast.h" | 
|  | 10 #include "src/effects.h" | 
|  | 11 #include "src/type-info.h" | 
|  | 12 #include "src/types.h" | 
|  | 13 #include "src/zone.h" | 
|  | 14 | 
|  | 15 namespace v8 { | 
|  | 16 namespace internal { | 
|  | 17 | 
|  | 18 class ZoneTypeCache; | 
|  | 19 | 
|  | 20 class AsmTyper : public AstVisitor { | 
|  | 21  public: | 
|  | 22   explicit AsmTyper(CompilationInfo* info); | 
|  | 23   bool Validate(); | 
|  | 24   const char* error_message() { return error_message_; } | 
|  | 25 | 
|  | 26   DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | 
|  | 27 | 
|  | 28  private: | 
|  | 29   CompilationInfo* info_; | 
|  | 30   bool valid_; | 
|  | 31 | 
|  | 32   // Information for bi-directional typing with a cap on nesting depth. | 
|  | 33   Type* expected_type_; | 
|  | 34   Type* computed_type_; | 
|  | 35   int intish_;  // How many ops we've gone without a x|0. | 
|  | 36 | 
|  | 37   Type* return_type_;  // Return type of last function. | 
|  | 38   size_t array_size_;  // Array size of last ArrayLiteral. | 
|  | 39 | 
|  | 40   typedef ZoneMap<std::string, Type*> ObjectTypeMap; | 
|  | 41   ObjectTypeMap stdlib_types_; | 
|  | 42   ObjectTypeMap stdlib_heap_types_; | 
|  | 43   ObjectTypeMap stdlib_math_types_; | 
|  | 44 | 
|  | 45   // Map from Variable* to global/local variable Type*. | 
|  | 46   ZoneHashMap global_variable_type_; | 
|  | 47   ZoneHashMap local_variable_type_; | 
|  | 48 | 
|  | 49   bool in_function_;  // In module function? | 
|  | 50   bool building_function_tables_; | 
|  | 51 | 
|  | 52   ZoneTypeCache const& cache_; | 
|  | 53 | 
|  | 54   static const int kErrorMessageLimit = 100; | 
|  | 55   char error_message_[kErrorMessageLimit]; | 
|  | 56 | 
|  | 57   static const int kMaxUncombinedAdditiveSteps = 1 << 20; | 
|  | 58   static const int kMaxUncombinedMultiplicativeSteps = 1; | 
|  | 59 | 
|  | 60   void InitializeStdlib(); | 
|  | 61 | 
|  | 62   void VisitDeclarations(ZoneList<Declaration*>* d) override; | 
|  | 63   void VisitStatements(ZoneList<Statement*>* s) override; | 
|  | 64 | 
|  | 65   void VisitExpressionAnnotation(Expression* e); | 
|  | 66   void VisitFunctionAnnotation(FunctionLiteral* f); | 
|  | 67   void VisitAsmModule(FunctionLiteral* f); | 
|  | 68 | 
|  | 69   void VisitHeapAccess(Property* expr); | 
|  | 70 | 
|  | 71   int ElementShiftSize(Type* type); | 
|  | 72 | 
|  | 73   void SetType(Variable* variable, Type* type); | 
|  | 74   Type* GetType(Variable* variable); | 
|  | 75 | 
|  | 76   Type* LibType(ObjectTypeMap map, Handle<String> name); | 
|  | 77 | 
|  | 78   void SetResult(Expression* expr, Type* type); | 
|  | 79   void IntersectResult(Expression* expr, Type* type); | 
|  | 80 | 
|  | 81   void VisitWithExpectation(Expression* expr, Type* expected_type, | 
|  | 82                             const char* msg); | 
|  | 83 | 
|  | 84 #define DECLARE_VISIT(type) virtual void Visit##type(type* node) override; | 
|  | 85   AST_NODE_LIST(DECLARE_VISIT) | 
|  | 86 #undef DECLARE_VISIT | 
|  | 87 | 
|  | 88   DISALLOW_COPY_AND_ASSIGN(AsmTyper); | 
|  | 89 }; | 
|  | 90 } | 
|  | 91 }  // namespace v8::internal | 
|  | 92 | 
|  | 93 #endif  // V8_TYPING_ASM_H_ | 
| OLD | NEW | 
|---|