Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(782)

Unified Diff: runtime/vm/object.h

Issue 23072013: - Avoid double iteration when accessing anonymous classes. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.h
===================================================================
--- runtime/vm/object.h (revision 26124)
+++ runtime/vm/object.h (working copy)
@@ -2246,14 +2246,26 @@
class ClassDictionaryIterator : public DictionaryIterator {
public:
- explicit ClassDictionaryIterator(const Library& library);
+ enum IterationKind {
+ kIteratePrivate,
+ kNoIteratePrivate
+ };
+ ClassDictionaryIterator(const Library& library,
+ IterationKind kind = kNoIteratePrivate);
+
+ bool HasNext() const { return (next_ix_ < size_) || (anon_ix_ < anon_size_); }
+
// Returns a non-null raw class.
RawClass* GetNextClass();
private:
void MoveToNextClass();
+ const Array& anon_array_;
+ const int anon_size_; // Number of anonymous classes to iterate over.
+ int anon_ix_; // Index of next anonymous class.
+
DISALLOW_COPY_AND_ASSIGN(ClassDictionaryIterator);
};
@@ -2336,6 +2348,9 @@
void AddLibraryMetadata(const Class& cls, intptr_t token_pos) const;
RawObject* GetMetadata(const Object& obj) const;
+ intptr_t num_anonymous_classes() const { return raw_ptr()->num_anonymous_; }
+ RawArray* anonymous_classes() const { return raw_ptr()->anonymous_classes_; }
+
// Library imports.
void AddImport(const Namespace& ns) const;
intptr_t num_imports() const { return raw_ptr()->num_imports_; }
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698