1 // Copyright 2017 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef V8_DEBUG_DEBUG_SCOPE_ITERATOR_H_ 6 #define V8_DEBUG_DEBUG_SCOPE_ITERATOR_H_ 7 8 #include "src/debug/debug-frames.h" 9 #include "src/debug/debug-interface.h" 10 #include "src/debug/debug-scopes.h" 11 12 namespace v8 { 13 namespace internal { 14 15 class DebugScopeIterator final : public debug::ScopeIterator { 16 public: 17 DebugScopeIterator(Isolate* isolate, FrameInspector* frame_inspector); 18 DebugScopeIterator(Isolate* isolate, Handle<JSFunction> function); 19 DebugScopeIterator(Isolate* isolate, Handle<JSGeneratorObject> generator); 20 21 bool Done() override; 22 void Advance() override; 23 ScopeType GetType() override; 24 v8::Local<v8::Object> GetObject() override; 25 v8::Local<v8::Value> GetFunctionDebugName() override; 26 int GetScriptId() override; 27 bool HasLocationInfo() override; 28 debug::Location GetStartLocation() override; 29 debug::Location GetEndLocation() override; 30 31 bool SetVariableValue(v8::Local<v8::String> name, 32 v8::Local<v8::Value> value) override; 33 34 private: 35 bool ShouldIgnore(); 36 37 v8::internal::ScopeIterator iterator_; 38 }; 39 40 class DebugWasmScopeIterator final : public debug::ScopeIterator { 41 public: 42 DebugWasmScopeIterator(Isolate* isolate, WasmFrame* frame); 43 44 bool Done() override; 45 void Advance() override; 46 ScopeType GetType() override; 47 v8::Local<v8::Object> GetObject() override; 48 v8::Local<v8::Value> GetFunctionDebugName() override; 49 int GetScriptId() override; 50 bool HasLocationInfo() override; 51 debug::Location GetStartLocation() override; 52 debug::Location GetEndLocation() override; 53 54 bool SetVariableValue(v8::Local<v8::String> name, 55 v8::Local<v8::Value> value) override; 56 private: 57 Isolate* isolate_; 58 WasmFrame* frame_; 59 ScopeType type_; 60 }; 61 } // namespace internal 62 } // namespace v8 63 64 #endif // V8_DEBUG_DEBUG_SCOPE_ITERATOR_H_ 65