OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
51 return zone->New(static_cast<int>(size)); | 51 return zone->New(static_cast<int>(size)); |
52 } | 52 } |
53 void operator delete(void* pointer, Zone* zone) { } | 53 void operator delete(void* pointer, Zone* zone) { } |
54 void operator delete(void* pointer) { } | 54 void operator delete(void* pointer) { } |
55 | 55 |
56 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | 56 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
57 | 57 |
58 private: | 58 private: |
59 explicit AstTyper(CompilationInfo* info); | 59 explicit AstTyper(CompilationInfo* info); |
60 | 60 |
61 Effect ObservedOnStack(Object* value); | |
62 void ObserveTypesAtOsrEntry(IterationStatement* stmt); | |
63 | |
61 static const int kNoVar = INT_MIN; | 64 static const int kNoVar = INT_MIN; |
62 typedef v8::internal::Effects<int, kNoVar> Effects; | 65 typedef v8::internal::Effects<int, kNoVar> Effects; |
63 typedef v8::internal::NestedEffects<int, kNoVar> Store; | 66 typedef v8::internal::NestedEffects<int, kNoVar> Store; |
64 | 67 |
65 CompilationInfo* info_; | 68 CompilationInfo* info_; |
66 TypeFeedbackOracle oracle_; | 69 TypeFeedbackOracle oracle_; |
67 Store store_; | 70 Store store_; |
68 | 71 |
69 TypeFeedbackOracle* oracle() { return &oracle_; } | 72 TypeFeedbackOracle* oracle() { return &oracle_; } |
70 Zone* zone() const { return info_->zone(); } | 73 Zone* zone() const { return info_->zone(); } |
71 | 74 |
72 void NarrowType(Expression* e, Bounds b) { | 75 void NarrowType(Expression* e, Bounds b) { |
73 e->set_bounds(Bounds::Both(e->bounds(), b, isolate_)); | 76 e->set_bounds(Bounds::Both(e->bounds(), b, isolate_)); |
74 } | 77 } |
75 void NarrowLowerType(Expression* e, Handle<Type> t) { | 78 void NarrowLowerType(Expression* e, Handle<Type> t) { |
76 e->set_bounds(Bounds::NarrowLower(e->bounds(), t, isolate_)); | 79 e->set_bounds(Bounds::NarrowLower(e->bounds(), t, isolate_)); |
77 } | 80 } |
78 | 81 |
79 Effects EnterEffects() { | 82 Effects EnterEffects() { |
80 store_ = store_.Push(); | 83 store_ = store_.Push(); |
81 return store_.Top(); | 84 return store_.Top(); |
82 } | 85 } |
83 void ExitEffects() { store_ = store_.Pop(); } | 86 void ExitEffects() { store_ = store_.Pop(); } |
84 | 87 |
88 inline int parameter_index(int index) { return -index - 2; } | |
89 inline int stack_local_index(int index) { return index; } | |
rossberg
2013/12/16 11:49:44
Nit: the 'inline' is redundant here.
Is there muc
Yang
2013/12/16 11:58:35
Removed 'inline'.
I use them in case where I don'
| |
90 | |
85 int variable_index(Variable* var) { | 91 int variable_index(Variable* var) { |
86 // Stack locals have the range [0 .. l] | 92 // Stack locals have the range [0 .. l] |
87 // Parameters have the range [-1 .. p] | 93 // Parameters have the range [-1 .. p] |
88 // We map this to [-p-2 .. -1, 0 .. l] | 94 // We map this to [-p-2 .. -1, 0 .. l] |
89 return var->IsStackLocal() ? var->index() : | 95 return var->IsStackLocal() ? stack_local_index(var->index()) : |
90 var->IsParameter() ? -var->index() - 2 : kNoVar; | 96 var->IsParameter() ? parameter_index(var->index()) : kNoVar; |
91 } | 97 } |
92 | 98 |
93 void VisitDeclarations(ZoneList<Declaration*>* declarations); | 99 void VisitDeclarations(ZoneList<Declaration*>* declarations); |
94 void VisitStatements(ZoneList<Statement*>* statements); | 100 void VisitStatements(ZoneList<Statement*>* statements); |
95 | 101 |
96 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); | 102 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); |
97 AST_NODE_LIST(DECLARE_VISIT) | 103 AST_NODE_LIST(DECLARE_VISIT) |
98 #undef DECLARE_VISIT | 104 #undef DECLARE_VISIT |
99 | 105 |
100 DISALLOW_COPY_AND_ASSIGN(AstTyper); | 106 DISALLOW_COPY_AND_ASSIGN(AstTyper); |
101 }; | 107 }; |
102 | 108 |
103 } } // namespace v8::internal | 109 } } // namespace v8::internal |
104 | 110 |
105 #endif // V8_TYPING_H_ | 111 #endif // V8_TYPING_H_ |
OLD | NEW |