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

Side by Side Diff: src/typing-asm.h

Issue 1473513004: Refactor VisitProperty, add starting point for SIMD.js support. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | src/typing-asm.cc » ('j') | src/typing-asm.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.h" 9 #include "src/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 const char* error_message() { return error_message_; } 26 const char* error_message() { return error_message_; }
26 27
27 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); 28 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
28 29
29 private: 30 private:
30 Zone* zone_; 31 Zone* zone_;
31 Script* script_; 32 Script* script_;
32 FunctionLiteral* root_; 33 FunctionLiteral* root_;
33 bool valid_; 34 bool valid_;
35 bool allow_simd_;
34 36
35 // Information for bi-directional typing with a cap on nesting depth. 37 // Information for bi-directional typing with a cap on nesting depth.
36 Type* expected_type_; 38 Type* expected_type_;
37 Type* computed_type_; 39 Type* computed_type_;
38 int intish_; // How many ops we've gone without a x|0. 40 int intish_; // How many ops we've gone without a x|0.
39 41
40 Type* return_type_; // Return type of last function. 42 Type* return_type_; // Return type of last function.
41 size_t array_size_; // Array size of last ArrayLiteral. 43 size_t array_size_; // Array size of last ArrayLiteral.
42 44
43 typedef ZoneMap<std::string, Type*> ObjectTypeMap; 45 typedef ZoneMap<std::string, Type*> ObjectTypeMap;
44 ObjectTypeMap stdlib_types_; 46 ObjectTypeMap stdlib_types_;
45 ObjectTypeMap stdlib_heap_types_; 47 ObjectTypeMap stdlib_heap_types_;
46 ObjectTypeMap stdlib_math_types_; 48 ObjectTypeMap stdlib_math_types_;
49 #define V(NAME, Name, name, lane_count, lane_type) \
50 ObjectTypeMap stdlib_simd_##name##_types_;
51 SIMD128_TYPES(V)
52 #undef V
47 53
48 // Map from Variable* to global/local variable Type*. 54 // Map from Variable* to global/local variable Type*.
49 ZoneHashMap global_variable_type_; 55 ZoneHashMap global_variable_type_;
50 ZoneHashMap local_variable_type_; 56 ZoneHashMap local_variable_type_;
51 57
52 bool in_function_; // In module function? 58 bool in_function_; // In module function?
53 bool building_function_tables_; 59 bool building_function_tables_;
54 60
55 TypeCache const& cache_; 61 TypeCache const& cache_;
56 62
57 static const int kErrorMessageLimit = 100; 63 static const int kErrorMessageLimit = 100;
58 char error_message_[kErrorMessageLimit]; 64 char error_message_[kErrorMessageLimit];
59 65
60 static const int kMaxUncombinedAdditiveSteps = 1 << 20; 66 static const int kMaxUncombinedAdditiveSteps = 1 << 20;
61 static const int kMaxUncombinedMultiplicativeSteps = 1; 67 static const int kMaxUncombinedMultiplicativeSteps = 1;
62 68
63 void InitializeStdlib(); 69 void InitializeStdlib();
64 70
65 void VisitDeclarations(ZoneList<Declaration*>* d) override; 71 void VisitDeclarations(ZoneList<Declaration*>* d) override;
66 void VisitStatements(ZoneList<Statement*>* s) override; 72 void VisitStatements(ZoneList<Statement*>* s) override;
67 73
68 void VisitExpressionAnnotation(Expression* e, bool is_return); 74 void VisitExpressionAnnotation(Expression* e, bool is_return);
69 void VisitFunctionAnnotation(FunctionLiteral* f); 75 void VisitFunctionAnnotation(FunctionLiteral* f);
70 void VisitAsmModule(FunctionLiteral* f); 76 void VisitAsmModule(FunctionLiteral* f);
71 77
72 void VisitHeapAccess(Property* expr); 78 void VisitHeapAccess(Property* expr);
73 79
80 bool IsMathObject(Expression* expr);
81 bool IsSIMDObject(Expression* expr);
82 bool IsSIMDTypeObject(Expression* expr, const char* name);
83 bool IsStdlibObject(Expression* expr);
84
85 void VisitSIMDProperty(Property* expr);
86
74 int ElementShiftSize(Type* type); 87 int ElementShiftSize(Type* type);
75 Type* StorageType(Type* type); 88 Type* StorageType(Type* type);
76 89
77 void SetType(Variable* variable, Type* type); 90 void SetType(Variable* variable, Type* type);
78 Type* GetType(Variable* variable); 91 Type* GetType(Variable* variable);
79 92
80 Type* LibType(ObjectTypeMap map, Handle<String> name); 93 Type* LibType(ObjectTypeMap map, Handle<String> name);
81 94
82 void SetResult(Expression* expr, Type* type); 95 void SetResult(Expression* expr, Type* type);
83 void IntersectResult(Expression* expr, Type* type); 96 void IntersectResult(Expression* expr, Type* type);
(...skipping 12 matching lines...) Expand all
96 #define DECLARE_VISIT(type) void Visit##type(type* node) override; 109 #define DECLARE_VISIT(type) void Visit##type(type* node) override;
97 AST_NODE_LIST(DECLARE_VISIT) 110 AST_NODE_LIST(DECLARE_VISIT)
98 #undef DECLARE_VISIT 111 #undef DECLARE_VISIT
99 112
100 DISALLOW_COPY_AND_ASSIGN(AsmTyper); 113 DISALLOW_COPY_AND_ASSIGN(AsmTyper);
101 }; 114 };
102 } // namespace internal 115 } // namespace internal
103 } // namespace v8 116 } // namespace v8
104 117
105 #endif // V8_TYPING_ASM_H_ 118 #endif // V8_TYPING_ASM_H_
OLDNEW
« no previous file with comments | « no previous file | src/typing-asm.cc » ('j') | src/typing-asm.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698