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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 if (pos < names_stack_.length() - 1 && | 79 if (pos < names_stack_.length() - 1 && |
80 names_stack_.at(pos).type == kVariableName && | 80 names_stack_.at(pos).type == kVariableName && |
81 names_stack_.at(pos + 1).type == kVariableName) { | 81 names_stack_.at(pos + 1).type == kVariableName) { |
82 // Skip consecutive variable declarations. | 82 // Skip consecutive variable declarations. |
83 return MakeNameFromStackHelper(pos + 1, prev); | 83 return MakeNameFromStackHelper(pos + 1, prev); |
84 } else { | 84 } else { |
85 if (prev->length() > 0) { | 85 if (prev->length() > 0) { |
86 Handle<String> name = names_stack_.at(pos).name; | 86 Handle<String> name = names_stack_.at(pos).name; |
87 if (prev->length() + name->length() + 1 > String::kMaxLength) return prev; | 87 if (prev->length() + name->length() + 1 > String::kMaxLength) return prev; |
88 Factory* factory = isolate()->factory(); | 88 Factory* factory = isolate()->factory(); |
89 Handle<String> curr = | 89 Handle<String> curr = factory->NewConsString(factory->dot_string(), name); |
90 factory->NewConsString(factory->dot_string(), name).ToHandleChecked(); | 90 CHECK_NOT_EMPTY_HANDLE(isolate(), curr); |
91 curr = factory->NewConsString(prev, curr).ToHandleChecked(); | 91 curr = factory->NewConsString(prev, curr); |
| 92 CHECK_NOT_EMPTY_HANDLE(isolate(), curr); |
92 return MakeNameFromStackHelper(pos + 1, curr); | 93 return MakeNameFromStackHelper(pos + 1, curr); |
93 } else { | 94 } else { |
94 return MakeNameFromStackHelper(pos + 1, names_stack_.at(pos).name); | 95 return MakeNameFromStackHelper(pos + 1, names_stack_.at(pos).name); |
95 } | 96 } |
96 } | 97 } |
97 } | 98 } |
98 | 99 |
99 | 100 |
100 void FuncNameInferrer::InferFunctionsNames() { | 101 void FuncNameInferrer::InferFunctionsNames() { |
101 Handle<String> func_name = MakeNameFromStack(); | 102 Handle<String> func_name = MakeNameFromStack(); |
102 for (int i = 0; i < funcs_to_infer_.length(); ++i) { | 103 for (int i = 0; i < funcs_to_infer_.length(); ++i) { |
103 funcs_to_infer_[i]->set_inferred_name(func_name); | 104 funcs_to_infer_[i]->set_inferred_name(func_name); |
104 } | 105 } |
105 funcs_to_infer_.Rewind(0); | 106 funcs_to_infer_.Rewind(0); |
106 } | 107 } |
107 | 108 |
108 | 109 |
109 } } // namespace v8::internal | 110 } } // namespace v8::internal |
OLD | NEW |