| Index: src/func-name-inferrer.h
|
| ===================================================================
|
| --- src/func-name-inferrer.h (revision 8618)
|
| +++ src/func-name-inferrer.h (working copy)
|
| @@ -31,6 +31,8 @@
|
| namespace v8 {
|
| namespace internal {
|
|
|
| +class Isolate;
|
| +
|
| // FuncNameInferrer is a stateful class that is used to perform name
|
| // inference for anonymous functions during static analysis of source code.
|
| // Inference is performed in cases when an anonymous function is assigned
|
| @@ -43,12 +45,7 @@
|
| // a name.
|
| class FuncNameInferrer : public ZoneObject {
|
| public:
|
| - FuncNameInferrer()
|
| - : entries_stack_(10),
|
| - names_stack_(5),
|
| - funcs_to_infer_(4),
|
| - dot_(FACTORY->NewStringFromAscii(CStrVector("."))) {
|
| - }
|
| + explicit FuncNameInferrer(Isolate* isolate);
|
|
|
| // Returns whether we have entered name collection state.
|
| bool IsOpen() const { return !entries_stack_.is_empty(); }
|
| @@ -81,13 +78,26 @@
|
| }
|
| }
|
|
|
| - // Infers a function name and leaves names collection state.
|
| + // Leaves names collection state.
|
| void Leave() {
|
| ASSERT(IsOpen());
|
| names_stack_.Rewind(entries_stack_.RemoveLast());
|
| }
|
|
|
| private:
|
| + enum NameType {
|
| + kEnclosingConstructorName,
|
| + kLiteralName,
|
| + kVariableName
|
| + };
|
| + struct Name {
|
| + Name(Handle<String> name, NameType type) : name(name), type(type) { }
|
| + Handle<String> name;
|
| + NameType type;
|
| + };
|
| +
|
| + Isolate* isolate() { return isolate_; }
|
| +
|
| // Constructs a full name in dotted notation from gathered names.
|
| Handle<String> MakeNameFromStack();
|
|
|
| @@ -97,10 +107,10 @@
|
| // Performs name inferring for added functions.
|
| void InferFunctionsNames();
|
|
|
| + Isolate* isolate_;
|
| ZoneList<int> entries_stack_;
|
| - ZoneList<Handle<String> > names_stack_;
|
| + ZoneList<Name> names_stack_;
|
| ZoneList<FunctionLiteral*> funcs_to_infer_;
|
| - Handle<String> dot_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(FuncNameInferrer);
|
| };
|
|
|