ValueNodeManager: Add flag to control frame variables.

- We now take a flag which determines whether or not to add parameters
  and locals from the frame to the container.
This commit is contained in:
Rene Gollent
2015-11-10 14:01:14 -05:00
parent be32382a6d
commit b4058de7fe
2 changed files with 17 additions and 14 deletions
@@ -17,12 +17,14 @@
#include "VariableValueNodeChild.h" #include "VariableValueNodeChild.h"
ValueNodeManager::ValueNodeManager() ValueNodeManager::ValueNodeManager(bool addFrameNodes)
: :
fAddFrameNodes(addFrameNodes),
fContainer(NULL), fContainer(NULL),
fStackFrame(NULL), fStackFrame(NULL),
fThread(NULL) fThread(NULL)
{ {
SetStackFrame(NULL, NULL);
} }
@@ -50,22 +52,22 @@ ValueNodeManager::SetStackFrame(Thread* thread,
fStackFrame = stackFrame; fStackFrame = stackFrame;
fThread = thread; fThread = thread;
if (fStackFrame != NULL) { fContainer = new(std::nothrow) ValueNodeContainer;
fContainer = new(std::nothrow) ValueNodeContainer; if (fContainer == NULL)
if (fContainer == NULL) return B_NO_MEMORY;
return B_NO_MEMORY;
status_t error = fContainer->Init(); status_t error = fContainer->Init();
if (error != B_OK) { if (error != B_OK) {
delete fContainer; delete fContainer;
fContainer = NULL; fContainer = NULL;
return error; return error;
} }
AutoLocker<ValueNodeContainer> containerLocker(fContainer); AutoLocker<ValueNodeContainer> containerLocker(fContainer);
fContainer->AddListener(this); fContainer->AddListener(this);
if (fStackFrame != NULL && fAddFrameNodes) {
for (int32 i = 0; Variable* variable = fStackFrame->ParameterAt(i); for (int32 i = 0; Variable* variable = fStackFrame->ParameterAt(i);
i++) { i++) {
_AddNode(variable); _AddNode(variable);
@@ -17,7 +17,7 @@ class Variable;
class ValueNodeManager : public BReferenceable, class ValueNodeManager : public BReferenceable,
private ValueNodeContainer::Listener { private ValueNodeContainer::Listener {
public: public:
ValueNodeManager(); ValueNodeManager(bool addFrameNodes = true);
virtual ~ValueNodeManager(); virtual ~ValueNodeManager();
status_t SetStackFrame(Thread* thread, status_t SetStackFrame(Thread* thread,
@@ -45,6 +45,7 @@ private:
status_t _CreateValueNode(ValueNodeChild* nodeChild); status_t _CreateValueNode(ValueNodeChild* nodeChild);
private: private:
bool fAddFrameNodes;
ValueNodeContainer* fContainer; ValueNodeContainer* fContainer;
StackFrame* fStackFrame; StackFrame* fStackFrame;
Thread* fThread; Thread* fThread;