Index: src/property.cc |
diff --git a/src/property.cc b/src/property.cc |
index 2f72eec48ec6626dd06bde01efc7007920d92d9e..bc193b31a8d769f334e33cad479ac0ed345a812c 100644 |
--- a/src/property.cc |
+++ b/src/property.cc |
@@ -25,12 +25,20 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-#include "v8.h" |
+#include "types.h" |
namespace v8 { |
namespace internal { |
+bool LookupResult::CanHoldValue(Handle<Object> value) const { |
+ if (IsNormal()) return true; |
+ if (!value->FitsRepresentation(details_.representation())) return false; |
+ if (!IsField() && !IsTransition()) return true; |
+ return HeapType::OfCurrently(value, isolate())->IsCurrently(GetFieldType()); |
+} |
+ |
+ |
void LookupResult::Iterate(ObjectVisitor* visitor) { |
LookupResult* current = this; // Could be NULL. |
while (current != NULL) { |
@@ -119,4 +127,30 @@ void Descriptor::Print(FILE* out) { |
#endif |
+HeapType* LookupResult::GetFieldTypeFromMap(Map* map) const { |
+ ASSERT(IsFound()); |
+ ASSERT(IsField() || IsTransition()); |
+ return HeapType::cast(GetValueFromMap(map)); |
+} |
+ |
+ |
+FieldDescriptor::FieldDescriptor(Name* key, |
+ int field_index, |
+ PropertyAttributes attributes, |
+ Representation representation) |
+ : Descriptor(key, HeapType::Any(), attributes, FIELD, |
+ representation, field_index) { |
+} |
+ |
+ |
+FieldDescriptor::FieldDescriptor(Name* key, |
+ int field_index, |
+ HeapType* field_type, |
+ PropertyAttributes attributes, |
+ Representation representation) |
+ : Descriptor(key, field_type, attributes, FIELD, |
+ representation, field_index) { |
+} |
+ |
+ |
} } // namespace v8::internal |