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

Side by Side Diff: src/property-details.h

Issue 10879013: Make order of addition the primary order of descriptor arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 4 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/property.cc ('k') | src/runtime.cc » ('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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 }; 70 };
71 71
72 72
73 // PropertyDetails captures type and attributes for a property. 73 // PropertyDetails captures type and attributes for a property.
74 // They are used both in property dictionaries and instance descriptors. 74 // They are used both in property dictionaries and instance descriptors.
75 class PropertyDetails BASE_EMBEDDED { 75 class PropertyDetails BASE_EMBEDDED {
76 public: 76 public:
77 PropertyDetails(PropertyAttributes attributes, 77 PropertyDetails(PropertyAttributes attributes,
78 PropertyType type, 78 PropertyType type,
79 int index = 0) { 79 int index = 0) {
80 ASSERT(TypeField::is_valid(type));
81 ASSERT(AttributesField::is_valid(attributes));
82 ASSERT(StorageField::is_valid(index));
83
84 value_ = TypeField::encode(type) 80 value_ = TypeField::encode(type)
85 | AttributesField::encode(attributes) 81 | AttributesField::encode(attributes)
86 | StorageField::encode(index); 82 | DictionaryStorageField::encode(index);
87 83
88 ASSERT(type == this->type()); 84 ASSERT(type == this->type());
89 ASSERT(attributes == this->attributes()); 85 ASSERT(attributes == this->attributes());
90 ASSERT(index == this->index()); 86 ASSERT(index == this->dictionary_index());
91 } 87 }
92 88
89 int pointer() { return DescriptorPointer::decode(value_); }
90
91 PropertyDetails set_pointer(int i) { return PropertyDetails(value_, i); }
92
93 // Conversion for storing details as Object*. 93 // Conversion for storing details as Object*.
94 explicit inline PropertyDetails(Smi* smi); 94 explicit inline PropertyDetails(Smi* smi);
95 inline Smi* AsSmi(); 95 inline Smi* AsSmi();
96 96
97 PropertyType type() { return TypeField::decode(value_); } 97 PropertyType type() { return TypeField::decode(value_); }
98 98
99 PropertyAttributes attributes() { return AttributesField::decode(value_); } 99 PropertyAttributes attributes() { return AttributesField::decode(value_); }
100 100
101 int index() { return StorageField::decode(value_); } 101 int dictionary_index() {
102 return DictionaryStorageField::decode(value_);
103 }
104
105 int descriptor_index() {
106 return DescriptorStorageField::decode(value_);
107 }
102 108
103 inline PropertyDetails AsDeleted(); 109 inline PropertyDetails AsDeleted();
104 110
105 static bool IsValidIndex(int index) { 111 static bool IsValidIndex(int index) {
106 return StorageField::is_valid(index); 112 return DictionaryStorageField::is_valid(index);
107 } 113 }
108 114
109 bool IsReadOnly() { return (attributes() & READ_ONLY) != 0; } 115 bool IsReadOnly() { return (attributes() & READ_ONLY) != 0; }
110 bool IsDontDelete() { return (attributes() & DONT_DELETE) != 0; } 116 bool IsDontDelete() { return (attributes() & DONT_DELETE) != 0; }
111 bool IsDontEnum() { return (attributes() & DONT_ENUM) != 0; } 117 bool IsDontEnum() { return (attributes() & DONT_ENUM) != 0; }
112 bool IsDeleted() { return DeletedField::decode(value_) != 0;} 118 bool IsDeleted() { return DeletedField::decode(value_) != 0;}
113 119
114 // Bit fields in value_ (type, shift, size). Must be public so the 120 // Bit fields in value_ (type, shift, size). Must be public so the
115 // constants can be embedded in generated code. 121 // constants can be embedded in generated code.
116 class TypeField: public BitField<PropertyType, 0, 3> {}; 122 class TypeField: public BitField<PropertyType, 0, 3> {};
117 class AttributesField: public BitField<PropertyAttributes, 3, 3> {}; 123 class AttributesField: public BitField<PropertyAttributes, 3, 3> {};
118 class DeletedField: public BitField<uint32_t, 6, 1> {}; 124 class DeletedField: public BitField<uint32_t, 6, 1> {};
119 class StorageField: public BitField<uint32_t, 7, 32-7> {}; 125 class DictionaryStorageField: public BitField<uint32_t, 7, 24> {};
126 class DescriptorStorageField: public BitField<uint32_t, 7, 11> {};
127 class DescriptorPointer: public BitField<uint32_t, 18, 11> {};
120 128
121 static const int kInitialIndex = 1; 129 static const int kInitialIndex = 1;
122 130
123 private: 131 private:
132 PropertyDetails(int value, int pointer) {
133 value_ = DescriptorPointer::update(value, pointer);
134 }
135
124 uint32_t value_; 136 uint32_t value_;
125 }; 137 };
126 138
127 } } // namespace v8::internal 139 } } // namespace v8::internal
128 140
129 #endif // V8_PROPERTY_DETAILS_H_ 141 #endif // V8_PROPERTY_DETAILS_H_
OLDNEW
« no previous file with comments | « src/property.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698