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

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

Issue 437083004: Keep function.prototype fast. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add TODO and make .prototype fast on creating the initial map Created 6 years, 4 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-prototype.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 2097 matching lines...) Expand 10 before | Expand all | Expand 10 after
2108 2108
2109 2109
2110 bool JSObject::HasFastProperties() { 2110 bool JSObject::HasFastProperties() {
2111 ASSERT(properties()->IsDictionary() == map()->is_dictionary_map()); 2111 ASSERT(properties()->IsDictionary() == map()->is_dictionary_map());
2112 return !properties()->IsDictionary(); 2112 return !properties()->IsDictionary();
2113 } 2113 }
2114 2114
2115 2115
2116 bool Map::TooManyFastProperties(StoreFromKeyed store_mode) { 2116 bool Map::TooManyFastProperties(StoreFromKeyed store_mode) {
2117 if (unused_property_fields() != 0) return false; 2117 if (unused_property_fields() != 0) return false;
2118 if (is_prototype_map()) return false;
2118 int minimum = store_mode == CERTAINLY_NOT_STORE_FROM_KEYED ? 128 : 12; 2119 int minimum = store_mode == CERTAINLY_NOT_STORE_FROM_KEYED ? 128 : 12;
2119 int limit = Max(minimum, inobject_properties()); 2120 int limit = Max(minimum, inobject_properties());
2120 int external = NumberOfFields() - inobject_properties(); 2121 int external = NumberOfFields() - inobject_properties();
2121 return external > limit; 2122 return external > limit;
2122 } 2123 }
2123 2124
2124 2125
2125 void Struct::InitializeBody(int object_size) { 2126 void Struct::InitializeBody(int object_size) {
2126 Object* value = GetHeap()->undefined_value(); 2127 Object* value = GetHeap()->undefined_value();
2127 for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) { 2128 for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) {
(...skipping 2310 matching lines...) Expand 10 before | Expand all | Expand 10 after
4438 } else { 4439 } else {
4439 set_bit_field2(bit_field2() & ~(1 << kIsExtensible)); 4440 set_bit_field2(bit_field2() & ~(1 << kIsExtensible));
4440 } 4441 }
4441 } 4442 }
4442 4443
4443 bool Map::is_extensible() { 4444 bool Map::is_extensible() {
4444 return ((1 << kIsExtensible) & bit_field2()) != 0; 4445 return ((1 << kIsExtensible) & bit_field2()) != 0;
4445 } 4446 }
4446 4447
4447 4448
4449 void Map::mark_prototype_map() {
4450 set_bit_field2(IsPrototypeMapBits::update(bit_field2(), true));
4451 }
4452
4453 bool Map::is_prototype_map() {
4454 return IsPrototypeMapBits::decode(bit_field2());
4455 }
4456
4457
4448 void Map::set_is_shared(bool value) { 4458 void Map::set_is_shared(bool value) {
4449 set_bit_field3(IsShared::update(bit_field3(), value)); 4459 set_bit_field3(IsShared::update(bit_field3(), value));
4450 } 4460 }
4451 4461
4452 4462
4453 bool Map::is_shared() { 4463 bool Map::is_shared() {
4454 return IsShared::decode(bit_field3()); } 4464 return IsShared::decode(bit_field3()); }
4455 4465
4456 4466
4457 void Map::set_dictionary_map(bool value) { 4467 void Map::set_dictionary_map(bool value) {
(...skipping 2801 matching lines...) Expand 10 before | Expand all | Expand 10 after
7259 #undef READ_SHORT_FIELD 7269 #undef READ_SHORT_FIELD
7260 #undef WRITE_SHORT_FIELD 7270 #undef WRITE_SHORT_FIELD
7261 #undef READ_BYTE_FIELD 7271 #undef READ_BYTE_FIELD
7262 #undef WRITE_BYTE_FIELD 7272 #undef WRITE_BYTE_FIELD
7263 #undef NOBARRIER_READ_BYTE_FIELD 7273 #undef NOBARRIER_READ_BYTE_FIELD
7264 #undef NOBARRIER_WRITE_BYTE_FIELD 7274 #undef NOBARRIER_WRITE_BYTE_FIELD
7265 7275
7266 } } // namespace v8::internal 7276 } } // namespace v8::internal
7267 7277
7268 #endif // V8_OBJECTS_INL_H_ 7278 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/fast-prototype.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698