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

Side by Side Diff: src/objects-inl.h

Issue 167303005: Track field types. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Support transitions in LookupResult. Created 6 years, 9 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
OLDNEW
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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 String::cast(this)->IsOneByteRepresentation(); 262 String::cast(this)->IsOneByteRepresentation();
263 } 263 }
264 264
265 265
266 bool Object::IsExternalTwoByteString() { 266 bool Object::IsExternalTwoByteString() {
267 if (!IsString()) return false; 267 if (!IsString()) return false;
268 return StringShape(String::cast(this)).IsExternal() && 268 return StringShape(String::cast(this)).IsExternal() &&
269 String::cast(this)->IsTwoByteRepresentation(); 269 String::cast(this)->IsTwoByteRepresentation();
270 } 270 }
271 271
272
272 bool Object::HasValidElements() { 273 bool Object::HasValidElements() {
273 // Dictionary is covered under FixedArray. 274 // Dictionary is covered under FixedArray.
274 return IsFixedArray() || IsFixedDoubleArray() || IsExternalArray() || 275 return IsFixedArray() || IsFixedDoubleArray() || IsExternalArray() ||
275 IsFixedTypedArrayBase(); 276 IsFixedTypedArrayBase();
276 } 277 }
277 278
278 279
279 MaybeObject* Object::AllocateNewStorageFor(Heap* heap, 280 MaybeObject* Object::AllocateNewStorageFor(Heap* heap,
280 Representation representation) { 281 Representation representation) {
281 if (representation.IsSmi() && IsUninitialized()) { 282 if (representation.IsSmi() && IsUninitialized()) {
(...skipping 2332 matching lines...) Expand 10 before | Expand all | Expand 10 after
2614 2615
2615 void DescriptorArray::SetRepresentation(int descriptor_index, 2616 void DescriptorArray::SetRepresentation(int descriptor_index,
2616 Representation representation) { 2617 Representation representation) {
2617 ASSERT(!representation.IsNone()); 2618 ASSERT(!representation.IsNone());
2618 PropertyDetails details = GetDetails(descriptor_index); 2619 PropertyDetails details = GetDetails(descriptor_index);
2619 set(ToDetailsIndex(descriptor_index), 2620 set(ToDetailsIndex(descriptor_index),
2620 details.CopyWithRepresentation(representation).AsSmi()); 2621 details.CopyWithRepresentation(representation).AsSmi());
2621 } 2622 }
2622 2623
2623 2624
2624 void DescriptorArray::InitializeRepresentations(Representation representation) {
2625 int length = number_of_descriptors();
2626 for (int i = 0; i < length; i++) {
2627 SetRepresentation(i, representation);
2628 }
2629 }
2630
2631
2632 Object** DescriptorArray::GetValueSlot(int descriptor_number) { 2625 Object** DescriptorArray::GetValueSlot(int descriptor_number) {
2633 ASSERT(descriptor_number < number_of_descriptors()); 2626 ASSERT(descriptor_number < number_of_descriptors());
2634 return RawFieldOfElementAt(ToValueIndex(descriptor_number)); 2627 return RawFieldOfElementAt(ToValueIndex(descriptor_number));
2635 } 2628 }
2636 2629
2637 2630
2638 Object* DescriptorArray::GetValue(int descriptor_number) { 2631 Object* DescriptorArray::GetValue(int descriptor_number) {
2639 ASSERT(descriptor_number < number_of_descriptors()); 2632 ASSERT(descriptor_number < number_of_descriptors());
2640 return get(ToValueIndex(descriptor_number)); 2633 return get(ToValueIndex(descriptor_number));
2641 } 2634 }
2642 2635
2643 2636
2637 void DescriptorArray::SetValue(int descriptor_index, Object* value) {
2638 set(ToValueIndex(descriptor_index), value);
2639 }
2640
2641
2644 PropertyDetails DescriptorArray::GetDetails(int descriptor_number) { 2642 PropertyDetails DescriptorArray::GetDetails(int descriptor_number) {
2645 ASSERT(descriptor_number < number_of_descriptors()); 2643 ASSERT(descriptor_number < number_of_descriptors());
2646 Object* details = get(ToDetailsIndex(descriptor_number)); 2644 Object* details = get(ToDetailsIndex(descriptor_number));
2647 return PropertyDetails(Smi::cast(details)); 2645 return PropertyDetails(Smi::cast(details));
2648 } 2646 }
2649 2647
2650 2648
2651 PropertyType DescriptorArray::GetType(int descriptor_number) { 2649 PropertyType DescriptorArray::GetType(int descriptor_number) {
2652 return GetDetails(descriptor_number).type(); 2650 return GetDetails(descriptor_number).type();
2653 } 2651 }
(...skipping 4146 matching lines...) Expand 10 before | Expand all | Expand 10 after
6800 #undef READ_UINT32_FIELD 6798 #undef READ_UINT32_FIELD
6801 #undef WRITE_UINT32_FIELD 6799 #undef WRITE_UINT32_FIELD
6802 #undef READ_SHORT_FIELD 6800 #undef READ_SHORT_FIELD
6803 #undef WRITE_SHORT_FIELD 6801 #undef WRITE_SHORT_FIELD
6804 #undef READ_BYTE_FIELD 6802 #undef READ_BYTE_FIELD
6805 #undef WRITE_BYTE_FIELD 6803 #undef WRITE_BYTE_FIELD
6806 6804
6807 } } // namespace v8::internal 6805 } } // namespace v8::internal
6808 6806
6809 #endif // V8_OBJECTS_INL_H_ 6807 #endif // V8_OBJECTS_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698