| 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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 // Dictionary is covered under FixedArray. | 285 // Dictionary is covered under FixedArray. |
| 286 return IsFixedArray() || IsFixedDoubleArray() || IsExternalArray(); | 286 return IsFixedArray() || IsFixedDoubleArray() || IsExternalArray(); |
| 287 } | 287 } |
| 288 | 288 |
| 289 | 289 |
| 290 MaybeObject* Object::AllocateNewStorageFor(Heap* heap, | 290 MaybeObject* Object::AllocateNewStorageFor(Heap* heap, |
| 291 Representation representation, | 291 Representation representation, |
| 292 PretenureFlag tenure) { | 292 PretenureFlag tenure) { |
| 293 if (!FLAG_track_double_fields) return this; | 293 if (!FLAG_track_double_fields) return this; |
| 294 if (!representation.IsDouble()) return this; | 294 if (!representation.IsDouble()) return this; |
| 295 if (IsUndefined()) { |
| 296 return heap->AllocateHeapNumber(0, tenure); |
| 297 } |
| 295 return heap->AllocateHeapNumber(Number(), tenure); | 298 return heap->AllocateHeapNumber(Number(), tenure); |
| 296 } | 299 } |
| 297 | 300 |
| 298 | 301 |
| 299 StringShape::StringShape(String* str) | 302 StringShape::StringShape(String* str) |
| 300 : type_(str->map()->instance_type()) { | 303 : type_(str->map()->instance_type()) { |
| 301 set_valid(); | 304 set_valid(); |
| 302 ASSERT((type_ & kIsNotStringMask) == kStringTag); | 305 ASSERT((type_ & kIsNotStringMask) == kStringTag); |
| 303 } | 306 } |
| 304 | 307 |
| (...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1534 } | 1537 } |
| 1535 set_map(map); | 1538 set_map(map); |
| 1536 return this; | 1539 return this; |
| 1537 } | 1540 } |
| 1538 | 1541 |
| 1539 | 1542 |
| 1540 MaybeObject* JSObject::MigrateInstance() { | 1543 MaybeObject* JSObject::MigrateInstance() { |
| 1541 // Converting any field to the most specific type will cause the | 1544 // Converting any field to the most specific type will cause the |
| 1542 // GeneralizeFieldRepresentation algorithm to create the most general existing | 1545 // GeneralizeFieldRepresentation algorithm to create the most general existing |
| 1543 // transition that matches the object. This achieves what is needed. | 1546 // transition that matches the object. This achieves what is needed. |
| 1544 return GeneralizeFieldRepresentation(0, Representation::Smi()); | 1547 return GeneralizeFieldRepresentation(0, Representation::None()); |
| 1545 } | 1548 } |
| 1546 | 1549 |
| 1547 | 1550 |
| 1548 MaybeObject* JSObject::TryMigrateInstance() { | 1551 MaybeObject* JSObject::TryMigrateInstance() { |
| 1549 Map* new_map = map()->CurrentMapForDeprecated(); | 1552 Map* new_map = map()->CurrentMapForDeprecated(); |
| 1550 if (new_map == NULL) return Smi::FromInt(0); | 1553 if (new_map == NULL) return Smi::FromInt(0); |
| 1551 return MigrateToMap(new_map); | 1554 return MigrateToMap(new_map); |
| 1552 } | 1555 } |
| 1553 | 1556 |
| 1554 | 1557 |
| (...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2359 GetDetails(descriptor_number)); | 2362 GetDetails(descriptor_number)); |
| 2360 } | 2363 } |
| 2361 | 2364 |
| 2362 | 2365 |
| 2363 void DescriptorArray::Set(int descriptor_number, | 2366 void DescriptorArray::Set(int descriptor_number, |
| 2364 Descriptor* desc, | 2367 Descriptor* desc, |
| 2365 const WhitenessWitness&) { | 2368 const WhitenessWitness&) { |
| 2366 // Range check. | 2369 // Range check. |
| 2367 ASSERT(descriptor_number < number_of_descriptors()); | 2370 ASSERT(descriptor_number < number_of_descriptors()); |
| 2368 | 2371 |
| 2369 ASSERT(!desc->GetDetails().representation().IsNone()); | |
| 2370 NoIncrementalWriteBarrierSet(this, | 2372 NoIncrementalWriteBarrierSet(this, |
| 2371 ToKeyIndex(descriptor_number), | 2373 ToKeyIndex(descriptor_number), |
| 2372 desc->GetKey()); | 2374 desc->GetKey()); |
| 2373 NoIncrementalWriteBarrierSet(this, | 2375 NoIncrementalWriteBarrierSet(this, |
| 2374 ToValueIndex(descriptor_number), | 2376 ToValueIndex(descriptor_number), |
| 2375 desc->GetValue()); | 2377 desc->GetValue()); |
| 2376 NoIncrementalWriteBarrierSet(this, | 2378 NoIncrementalWriteBarrierSet(this, |
| 2377 ToDetailsIndex(descriptor_number), | 2379 ToDetailsIndex(descriptor_number), |
| 2378 desc->GetDetails().AsSmi()); | 2380 desc->GetDetails().AsSmi()); |
| 2379 } | 2381 } |
| 2380 | 2382 |
| 2381 | 2383 |
| 2382 void DescriptorArray::Set(int descriptor_number, Descriptor* desc) { | 2384 void DescriptorArray::Set(int descriptor_number, Descriptor* desc) { |
| 2383 // Range check. | 2385 // Range check. |
| 2384 ASSERT(descriptor_number < number_of_descriptors()); | 2386 ASSERT(descriptor_number < number_of_descriptors()); |
| 2385 ASSERT(!desc->GetDetails().representation().IsNone()); | |
| 2386 | 2387 |
| 2387 set(ToKeyIndex(descriptor_number), desc->GetKey()); | 2388 set(ToKeyIndex(descriptor_number), desc->GetKey()); |
| 2388 set(ToValueIndex(descriptor_number), desc->GetValue()); | 2389 set(ToValueIndex(descriptor_number), desc->GetValue()); |
| 2389 set(ToDetailsIndex(descriptor_number), desc->GetDetails().AsSmi()); | 2390 set(ToDetailsIndex(descriptor_number), desc->GetDetails().AsSmi()); |
| 2390 } | 2391 } |
| 2391 | 2392 |
| 2392 | 2393 |
| 2393 void DescriptorArray::Append(Descriptor* desc, | 2394 void DescriptorArray::Append(Descriptor* desc, |
| 2394 const WhitenessWitness& witness) { | 2395 const WhitenessWitness& witness) { |
| 2395 int descriptor_number = number_of_descriptors(); | 2396 int descriptor_number = number_of_descriptors(); |
| (...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3610 | 3611 |
| 3611 bool Map::is_frozen() { | 3612 bool Map::is_frozen() { |
| 3612 return IsFrozen::decode(bit_field3()); | 3613 return IsFrozen::decode(bit_field3()); |
| 3613 } | 3614 } |
| 3614 | 3615 |
| 3615 | 3616 |
| 3616 bool Map::CanBeDeprecated() { | 3617 bool Map::CanBeDeprecated() { |
| 3617 int descriptor = LastAdded(); | 3618 int descriptor = LastAdded(); |
| 3618 for (int i = 0; i <= descriptor; i++) { | 3619 for (int i = 0; i <= descriptor; i++) { |
| 3619 PropertyDetails details = instance_descriptors()->GetDetails(i); | 3620 PropertyDetails details = instance_descriptors()->GetDetails(i); |
| 3621 if (FLAG_track_fields && details.representation().IsNone()) { |
| 3622 return true; |
| 3623 } |
| 3620 if (FLAG_track_fields && details.representation().IsSmi()) { | 3624 if (FLAG_track_fields && details.representation().IsSmi()) { |
| 3621 return true; | 3625 return true; |
| 3622 } | 3626 } |
| 3623 if (FLAG_track_double_fields && details.representation().IsDouble()) { | 3627 if (FLAG_track_double_fields && details.representation().IsDouble()) { |
| 3624 return true; | 3628 return true; |
| 3625 } | 3629 } |
| 3626 if (FLAG_track_heap_object_fields && | 3630 if (FLAG_track_heap_object_fields && |
| 3627 details.representation().IsHeapObject()) { | 3631 details.representation().IsHeapObject()) { |
| 3628 return true; | 3632 return true; |
| 3629 } | 3633 } |
| (...skipping 2591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6221 #undef WRITE_UINT32_FIELD | 6225 #undef WRITE_UINT32_FIELD |
| 6222 #undef READ_SHORT_FIELD | 6226 #undef READ_SHORT_FIELD |
| 6223 #undef WRITE_SHORT_FIELD | 6227 #undef WRITE_SHORT_FIELD |
| 6224 #undef READ_BYTE_FIELD | 6228 #undef READ_BYTE_FIELD |
| 6225 #undef WRITE_BYTE_FIELD | 6229 #undef WRITE_BYTE_FIELD |
| 6226 | 6230 |
| 6227 | 6231 |
| 6228 } } // namespace v8::internal | 6232 } } // namespace v8::internal |
| 6229 | 6233 |
| 6230 #endif // V8_OBJECTS_INL_H_ | 6234 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |