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

Side by Side Diff: src/property.h

Issue 856503002: Massive renaming of PropertyType values and other implied stuff. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Spurious file addition fixed Created 5 years, 11 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
« no previous file with comments | « src/ppc/macro-assembler-ppc.cc ('k') | src/property.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_PROPERTY_H_ 5 #ifndef V8_PROPERTY_H_
6 #define V8_PROPERTY_H_ 6 #define V8_PROPERTY_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 9
10 #include "src/factory.h" 10 #include "src/factory.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 details_(attributes, type, representation, field_index) { } 66 details_(attributes, type, representation, field_index) { }
67 67
68 friend class DescriptorArray; 68 friend class DescriptorArray;
69 friend class Map; 69 friend class Map;
70 }; 70 };
71 71
72 72
73 std::ostream& operator<<(std::ostream& os, const Descriptor& d); 73 std::ostream& operator<<(std::ostream& os, const Descriptor& d);
74 74
75 75
76 class FieldDescriptor FINAL : public Descriptor { 76 class DataDescriptor FINAL : public Descriptor {
77 public: 77 public:
78 FieldDescriptor(Handle<Name> key, 78 DataDescriptor(Handle<Name> key, int field_index,
79 int field_index, 79 PropertyAttributes attributes, Representation representation)
80 PropertyAttributes attributes, 80 : Descriptor(key, HeapType::Any(key->GetIsolate()), attributes, DATA,
81 Representation representation) 81 representation, field_index) {}
82 : Descriptor(key, HeapType::Any(key->GetIsolate()), attributes, 82 DataDescriptor(Handle<Name> key, int field_index, Handle<HeapType> field_type,
83 FIELD, representation, field_index) {} 83 PropertyAttributes attributes, Representation representation)
84 FieldDescriptor(Handle<Name> key, 84 : Descriptor(key, field_type, attributes, DATA, representation,
85 int field_index, 85 field_index) {}
86 Handle<HeapType> field_type,
87 PropertyAttributes attributes,
88 Representation representation)
89 : Descriptor(key, field_type, attributes, FIELD,
90 representation, field_index) { }
91 }; 86 };
92 87
93 88
94 class ConstantDescriptor FINAL : public Descriptor { 89 class DataConstantDescriptor FINAL : public Descriptor {
95 public: 90 public:
96 ConstantDescriptor(Handle<Name> key, 91 DataConstantDescriptor(Handle<Name> key, Handle<Object> value,
97 Handle<Object> value, 92 PropertyAttributes attributes)
98 PropertyAttributes attributes) 93 : Descriptor(key, value, attributes, DATA_CONSTANT,
99 : Descriptor(key, value, attributes, CONSTANT,
100 value->OptimalRepresentation()) {} 94 value->OptimalRepresentation()) {}
101 }; 95 };
102 96
103 97
104 class CallbacksDescriptor FINAL : public Descriptor { 98 class AccessorConstantDescriptor FINAL : public Descriptor {
105 public: 99 public:
106 CallbacksDescriptor(Handle<Name> key, 100 AccessorConstantDescriptor(Handle<Name> key, Handle<Object> foreign,
107 Handle<Object> foreign, 101 PropertyAttributes attributes)
108 PropertyAttributes attributes) 102 : Descriptor(key, foreign, attributes, ACCESSOR_CONSTANT,
109 : Descriptor(key, foreign, attributes, CALLBACKS,
110 Representation::Tagged()) {} 103 Representation::Tagged()) {}
111 }; 104 };
112 105
113 106
114 class LookupResult FINAL BASE_EMBEDDED { 107 class LookupResult FINAL BASE_EMBEDDED {
115 public: 108 public:
116 explicit LookupResult(Isolate* isolate) 109 explicit LookupResult(Isolate* isolate)
117 : isolate_(isolate), 110 : isolate_(isolate),
118 next_(isolate->top_lookup_result()), 111 next_(isolate->top_lookup_result()),
119 lookup_type_(NOT_FOUND), 112 lookup_type_(NOT_FOUND),
120 holder_(NULL), 113 holder_(NULL),
121 transition_(NULL), 114 transition_(NULL),
122 details_(NONE, FIELD, Representation::None()) { 115 details_(NONE, DATA, Representation::None()) {
123 isolate->set_top_lookup_result(this); 116 isolate->set_top_lookup_result(this);
124 } 117 }
125 118
126 ~LookupResult() { 119 ~LookupResult() {
127 DCHECK(isolate()->top_lookup_result() == this); 120 DCHECK(isolate()->top_lookup_result() == this);
128 isolate()->set_top_lookup_result(next_); 121 isolate()->set_top_lookup_result(next_);
129 } 122 }
130 123
131 Isolate* isolate() const { return isolate_; } 124 Isolate* isolate() const { return isolate_; }
132 125
133 void DescriptorResult(JSObject* holder, PropertyDetails details, int number) { 126 void DescriptorResult(JSObject* holder, PropertyDetails details, int number) {
134 lookup_type_ = DESCRIPTOR_TYPE; 127 lookup_type_ = DESCRIPTOR_TYPE;
135 holder_ = holder; 128 holder_ = holder;
136 transition_ = NULL; 129 transition_ = NULL;
137 details_ = details; 130 details_ = details;
138 number_ = number; 131 number_ = number;
139 } 132 }
140 133
141 void TransitionResult(JSObject* holder, Map* target) { 134 void TransitionResult(JSObject* holder, Map* target) {
142 lookup_type_ = TRANSITION_TYPE; 135 lookup_type_ = TRANSITION_TYPE;
143 number_ = target->LastAdded(); 136 number_ = target->LastAdded();
144 details_ = target->instance_descriptors()->GetDetails(number_); 137 details_ = target->instance_descriptors()->GetDetails(number_);
145 holder_ = holder; 138 holder_ = holder;
146 transition_ = target; 139 transition_ = target;
147 } 140 }
148 141
149 void NotFound() { 142 void NotFound() {
150 lookup_type_ = NOT_FOUND; 143 lookup_type_ = NOT_FOUND;
151 details_ = PropertyDetails(NONE, FIELD, 0); 144 details_ = PropertyDetails(NONE, DATA, 0);
152 holder_ = NULL; 145 holder_ = NULL;
153 transition_ = NULL; 146 transition_ = NULL;
154 } 147 }
155 148
156 Representation representation() const { 149 Representation representation() const {
157 DCHECK(IsFound()); 150 DCHECK(IsFound());
158 return details_.representation(); 151 return details_.representation();
159 } 152 }
160 153
161 // Property callbacks does not include transitions to callbacks. 154 // Property callbacks does not include transitions to callbacks.
162 bool IsPropertyCallbacks() const { 155 bool IsAccessorConstant() const {
163 return !IsTransition() && details_.type() == CALLBACKS; 156 return !IsTransition() && details_.type() == ACCESSOR_CONSTANT;
164 } 157 }
165 158
166 bool IsReadOnly() const { 159 bool IsReadOnly() const {
167 DCHECK(IsFound()); 160 DCHECK(IsFound());
168 return details_.IsReadOnly(); 161 return details_.IsReadOnly();
169 } 162 }
170 163
171 bool IsField() const { 164 bool IsData() const {
172 return lookup_type_ == DESCRIPTOR_TYPE && details_.type() == FIELD; 165 return lookup_type_ == DESCRIPTOR_TYPE && details_.type() == DATA;
173 } 166 }
174 167
175 bool IsConstant() const { 168 bool IsDataConstant() const {
176 return lookup_type_ == DESCRIPTOR_TYPE && details_.type() == CONSTANT; 169 return lookup_type_ == DESCRIPTOR_TYPE && details_.type() == DATA_CONSTANT;
177 } 170 }
178 171
179 bool IsConfigurable() const { return details_.IsConfigurable(); } 172 bool IsConfigurable() const { return details_.IsConfigurable(); }
180 bool IsFound() const { return lookup_type_ != NOT_FOUND; } 173 bool IsFound() const { return lookup_type_ != NOT_FOUND; }
181 bool IsTransition() const { return lookup_type_ == TRANSITION_TYPE; } 174 bool IsTransition() const { return lookup_type_ == TRANSITION_TYPE; }
182 175
183 // Is the result is a property excluding transitions and the null descriptor? 176 // Is the result is a property excluding transitions and the null descriptor?
184 bool IsProperty() const { 177 bool IsProperty() const {
185 return IsFound() && !IsTransition(); 178 return IsFound() && !IsTransition();
186 } 179 }
187 180
188 Map* GetTransitionTarget() const { 181 Map* GetTransitionTarget() const {
189 DCHECK(IsTransition()); 182 DCHECK(IsTransition());
190 return transition_; 183 return transition_;
191 } 184 }
192 185
193 bool IsTransitionToField() const { 186 bool IsTransitionToData() const {
194 return IsTransition() && details_.type() == FIELD; 187 return IsTransition() && details_.type() == DATA;
195 } 188 }
196 189
197 int GetLocalFieldIndexFromMap(Map* map) const { 190 int GetLocalFieldIndexFromMap(Map* map) const {
198 return GetFieldIndexFromMap(map) - map->inobject_properties(); 191 return GetFieldIndexFromMap(map) - map->inobject_properties();
199 } 192 }
200 193
201 Object* GetConstantFromMap(Map* map) const { 194 Object* GetConstantFromMap(Map* map) const {
202 DCHECK(details_.type() == CONSTANT); 195 DCHECK(details_.type() == DATA_CONSTANT);
203 return GetValueFromMap(map); 196 return GetValueFromMap(map);
204 } 197 }
205 198
206 Object* GetValueFromMap(Map* map) const { 199 Object* GetValueFromMap(Map* map) const {
207 DCHECK(lookup_type_ == DESCRIPTOR_TYPE || 200 DCHECK(lookup_type_ == DESCRIPTOR_TYPE ||
208 lookup_type_ == TRANSITION_TYPE); 201 lookup_type_ == TRANSITION_TYPE);
209 DCHECK(number_ < map->NumberOfOwnDescriptors()); 202 DCHECK(number_ < map->NumberOfOwnDescriptors());
210 return map->instance_descriptors()->GetValue(number_); 203 return map->instance_descriptors()->GetValue(number_);
211 } 204 }
212 205
(...skipping 30 matching lines...) Expand all
243 Map* transition_; 236 Map* transition_;
244 int number_; 237 int number_;
245 PropertyDetails details_; 238 PropertyDetails details_;
246 }; 239 };
247 240
248 241
249 std::ostream& operator<<(std::ostream& os, const LookupResult& r); 242 std::ostream& operator<<(std::ostream& os, const LookupResult& r);
250 } } // namespace v8::internal 243 } } // namespace v8::internal
251 244
252 #endif // V8_PROPERTY_H_ 245 #endif // V8_PROPERTY_H_
OLDNEW
« no previous file with comments | « src/ppc/macro-assembler-ppc.cc ('k') | src/property.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698