OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 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 26 matching lines...) Expand all Loading... |
37 void FuncNameInferrer::PushEnclosingName(Handle<String> name) { | 37 void FuncNameInferrer::PushEnclosingName(Handle<String> name) { |
38 // Enclosing name is a name of a constructor function. To check | 38 // Enclosing name is a name of a constructor function. To check |
39 // that it is really a constructor, we check that it is not empty | 39 // that it is really a constructor, we check that it is not empty |
40 // and starts with a capital letter. | 40 // and starts with a capital letter. |
41 if (name->length() > 0 && Runtime::IsUpperCaseChar(name->Get(0))) { | 41 if (name->length() > 0 && Runtime::IsUpperCaseChar(name->Get(0))) { |
42 names_stack_.Add(name); | 42 names_stack_.Add(name); |
43 } | 43 } |
44 } | 44 } |
45 | 45 |
46 | 46 |
| 47 void FuncNameInferrer::PushLiteralName(Handle<String> name) { |
| 48 if (IsOpen() && !Heap::prototype_symbol()->Equals(*name)) { |
| 49 names_stack_.Add(name); |
| 50 } |
| 51 } |
| 52 |
| 53 |
| 54 void FuncNameInferrer::PushVariableName(Handle<String> name) { |
| 55 if (IsOpen() && !Heap::result_symbol()->Equals(*name)) { |
| 56 names_stack_.Add(name); |
| 57 } |
| 58 } |
| 59 |
| 60 |
47 Handle<String> FuncNameInferrer::MakeNameFromStack() { | 61 Handle<String> FuncNameInferrer::MakeNameFromStack() { |
48 if (names_stack_.is_empty()) { | 62 if (names_stack_.is_empty()) { |
49 return Factory::empty_string(); | 63 return Factory::empty_string(); |
50 } else { | 64 } else { |
51 return MakeNameFromStackHelper(1, names_stack_.at(0)); | 65 return MakeNameFromStackHelper(1, names_stack_.at(0)); |
52 } | 66 } |
53 } | 67 } |
54 | 68 |
55 | 69 |
56 Handle<String> FuncNameInferrer::MakeNameFromStackHelper(int pos, | 70 Handle<String> FuncNameInferrer::MakeNameFromStackHelper(int pos, |
(...skipping 10 matching lines...) Expand all Loading... |
67 void FuncNameInferrer::InferFunctionsNames() { | 81 void FuncNameInferrer::InferFunctionsNames() { |
68 Handle<String> func_name = MakeNameFromStack(); | 82 Handle<String> func_name = MakeNameFromStack(); |
69 for (int i = 0; i < funcs_to_infer_.length(); ++i) { | 83 for (int i = 0; i < funcs_to_infer_.length(); ++i) { |
70 funcs_to_infer_[i]->set_inferred_name(func_name); | 84 funcs_to_infer_[i]->set_inferred_name(func_name); |
71 } | 85 } |
72 funcs_to_infer_.Rewind(0); | 86 funcs_to_infer_.Rewind(0); |
73 } | 87 } |
74 | 88 |
75 | 89 |
76 } } // namespace v8::internal | 90 } } // namespace v8::internal |
OLD | NEW |