| 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 ScopeTypeEval, |
| 27 ScopeTypeScript, | 28 ScopeTypeScript, |
| 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; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 111 |
| 111 void CollectNonLocals(Scope* scope); | 112 void CollectNonLocals(Scope* scope); |
| 112 | 113 |
| 113 void UnwrapEvaluationContext(); | 114 void UnwrapEvaluationContext(); |
| 114 | 115 |
| 115 MUST_USE_RESULT MaybeHandle<JSObject> MaterializeScriptScope(); | 116 MUST_USE_RESULT MaybeHandle<JSObject> MaterializeScriptScope(); |
| 116 MUST_USE_RESULT MaybeHandle<JSObject> MaterializeLocalScope(); | 117 MUST_USE_RESULT MaybeHandle<JSObject> MaterializeLocalScope(); |
| 117 MUST_USE_RESULT MaybeHandle<JSObject> MaterializeModuleScope(); | 118 MUST_USE_RESULT MaybeHandle<JSObject> MaterializeModuleScope(); |
| 118 Handle<JSObject> MaterializeClosure(); | 119 Handle<JSObject> MaterializeClosure(); |
| 119 Handle<JSObject> MaterializeCatchScope(); | 120 Handle<JSObject> MaterializeCatchScope(); |
| 120 Handle<JSObject> MaterializeBlockScope(); | 121 Handle<JSObject> MaterializeInnerScope(); |
| 121 Handle<JSObject> WithContextExtension(); | 122 Handle<JSObject> WithContextExtension(); |
| 122 | 123 |
| 123 bool SetLocalVariableValue(Handle<String> variable_name, | 124 bool SetLocalVariableValue(Handle<String> variable_name, |
| 124 Handle<Object> new_value); | 125 Handle<Object> new_value); |
| 125 bool SetBlockVariableValue(Handle<String> variable_name, | 126 bool SetInnerScopeVariableValue(Handle<String> variable_name, |
| 126 Handle<Object> new_value); | 127 Handle<Object> new_value); |
| 127 bool SetClosureVariableValue(Handle<String> variable_name, | 128 bool SetClosureVariableValue(Handle<String> variable_name, |
| 128 Handle<Object> new_value); | 129 Handle<Object> new_value); |
| 129 bool SetScriptVariableValue(Handle<String> variable_name, | 130 bool SetScriptVariableValue(Handle<String> variable_name, |
| 130 Handle<Object> new_value); | 131 Handle<Object> new_value); |
| 131 bool SetCatchVariableValue(Handle<String> variable_name, | 132 bool SetCatchVariableValue(Handle<String> variable_name, |
| 132 Handle<Object> new_value); | 133 Handle<Object> new_value); |
| 133 | 134 |
| 134 // Helper functions. | 135 // Helper functions. |
| 135 bool SetParameterValue(Handle<ScopeInfo> scope_info, JavaScriptFrame* frame, | 136 bool SetParameterValue(Handle<ScopeInfo> scope_info, JavaScriptFrame* frame, |
| 136 Handle<String> parameter_name, | 137 Handle<String> parameter_name, |
| 137 Handle<Object> new_value); | 138 Handle<Object> new_value); |
| 138 bool SetStackVariableValue(Handle<ScopeInfo> scope_info, | 139 bool SetStackVariableValue(Handle<ScopeInfo> scope_info, |
| 139 JavaScriptFrame* frame, | 140 JavaScriptFrame* frame, |
| 140 Handle<String> variable_name, | 141 Handle<String> variable_name, |
| 141 Handle<Object> new_value); | 142 Handle<Object> new_value); |
| 142 bool SetContextVariableValue(Handle<ScopeInfo> scope_info, | 143 bool SetContextVariableValue(Handle<ScopeInfo> scope_info, |
| 143 Handle<Context> context, | 144 Handle<Context> context, |
| 144 Handle<String> variable_name, | 145 Handle<String> variable_name, |
| 145 Handle<Object> new_value); | 146 Handle<Object> new_value); |
| 146 | 147 |
| 147 void CopyContextLocalsToScopeObject(Handle<ScopeInfo> scope_info, | 148 void CopyContextLocalsToScopeObject(Handle<ScopeInfo> scope_info, |
| 148 Handle<Context> context, | 149 Handle<Context> context, |
| 149 Handle<JSObject> scope_object); | 150 Handle<JSObject> scope_object); |
| 150 bool CopyContextExtensionToScopeObject(Handle<JSObject> extension, | 151 void CopyContextExtensionToScopeObject(Handle<Context> context, |
| 151 Handle<JSObject> scope_object, | 152 Handle<JSObject> scope_object, |
| 152 KeyCollectionType type); | 153 KeyCollectionType type); |
| 153 | 154 |
| 154 // Get the chain of nested scopes within this scope for the source statement | 155 // Get the chain of nested scopes within this scope for the source statement |
| 155 // position. The scopes will be added to the list from the outermost scope to | 156 // position. The scopes will be added to the list from the outermost scope to |
| 156 // the innermost scope. Only nested block, catch or with scopes are tracked | 157 // the innermost scope. Only nested block, catch or with scopes are tracked |
| 157 // and will be returned, but no inner function scopes. | 158 // and will be returned, but no inner function scopes. |
| 158 void GetNestedScopeChain(Isolate* isolate, Scope* scope, | 159 void GetNestedScopeChain(Isolate* isolate, Scope* scope, |
| 159 int statement_position); | 160 int statement_position); |
| 160 | 161 |
| 161 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopeIterator); | 162 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopeIterator); |
| 162 }; | 163 }; |
| 163 | 164 |
| 164 } // namespace internal | 165 } // namespace internal |
| 165 } // namespace v8 | 166 } // namespace v8 |
| 166 | 167 |
| 167 #endif // V8_DEBUG_DEBUG_SCOPES_H_ | 168 #endif // V8_DEBUG_DEBUG_SCOPES_H_ |
| OLD | NEW |