Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 if (!IsString()) return false; | 279 if (!IsString()) return false; |
| 280 return StringShape(String::cast(this)).IsExternal() && | 280 return StringShape(String::cast(this)).IsExternal() && |
| 281 String::cast(this)->IsTwoByteRepresentation(); | 281 String::cast(this)->IsTwoByteRepresentation(); |
| 282 } | 282 } |
| 283 | 283 |
| 284 bool Object::HasValidElements() { | 284 bool Object::HasValidElements() { |
| 285 // Dictionary is covered under FixedArray. | 285 // Dictionary is covered under FixedArray. |
| 286 return IsFixedArray() || IsFixedDoubleArray() || IsExternalArray(); | 286 return IsFixedArray() || IsFixedDoubleArray() || IsExternalArray(); |
| 287 } | 287 } |
| 288 | 288 |
| 289 | |
| 290 MaybeObject* Object::StorageFor(Heap* heap, Representation representation) { | |
|
danno
2013/05/07 13:04:47
AllocateNewStorageFor
Toon Verwaest
2013/05/07 15:08:52
Done.
| |
| 291 if (!FLAG_track_double_fields) return this; | |
| 292 if (!representation.IsDouble()) return this; | |
| 293 return heap->AllocateHeapNumber(Number()); | |
| 294 } | |
| 295 | |
| 296 | |
| 289 StringShape::StringShape(String* str) | 297 StringShape::StringShape(String* str) |
| 290 : type_(str->map()->instance_type()) { | 298 : type_(str->map()->instance_type()) { |
| 291 set_valid(); | 299 set_valid(); |
| 292 ASSERT((type_ & kIsNotStringMask) == kStringTag); | 300 ASSERT((type_ & kIsNotStringMask) == kStringTag); |
| 293 } | 301 } |
| 294 | 302 |
| 295 | 303 |
| 296 StringShape::StringShape(Map* map) | 304 StringShape::StringShape(Map* map) |
| 297 : type_(map->instance_type()) { | 305 : type_(map->instance_type()) { |
| 298 set_valid(); | 306 set_valid(); |
| (...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1711 if (index < 0) { | 1719 if (index < 0) { |
| 1712 int offset = map()->instance_size() + (index * kPointerSize); | 1720 int offset = map()->instance_size() + (index * kPointerSize); |
| 1713 return READ_FIELD(this, offset); | 1721 return READ_FIELD(this, offset); |
| 1714 } else { | 1722 } else { |
| 1715 ASSERT(index < properties()->length()); | 1723 ASSERT(index < properties()->length()); |
| 1716 return properties()->get(index); | 1724 return properties()->get(index); |
| 1717 } | 1725 } |
| 1718 } | 1726 } |
| 1719 | 1727 |
| 1720 | 1728 |
| 1721 Object* JSObject::FastPropertyAtPut(int index, Object* value) { | 1729 void JSObject::FastPropertyAtPut(int index, Object* value) { |
| 1722 // Adjust for the number of properties stored in the object. | 1730 // Adjust for the number of properties stored in the object. |
| 1723 index -= map()->inobject_properties(); | 1731 index -= map()->inobject_properties(); |
| 1724 if (index < 0) { | 1732 if (index < 0) { |
| 1725 int offset = map()->instance_size() + (index * kPointerSize); | 1733 int offset = map()->instance_size() + (index * kPointerSize); |
| 1726 WRITE_FIELD(this, offset, value); | 1734 WRITE_FIELD(this, offset, value); |
| 1727 WRITE_BARRIER(GetHeap(), this, offset, value); | 1735 WRITE_BARRIER(GetHeap(), this, offset, value); |
| 1728 } else { | 1736 } else { |
| 1729 ASSERT(index < properties()->length()); | 1737 ASSERT(index < properties()->length()); |
| 1730 properties()->set(index, value); | 1738 properties()->set(index, value); |
| 1731 } | 1739 } |
| 1732 return value; | |
| 1733 } | 1740 } |
| 1734 | 1741 |
| 1735 | 1742 |
| 1736 int JSObject::GetInObjectPropertyOffset(int index) { | 1743 int JSObject::GetInObjectPropertyOffset(int index) { |
| 1737 // Adjust for the number of properties stored in the object. | 1744 // Adjust for the number of properties stored in the object. |
| 1738 index -= map()->inobject_properties(); | 1745 index -= map()->inobject_properties(); |
| 1739 ASSERT(index < 0); | 1746 ASSERT(index < 0); |
| 1740 return map()->instance_size() + (index * kPointerSize); | 1747 return map()->instance_size() + (index * kPointerSize); |
| 1741 } | 1748 } |
| 1742 | 1749 |
| (...skipping 4484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6227 #undef WRITE_UINT32_FIELD | 6234 #undef WRITE_UINT32_FIELD |
| 6228 #undef READ_SHORT_FIELD | 6235 #undef READ_SHORT_FIELD |
| 6229 #undef WRITE_SHORT_FIELD | 6236 #undef WRITE_SHORT_FIELD |
| 6230 #undef READ_BYTE_FIELD | 6237 #undef READ_BYTE_FIELD |
| 6231 #undef WRITE_BYTE_FIELD | 6238 #undef WRITE_BYTE_FIELD |
| 6232 | 6239 |
| 6233 | 6240 |
| 6234 } } // namespace v8::internal | 6241 } } // namespace v8::internal |
| 6235 | 6242 |
| 6236 #endif // V8_OBJECTS_INL_H_ | 6243 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |