diff options
author | Michaël Zasso <targos@protonmail.com> | 2018-09-07 17:07:13 +0200 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2018-09-07 20:59:13 +0200 |
commit | 586db2414a338e1bf6eaf6e672a3adc7ce309f6a (patch) | |
tree | 139fa972aef648481ddee22a3a85b99707d28df5 /deps/v8/src/debug/debug-scopes.h | |
parent | 12ed7c94e5160aa6d38e3d2cb2a73dae0a6f9342 (diff) | |
download | android-node-v8-586db2414a338e1bf6eaf6e672a3adc7ce309f6a.tar.gz android-node-v8-586db2414a338e1bf6eaf6e672a3adc7ce309f6a.tar.bz2 android-node-v8-586db2414a338e1bf6eaf6e672a3adc7ce309f6a.zip |
deps: update V8 to 6.9.427.22
PR-URL: https://github.com/nodejs/node/pull/21983
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'deps/v8/src/debug/debug-scopes.h')
-rw-r--r-- | deps/v8/src/debug/debug-scopes.h | 114 |
1 files changed, 41 insertions, 73 deletions
diff --git a/deps/v8/src/debug/debug-scopes.h b/deps/v8/src/debug/debug-scopes.h index c61cf73cc5..f598f3e994 100644 --- a/deps/v8/src/debug/debug-scopes.h +++ b/deps/v8/src/debug/debug-scopes.h @@ -48,37 +48,38 @@ class ScopeIterator { ScopeIterator(Isolate* isolate, Handle<JSFunction> function); ScopeIterator(Isolate* isolate, Handle<JSGeneratorObject> generator); + ~ScopeIterator(); - V8_WARN_UNUSED_RESULT MaybeHandle<JSObject> MaterializeScopeDetails(); + Handle<JSObject> MaterializeScopeDetails(); // More scopes? - bool Done() { return context_.is_null(); } + bool Done() const { return context_.is_null(); } // Move to the next scope. void Next(); + // Restart to the first scope and context. + void Restart(); + // Return the type of the current scope. - ScopeType Type(); + ScopeType Type() const; + + // Indicates which variables should be visited. Either only variables from the + // scope that are available on the stack, or all variables. + enum class Mode { STACK, ALL }; // Return the JavaScript object with the content of the current scope. - MaybeHandle<JSObject> ScopeObject(); + Handle<JSObject> ScopeObject(Mode mode); - bool HasContext(); + // Returns whether the current scope declares any variables. + bool DeclaresLocals(Mode mode) const; // Set variable value and return true on success. bool SetVariableValue(Handle<String> variable_name, Handle<Object> new_value); - Handle<ScopeInfo> CurrentScopeInfo(); - - // Return the context for this scope. For the local context there might not - // be an actual context. - Handle<Context> CurrentContext(); - // Populate the set with collected non-local variable names. Handle<StringSet> GetNonLocals(); - // Return function which represents closure for current scope. - Handle<JSFunction> GetFunction() { return function_; } // Similar to JSFunction::GetName return the function's name or it's inferred // name. Handle<Object> GetFunctionDebugName() const; @@ -94,96 +95,63 @@ class ScopeIterator { void DebugPrint(); #endif - private: - struct ExtendedScopeInfo { - ExtendedScopeInfo(Handle<ScopeInfo> info, int start, int end) - : scope_info(info), start_position(start), end_position(end) {} - explicit ExtendedScopeInfo(Handle<ScopeInfo> info) - : scope_info(info), start_position(-1), end_position(-1) {} - Handle<ScopeInfo> scope_info; - int start_position; - int end_position; - bool is_hidden() { return start_position == -1 && end_position == -1; } - }; + bool InInnerScope() const { return !function_.is_null(); } + bool HasContext() const; + Handle<Context> CurrentContext() const { + DCHECK(HasContext()); + return context_; + } + private: Isolate* isolate_; + ParseInfo* info_ = nullptr; FrameInspector* const frame_inspector_ = nullptr; Handle<JSGeneratorObject> generator_; Handle<JSFunction> function_; - Handle<ScopeInfo> function_scope_info_; Handle<Context> context_; Handle<Script> script_; - std::vector<ExtendedScopeInfo> nested_scope_chain_; Handle<StringSet> non_locals_; - bool seen_script_scope_; + DeclarationScope* closure_scope_ = nullptr; + Scope* start_scope_ = nullptr; + Scope* current_scope_ = nullptr; + bool seen_script_scope_ = false; - inline JavaScriptFrame* GetFrame() { - return frame_inspector_->GetArgumentsFrame(); + inline JavaScriptFrame* GetFrame() const { + return frame_inspector_->javascript_frame(); } - Handle<Context> GetContext(); int GetSourcePosition(); - void MaterializeStackLocals(Handle<JSObject> local_scope, - Handle<ScopeInfo> scope_info); - void TryParseAndRetrieveScopes(ScopeIterator::Option option); void RetrieveScopeChain(DeclarationScope* scope); - void CollectNonLocals(ParseInfo* info, DeclarationScope* scope); - void UnwrapEvaluationContext(); - V8_WARN_UNUSED_RESULT MaybeHandle<JSObject> MaterializeScriptScope(); - V8_WARN_UNUSED_RESULT MaybeHandle<JSObject> MaterializeLocalScope(); - V8_WARN_UNUSED_RESULT MaybeHandle<JSObject> MaterializeModuleScope(); - Handle<JSObject> MaterializeClosure(); - Handle<JSObject> MaterializeInnerScope(); + typedef std::function<bool(Handle<String> name, Handle<Object> value)> + Visitor; + Handle<JSObject> WithContextExtension(); bool SetLocalVariableValue(Handle<String> variable_name, Handle<Object> new_value); - bool SetInnerScopeVariableValue(Handle<String> variable_name, - Handle<Object> new_value); - bool SetClosureVariableValue(Handle<String> variable_name, + bool SetContextVariableValue(Handle<String> variable_name, Handle<Object> new_value); + bool SetContextExtensionValue(Handle<String> variable_name, + Handle<Object> new_value); bool SetScriptVariableValue(Handle<String> variable_name, Handle<Object> new_value); bool SetModuleVariableValue(Handle<String> variable_name, Handle<Object> new_value); // Helper functions. - bool SetParameterValue(Handle<ScopeInfo> scope_info, - Handle<String> parameter_name, - Handle<Object> new_value); - bool SetStackVariableValue(Handle<ScopeInfo> scope_info, - Handle<String> variable_name, - Handle<Object> new_value); - bool SetContextVariableValue(Handle<ScopeInfo> scope_info, - Handle<Context> context, - Handle<String> variable_name, - Handle<Object> new_value); - - void CopyContextLocalsToScopeObject(Handle<ScopeInfo> scope_info, - Handle<Context> context, - Handle<JSObject> scope_object); - void CopyModuleVarsToScopeObject(Handle<ScopeInfo> scope_info, - Handle<Context> context, - Handle<JSObject> scope_object); - void CopyContextExtensionToScopeObject(Handle<Context> context, - Handle<JSObject> scope_object, - KeyCollectionMode mode); - - // Get the chain of nested scopes within this scope for the source statement - // position. The scopes will be added to the list from the outermost scope to - // the innermost scope. Only nested block, catch or with scopes are tracked - // and will be returned, but no inner function scopes. - void GetNestedScopeChain(Isolate* isolate, Scope* scope, - int statement_position); - - bool HasNestedScopeChain() const; - ExtendedScopeInfo& LastNestedScopeChain(); + void VisitScope(const Visitor& visitor, Mode mode) const; + void VisitLocalScope(const Visitor& visitor, Mode mode) const; + void VisitScriptScope(const Visitor& visitor) const; + void VisitModuleScope(const Visitor& visitor) const; + bool VisitLocals(const Visitor& visitor, Mode mode) const; + bool VisitContextLocals(const Visitor& visitor, Handle<ScopeInfo> scope_info, + Handle<Context> context) const; DISALLOW_IMPLICIT_CONSTRUCTORS(ScopeIterator); }; |