OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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_FUNC_NAME_INFERRER_H_ | 5 #ifndef V8_FUNC_NAME_INFERRER_H_ |
6 #define V8_FUNC_NAME_INFERRER_H_ | 6 #define V8_FUNC_NAME_INFERRER_H_ |
7 | 7 |
8 #include "src/handles.h" | 8 #include "src/handles.h" |
9 #include "src/zone.h" | 9 #include "src/zone.h" |
10 | 10 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 } | 54 } |
55 | 55 |
56 void RemoveLastFunction() { | 56 void RemoveLastFunction() { |
57 if (IsOpen() && !funcs_to_infer_.is_empty()) { | 57 if (IsOpen() && !funcs_to_infer_.is_empty()) { |
58 funcs_to_infer_.RemoveLast(); | 58 funcs_to_infer_.RemoveLast(); |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 // Infers a function name and leaves names collection state. | 62 // Infers a function name and leaves names collection state. |
63 void Infer() { | 63 void Infer() { |
64 ASSERT(IsOpen()); | 64 DCHECK(IsOpen()); |
65 if (!funcs_to_infer_.is_empty()) { | 65 if (!funcs_to_infer_.is_empty()) { |
66 InferFunctionsNames(); | 66 InferFunctionsNames(); |
67 } | 67 } |
68 } | 68 } |
69 | 69 |
70 // Leaves names collection state. | 70 // Leaves names collection state. |
71 void Leave() { | 71 void Leave() { |
72 ASSERT(IsOpen()); | 72 DCHECK(IsOpen()); |
73 names_stack_.Rewind(entries_stack_.RemoveLast()); | 73 names_stack_.Rewind(entries_stack_.RemoveLast()); |
74 if (entries_stack_.is_empty()) | 74 if (entries_stack_.is_empty()) |
75 funcs_to_infer_.Clear(); | 75 funcs_to_infer_.Clear(); |
76 } | 76 } |
77 | 77 |
78 private: | 78 private: |
79 enum NameType { | 79 enum NameType { |
80 kEnclosingConstructorName, | 80 kEnclosingConstructorName, |
81 kLiteralName, | 81 kLiteralName, |
82 kVariableName | 82 kVariableName |
(...skipping 22 matching lines...) Expand all Loading... |
105 ZoneList<FunctionLiteral*> funcs_to_infer_; | 105 ZoneList<FunctionLiteral*> funcs_to_infer_; |
106 Zone* zone_; | 106 Zone* zone_; |
107 | 107 |
108 DISALLOW_COPY_AND_ASSIGN(FuncNameInferrer); | 108 DISALLOW_COPY_AND_ASSIGN(FuncNameInferrer); |
109 }; | 109 }; |
110 | 110 |
111 | 111 |
112 } } // namespace v8::internal | 112 } } // namespace v8::internal |
113 | 113 |
114 #endif // V8_FUNC_NAME_INFERRER_H_ | 114 #endif // V8_FUNC_NAME_INFERRER_H_ |
OLD | NEW |