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

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

Issue 1322773002: Add asm.js typer / validator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: based on landing others Created 5 years, 3 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
« no previous file with comments | « BUILD.gn ('k') | 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
(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 void InitializeStdlib();
58
59 void VisitDeclarations(ZoneList<Declaration*>* d) override;
60 void VisitStatements(ZoneList<Statement*>* s) override;
61
62 void VisitExpressionAnnotation(Expression* e);
63 void VisitFunctionAnnotation(FunctionLiteral* f);
64 void VisitAsmModule(FunctionLiteral* f);
65
66 int ElementShiftSize(Type* type);
67
68 void SetType(Variable* variable, Type* type);
69 Type* GetType(Variable* variable);
70
71 Type* LibType(ObjectTypeMap map, Handle<String> name);
72
73 #define DECLARE_VISIT(type) virtual void Visit##type(type* node) override;
74 AST_NODE_LIST(DECLARE_VISIT)
75 #undef DECLARE_VISIT
76
77 DISALLOW_COPY_AND_ASSIGN(AsmTyper);
78 };
79 }
80 } // namespace v8::internal
81
82 #endif // V8_TYPING_ASM_H_
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | src/typing-asm.cc » ('j') | src/typing-asm.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698