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

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

Issue 22861025: Get rid of ConvertFieldToDescriptor and simplify related code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comment and fixed cornercase Created 7 years, 3 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 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 1847 matching lines...) Expand 10 before | Expand all | Expand 10 after
1858 } 1858 }
1859 } 1859 }
1860 1860
1861 1861
1862 bool JSObject::HasFastProperties() { 1862 bool JSObject::HasFastProperties() {
1863 ASSERT(properties()->IsDictionary() == map()->is_dictionary_map()); 1863 ASSERT(properties()->IsDictionary() == map()->is_dictionary_map());
1864 return !properties()->IsDictionary(); 1864 return !properties()->IsDictionary();
1865 } 1865 }
1866 1866
1867 1867
1868 bool JSObject::TooManyFastProperties(int properties, 1868 bool JSObject::TooManyFastProperties(StoreFromKeyed store_mode) {
1869 JSObject::StoreFromKeyed store_mode) {
1870 // Allow extra fast properties if the object has more than 1869 // Allow extra fast properties if the object has more than
1871 // kFastPropertiesSoftLimit in-object properties. When this is the case, 1870 // kFastPropertiesSoftLimit in-object properties. When this is the case, it is
1872 // it is very unlikely that the object is being used as a dictionary 1871 // very unlikely that the object is being used as a dictionary and there is a
1873 // and there is a good chance that allowing more map transitions 1872 // good chance that allowing more map transitions will be worth it.
1874 // will be worth it. 1873 Map* map = this->map();
1875 int inobject = map()->inobject_properties(); 1874 if (map->unused_property_fields() != 0) return false;
1875
1876 int inobject = map->inobject_properties();
1876 1877
1877 int limit; 1878 int limit;
1878 if (store_mode == CERTAINLY_NOT_STORE_FROM_KEYED) { 1879 if (store_mode == CERTAINLY_NOT_STORE_FROM_KEYED) {
1879 limit = Max(inobject, kMaxFastProperties); 1880 limit = Max(inobject, kMaxFastProperties);
1880 } else { 1881 } else {
1881 limit = Max(inobject, kFastPropertiesSoftLimit); 1882 limit = Max(inobject, kFastPropertiesSoftLimit);
1882 } 1883 }
1883 return properties > limit; 1884 return properties()->length() > limit;
1884 } 1885 }
1885 1886
1886 1887
1887 void Struct::InitializeBody(int object_size) { 1888 void Struct::InitializeBody(int object_size) {
1888 Object* value = GetHeap()->undefined_value(); 1889 Object* value = GetHeap()->undefined_value();
1889 for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) { 1890 for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) {
1890 WRITE_FIELD(this, offset, value); 1891 WRITE_FIELD(this, offset, value);
1891 } 1892 }
1892 } 1893 }
1893 1894
(...skipping 4364 matching lines...) Expand 10 before | Expand all | Expand 10 after
6258 #undef WRITE_UINT32_FIELD 6259 #undef WRITE_UINT32_FIELD
6259 #undef READ_SHORT_FIELD 6260 #undef READ_SHORT_FIELD
6260 #undef WRITE_SHORT_FIELD 6261 #undef WRITE_SHORT_FIELD
6261 #undef READ_BYTE_FIELD 6262 #undef READ_BYTE_FIELD
6262 #undef WRITE_BYTE_FIELD 6263 #undef WRITE_BYTE_FIELD
6263 6264
6264 6265
6265 } } // namespace v8::internal 6266 } } // namespace v8::internal
6266 6267
6267 #endif // V8_OBJECTS_INL_H_ 6268 #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