Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 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 | 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_TYPING_ASM_H_ | 5 #ifndef V8_TYPING_ASM_H_ |
| 6 #define V8_TYPING_ASM_H_ | 6 #define V8_TYPING_ASM_H_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
| 10 #include "src/effects.h" | 10 #include "src/effects.h" |
| 11 #include "src/type-info.h" | 11 #include "src/type-info.h" |
| 12 #include "src/types.h" | 12 #include "src/types.h" |
| 13 #include "src/zone.h" | 13 #include "src/zone.h" |
| 14 | 14 |
| 15 namespace v8 { | 15 namespace v8 { |
| 16 namespace internal { | 16 namespace internal { |
| 17 | 17 |
| 18 class TypeCache; | 18 class TypeCache; |
| 19 | 19 |
| 20 class AsmTyper : public AstVisitor { | 20 class AsmTyper : public AstVisitor { |
| 21 public: | 21 public: |
| 22 explicit AsmTyper(Isolate* isolate, Zone* zone, Script* script, | 22 explicit AsmTyper(Isolate* isolate, Zone* zone, Script* script, |
| 23 FunctionLiteral* root); | 23 FunctionLiteral* root); |
| 24 bool Validate(); | 24 bool Validate(); |
| 25 void set_allow_simd(bool simd); | 25 void set_allow_simd(bool simd); |
| 26 const char* error_message() { return error_message_; } | 26 const char* error_message() { return error_message_; } |
| 27 | 27 |
| 28 enum StandardObject { | |
|
titzer
2015/12/08 10:27:20
Better name here? Many of these things are functio
bradn
2015/12/09 03:40:09
Done.
| |
| 29 kNone = 0, | |
| 30 kStdlib, | |
| 31 kInfinity, | |
| 32 kNaN, | |
| 33 kMathAcos, | |
| 34 kMathAsin, | |
| 35 kMathAtan, | |
| 36 kMathCos, | |
| 37 kMathSin, | |
| 38 kMathTan, | |
| 39 kMathExp, | |
| 40 kMathLog, | |
| 41 kMathCeil, | |
| 42 kMathFloor, | |
| 43 kMathSqrt, | |
| 44 kMathAbs, | |
| 45 kMathMin, | |
| 46 kMathMax, | |
| 47 kMathAtan2, | |
| 48 kMathPow, | |
| 49 kMathImul, | |
| 50 kMathFround, | |
| 51 kMathE, | |
| 52 kMathLN10, | |
| 53 kMathLN2, | |
| 54 kMathLOG2E, | |
| 55 kMathLOG10E, | |
| 56 kMathPI, | |
| 57 kMathSQRT1_2, | |
| 58 kMathSQRT2, | |
| 59 }; | |
| 60 | |
| 61 StandardObject VariableAsStandardObject(Variable* variable); | |
| 62 | |
| 28 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | 63 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
| 29 | 64 |
| 30 private: | 65 private: |
| 31 Zone* zone_; | 66 Zone* zone_; |
| 32 Isolate* isolate_; | 67 Isolate* isolate_; |
| 33 Script* script_; | 68 Script* script_; |
| 34 FunctionLiteral* root_; | 69 FunctionLiteral* root_; |
| 35 bool valid_; | 70 bool valid_; |
| 36 bool allow_simd_; | 71 bool allow_simd_; |
| 37 | 72 |
| 38 struct VariableInfo : public ZoneObject { | 73 struct VariableInfo : public ZoneObject { |
| 39 Type* type; | 74 Type* type; |
| 40 bool is_stdlib_object; | |
| 41 bool is_check_function; | 75 bool is_check_function; |
| 42 bool is_constructor_function; | 76 bool is_constructor_function; |
| 77 StandardObject standard_object; | |
| 43 | 78 |
| 44 VariableInfo() | 79 VariableInfo() |
| 45 : type(NULL), | 80 : type(NULL), |
| 46 is_stdlib_object(false), | |
| 47 is_check_function(false), | 81 is_check_function(false), |
| 48 is_constructor_function(false) {} | 82 is_constructor_function(false), |
| 83 standard_object(kNone) {} | |
| 49 explicit VariableInfo(Type* t) | 84 explicit VariableInfo(Type* t) |
| 50 : type(t), is_check_function(false), is_constructor_function(false) {} | 85 : type(t), is_check_function(false), is_constructor_function(false) {} |
| 51 }; | 86 }; |
| 52 | 87 |
| 53 // Information for bi-directional typing with a cap on nesting depth. | 88 // Information for bi-directional typing with a cap on nesting depth. |
| 54 Type* expected_type_; | 89 Type* expected_type_; |
| 55 Type* computed_type_; | 90 Type* computed_type_; |
| 56 VariableInfo* property_info_; | 91 VariableInfo* property_info_; |
| 57 int intish_; // How many ops we've gone without a x|0. | 92 int intish_; // How many ops we've gone without a x|0. |
| 58 | 93 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 #define DECLARE_VISIT(type) void Visit##type(type* node) override; | 167 #define DECLARE_VISIT(type) void Visit##type(type* node) override; |
| 133 AST_NODE_LIST(DECLARE_VISIT) | 168 AST_NODE_LIST(DECLARE_VISIT) |
| 134 #undef DECLARE_VISIT | 169 #undef DECLARE_VISIT |
| 135 | 170 |
| 136 DISALLOW_COPY_AND_ASSIGN(AsmTyper); | 171 DISALLOW_COPY_AND_ASSIGN(AsmTyper); |
| 137 }; | 172 }; |
| 138 } // namespace internal | 173 } // namespace internal |
| 139 } // namespace v8 | 174 } // namespace v8 |
| 140 | 175 |
| 141 #endif // V8_TYPING_ASM_H_ | 176 #endif // V8_TYPING_ASM_H_ |
| OLD | NEW |