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

Side by Side Diff: src/frame-element.h

Issue 113524: Remove code that adjusts synced and copied flags in MergeTo. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/ia32/virtual-frame-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 StaticType static_type() { 145 StaticType static_type() {
146 return StaticType(StaticTypeField::decode(value_)); 146 return StaticType(StaticTypeField::decode(value_));
147 } 147 }
148 148
149 void set_static_type(StaticType static_type) { 149 void set_static_type(StaticType static_type) {
150 value_ = value_ & ~StaticTypeField::mask(); 150 value_ = value_ & ~StaticTypeField::mask();
151 value_ = value_ | StaticTypeField::encode(static_type.static_type_); 151 value_ = value_ | StaticTypeField::encode(static_type.static_type_);
152 } 152 }
153 153
154 bool Equals(FrameElement other) { 154 bool Equals(FrameElement other) {
155 if (value_ == other.value_) return true; 155 uint32_t masked_difference = (value_ ^ other.value_) & ~CopiedField::mask();
156 if (!masked_difference) {
157 // The elements are equal if they agree exactly except on copied field.
158 return true;
159 } else {
160 // If two constants have the same value, and agree otherwise, return true.
161 return !(masked_difference & ~DataField::mask()) &&
162 is_constant() &&
163 handle().is_identical_to(other.handle());
164 }
165 }
156 166
157 if (type() != other.type() || 167 // Test if two FrameElements refer to the same memory or register location.
158 is_copied() != other.is_copied() || 168 bool SameLocation(FrameElement* other) {
159 is_synced() != other.is_synced() || 169 if (type() == other->type()) {
160 !(static_type() == other.static_type())) { 170 if (value_ == other->value_) return true;
161 return false; 171 if (is_constant() && handle().is_identical_to(other->handle())) {
172 return true;
173 }
162 } 174 }
163 175 return false;
164 if (is_register()) {
165 if (!reg().is(other.reg())) return false;
166 } else if (is_constant()) {
167 if (!handle().is_identical_to(other.handle())) return false;
168 } else if (is_copy()) {
169 if (index() != other.index()) return false;
170 }
171
172 return true;
173 } 176 }
174 177
175 // Given a pair of non-null frame element pointers, return one of them 178 // Given a pair of non-null frame element pointers, return one of them
176 // as an entry frame candidate or null if they are incompatible. 179 // as an entry frame candidate or null if they are incompatible.
177 FrameElement* Combine(FrameElement* other) { 180 FrameElement* Combine(FrameElement* other) {
178 // If either is invalid, the result is. 181 // If either is invalid, the result is.
179 if (!is_valid()) return this; 182 if (!is_valid()) return this;
180 if (!other->is_valid()) return other; 183 if (!other->is_valid()) return other;
181 184
182 // If they do not have the exact same location we reallocate. 185 if (!SameLocation(other)) return NULL;
183 bool not_same_location =
184 (type() != other->type()) ||
185 (is_register() && !reg().is(other->reg())) ||
186 (is_constant() && !handle().is_identical_to(other->handle())) ||
187 (is_copy() && index() != other->index());
188 if (not_same_location) return NULL;
189
190 // If either is unsynced, the result is. The result static type is 186 // If either is unsynced, the result is. The result static type is
191 // the merge of the static types. It's safe to set it on one of the 187 // the merge of the static types. It's safe to set it on one of the
192 // frame elements, and harmless too (because we are only going to 188 // frame elements, and harmless too (because we are only going to
193 // merge the reaching frames and will ensure that the types are 189 // merge the reaching frames and will ensure that the types are
194 // coherent, and changing the static type does not emit code). 190 // coherent, and changing the static type does not emit code).
195 FrameElement* result = is_synced() ? other : this; 191 FrameElement* result = is_synced() ? other : this;
196 result->set_static_type(static_type().merge(other->static_type())); 192 result->set_static_type(static_type().merge(other->static_type()));
197 return result; 193 return result;
198 } 194 }
199 195
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 class CopiedField: public BitField<uint32_t, 6, 1> {}; 255 class CopiedField: public BitField<uint32_t, 6, 1> {};
260 class SyncedField: public BitField<uint32_t, 7, 1> {}; 256 class SyncedField: public BitField<uint32_t, 7, 1> {};
261 class DataField: public BitField<uint32_t, 8, 32 - 9> {}; 257 class DataField: public BitField<uint32_t, 8, 32 - 9> {};
262 258
263 friend class VirtualFrame; 259 friend class VirtualFrame;
264 }; 260 };
265 261
266 } } // namespace v8::internal 262 } } // namespace v8::internal
267 263
268 #endif // V8_FRAME_ELEMENT_H_ 264 #endif // V8_FRAME_ELEMENT_H_
OLDNEW
« no previous file with comments | « no previous file | src/ia32/virtual-frame-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698