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

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: Addressed comments Created 6 years, 8 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 | « src/objects-debug.cc ('k') | src/property.h » ('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 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
279 String::cast(this)->IsOneByteRepresentation(); 279 String::cast(this)->IsOneByteRepresentation();
280 } 280 }
281 281
282 282
283 bool Object::IsExternalTwoByteString() { 283 bool Object::IsExternalTwoByteString() {
284 if (!IsString()) return false; 284 if (!IsString()) return false;
285 return StringShape(String::cast(this)).IsExternal() && 285 return StringShape(String::cast(this)).IsExternal() &&
286 String::cast(this)->IsTwoByteRepresentation(); 286 String::cast(this)->IsTwoByteRepresentation();
287 } 287 }
288 288
289
289 bool Object::HasValidElements() { 290 bool Object::HasValidElements() {
290 // Dictionary is covered under FixedArray. 291 // Dictionary is covered under FixedArray.
291 return IsFixedArray() || IsFixedDoubleArray() || IsExternalArray() || 292 return IsFixedArray() || IsFixedDoubleArray() || IsExternalArray() ||
292 IsFixedTypedArrayBase(); 293 IsFixedTypedArrayBase();
293 } 294 }
294 295
295 296
296 MaybeObject* Object::AllocateNewStorageFor(Heap* heap, 297 MaybeObject* Object::AllocateNewStorageFor(Heap* heap,
297 Representation representation) { 298 Representation representation) {
298 if (representation.IsSmi() && IsUninitialized()) { 299 if (representation.IsSmi() && IsUninitialized()) {
(...skipping 2417 matching lines...) Expand 10 before | Expand all | Expand 10 after
2716 2717
2717 void DescriptorArray::SetRepresentation(int descriptor_index, 2718 void DescriptorArray::SetRepresentation(int descriptor_index,
2718 Representation representation) { 2719 Representation representation) {
2719 ASSERT(!representation.IsNone()); 2720 ASSERT(!representation.IsNone());
2720 PropertyDetails details = GetDetails(descriptor_index); 2721 PropertyDetails details = GetDetails(descriptor_index);
2721 set(ToDetailsIndex(descriptor_index), 2722 set(ToDetailsIndex(descriptor_index),
2722 details.CopyWithRepresentation(representation).AsSmi()); 2723 details.CopyWithRepresentation(representation).AsSmi());
2723 } 2724 }
2724 2725
2725 2726
2726 void DescriptorArray::InitializeRepresentations(Representation representation) {
2727 int length = number_of_descriptors();
2728 for (int i = 0; i < length; i++) {
2729 SetRepresentation(i, representation);
2730 }
2731 }
2732
2733
2734 Object** DescriptorArray::GetValueSlot(int descriptor_number) { 2727 Object** DescriptorArray::GetValueSlot(int descriptor_number) {
2735 ASSERT(descriptor_number < number_of_descriptors()); 2728 ASSERT(descriptor_number < number_of_descriptors());
2736 return RawFieldOfElementAt(ToValueIndex(descriptor_number)); 2729 return RawFieldOfElementAt(ToValueIndex(descriptor_number));
2737 } 2730 }
2738 2731
2739 2732
2740 Object* DescriptorArray::GetValue(int descriptor_number) { 2733 Object* DescriptorArray::GetValue(int descriptor_number) {
2741 ASSERT(descriptor_number < number_of_descriptors()); 2734 ASSERT(descriptor_number < number_of_descriptors());
2742 return get(ToValueIndex(descriptor_number)); 2735 return get(ToValueIndex(descriptor_number));
2743 } 2736 }
2744 2737
2745 2738
2739 void DescriptorArray::SetValue(int descriptor_index, Object* value) {
2740 set(ToValueIndex(descriptor_index), value);
2741 }
2742
2743
2746 PropertyDetails DescriptorArray::GetDetails(int descriptor_number) { 2744 PropertyDetails DescriptorArray::GetDetails(int descriptor_number) {
2747 ASSERT(descriptor_number < number_of_descriptors()); 2745 ASSERT(descriptor_number < number_of_descriptors());
2748 Object* details = get(ToDetailsIndex(descriptor_number)); 2746 Object* details = get(ToDetailsIndex(descriptor_number));
2749 return PropertyDetails(Smi::cast(details)); 2747 return PropertyDetails(Smi::cast(details));
2750 } 2748 }
2751 2749
2752 2750
2753 PropertyType DescriptorArray::GetType(int descriptor_number) { 2751 PropertyType DescriptorArray::GetType(int descriptor_number) {
2754 return GetDetails(descriptor_number).type(); 2752 return GetDetails(descriptor_number).type();
2755 } 2753 }
2756 2754
2757 2755
2758 int DescriptorArray::GetFieldIndex(int descriptor_number) { 2756 int DescriptorArray::GetFieldIndex(int descriptor_number) {
2759 ASSERT(GetDetails(descriptor_number).type() == FIELD); 2757 ASSERT(GetDetails(descriptor_number).type() == FIELD);
2760 return GetDetails(descriptor_number).field_index(); 2758 return GetDetails(descriptor_number).field_index();
2761 } 2759 }
2762 2760
2763 2761
2762 HeapType* DescriptorArray::GetFieldType(int descriptor_number) {
2763 ASSERT(GetDetails(descriptor_number).type() == FIELD);
2764 return HeapType::cast(GetValue(descriptor_number));
2765 }
2766
2767
2764 Object* DescriptorArray::GetConstant(int descriptor_number) { 2768 Object* DescriptorArray::GetConstant(int descriptor_number) {
2765 return GetValue(descriptor_number); 2769 return GetValue(descriptor_number);
2766 } 2770 }
2767 2771
2768 2772
2769 Object* DescriptorArray::GetCallbacksObject(int descriptor_number) { 2773 Object* DescriptorArray::GetCallbacksObject(int descriptor_number) {
2770 ASSERT(GetType(descriptor_number) == CALLBACKS); 2774 ASSERT(GetType(descriptor_number) == CALLBACKS);
2771 return GetValue(descriptor_number); 2775 return GetValue(descriptor_number);
2772 } 2776 }
2773 2777
(...skipping 4326 matching lines...) Expand 10 before | Expand all | Expand 10 after
7100 #undef READ_SHORT_FIELD 7104 #undef READ_SHORT_FIELD
7101 #undef WRITE_SHORT_FIELD 7105 #undef WRITE_SHORT_FIELD
7102 #undef READ_BYTE_FIELD 7106 #undef READ_BYTE_FIELD
7103 #undef WRITE_BYTE_FIELD 7107 #undef WRITE_BYTE_FIELD
7104 #undef NOBARRIER_READ_BYTE_FIELD 7108 #undef NOBARRIER_READ_BYTE_FIELD
7105 #undef NOBARRIER_WRITE_BYTE_FIELD 7109 #undef NOBARRIER_WRITE_BYTE_FIELD
7106 7110
7107 } } // namespace v8::internal 7111 } } // namespace v8::internal
7108 7112
7109 #endif // V8_OBJECTS_INL_H_ 7113 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects-debug.cc ('k') | src/property.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698