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

Unified Diff: src/lithium.h

Issue 6352006: Remove instruction summaries and provide a LIR-interface for the register all... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: addressed comments, rebased and ported to ARM and x64 Created 9 years, 11 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 | « src/ia32/lithium-ia32.cc ('k') | src/lithium-allocator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lithium.h
===================================================================
--- src/lithium.h (revision 6471)
+++ src/lithium.h (working copy)
@@ -509,6 +509,82 @@
friend class LCodegen;
};
+
+// Iterates over the non-null, non-constant operands in an environment.
+class ShallowIterator BASE_EMBEDDED {
+ public:
+ explicit ShallowIterator(LEnvironment* env)
+ : env_(env),
+ limit_(env != NULL ? env->values()->length() : 0),
+ current_(0) {
+ current_ = AdvanceToNext(0);
+ }
+
+ inline bool HasNext() {
+ return env_ != NULL && current_ < limit_;
+ }
+
+ inline LOperand* Next() {
+ ASSERT(HasNext());
+ return env_->values()->at(current_);
+ }
+
+ inline void Advance() {
+ current_ = AdvanceToNext(current_ + 1);
+ }
+
+ inline LEnvironment* env() { return env_; }
+
+ private:
+ inline int AdvanceToNext(int start) {
+ while (start < limit_ &&
+ (env_->values()->at(start) == NULL ||
+ env_->values()->at(start)->IsConstantOperand())) {
+ start++;
+ }
+ return start;
+ }
+
+ LEnvironment* env_;
+ int limit_;
+ int current_;
+};
+
+
+// Iterator for non-null, non-constant operands incl. outer environments.
+class DeepIterator BASE_EMBEDDED {
+ public:
+ explicit DeepIterator(LEnvironment* env)
+ : current_iterator_(env) { }
+
+ inline bool HasNext() {
+ if (current_iterator_.HasNext()) return true;
+ if (current_iterator_.env() == NULL) return false;
+ AdvanceToOuter();
+ return current_iterator_.HasNext();
+ }
+
+ inline LOperand* Next() {
+ ASSERT(current_iterator_.HasNext());
+ return current_iterator_.Next();
+ }
+
+ inline void Advance() {
+ if (current_iterator_.HasNext()) {
+ current_iterator_.Advance();
+ } else {
+ AdvanceToOuter();
+ }
+ }
+
+ private:
+ inline void AdvanceToOuter() {
+ current_iterator_ = ShallowIterator(current_iterator_.env()->outer());
+ }
+
+ ShallowIterator current_iterator_;
+};
+
} } // namespace v8::internal
#endif // V8_LITHIUM_H_
« no previous file with comments | « src/ia32/lithium-ia32.cc ('k') | src/lithium-allocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698