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

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

Issue 126201: - Changed fast case for computing object size based on usage histogram.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 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 | « no previous file | src/string.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 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 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after
1779 } 1779 }
1780 1780
1781 1781
1782 int Map::inobject_properties() { 1782 int Map::inobject_properties() {
1783 return READ_BYTE_FIELD(this, kInObjectPropertiesOffset); 1783 return READ_BYTE_FIELD(this, kInObjectPropertiesOffset);
1784 } 1784 }
1785 1785
1786 1786
1787 int HeapObject::SizeFromMap(Map* map) { 1787 int HeapObject::SizeFromMap(Map* map) {
1788 InstanceType instance_type = map->instance_type(); 1788 InstanceType instance_type = map->instance_type();
1789 // Only inline the two most frequent cases. 1789 // Only inline the most frequent cases.
1790 if (instance_type == JS_OBJECT_TYPE) return map->instance_size(); 1790 if (instance_type == JS_OBJECT_TYPE ||
1791 (instance_type & (kIsNotStringMask | kStringRepresentationMask)) ==
1792 (kStringTag | kConsStringTag) ||
1793 instance_type == JS_ARRAY_TYPE) return map->instance_size();
1791 if (instance_type == FIXED_ARRAY_TYPE) { 1794 if (instance_type == FIXED_ARRAY_TYPE) {
1792 return reinterpret_cast<FixedArray*>(this)->FixedArraySize(); 1795 return reinterpret_cast<FixedArray*>(this)->FixedArraySize();
1793 } 1796 }
1797 if (instance_type == BYTE_ARRAY_TYPE) {
1798 return reinterpret_cast<ByteArray*>(this)->ByteArraySize();
1799 }
1794 // Otherwise do the general size computation. 1800 // Otherwise do the general size computation.
1795 return SlowSizeFromMap(map); 1801 return SlowSizeFromMap(map);
1796 } 1802 }
1797 1803
1798 1804
1799 void Map::set_instance_size(int value) { 1805 void Map::set_instance_size(int value) {
1800 ASSERT_EQ(0, value & (kPointerSize - 1)); 1806 ASSERT_EQ(0, value & (kPointerSize - 1));
1801 value >>= kPointerSizeLog2; 1807 value >>= kPointerSizeLog2;
1802 ASSERT(0 <= value && value < 256); 1808 ASSERT(0 <= value && value < 256);
1803 WRITE_BYTE_FIELD(this, kInstanceSizeOffset, static_cast<byte>(value)); 1809 WRITE_BYTE_FIELD(this, kInstanceSizeOffset, static_cast<byte>(value));
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
2668 #undef WRITE_INT_FIELD 2674 #undef WRITE_INT_FIELD
2669 #undef READ_SHORT_FIELD 2675 #undef READ_SHORT_FIELD
2670 #undef WRITE_SHORT_FIELD 2676 #undef WRITE_SHORT_FIELD
2671 #undef READ_BYTE_FIELD 2677 #undef READ_BYTE_FIELD
2672 #undef WRITE_BYTE_FIELD 2678 #undef WRITE_BYTE_FIELD
2673 2679
2674 2680
2675 } } // namespace v8::internal 2681 } } // namespace v8::internal
2676 2682
2677 #endif // V8_OBJECTS_INL_H_ 2683 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « no previous file | src/string.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698