OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // that it is really a constructor, we check that it is not empty | 48 // that it is really a constructor, we check that it is not empty |
49 // and starts with a capital letter. | 49 // and starts with a capital letter. |
50 if (name->length() > 0 && Runtime::IsUpperCaseChar( | 50 if (name->length() > 0 && Runtime::IsUpperCaseChar( |
51 isolate()->runtime_state(), name->Get(0))) { | 51 isolate()->runtime_state(), name->Get(0))) { |
52 names_stack_.Add(Name(name, kEnclosingConstructorName), zone()); | 52 names_stack_.Add(Name(name, kEnclosingConstructorName), zone()); |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
56 | 56 |
57 void FuncNameInferrer::PushLiteralName(Handle<String> name) { | 57 void FuncNameInferrer::PushLiteralName(Handle<String> name) { |
58 if (IsOpen() && !isolate()->heap()->prototype_string()->Equals(*name)) { | 58 if (IsOpen() && |
| 59 !String::Equals(isolate()->factory()->prototype_string(), name)) { |
59 names_stack_.Add(Name(name, kLiteralName), zone()); | 60 names_stack_.Add(Name(name, kLiteralName), zone()); |
60 } | 61 } |
61 } | 62 } |
62 | 63 |
63 | 64 |
64 void FuncNameInferrer::PushVariableName(Handle<String> name) { | 65 void FuncNameInferrer::PushVariableName(Handle<String> name) { |
65 if (IsOpen() && !isolate()->heap()->dot_result_string()->Equals(*name)) { | 66 if (IsOpen() && |
| 67 !String::Equals(isolate()->factory()->dot_result_string(), name)) { |
66 names_stack_.Add(Name(name, kVariableName), zone()); | 68 names_stack_.Add(Name(name, kVariableName), zone()); |
67 } | 69 } |
68 } | 70 } |
69 | 71 |
70 | 72 |
71 Handle<String> FuncNameInferrer::MakeNameFromStack() { | 73 Handle<String> FuncNameInferrer::MakeNameFromStack() { |
72 return MakeNameFromStackHelper(0, isolate()->factory()->empty_string()); | 74 return MakeNameFromStackHelper(0, isolate()->factory()->empty_string()); |
73 } | 75 } |
74 | 76 |
75 | 77 |
(...skipping 24 matching lines...) Expand all Loading... |
100 void FuncNameInferrer::InferFunctionsNames() { | 102 void FuncNameInferrer::InferFunctionsNames() { |
101 Handle<String> func_name = MakeNameFromStack(); | 103 Handle<String> func_name = MakeNameFromStack(); |
102 for (int i = 0; i < funcs_to_infer_.length(); ++i) { | 104 for (int i = 0; i < funcs_to_infer_.length(); ++i) { |
103 funcs_to_infer_[i]->set_inferred_name(func_name); | 105 funcs_to_infer_[i]->set_inferred_name(func_name); |
104 } | 106 } |
105 funcs_to_infer_.Rewind(0); | 107 funcs_to_infer_.Rewind(0); |
106 } | 108 } |
107 | 109 |
108 | 110 |
109 } } // namespace v8::internal | 111 } } // namespace v8::internal |
OLD | NEW |