| 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 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 #include "ast.h" | 30 #include "ast.h" |
| 31 #include "func-name-inferrer.h" | 31 #include "func-name-inferrer.h" |
| 32 #include "list-inl.h" | 32 #include "list-inl.h" |
| 33 | 33 |
| 34 namespace v8 { | 34 namespace v8 { |
| 35 namespace internal { | 35 namespace internal { |
| 36 | 36 |
| 37 FuncNameInferrer::FuncNameInferrer(Isolate* isolate) | 37 FuncNameInferrer::FuncNameInferrer(Isolate* isolate) |
| 38 : isolate_(isolate), | 38 : isolate_(isolate), |
| 39 entries_stack_(10), | 39 entries_stack_(isolate->zone(), 10), |
| 40 names_stack_(5), | 40 names_stack_(isolate->zone(), 5), |
| 41 funcs_to_infer_(4) { | 41 funcs_to_infer_(isolate->zone(), 4) { |
| 42 } | 42 } |
| 43 | 43 |
| 44 | 44 |
| 45 void FuncNameInferrer::PushEnclosingName(Handle<String> name) { | 45 void FuncNameInferrer::PushEnclosingName(Handle<String> name) { |
| 46 // Enclosing name is a name of a constructor function. To check | 46 // Enclosing name is a name of a constructor function. To check |
| 47 // that it is really a constructor, we check that it is not empty | 47 // that it is really a constructor, we check that it is not empty |
| 48 // and starts with a capital letter. | 48 // and starts with a capital letter. |
| 49 if (name->length() > 0 && Runtime::IsUpperCaseChar( | 49 if (name->length() > 0 && Runtime::IsUpperCaseChar( |
| 50 isolate()->runtime_state(), name->Get(0))) { | 50 isolate()->runtime_state(), name->Get(0))) { |
| 51 names_stack_.Add(Name(name, kEnclosingConstructorName)); | 51 names_stack_.Add(Name(name, kEnclosingConstructorName)); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 void FuncNameInferrer::InferFunctionsNames() { | 97 void FuncNameInferrer::InferFunctionsNames() { |
| 98 Handle<String> func_name = MakeNameFromStack(); | 98 Handle<String> func_name = MakeNameFromStack(); |
| 99 for (int i = 0; i < funcs_to_infer_.length(); ++i) { | 99 for (int i = 0; i < funcs_to_infer_.length(); ++i) { |
| 100 funcs_to_infer_[i]->set_inferred_name(func_name); | 100 funcs_to_infer_[i]->set_inferred_name(func_name); |
| 101 } | 101 } |
| 102 funcs_to_infer_.Rewind(0); | 102 funcs_to_infer_.Rewind(0); |
| 103 } | 103 } |
| 104 | 104 |
| 105 | 105 |
| 106 } } // namespace v8::internal | 106 } } // namespace v8::internal |
| OLD | NEW |