| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 void PushVariableName(Handle<String> name); | 64 void PushVariableName(Handle<String> name); |
| 65 | 65 |
| 66 // Adds a function to infer name for. | 66 // Adds a function to infer name for. |
| 67 void AddFunction(FunctionLiteral* func_to_infer) { | 67 void AddFunction(FunctionLiteral* func_to_infer) { |
| 68 if (IsOpen()) { | 68 if (IsOpen()) { |
| 69 funcs_to_infer_.Add(func_to_infer); | 69 funcs_to_infer_.Add(func_to_infer); |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 void RemoveLastFunction() { |
| 74 if (IsOpen() && !funcs_to_infer_.is_empty()) { |
| 75 funcs_to_infer_.RemoveLast(); |
| 76 } |
| 77 } |
| 78 |
| 73 // Infers a function name and leaves names collection state. | 79 // Infers a function name and leaves names collection state. |
| 74 void Infer() { | 80 void Infer() { |
| 75 ASSERT(IsOpen()); | 81 ASSERT(IsOpen()); |
| 76 if (!funcs_to_infer_.is_empty()) { | 82 if (!funcs_to_infer_.is_empty()) { |
| 77 InferFunctionsNames(); | 83 InferFunctionsNames(); |
| 78 } | 84 } |
| 79 } | 85 } |
| 80 | 86 |
| 81 // Leaves names collection state. | 87 // Leaves names collection state. |
| 82 void Leave() { | 88 void Leave() { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 112 ZoneList<Name> names_stack_; | 118 ZoneList<Name> names_stack_; |
| 113 ZoneList<FunctionLiteral*> funcs_to_infer_; | 119 ZoneList<FunctionLiteral*> funcs_to_infer_; |
| 114 | 120 |
| 115 DISALLOW_COPY_AND_ASSIGN(FuncNameInferrer); | 121 DISALLOW_COPY_AND_ASSIGN(FuncNameInferrer); |
| 116 }; | 122 }; |
| 117 | 123 |
| 118 | 124 |
| 119 } } // namespace v8::internal | 125 } } // namespace v8::internal |
| 120 | 126 |
| 121 #endif // V8_FUNC_NAME_INFERRER_H_ | 127 #endif // V8_FUNC_NAME_INFERRER_H_ |
| OLD | NEW |