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

Side by Side Diff: src/objects-inl.h

Issue 2818041: Use the number of in-object properties when deciding how many fast... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 5 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.cc ('k') | no next file » | 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 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after
1328 1328
1329 1329
1330 void JSObject::InitializeBody(int object_size) { 1330 void JSObject::InitializeBody(int object_size) {
1331 Object* value = Heap::undefined_value(); 1331 Object* value = Heap::undefined_value();
1332 for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) { 1332 for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) {
1333 WRITE_FIELD(this, offset, value); 1333 WRITE_FIELD(this, offset, value);
1334 } 1334 }
1335 } 1335 }
1336 1336
1337 1337
1338 bool JSObject::HasFastProperties() {
1339 return !properties()->IsDictionary();
1340 }
1341
1342
1343 int JSObject::MaxFastProperties() {
1344 // Allow extra fast properties if the object has more than
1345 // kMaxFastProperties in-object properties. When this is the case,
1346 // it is very unlikely that the object is being used as a dictionary
1347 // and there is a good chance that allowing more map transitions
1348 // will be worth it.
1349 return Max(map()->inobject_properties(), kMaxFastProperties);
1350 }
1351
1352
1338 void Struct::InitializeBody(int object_size) { 1353 void Struct::InitializeBody(int object_size) {
1339 Object* value = Heap::undefined_value(); 1354 Object* value = Heap::undefined_value();
1340 for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) { 1355 for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) {
1341 WRITE_FIELD(this, offset, value); 1356 WRITE_FIELD(this, offset, value);
1342 } 1357 }
1343 } 1358 }
1344 1359
1345 1360
1346 bool JSObject::HasFastProperties() {
1347 return !properties()->IsDictionary();
1348 }
1349
1350
1351 bool Object::ToArrayIndex(uint32_t* index) { 1361 bool Object::ToArrayIndex(uint32_t* index) {
1352 if (IsSmi()) { 1362 if (IsSmi()) {
1353 int value = Smi::cast(this)->value(); 1363 int value = Smi::cast(this)->value();
1354 if (value < 0) return false; 1364 if (value < 0) return false;
1355 *index = value; 1365 *index = value;
1356 return true; 1366 return true;
1357 } 1367 }
1358 if (IsHeapNumber()) { 1368 if (IsHeapNumber()) {
1359 double value = HeapNumber::cast(this)->value(); 1369 double value = HeapNumber::cast(this)->value();
1360 uint32_t uint_value = static_cast<uint32_t>(value); 1370 uint32_t uint_value = static_cast<uint32_t>(value);
(...skipping 1893 matching lines...) Expand 10 before | Expand all | Expand 10 after
3254 #undef WRITE_INT_FIELD 3264 #undef WRITE_INT_FIELD
3255 #undef READ_SHORT_FIELD 3265 #undef READ_SHORT_FIELD
3256 #undef WRITE_SHORT_FIELD 3266 #undef WRITE_SHORT_FIELD
3257 #undef READ_BYTE_FIELD 3267 #undef READ_BYTE_FIELD
3258 #undef WRITE_BYTE_FIELD 3268 #undef WRITE_BYTE_FIELD
3259 3269
3260 3270
3261 } } // namespace v8::internal 3271 } } // namespace v8::internal
3262 3272
3263 #endif // V8_OBJECTS_INL_H_ 3273 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698