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 // 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 ASSERT(IsOpen()); | 81 ASSERT(IsOpen()); |
82 if (!funcs_to_infer_.is_empty()) { | 82 if (!funcs_to_infer_.is_empty()) { |
83 InferFunctionsNames(); | 83 InferFunctionsNames(); |
84 } | 84 } |
85 } | 85 } |
86 | 86 |
87 // Leaves names collection state. | 87 // Leaves names collection state. |
88 void Leave() { | 88 void Leave() { |
89 ASSERT(IsOpen()); | 89 ASSERT(IsOpen()); |
90 names_stack_.Rewind(entries_stack_.RemoveLast()); | 90 names_stack_.Rewind(entries_stack_.RemoveLast()); |
| 91 if (entries_stack_.is_empty()) |
| 92 funcs_to_infer_.Clear(); |
91 } | 93 } |
92 | 94 |
93 private: | 95 private: |
94 enum NameType { | 96 enum NameType { |
95 kEnclosingConstructorName, | 97 kEnclosingConstructorName, |
96 kLiteralName, | 98 kLiteralName, |
97 kVariableName | 99 kVariableName |
98 }; | 100 }; |
99 struct Name { | 101 struct Name { |
100 Name(Handle<String> name, NameType type) : name(name), type(type) { } | 102 Name(Handle<String> name, NameType type) : name(name), type(type) { } |
(...skipping 17 matching lines...) Expand all Loading... |
118 ZoneList<Name> names_stack_; | 120 ZoneList<Name> names_stack_; |
119 ZoneList<FunctionLiteral*> funcs_to_infer_; | 121 ZoneList<FunctionLiteral*> funcs_to_infer_; |
120 | 122 |
121 DISALLOW_COPY_AND_ASSIGN(FuncNameInferrer); | 123 DISALLOW_COPY_AND_ASSIGN(FuncNameInferrer); |
122 }; | 124 }; |
123 | 125 |
124 | 126 |
125 } } // namespace v8::internal | 127 } } // namespace v8::internal |
126 | 128 |
127 #endif // V8_FUNC_NAME_INFERRER_H_ | 129 #endif // V8_FUNC_NAME_INFERRER_H_ |
OLD | NEW |