OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_DEBUG_DEBUG_SCOPES_H_ | 5 #ifndef V8_DEBUG_DEBUG_SCOPES_H_ |
6 #define V8_DEBUG_DEBUG_SCOPES_H_ | 6 #define V8_DEBUG_DEBUG_SCOPES_H_ |
7 | 7 |
8 #include "src/debug/debug-frames.h" | 8 #include "src/debug/debug-frames.h" |
9 #include "src/frames.h" | 9 #include "src/frames.h" |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 | 13 |
14 // Iterate over the actual scopes visible from a stack frame or from a closure. | 14 // Iterate over the actual scopes visible from a stack frame or from a closure. |
15 // The iteration proceeds from the innermost visible nested scope outwards. | 15 // The iteration proceeds from the innermost visible nested scope outwards. |
16 // All scopes are backed by an actual context except the local scope, | 16 // All scopes are backed by an actual context except the local scope, |
17 // which is inserted "artificially" in the context chain. | 17 // which is inserted "artificially" in the context chain. |
18 class ScopeIterator { | 18 class ScopeIterator { |
19 public: | 19 public: |
20 enum ScopeType { | 20 enum ScopeType { |
21 ScopeTypeGlobal = 0, | 21 ScopeTypeGlobal = 0, |
22 ScopeTypeLocal, | 22 ScopeTypeLocal, |
23 ScopeTypeWith, | 23 ScopeTypeWith, |
24 ScopeTypeClosure, | 24 ScopeTypeClosure, |
25 ScopeTypeCatch, | 25 ScopeTypeCatch, |
26 ScopeTypeBlock, | 26 ScopeTypeBlock, |
27 ScopeTypeScript, | 27 ScopeTypeScript, |
| 28 ScopeTypeEval, |
28 ScopeTypeModule | 29 ScopeTypeModule |
29 }; | 30 }; |
30 | 31 |
31 static const int kScopeDetailsTypeIndex = 0; | 32 static const int kScopeDetailsTypeIndex = 0; |
32 static const int kScopeDetailsObjectIndex = 1; | 33 static const int kScopeDetailsObjectIndex = 1; |
33 static const int kScopeDetailsNameIndex = 2; | 34 static const int kScopeDetailsNameIndex = 2; |
34 static const int kScopeDetailsStartPositionIndex = 3; | 35 static const int kScopeDetailsStartPositionIndex = 3; |
35 static const int kScopeDetailsEndPositionIndex = 4; | 36 static const int kScopeDetailsEndPositionIndex = 4; |
36 static const int kScopeDetailsFunctionIndex = 5; | 37 static const int kScopeDetailsFunctionIndex = 5; |
37 static const int kScopeDetailsSize = 6; | 38 static const int kScopeDetailsSize = 6; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 114 |
114 void CollectNonLocals(Scope* scope); | 115 void CollectNonLocals(Scope* scope); |
115 | 116 |
116 void UnwrapEvaluationContext(); | 117 void UnwrapEvaluationContext(); |
117 | 118 |
118 MUST_USE_RESULT MaybeHandle<JSObject> MaterializeScriptScope(); | 119 MUST_USE_RESULT MaybeHandle<JSObject> MaterializeScriptScope(); |
119 MUST_USE_RESULT MaybeHandle<JSObject> MaterializeLocalScope(); | 120 MUST_USE_RESULT MaybeHandle<JSObject> MaterializeLocalScope(); |
120 MUST_USE_RESULT MaybeHandle<JSObject> MaterializeModuleScope(); | 121 MUST_USE_RESULT MaybeHandle<JSObject> MaterializeModuleScope(); |
121 Handle<JSObject> MaterializeClosure(); | 122 Handle<JSObject> MaterializeClosure(); |
122 Handle<JSObject> MaterializeCatchScope(); | 123 Handle<JSObject> MaterializeCatchScope(); |
123 Handle<JSObject> MaterializeBlockScope(); | 124 Handle<JSObject> MaterializeInnerScope(); |
124 Handle<JSObject> WithContextExtension(); | 125 Handle<JSObject> WithContextExtension(); |
125 | 126 |
126 bool SetLocalVariableValue(Handle<String> variable_name, | 127 bool SetLocalVariableValue(Handle<String> variable_name, |
127 Handle<Object> new_value); | 128 Handle<Object> new_value); |
128 bool SetBlockVariableValue(Handle<String> variable_name, | 129 bool SetInnerScopeVariableValue(Handle<String> variable_name, |
129 Handle<Object> new_value); | 130 Handle<Object> new_value); |
130 bool SetClosureVariableValue(Handle<String> variable_name, | 131 bool SetClosureVariableValue(Handle<String> variable_name, |
131 Handle<Object> new_value); | 132 Handle<Object> new_value); |
132 bool SetScriptVariableValue(Handle<String> variable_name, | 133 bool SetScriptVariableValue(Handle<String> variable_name, |
133 Handle<Object> new_value); | 134 Handle<Object> new_value); |
134 bool SetCatchVariableValue(Handle<String> variable_name, | 135 bool SetCatchVariableValue(Handle<String> variable_name, |
135 Handle<Object> new_value); | 136 Handle<Object> new_value); |
136 | 137 |
137 // Helper functions. | 138 // Helper functions. |
138 bool SetParameterValue(Handle<ScopeInfo> scope_info, JavaScriptFrame* frame, | 139 bool SetParameterValue(Handle<ScopeInfo> scope_info, JavaScriptFrame* frame, |
139 Handle<String> parameter_name, | 140 Handle<String> parameter_name, |
140 Handle<Object> new_value); | 141 Handle<Object> new_value); |
141 bool SetStackVariableValue(Handle<ScopeInfo> scope_info, | 142 bool SetStackVariableValue(Handle<ScopeInfo> scope_info, |
142 JavaScriptFrame* frame, | 143 JavaScriptFrame* frame, |
143 Handle<String> variable_name, | 144 Handle<String> variable_name, |
144 Handle<Object> new_value); | 145 Handle<Object> new_value); |
145 bool SetContextVariableValue(Handle<ScopeInfo> scope_info, | 146 bool SetContextVariableValue(Handle<ScopeInfo> scope_info, |
146 Handle<Context> context, | 147 Handle<Context> context, |
147 Handle<String> variable_name, | 148 Handle<String> variable_name, |
148 Handle<Object> new_value); | 149 Handle<Object> new_value); |
149 | 150 |
150 void CopyContextLocalsToScopeObject(Handle<ScopeInfo> scope_info, | 151 void CopyContextLocalsToScopeObject(Handle<ScopeInfo> scope_info, |
151 Handle<Context> context, | 152 Handle<Context> context, |
152 Handle<JSObject> scope_object); | 153 Handle<JSObject> scope_object); |
153 bool CopyContextExtensionToScopeObject(Handle<JSObject> extension, | 154 void CopyContextExtensionToScopeObject(Handle<Context> context, |
154 Handle<JSObject> scope_object, | 155 Handle<JSObject> scope_object, |
155 KeyCollectionType type); | 156 KeyCollectionType type); |
156 | 157 |
157 // Get the chain of nested scopes within this scope for the source statement | 158 // Get the chain of nested scopes within this scope for the source statement |
158 // position. The scopes will be added to the list from the outermost scope to | 159 // position. The scopes will be added to the list from the outermost scope to |
159 // the innermost scope. Only nested block, catch or with scopes are tracked | 160 // the innermost scope. Only nested block, catch or with scopes are tracked |
160 // and will be returned, but no inner function scopes. | 161 // and will be returned, but no inner function scopes. |
161 void GetNestedScopeChain(Isolate* isolate, Scope* scope, | 162 void GetNestedScopeChain(Isolate* isolate, Scope* scope, |
162 int statement_position); | 163 int statement_position); |
163 | 164 |
164 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopeIterator); | 165 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopeIterator); |
165 }; | 166 }; |
166 | 167 |
167 } // namespace internal | 168 } // namespace internal |
168 } // namespace v8 | 169 } // namespace v8 |
169 | 170 |
170 #endif // V8_DEBUG_DEBUG_SCOPES_H_ | 171 #endif // V8_DEBUG_DEBUG_SCOPES_H_ |
OLD | NEW |