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

Side by Side Diff: src/scopeinfo.h

Issue 8344046: Reapply r9673 "Scope tree serialization and ScopeIterator cleanup." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Skip nested contexts of an internal function. Created 9 years, 2 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/runtime.cc ('k') | src/scopeinfo.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 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 17 matching lines...) Expand all
28 #ifndef V8_SCOPEINFO_H_ 28 #ifndef V8_SCOPEINFO_H_
29 #define V8_SCOPEINFO_H_ 29 #define V8_SCOPEINFO_H_
30 30
31 #include "allocation.h" 31 #include "allocation.h"
32 #include "variables.h" 32 #include "variables.h"
33 #include "zone-inl.h" 33 #include "zone-inl.h"
34 34
35 namespace v8 { 35 namespace v8 {
36 namespace internal { 36 namespace internal {
37 37
38 // Scope information represents information about a functions's 38 // ScopeInfo represents information about different scopes of a source
39 // scopes (currently only one, because we don't do any inlining) 39 // program and the allocation of the scope's variables. Scope information
40 // and the allocation of the scope's variables. Scope information 40 // is stored in a compressed form in SerializedScopeInfo objects and is used
41 // is stored in a compressed form in FixedArray objects and is used
42 // at runtime (stack dumps, deoptimization, etc.). 41 // at runtime (stack dumps, deoptimization, etc.).
43 //
44 // Historical note: In other VMs built by this team, ScopeInfo was
45 // usually called DebugInfo since the information was used (among
46 // other things) for on-demand debugging (Self, Smalltalk). However,
47 // DebugInfo seems misleading, since this information is primarily used
48 // in debugging-unrelated contexts.
49 42
50 // Forward defined as 43 // Forward defined as
51 // template <class Allocator = FreeStoreAllocationPolicy> class ScopeInfo; 44 // template <class Allocator = FreeStoreAllocationPolicy> class ScopeInfo;
52 template<class Allocator> 45 template<class Allocator>
53 class ScopeInfo BASE_EMBEDDED { 46 class ScopeInfo BASE_EMBEDDED {
54 public: 47 public:
55 // Create a ScopeInfo instance from a scope. 48 // Create a ScopeInfo instance from a scope.
56 explicit ScopeInfo(Scope* scope); 49 explicit ScopeInfo(Scope* scope);
57 50
58 // Create a ScopeInfo instance from SerializedScopeInfo. 51 // Create a ScopeInfo instance from SerializedScopeInfo.
(...skipping 17 matching lines...) Expand all
76 return context_slots_[i - Context::MIN_CONTEXT_SLOTS]; 69 return context_slots_[i - Context::MIN_CONTEXT_SLOTS];
77 } 70 }
78 int number_of_context_slots() const { 71 int number_of_context_slots() const {
79 int l = context_slots_.length(); 72 int l = context_slots_.length();
80 return l == 0 ? 0 : l + Context::MIN_CONTEXT_SLOTS; 73 return l == 0 ? 0 : l + Context::MIN_CONTEXT_SLOTS;
81 } 74 }
82 75
83 Handle<String> LocalName(int i) const; 76 Handle<String> LocalName(int i) const;
84 int NumberOfLocals() const; 77 int NumberOfLocals() const;
85 78
79 ScopeType type() const { return type_; }
86 // -------------------------------------------------------------------------- 80 // --------------------------------------------------------------------------
87 // Debugging support 81 // Debugging support
88 82
89 #ifdef DEBUG 83 #ifdef DEBUG
90 void Print(); 84 void Print();
91 #endif 85 #endif
92 86
93 private: 87 private:
94 Handle<String> function_name_; 88 Handle<String> function_name_;
95 bool calls_eval_; 89 bool calls_eval_;
96 bool is_strict_mode_; 90 bool is_strict_mode_;
91 ScopeType type_;
97 List<Handle<String>, Allocator > parameters_; 92 List<Handle<String>, Allocator > parameters_;
98 List<Handle<String>, Allocator > stack_slots_; 93 List<Handle<String>, Allocator > stack_slots_;
99 List<Handle<String>, Allocator > context_slots_; 94 List<Handle<String>, Allocator > context_slots_;
100 List<VariableMode, Allocator > context_modes_; 95 List<VariableMode, Allocator > context_modes_;
101 }; 96 };
102 97
103 98
104 // Cache for mapping (data, property name) into context slot index. 99 // Cache for mapping (data, property name) into context slot index.
105 // The cache contains both positive and negative results. 100 // The cache contains both positive and negative results.
106 // Slot index equals -1 means the property is absent. 101 // Slot index equals -1 means the property is absent.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 uint32_t values_[kLength]; 172 uint32_t values_[kLength];
178 173
179 friend class Isolate; 174 friend class Isolate;
180 DISALLOW_COPY_AND_ASSIGN(ContextSlotCache); 175 DISALLOW_COPY_AND_ASSIGN(ContextSlotCache);
181 }; 176 };
182 177
183 178
184 } } // namespace v8::internal 179 } } // namespace v8::internal
185 180
186 #endif // V8_SCOPEINFO_H_ 181 #endif // V8_SCOPEINFO_H_
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | src/scopeinfo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698