Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/func-name-inferrer.cc

Issue 3141034: Move the function name inferrer code from the AstOptimizer to... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/func-name-inferrer.h ('k') | src/parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/func-name-inferrer.h ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698