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

Side by Side Diff: src/objects.h

Issue 7341: Allocate room for expected number of properties based on the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 2 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/heap.cc ('k') | src/objects.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 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after
1342 1342
1343 // Convert the object to use the canonical dictionary 1343 // Convert the object to use the canonical dictionary
1344 // representation. 1344 // representation.
1345 Object* NormalizeProperties(); 1345 Object* NormalizeProperties();
1346 Object* NormalizeElements(); 1346 Object* NormalizeElements();
1347 1347
1348 // Transform slow named properties to fast variants. 1348 // Transform slow named properties to fast variants.
1349 // Returns failure if allocation failed. 1349 // Returns failure if allocation failed.
1350 Object* TransformToFastProperties(int unused_property_fields); 1350 Object* TransformToFastProperties(int unused_property_fields);
1351 1351
1352 // Access fast-case object properties at index.
1353 inline Object* FastPropertyAt(int index);
1354 inline Object* FastPropertyAtPut(int index, Object* value);
1355
1356
1352 // initializes the body after properties slot, properties slot is 1357 // initializes the body after properties slot, properties slot is
1353 // initialized by set_properties 1358 // initialized by set_properties
1354 // Note: this call does not update write barrier, it is caller's 1359 // Note: this call does not update write barrier, it is caller's
1355 // reponsibility to ensure that *v* can be collected without WB here. 1360 // reponsibility to ensure that *v* can be collected without WB here.
1356 inline void InitializeBody(int object_size); 1361 inline void InitializeBody(int object_size);
1357 1362
1358 // Check whether this object references another object 1363 // Check whether this object references another object
1359 bool ReferencesObject(Object* obj); 1364 bool ReferencesObject(Object* obj);
1360 1365
1361 // Casting. 1366 // Casting.
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after
2247 // All heap objects have a Map that describes their structure. 2252 // All heap objects have a Map that describes their structure.
2248 // A Map contains information about: 2253 // A Map contains information about:
2249 // - Size information about the object 2254 // - Size information about the object
2250 // - How to iterate over an object (for garbage collection) 2255 // - How to iterate over an object (for garbage collection)
2251 class Map: public HeapObject { 2256 class Map: public HeapObject {
2252 public: 2257 public:
2253 // instance size. 2258 // instance size.
2254 inline int instance_size(); 2259 inline int instance_size();
2255 inline void set_instance_size(int value); 2260 inline void set_instance_size(int value);
2256 2261
2262 // Count of properties allocated in the object.
2263 inline int inobject_properties();
2264 inline void set_inobject_properties(int value);
2265
2257 // instance type. 2266 // instance type.
2258 inline InstanceType instance_type(); 2267 inline InstanceType instance_type();
2259 inline void set_instance_type(InstanceType value); 2268 inline void set_instance_type(InstanceType value);
2260 2269
2261 // tells how many unused property fields are available in the instance. 2270 // tells how many unused property fields are available in the instance.
2262 // (only used for JSObject in fast mode). 2271 // (only used for JSObject in fast mode).
2263 inline int unused_property_fields(); 2272 inline int unused_property_fields();
2264 inline void set_unused_property_fields(int value); 2273 inline void set_unused_property_fields(int value);
2265 2274
2266 // bit field. 2275 // bit field.
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
2389 void RemoveFromCodeCache(int index); 2398 void RemoveFromCodeCache(int index);
2390 2399
2391 // Dispatched behavior. 2400 // Dispatched behavior.
2392 void MapIterateBody(ObjectVisitor* v); 2401 void MapIterateBody(ObjectVisitor* v);
2393 #ifdef DEBUG 2402 #ifdef DEBUG
2394 void MapPrint(); 2403 void MapPrint();
2395 void MapVerify(); 2404 void MapVerify();
2396 #endif 2405 #endif
2397 2406
2398 // Layout description. 2407 // Layout description.
2399 static const int kInstanceAttributesOffset = HeapObject::kHeaderSize; 2408 static const int kInstanceSizesOffset = HeapObject::kHeaderSize;
2409 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize;
2400 static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize; 2410 static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize;
2401 static const int kConstructorOffset = kPrototypeOffset + kPointerSize; 2411 static const int kConstructorOffset = kPrototypeOffset + kPointerSize;
2402 static const int kInstanceDescriptorsOffset = 2412 static const int kInstanceDescriptorsOffset =
2403 kConstructorOffset + kPointerSize; 2413 kConstructorOffset + kPointerSize;
2404 static const int kCodeCacheOffset = kInstanceDescriptorsOffset + kPointerSize; 2414 static const int kCodeCacheOffset = kInstanceDescriptorsOffset + kPointerSize;
2405 static const int kSize = kCodeCacheOffset + kIntSize; 2415 static const int kSize = kCodeCacheOffset + kIntSize;
2406 2416
2417 // Byte offsets within kInstanceSizesOffset.
2418 static const int kInstanceSizeOffset = kInstanceSizesOffset + 0;
2419 static const int kInObjectPropertiesOffset = kInstanceSizesOffset + 1;
2420 // The bytes at positions 2 and 3 are not in use at the moment.
2421
2422
2407 // Byte offsets within kInstanceAttributesOffset attributes. 2423 // Byte offsets within kInstanceAttributesOffset attributes.
2408 static const int kInstanceSizeOffset = kInstanceAttributesOffset + 0; 2424 static const int kInstanceTypeOffset = kInstanceAttributesOffset + 0;
2409 static const int kInstanceTypeOffset = kInstanceAttributesOffset + 1; 2425 static const int kUnusedPropertyFieldsOffset = kInstanceAttributesOffset + 1;
2410 static const int kUnusedPropertyFieldsOffset = kInstanceAttributesOffset + 2; 2426 static const int kBitFieldOffset = kInstanceAttributesOffset + 2;
2411 static const int kBitFieldOffset = kInstanceAttributesOffset + 3; 2427 // The byte at position 3 is not in use at the moment.
2412 2428
2413 // Bit positions for bit field. 2429 // Bit positions for bit field.
2414 static const int kUnused = 0; // To be used for marking recently used maps. 2430 static const int kUnused = 0; // To be used for marking recently used maps.
2415 static const int kHasNonInstancePrototype = 1; 2431 static const int kHasNonInstancePrototype = 1;
2416 static const int kIsHiddenPrototype = 2; 2432 static const int kIsHiddenPrototype = 2;
2417 static const int kHasNamedInterceptor = 3; 2433 static const int kHasNamedInterceptor = 3;
2418 static const int kHasIndexedInterceptor = 4; 2434 static const int kHasIndexedInterceptor = 4;
2419 static const int kIsUndetectable = 5; 2435 static const int kIsUndetectable = 5;
2420 static const int kHasInstanceCallHandler = 6; 2436 static const int kHasInstanceCallHandler = 6;
2421 static const int kNeedsAccessCheck = 7; 2437 static const int kNeedsAccessCheck = 7;
(...skipping 1575 matching lines...) Expand 10 before | Expand all | Expand 10 after
3997 } else { 4013 } else {
3998 value &= ~(1 << bit_position); 4014 value &= ~(1 << bit_position);
3999 } 4015 }
4000 return value; 4016 return value;
4001 } 4017 }
4002 }; 4018 };
4003 4019
4004 } } // namespace v8::internal 4020 } } // namespace v8::internal
4005 4021
4006 #endif // V8_OBJECTS_H_ 4022 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698