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

Unified Diff: src/virtual-frame.h

Issue 113329: Refactor JumpTarget::Combine. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 7 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
Index: src/virtual-frame.h
===================================================================
--- src/virtual-frame.h (revision 1927)
+++ src/virtual-frame.h (working copy)
@@ -121,8 +121,6 @@
return data_.index_;
}
- bool Equals(FrameElement other);
-
StaticType static_type() { return static_type_; }
void set_static_type(StaticType static_type) {
@@ -131,6 +129,34 @@
static_type_ = static_type;
}
+ // True if the frame elements are identical (all data members).
+ bool Equals(FrameElement other);
+
+ // Given a pair of non-null frame element pointers, return one of them
+ // as an entry frame candidate or null if they are incompatible.
+ FrameElement* Combine(FrameElement* other) {
+ // If either is invalid, the result is.
+ if (!is_valid()) return this;
+ if (!other->is_valid()) return other;
+
+ // If they do not have the exact same location we reallocate.
+ bool not_same_location =
+ (type_ != other->type_) ||
+ (is_register() && !reg().is(other->reg())) ||
+ (is_constant() && !handle().is_identical_to(other->handle())) ||
+ (is_copy() && index() != other->index());
+ if (not_same_location) return NULL;
+
+ // If either is unsynced, the result is. The result static type is
+ // the merge of the static types. It's safe to set it on one of the
+ // frame elements, and harmless too (because we are only going to
+ // merge the reaching frames and will ensure that the types are
+ // coherent, and changing the static type does not emit code).
+ FrameElement* result = is_synced() ? other : this;
+ result->set_static_type(static_type().merge(other->static_type()));
+ return result;
Lasse Reichstein 2009/05/13 10:23:30 Much more readable.
+ }
+
private:
enum Type {
INVALID,

Powered by Google App Engine
This is Rietveld 408576698