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

Side by Side Diff: src/property.h

Issue 6685073: Remember and reuse derived map for external arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: review feedback Created 9 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
« no previous file with comments | « src/objects-inl.h ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // A pointer from a map to the new map that is created by adding 103 // A pointer from a map to the new map that is created by adding
104 // a named property. These are key to the speed and functioning of V8. 104 // a named property. These are key to the speed and functioning of V8.
105 // The two maps should always have the same prototype, since 105 // The two maps should always have the same prototype, since
106 // MapSpace::CreateBackPointers depends on this. 106 // MapSpace::CreateBackPointers depends on this.
107 class MapTransitionDescriptor: public Descriptor { 107 class MapTransitionDescriptor: public Descriptor {
108 public: 108 public:
109 MapTransitionDescriptor(String* key, Map* map, PropertyAttributes attributes) 109 MapTransitionDescriptor(String* key, Map* map, PropertyAttributes attributes)
110 : Descriptor(key, map, attributes, MAP_TRANSITION) { } 110 : Descriptor(key, map, attributes, MAP_TRANSITION) { }
111 }; 111 };
112 112
113 class ExternalArrayTransitionDescriptor: public Descriptor {
114 public:
115 ExternalArrayTransitionDescriptor(String* key,
116 Map* map,
117 ExternalArrayType array_type)
118 : Descriptor(key, map, PropertyDetails(NONE,
119 EXTERNAL_ARRAY_TRANSITION,
120 array_type)) { }
121 };
122
113 // Marks a field name in a map so that adding the field is guaranteed 123 // Marks a field name in a map so that adding the field is guaranteed
114 // to create a FIELD descriptor in the new map. Used after adding 124 // to create a FIELD descriptor in the new map. Used after adding
115 // a constant function the first time, creating a CONSTANT_FUNCTION 125 // a constant function the first time, creating a CONSTANT_FUNCTION
116 // descriptor in the new map. This avoids creating multiple maps with 126 // descriptor in the new map. This avoids creating multiple maps with
117 // the same CONSTANT_FUNCTION field. 127 // the same CONSTANT_FUNCTION field.
118 class ConstTransitionDescriptor: public Descriptor { 128 class ConstTransitionDescriptor: public Descriptor {
119 public: 129 public:
120 explicit ConstTransitionDescriptor(String* key, Map* map) 130 explicit ConstTransitionDescriptor(String* key, Map* map)
121 : Descriptor(key, map, NONE, CONSTANT_TRANSITION) { } 131 : Descriptor(key, map, NONE, CONSTANT_TRANSITION) { }
122 }; 132 };
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 } 265 }
256 case CONSTANT_FUNCTION: 266 case CONSTANT_FUNCTION:
257 return GetConstantFunction(); 267 return GetConstantFunction();
258 default: 268 default:
259 return Smi::FromInt(0); 269 return Smi::FromInt(0);
260 } 270 }
261 } 271 }
262 272
263 Map* GetTransitionMap() { 273 Map* GetTransitionMap() {
264 ASSERT(lookup_type_ == DESCRIPTOR_TYPE); 274 ASSERT(lookup_type_ == DESCRIPTOR_TYPE);
265 ASSERT(type() == MAP_TRANSITION || type() == CONSTANT_TRANSITION); 275 ASSERT(type() == MAP_TRANSITION || type() == CONSTANT_TRANSITION ||
276 type() == EXTERNAL_ARRAY_TRANSITION);
266 return Map::cast(GetValue()); 277 return Map::cast(GetValue());
267 } 278 }
268 279
269 Map* GetTransitionMapFromMap(Map* map) { 280 Map* GetTransitionMapFromMap(Map* map) {
270 ASSERT(lookup_type_ == DESCRIPTOR_TYPE); 281 ASSERT(lookup_type_ == DESCRIPTOR_TYPE);
271 ASSERT(type() == MAP_TRANSITION); 282 ASSERT(type() == MAP_TRANSITION);
272 return Map::cast(map->instance_descriptors()->GetValue(number_)); 283 return Map::cast(map->instance_descriptors()->GetValue(number_));
273 } 284 }
274 285
275 int GetFieldIndex() { 286 int GetFieldIndex() {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 JSObject* holder_; 339 JSObject* holder_;
329 int number_; 340 int number_;
330 bool cacheable_; 341 bool cacheable_;
331 PropertyDetails details_; 342 PropertyDetails details_;
332 }; 343 };
333 344
334 345
335 } } // namespace v8::internal 346 } } // namespace v8::internal
336 347
337 #endif // V8_PROPERTY_H_ 348 #endif // V8_PROPERTY_H_
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/property.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698