Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 Handle<Object> handle() const { | 114 Handle<Object> handle() const { |
| 115 ASSERT(is_constant()); | 115 ASSERT(is_constant()); |
| 116 return Handle<Object>(data_.handle_); | 116 return Handle<Object>(data_.handle_); |
| 117 } | 117 } |
| 118 | 118 |
| 119 int index() const { | 119 int index() const { |
| 120 ASSERT(is_copy()); | 120 ASSERT(is_copy()); |
| 121 return data_.index_; | 121 return data_.index_; |
| 122 } | 122 } |
| 123 | 123 |
| 124 bool Equals(FrameElement other); | |
| 125 | |
| 126 StaticType static_type() { return static_type_; } | 124 StaticType static_type() { return static_type_; } |
| 127 | 125 |
| 128 void set_static_type(StaticType static_type) { | 126 void set_static_type(StaticType static_type) { |
| 129 // TODO(lrn): If it's s copy, it would be better to update the real one, | 127 // TODO(lrn): If it's s copy, it would be better to update the real one, |
| 130 // but we can't from here. The caller must handle this. | 128 // but we can't from here. The caller must handle this. |
| 131 static_type_ = static_type; | 129 static_type_ = static_type; |
| 132 } | 130 } |
| 133 | 131 |
| 132 // True if the frame elements are identical (all data members). | |
| 133 bool Equals(FrameElement other); | |
| 134 | |
| 135 // Given a pair of non-null frame element pointers, return one of them | |
| 136 // as an entry frame candidate or null if they are incompatible. | |
| 137 FrameElement* Combine(FrameElement* other) { | |
| 138 // If either is invalid, the result is. | |
| 139 if (!is_valid()) return this; | |
| 140 if (!other->is_valid()) return other; | |
| 141 | |
| 142 // If they do not have the exact same location we reallocate. | |
| 143 bool not_same_location = | |
| 144 (type_ != other->type_) || | |
| 145 (is_register() && !reg().is(other->reg())) || | |
| 146 (is_constant() && !handle().is_identical_to(other->handle())) || | |
| 147 (is_copy() && index() != other->index()); | |
| 148 if (not_same_location) return NULL; | |
| 149 | |
| 150 // If either is unsynced, the result is. The result static type is | |
| 151 // the merge of the static types. It's safe to set it on one of the | |
| 152 // frame elements, and harmless too (because we are only going to | |
| 153 // merge the reaching frames and will ensure that the types are | |
| 154 // coherent, and changing the static type does not emit code). | |
| 155 FrameElement* result = is_synced() ? other : this; | |
| 156 result->set_static_type(static_type().merge(other->static_type())); | |
| 157 return result; | |
|
Lasse Reichstein
2009/05/13 10:23:30
Much more readable.
| |
| 158 } | |
| 159 | |
| 134 private: | 160 private: |
| 135 enum Type { | 161 enum Type { |
| 136 INVALID, | 162 INVALID, |
| 137 MEMORY, | 163 MEMORY, |
| 138 REGISTER, | 164 REGISTER, |
| 139 CONSTANT, | 165 CONSTANT, |
| 140 COPY | 166 COPY |
| 141 }; | 167 }; |
| 142 | 168 |
| 143 Type type() const { return static_cast<Type>(type_); } | 169 Type type() const { return static_cast<Type>(type_); } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 204 | 230 |
| 205 #if V8_TARGET_ARCH_IA32 | 231 #if V8_TARGET_ARCH_IA32 |
| 206 #include "ia32/virtual-frame-ia32.h" | 232 #include "ia32/virtual-frame-ia32.h" |
| 207 #elif V8_TARGET_ARCH_X64 | 233 #elif V8_TARGET_ARCH_X64 |
| 208 #include "x64/virtual-frame-x64.h" | 234 #include "x64/virtual-frame-x64.h" |
| 209 #elif V8_TARGET_ARCH_ARM | 235 #elif V8_TARGET_ARCH_ARM |
| 210 #include "arm/virtual-frame-arm.h" | 236 #include "arm/virtual-frame-arm.h" |
| 211 #endif | 237 #endif |
| 212 | 238 |
| 213 #endif // V8_VIRTUAL_FRAME_H_ | 239 #endif // V8_VIRTUAL_FRAME_H_ |
| OLD | NEW |