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

Side by Side Diff: src/objects.cc

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.h ('k') | src/objects-inl.h » ('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-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1269 Map* new_map = Map::cast(r); 1269 Map* new_map = Map::cast(r);
1270 if (allow_map_transition) { 1270 if (allow_map_transition) {
1271 // Allocate new instance descriptors for the old map with map transition. 1271 // Allocate new instance descriptors for the old map with map transition.
1272 MapTransitionDescriptor d(name, Map::cast(new_map), attributes); 1272 MapTransitionDescriptor d(name, Map::cast(new_map), attributes);
1273 Object* r = old_descriptors->CopyInsert(&d, KEEP_TRANSITIONS); 1273 Object* r = old_descriptors->CopyInsert(&d, KEEP_TRANSITIONS);
1274 if (r->IsFailure()) return r; 1274 if (r->IsFailure()) return r;
1275 old_descriptors = DescriptorArray::cast(r); 1275 old_descriptors = DescriptorArray::cast(r);
1276 } 1276 }
1277 1277
1278 if (map()->unused_property_fields() == 0) { 1278 if (map()->unused_property_fields() == 0) {
1279 if (properties()->length() > kMaxFastProperties) { 1279 if (properties()->length() > MaxFastProperties()) {
1280 Object* obj = NormalizeProperties(CLEAR_INOBJECT_PROPERTIES, 0); 1280 Object* obj = NormalizeProperties(CLEAR_INOBJECT_PROPERTIES, 0);
1281 if (obj->IsFailure()) return obj; 1281 if (obj->IsFailure()) return obj;
1282 return AddSlowProperty(name, value, attributes); 1282 return AddSlowProperty(name, value, attributes);
1283 } 1283 }
1284 // Make room for the new value 1284 // Make room for the new value
1285 Object* values = 1285 Object* values =
1286 properties()->CopySize(properties()->length() + kFieldsAdded); 1286 properties()->CopySize(properties()->length() + kFieldsAdded);
1287 if (values->IsFailure()) return values; 1287 if (values->IsFailure()) return values;
1288 set_properties(FixedArray::cast(values)); 1288 set_properties(FixedArray::cast(values));
1289 new_map->set_unused_property_fields(kFieldsAdded - 1); 1289 new_map->set_unused_property_fields(kFieldsAdded - 1);
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 if (new_descriptors->IsFailure()) return result; // Yes, return _result_. 1467 if (new_descriptors->IsFailure()) return result; // Yes, return _result_.
1468 old_map->set_instance_descriptors(DescriptorArray::cast(new_descriptors)); 1468 old_map->set_instance_descriptors(DescriptorArray::cast(new_descriptors));
1469 return result; 1469 return result;
1470 } 1470 }
1471 1471
1472 1472
1473 Object* JSObject::ConvertDescriptorToField(String* name, 1473 Object* JSObject::ConvertDescriptorToField(String* name,
1474 Object* new_value, 1474 Object* new_value,
1475 PropertyAttributes attributes) { 1475 PropertyAttributes attributes) {
1476 if (map()->unused_property_fields() == 0 && 1476 if (map()->unused_property_fields() == 0 &&
1477 properties()->length() > kMaxFastProperties) { 1477 properties()->length() > MaxFastProperties()) {
1478 Object* obj = NormalizeProperties(CLEAR_INOBJECT_PROPERTIES, 0); 1478 Object* obj = NormalizeProperties(CLEAR_INOBJECT_PROPERTIES, 0);
1479 if (obj->IsFailure()) return obj; 1479 if (obj->IsFailure()) return obj;
1480 return ReplaceSlowProperty(name, new_value, attributes); 1480 return ReplaceSlowProperty(name, new_value, attributes);
1481 } 1481 }
1482 1482
1483 int index = map()->NextFreePropertyIndex(); 1483 int index = map()->NextFreePropertyIndex();
1484 FieldDescriptor new_field(name, index, attributes); 1484 FieldDescriptor new_field(name, index, attributes);
1485 // Make a new DescriptorArray replacing an entry with FieldDescriptor. 1485 // Make a new DescriptorArray replacing an entry with FieldDescriptor.
1486 Object* descriptors_unchecked = map()->instance_descriptors()-> 1486 Object* descriptors_unchecked = map()->instance_descriptors()->
1487 CopyInsert(&new_field, REMOVE_TRANSITIONS); 1487 CopyInsert(&new_field, REMOVE_TRANSITIONS);
(...skipping 7250 matching lines...) Expand 10 before | Expand all | Expand 10 after
8738 if (break_point_objects()->IsUndefined()) return 0; 8738 if (break_point_objects()->IsUndefined()) return 0;
8739 // Single beak point. 8739 // Single beak point.
8740 if (!break_point_objects()->IsFixedArray()) return 1; 8740 if (!break_point_objects()->IsFixedArray()) return 1;
8741 // Multiple break points. 8741 // Multiple break points.
8742 return FixedArray::cast(break_point_objects())->length(); 8742 return FixedArray::cast(break_point_objects())->length();
8743 } 8743 }
8744 #endif 8744 #endif
8745 8745
8746 8746
8747 } } // namespace v8::internal 8747 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698