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

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

Issue 10537050: Use the syntax of a property addition as a hint for controlling the fast-mode vs. dictionary mode h… (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 6 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') | test/mjsunit/fast-non-keyed.js » ('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 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 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after
1604 offset += kPointerSize; 1604 offset += kPointerSize;
1605 } 1605 }
1606 } 1606 }
1607 1607
1608 1608
1609 bool JSObject::HasFastProperties() { 1609 bool JSObject::HasFastProperties() {
1610 return !properties()->IsDictionary(); 1610 return !properties()->IsDictionary();
1611 } 1611 }
1612 1612
1613 1613
1614 bool JSObject::TooManyFastProperties(int properties) { 1614 bool JSObject::TooManyFastProperties(int properties,
1615 JSObject::StoreFromKeyed store_mode) {
1615 // Allow extra fast properties if the object has more than 1616 // Allow extra fast properties if the object has more than
1616 // kFastPropertiesSoftLimit in-object properties. When this is the case, 1617 // kFastPropertiesSoftLimit in-object properties. When this is the case,
1617 // it is very unlikely that the object is being used as a dictionary 1618 // it is very unlikely that the object is being used as a dictionary
1618 // and there is a good chance that allowing more map transitions 1619 // and there is a good chance that allowing more map transitions
1619 // will be worth it. 1620 // will be worth it.
1620 int inobject = map()->inobject_properties(); 1621 int inobject = map()->inobject_properties();
1621 1622
1622 int limit; 1623 int limit;
1623 if (map()->used_for_prototype()) { 1624 if (store_mode == CERTAINLY_NOT_STORE_FROM_KEYED ||
1625 map()->used_for_prototype()) {
1624 limit = Max(inobject, kMaxFastProperties); 1626 limit = Max(inobject, kMaxFastProperties);
1625 } else { 1627 } else {
1626 limit = Max(inobject, kFastPropertiesSoftLimit); 1628 limit = Max(inobject, kFastPropertiesSoftLimit);
1627 } 1629 }
1628 return properties > limit; 1630 return properties > limit;
1629 } 1631 }
1630 1632
1631 1633
1632 void Struct::InitializeBody(int object_size) { 1634 void Struct::InitializeBody(int object_size) {
1633 Object* value = GetHeap()->undefined_value(); 1635 Object* value = GetHeap()->undefined_value();
(...skipping 3451 matching lines...) Expand 10 before | Expand all | Expand 10 after
5085 #undef WRITE_UINT32_FIELD 5087 #undef WRITE_UINT32_FIELD
5086 #undef READ_SHORT_FIELD 5088 #undef READ_SHORT_FIELD
5087 #undef WRITE_SHORT_FIELD 5089 #undef WRITE_SHORT_FIELD
5088 #undef READ_BYTE_FIELD 5090 #undef READ_BYTE_FIELD
5089 #undef WRITE_BYTE_FIELD 5091 #undef WRITE_BYTE_FIELD
5090 5092
5091 5093
5092 } } // namespace v8::internal 5094 } } // namespace v8::internal
5093 5095
5094 #endif // V8_OBJECTS_INL_H_ 5096 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/fast-non-keyed.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698