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

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

Issue 2792353002: [parser/ast] Reduce memory consumption for AstConsString. (Closed)
Patch Set: Fix (and minor cleanup) Created 3 years, 8 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
« no previous file with comments | « src/ast/ast-value-factory.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/parsing/func-name-inferrer.h" 5 #include "src/parsing/func-name-inferrer.h"
6 6
7 #include "src/ast/ast-value-factory.h" 7 #include "src/ast/ast-value-factory.h"
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/list-inl.h" 9 #include "src/list-inl.h"
10 #include "src/objects-inl.h" 10 #include "src/objects-inl.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 AstConsString* result = ast_value_factory_->NewConsString(); 57 AstConsString* result = ast_value_factory_->NewConsString();
58 for (int pos = 0; pos < names_stack_.length(); pos++) { 58 for (int pos = 0; pos < names_stack_.length(); pos++) {
59 // Skip consecutive variable declarations. 59 // Skip consecutive variable declarations.
60 if (pos + 1 < names_stack_.length() && 60 if (pos + 1 < names_stack_.length() &&
61 names_stack_.at(pos).type == kVariableName && 61 names_stack_.at(pos).type == kVariableName &&
62 names_stack_.at(pos + 1).type == kVariableName) { 62 names_stack_.at(pos + 1).type == kVariableName) {
63 continue; 63 continue;
64 } 64 }
65 // Add name. Separate names with ".". 65 // Add name. Separate names with ".".
66 if (!result->IsEmpty()) { 66 if (!result->IsEmpty()) {
67 result->AddString(ast_value_factory_->dot_string()); 67 result->AddString(zone(), ast_value_factory_->dot_string());
68 } 68 }
69 result->AddString(names_stack_.at(pos).name); 69 result->AddString(zone(), names_stack_.at(pos).name);
70 } 70 }
71 return result; 71 return result;
72 } 72 }
73 73
74 void FuncNameInferrer::InferFunctionsNames() { 74 void FuncNameInferrer::InferFunctionsNames() {
75 const AstConsString* func_name = MakeNameFromStack(); 75 const AstConsString* func_name = MakeNameFromStack();
76 for (int i = 0; i < funcs_to_infer_.length(); ++i) { 76 for (int i = 0; i < funcs_to_infer_.length(); ++i) {
77 funcs_to_infer_[i]->set_raw_inferred_name(func_name); 77 funcs_to_infer_[i]->set_raw_inferred_name(func_name);
78 } 78 }
79 funcs_to_infer_.Rewind(0); 79 funcs_to_infer_.Rewind(0);
80 } 80 }
81 81
82 82
83 } // namespace internal 83 } // namespace internal
84 } // namespace v8 84 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/ast-value-factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698