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

Side by Side Diff: src/ast/scopes.h

Issue 2950993002: Make some functions that are hit during renderer startup available for inlining (Closed)
Patch Set: Created 3 years, 6 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #ifndef V8_AST_SCOPES_H_ 5 #ifndef V8_AST_SCOPES_H_
6 #define V8_AST_SCOPES_H_ 6 #define V8_AST_SCOPES_H_
7 7
8 #include "src/ast/ast.h"
8 #include "src/base/compiler-specific.h" 9 #include "src/base/compiler-specific.h"
9 #include "src/base/hashmap.h" 10 #include "src/base/hashmap.h"
10 #include "src/globals.h" 11 #include "src/globals.h"
11 #include "src/objects.h" 12 #include "src/objects.h"
12 #include "src/zone/zone.h" 13 #include "src/zone/zone.h"
13 14
14 namespace v8 { 15 namespace v8 {
15 namespace internal { 16 namespace internal {
16 17
17 class AstNodeFactory; 18 class AstNodeFactory;
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 Variable* DeclareVariableName(const AstRawString* name, VariableMode mode); 202 Variable* DeclareVariableName(const AstRawString* name, VariableMode mode);
202 203
203 // Declarations list. 204 // Declarations list.
204 ThreadedList<Declaration>* declarations() { return &decls_; } 205 ThreadedList<Declaration>* declarations() { return &decls_; }
205 206
206 ThreadedList<Variable>* locals() { return &locals_; } 207 ThreadedList<Variable>* locals() { return &locals_; }
207 208
208 // Create a new unresolved variable. 209 // Create a new unresolved variable.
209 VariableProxy* NewUnresolved(AstNodeFactory* factory, 210 VariableProxy* NewUnresolved(AstNodeFactory* factory,
210 const AstRawString* name, 211 const AstRawString* name,
211 int start_position = kNoSourcePosition, 212 int start_pos = kNoSourcePosition,
212 VariableKind kind = NORMAL_VARIABLE); 213 VariableKind kind = NORMAL_VARIABLE) {
214 // Note that we must not share the unresolved variables with
215 // the same name because they may be removed selectively via
216 // RemoveUnresolved().
217 DCHECK(!already_resolved_);
218 DCHECK_EQ(factory->zone(), zone());
219 VariableProxy* proxy = factory->NewVariableProxy(name, kind, start_pos);
220 proxy->set_next_unresolved(unresolved_);
221 unresolved_ = proxy;
222 return proxy;
223 }
213 224
214 void AddUnresolved(VariableProxy* proxy); 225 void AddUnresolved(VariableProxy* proxy);
215 226
216 // Remove a unresolved variable. During parsing, an unresolved variable 227 // Remove a unresolved variable. During parsing, an unresolved variable
217 // may have been added optimistically, but then only the variable name 228 // may have been added optimistically, but then only the variable name
218 // was used (typically for labels). If the variable was not declared, the 229 // was used (typically for labels). If the variable was not declared, the
219 // addition introduced a new unresolved variable which may end up being 230 // addition introduced a new unresolved variable which may end up being
220 // allocated globally as a "ghost" variable. RemoveUnresolved removes 231 // allocated globally as a "ghost" variable. RemoveUnresolved removes
221 // such a variable again if it was added; otherwise this is a no-op. 232 // such a variable again if it was added; otherwise this is a no-op.
222 bool RemoveUnresolved(VariableProxy* var); 233 bool RemoveUnresolved(VariableProxy* var);
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 void AllocateModuleVariables(); 1024 void AllocateModuleVariables();
1014 1025
1015 private: 1026 private:
1016 ModuleDescriptor* module_descriptor_; 1027 ModuleDescriptor* module_descriptor_;
1017 }; 1028 };
1018 1029
1019 } // namespace internal 1030 } // namespace internal
1020 } // namespace v8 1031 } // namespace v8
1021 1032
1022 #endif // V8_AST_SCOPES_H_ 1033 #endif // V8_AST_SCOPES_H_
OLDNEW
« no previous file with comments | « src/ast/ast.cc ('k') | src/ast/scopes.cc » ('j') | src/interpreter/bytecodes.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698