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

Side by Side Diff: src/property.h

Issue 14146005: Track representations of fields (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Make double support consistent. Now DOUBLE always contains smi or heapnumber Created 7 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
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 Name* GetKey() { return key_; } 59 Name* GetKey() { return key_; }
60 Object* GetValue() { return value_; } 60 Object* GetValue() { return value_; }
61 PropertyDetails GetDetails() { return details_; } 61 PropertyDetails GetDetails() { return details_; }
62 62
63 #ifdef OBJECT_PRINT 63 #ifdef OBJECT_PRINT
64 void Print(FILE* out); 64 void Print(FILE* out);
65 #endif 65 #endif
66 66
67 void SetEnumerationIndex(int index) { 67 void SetEnumerationIndex(int index) {
68 StorageType storage = details_.storage_type();
68 details_ = PropertyDetails(details_.attributes(), details_.type(), index); 69 details_ = PropertyDetails(details_.attributes(), details_.type(), index);
70 details_ = details_.set_storage_type(storage);
69 } 71 }
70 72
71 void SetSortedKeyIndex(int index) { details_ = details_.set_pointer(index); } 73 void SetSortedKeyIndex(int index) { details_ = details_.set_pointer(index); }
72 74
75 void SetStorageType(StorageType storage) {
76 details_ = details_.set_storage_type(storage);
77 }
78
73 private: 79 private:
74 Name* key_; 80 Name* key_;
75 Object* value_; 81 Object* value_;
76 PropertyDetails details_; 82 PropertyDetails details_;
77 83
78 protected: 84 protected:
79 Descriptor() : details_(Smi::FromInt(0)) {} 85 Descriptor() : details_(Smi::FromInt(0)) {}
80 86
81 void Init(Name* key, Object* value, PropertyDetails details) { 87 void Init(Name* key, Object* value, PropertyDetails details) {
82 key_ = key; 88 key_ = key;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 207
202 Isolate* isolate() const { return isolate_; } 208 Isolate* isolate() const { return isolate_; }
203 209
204 void DescriptorResult(JSObject* holder, PropertyDetails details, int number) { 210 void DescriptorResult(JSObject* holder, PropertyDetails details, int number) {
205 lookup_type_ = DESCRIPTOR_TYPE; 211 lookup_type_ = DESCRIPTOR_TYPE;
206 holder_ = holder; 212 holder_ = holder;
207 details_ = details; 213 details_ = details;
208 number_ = number; 214 number_ = number;
209 } 215 }
210 216
217 bool CanStore(Handle<Object> value) {
218 return value->FitsStorage(details_.storage_type());
219 }
220
211 void TransitionResult(JSObject* holder, int number) { 221 void TransitionResult(JSObject* holder, int number) {
212 lookup_type_ = TRANSITION_TYPE; 222 lookup_type_ = TRANSITION_TYPE;
213 details_ = PropertyDetails(NONE, TRANSITION); 223 details_ = PropertyDetails(NONE, TRANSITION);
214 holder_ = holder; 224 holder_ = holder;
215 number_ = number; 225 number_ = number;
216 } 226 }
217 227
218 void DictionaryResult(JSObject* holder, int entry) { 228 void DictionaryResult(JSObject* holder, int entry) {
219 lookup_type_ = DICTIONARY_TYPE; 229 lookup_type_ = DICTIONARY_TYPE;
220 holder_ = holder; 230 holder_ = holder;
(...skipping 28 matching lines...) Expand all
249 JSProxy* proxy() { 259 JSProxy* proxy() {
250 ASSERT(IsFound()); 260 ASSERT(IsFound());
251 return JSProxy::cast(holder_); 261 return JSProxy::cast(holder_);
252 } 262 }
253 263
254 PropertyType type() { 264 PropertyType type() {
255 ASSERT(IsFound()); 265 ASSERT(IsFound());
256 return details_.type(); 266 return details_.type();
257 } 267 }
258 268
269 StorageType storage_type() {
270 ASSERT(IsFound());
271 return details_.storage_type();
272 }
273
259 PropertyAttributes GetAttributes() { 274 PropertyAttributes GetAttributes() {
260 ASSERT(!IsTransition()); 275 ASSERT(!IsTransition());
261 ASSERT(IsFound()); 276 ASSERT(IsFound());
262 ASSERT(details_.type() != NONEXISTENT); 277 ASSERT(details_.type() != NONEXISTENT);
263 return details_.attributes(); 278 return details_.attributes();
264 } 279 }
265 280
266 PropertyDetails GetPropertyDetails() { 281 PropertyDetails GetPropertyDetails() {
267 ASSERT(!IsTransition()); 282 ASSERT(!IsTransition());
268 return details_; 283 return details_;
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 JSReceiver* holder_; 492 JSReceiver* holder_;
478 int number_; 493 int number_;
479 bool cacheable_; 494 bool cacheable_;
480 PropertyDetails details_; 495 PropertyDetails details_;
481 }; 496 };
482 497
483 498
484 } } // namespace v8::internal 499 } } // namespace v8::internal
485 500
486 #endif // V8_PROPERTY_H_ 501 #endif // V8_PROPERTY_H_
OLDNEW
« src/objects.cc ('K') | « src/objects-inl.h ('k') | src/property-details.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698