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 29 matching lines...) Expand all Loading... |
40 // (assignments, declarations, object literals) we collect name strings, | 40 // (assignments, declarations, object literals) we collect name strings, |
41 // and during parsing of the RHS, a function literal can be collected. After | 41 // and during parsing of the RHS, a function literal can be collected. After |
42 // parsing the RHS we can infer a name for function literals that do not have | 42 // parsing the RHS we can infer a name for function literals that do not have |
43 // a name. | 43 // a name. |
44 class FuncNameInferrer : public ZoneObject { | 44 class FuncNameInferrer : public ZoneObject { |
45 public: | 45 public: |
46 FuncNameInferrer() | 46 FuncNameInferrer() |
47 : entries_stack_(10), | 47 : entries_stack_(10), |
48 names_stack_(5), | 48 names_stack_(5), |
49 funcs_to_infer_(4), | 49 funcs_to_infer_(4), |
50 dot_(Factory::NewStringFromAscii(CStrVector("."))) { | 50 dot_(FACTORY->NewStringFromAscii(CStrVector("."))) { |
51 } | 51 } |
52 | 52 |
53 // Returns whether we have entered name collection state. | 53 // Returns whether we have entered name collection state. |
54 bool IsOpen() const { return !entries_stack_.is_empty(); } | 54 bool IsOpen() const { return !entries_stack_.is_empty(); } |
55 | 55 |
56 // Pushes an enclosing the name of enclosing function onto names stack. | 56 // Pushes an enclosing the name of enclosing function onto names stack. |
57 void PushEnclosingName(Handle<String> name); | 57 void PushEnclosingName(Handle<String> name); |
58 | 58 |
59 // Enters name collection state. | 59 // Enters name collection state. |
60 void Enter() { | 60 void Enter() { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 ZoneList<FunctionLiteral*> funcs_to_infer_; | 102 ZoneList<FunctionLiteral*> funcs_to_infer_; |
103 Handle<String> dot_; | 103 Handle<String> dot_; |
104 | 104 |
105 DISALLOW_COPY_AND_ASSIGN(FuncNameInferrer); | 105 DISALLOW_COPY_AND_ASSIGN(FuncNameInferrer); |
106 }; | 106 }; |
107 | 107 |
108 | 108 |
109 } } // namespace v8::internal | 109 } } // namespace v8::internal |
110 | 110 |
111 #endif // V8_FUNC_NAME_INFERRER_H_ | 111 #endif // V8_FUNC_NAME_INFERRER_H_ |
OLD | NEW |