Files
sdk/runtime/vm/visitor.h
T
zra@google.com daf539e2f9 Fixes a couple problems with GC of unoptimized code.
1. Instead of making a pass before the Marking phase,
   this change does not visit code pointers in functions
   during marking. Then after marking, if the code has
   still not been marked, code pointers in functions
   are nulled out.
2. Since code pointers in functions may be nulled out,
   functions are no longer used as proxies for code in
   deoptimization info.

R=iposva@google.com, srdjan@google.com

Review URL: https://codereview.chromium.org//70183010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30600 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-23 00:17:28 +00:00

84 lines
2.0 KiB
C++

// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#ifndef VM_VISITOR_H_
#define VM_VISITOR_H_
#include "vm/globals.h"
#include "vm/growable_array.h"
namespace dart {
// Forward declarations.
class Isolate;
class RawObject;
// An object pointer visitor interface.
class ObjectPointerVisitor {
public:
explicit ObjectPointerVisitor(Isolate* isolate) : isolate_(isolate) {}
virtual ~ObjectPointerVisitor() {}
Isolate* isolate() const { return isolate_; }
// Range of pointers to visit 'first' <= pointer <= 'last'.
virtual void VisitPointers(RawObject** first, RawObject** last) = 0;
virtual bool visit_function_code() const { return true; }
virtual GrowableArray<RawFunction*>* skipped_code_functions() {
return NULL;
}
// len argument is the number of pointers to visit starting from 'p'.
void VisitPointers(RawObject** p, intptr_t len) {
VisitPointers(p, (p + len - 1));
}
void VisitPointer(RawObject** p) { VisitPointers(p , p); }
private:
Isolate* isolate_;
DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectPointerVisitor);
};
// An object visitor interface.
class ObjectVisitor {
public:
explicit ObjectVisitor(Isolate* isolate) : isolate_(isolate) {}
virtual ~ObjectVisitor() {}
Isolate* isolate() const { return isolate_; }
// Invoked for each object.
virtual void VisitObject(RawObject* obj) = 0;
private:
Isolate* isolate_;
DISALLOW_COPY_AND_ASSIGN(ObjectVisitor);
};
// An object finder visitor interface.
class FindObjectVisitor {
public:
explicit FindObjectVisitor(Isolate* isolate) : isolate_(isolate) {}
virtual ~FindObjectVisitor() {}
// Check if object matches find condition.
virtual bool FindObject(RawObject* obj) = 0;
private:
Isolate* isolate_;
DISALLOW_IMPLICIT_CONSTRUCTORS(FindObjectVisitor);
};
} // namespace dart
#endif // VM_VISITOR_H_