OLD | NEW |
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 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1609 bool JSObject::TooManyFastProperties(int properties, | 1609 bool JSObject::TooManyFastProperties(int properties, |
1610 JSObject::StoreFromKeyed store_mode) { | 1610 JSObject::StoreFromKeyed store_mode) { |
1611 // Allow extra fast properties if the object has more than | 1611 // Allow extra fast properties if the object has more than |
1612 // kFastPropertiesSoftLimit in-object properties. When this is the case, | 1612 // kFastPropertiesSoftLimit in-object properties. When this is the case, |
1613 // it is very unlikely that the object is being used as a dictionary | 1613 // it is very unlikely that the object is being used as a dictionary |
1614 // and there is a good chance that allowing more map transitions | 1614 // and there is a good chance that allowing more map transitions |
1615 // will be worth it. | 1615 // will be worth it. |
1616 int inobject = map()->inobject_properties(); | 1616 int inobject = map()->inobject_properties(); |
1617 | 1617 |
1618 int limit; | 1618 int limit; |
1619 if (store_mode == CERTAINLY_NOT_STORE_FROM_KEYED || | 1619 if (store_mode == CERTAINLY_NOT_STORE_FROM_KEYED) { |
1620 map()->used_for_prototype()) { | |
1621 limit = Max(inobject, kMaxFastProperties); | 1620 limit = Max(inobject, kMaxFastProperties); |
1622 } else { | 1621 } else { |
1623 limit = Max(inobject, kFastPropertiesSoftLimit); | 1622 limit = Max(inobject, kFastPropertiesSoftLimit); |
1624 } | 1623 } |
1625 return properties > limit; | 1624 return properties > limit; |
1626 } | 1625 } |
1627 | 1626 |
1628 | 1627 |
1629 void Struct::InitializeBody(int object_size) { | 1628 void Struct::InitializeBody(int object_size) { |
1630 Object* value = GetHeap()->undefined_value(); | 1629 Object* value = GetHeap()->undefined_value(); |
(...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2975 } else { | 2974 } else { |
2976 set_bit_field3(bit_field3() & ~(1 << kIsShared)); | 2975 set_bit_field3(bit_field3() & ~(1 << kIsShared)); |
2977 } | 2976 } |
2978 } | 2977 } |
2979 | 2978 |
2980 bool Map::is_shared() { | 2979 bool Map::is_shared() { |
2981 return ((1 << kIsShared) & bit_field3()) != 0; | 2980 return ((1 << kIsShared) & bit_field3()) != 0; |
2982 } | 2981 } |
2983 | 2982 |
2984 | 2983 |
2985 void Map::set_used_for_prototype(bool value) { | |
2986 if (value) { | |
2987 set_bit_field3(bit_field3() | (1 << kUsedForPrototype)); | |
2988 } else { | |
2989 set_bit_field3(bit_field3() & ~(1 << kUsedForPrototype)); | |
2990 } | |
2991 } | |
2992 | |
2993 | |
2994 bool Map::used_for_prototype() { | |
2995 return ((1 << kUsedForPrototype) & bit_field3()) != 0; | |
2996 } | |
2997 | |
2998 | |
2999 JSFunction* Map::unchecked_constructor() { | 2984 JSFunction* Map::unchecked_constructor() { |
3000 return reinterpret_cast<JSFunction*>(READ_FIELD(this, kConstructorOffset)); | 2985 return reinterpret_cast<JSFunction*>(READ_FIELD(this, kConstructorOffset)); |
3001 } | 2986 } |
3002 | 2987 |
3003 | 2988 |
3004 Code::Flags Code::flags() { | 2989 Code::Flags Code::flags() { |
3005 return static_cast<Flags>(READ_INT_FIELD(this, kFlagsOffset)); | 2990 return static_cast<Flags>(READ_INT_FIELD(this, kFlagsOffset)); |
3006 } | 2991 } |
3007 | 2992 |
3008 | 2993 |
(...skipping 2170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5179 #undef WRITE_UINT32_FIELD | 5164 #undef WRITE_UINT32_FIELD |
5180 #undef READ_SHORT_FIELD | 5165 #undef READ_SHORT_FIELD |
5181 #undef WRITE_SHORT_FIELD | 5166 #undef WRITE_SHORT_FIELD |
5182 #undef READ_BYTE_FIELD | 5167 #undef READ_BYTE_FIELD |
5183 #undef WRITE_BYTE_FIELD | 5168 #undef WRITE_BYTE_FIELD |
5184 | 5169 |
5185 | 5170 |
5186 } } // namespace v8::internal | 5171 } } // namespace v8::internal |
5187 | 5172 |
5188 #endif // V8_OBJECTS_INL_H_ | 5173 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |