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

Side by Side Diff: src/typing.h

Issue 1405363003: Move Hydrogen and Lithium to src/crankshaft/ (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebased Created 5 years, 2 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 | « src/ppc/lithium-ppc.cc ('k') | src/typing.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef V8_TYPING_H_
6 #define V8_TYPING_H_
7
8 #include "src/allocation.h"
9 #include "src/ast.h"
10 #include "src/effects.h"
11 #include "src/scopes.h"
12 #include "src/type-info.h"
13 #include "src/types.h"
14 #include "src/zone.h"
15
16 namespace v8 {
17 namespace internal {
18
19
20 class AstTyper: public AstVisitor {
21 public:
22 AstTyper(Isolate* isolate, Zone* zone, Handle<JSFunction> closure,
23 Scope* scope, BailoutId osr_ast_id, FunctionLiteral* root);
24 void Run();
25
26 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
27
28 private:
29 Effect ObservedOnStack(Object* value);
30 void ObserveTypesAtOsrEntry(IterationStatement* stmt);
31
32 static const int kNoVar = INT_MIN;
33 typedef v8::internal::Effects<int, kNoVar> Effects;
34 typedef v8::internal::NestedEffects<int, kNoVar> Store;
35
36 Isolate* isolate_;
37 Zone* zone_;
38 Handle<JSFunction> closure_;
39 Scope* scope_;
40 BailoutId osr_ast_id_;
41 FunctionLiteral* root_;
42 TypeFeedbackOracle oracle_;
43 Store store_;
44
45 Zone* zone() const { return zone_; }
46 TypeFeedbackOracle* oracle() { return &oracle_; }
47
48 void NarrowType(Expression* e, Bounds b) {
49 e->set_bounds(Bounds::Both(e->bounds(), b, zone()));
50 }
51 void NarrowLowerType(Expression* e, Type* t) {
52 e->set_bounds(Bounds::NarrowLower(e->bounds(), t, zone()));
53 }
54
55 Effects EnterEffects() {
56 store_ = store_.Push();
57 return store_.Top();
58 }
59 void ExitEffects() { store_ = store_.Pop(); }
60
61 int parameter_index(int index) { return -index - 2; }
62 int stack_local_index(int index) { return index; }
63
64 int variable_index(Variable* var) {
65 // Stack locals have the range [0 .. l]
66 // Parameters have the range [-1 .. p]
67 // We map this to [-p-2 .. -1, 0 .. l]
68 return var->IsStackLocal() ? stack_local_index(var->index()) :
69 var->IsParameter() ? parameter_index(var->index()) : kNoVar;
70 }
71
72 void VisitDeclarations(ZoneList<Declaration*>* declarations) override;
73 void VisitStatements(ZoneList<Statement*>* statements) override;
74
75 #define DECLARE_VISIT(type) virtual void Visit##type(type* node) override;
76 AST_NODE_LIST(DECLARE_VISIT)
77 #undef DECLARE_VISIT
78
79 DISALLOW_COPY_AND_ASSIGN(AstTyper);
80 };
81
82 } // namespace internal
83 } // namespace v8
84
85 #endif // V8_TYPING_H_
OLDNEW
« no previous file with comments | « src/ppc/lithium-ppc.cc ('k') | src/typing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698