| 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 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 | 667 |
| 668 bool Object::IsJSFunctionResultCache() { | 668 bool Object::IsJSFunctionResultCache() { |
| 669 if (!IsFixedArray()) return false; | 669 if (!IsFixedArray()) return false; |
| 670 FixedArray* self = FixedArray::cast(this); | 670 FixedArray* self = FixedArray::cast(this); |
| 671 int length = self->length(); | 671 int length = self->length(); |
| 672 if (length < JSFunctionResultCache::kEntriesIndex) return false; | 672 if (length < JSFunctionResultCache::kEntriesIndex) return false; |
| 673 if ((length - JSFunctionResultCache::kEntriesIndex) | 673 if ((length - JSFunctionResultCache::kEntriesIndex) |
| 674 % JSFunctionResultCache::kEntrySize != 0) { | 674 % JSFunctionResultCache::kEntrySize != 0) { |
| 675 return false; | 675 return false; |
| 676 } | 676 } |
| 677 #ifdef DEBUG | 677 #ifdef VERIFY_HEAP |
| 678 if (FLAG_verify_heap) { | 678 if (FLAG_verify_heap) { |
| 679 reinterpret_cast<JSFunctionResultCache*>(this)-> | 679 reinterpret_cast<JSFunctionResultCache*>(this)-> |
| 680 JSFunctionResultCacheVerify(); | 680 JSFunctionResultCacheVerify(); |
| 681 } | 681 } |
| 682 #endif | 682 #endif |
| 683 return true; | 683 return true; |
| 684 } | 684 } |
| 685 | 685 |
| 686 | 686 |
| 687 bool Object::IsNormalizedMapCache() { | 687 bool Object::IsNormalizedMapCache() { |
| 688 if (!IsFixedArray()) return false; | 688 if (!IsFixedArray()) return false; |
| 689 if (FixedArray::cast(this)->length() != NormalizedMapCache::kEntries) { | 689 if (FixedArray::cast(this)->length() != NormalizedMapCache::kEntries) { |
| 690 return false; | 690 return false; |
| 691 } | 691 } |
| 692 #ifdef DEBUG | 692 #ifdef VERIFY_HEAP |
| 693 if (FLAG_verify_heap) { | 693 if (FLAG_verify_heap) { |
| 694 reinterpret_cast<NormalizedMapCache*>(this)->NormalizedMapCacheVerify(); | 694 reinterpret_cast<NormalizedMapCache*>(this)->NormalizedMapCacheVerify(); |
| 695 } | 695 } |
| 696 #endif | 696 #endif |
| 697 return true; | 697 return true; |
| 698 } | 698 } |
| 699 | 699 |
| 700 | 700 |
| 701 bool Object::IsCompilationCacheTable() { | 701 bool Object::IsCompilationCacheTable() { |
| 702 return IsHashTable(); | 702 return IsHashTable(); |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 return MapWord(reinterpret_cast<uintptr_t>(raw)); | 1103 return MapWord(reinterpret_cast<uintptr_t>(raw)); |
| 1104 } | 1104 } |
| 1105 | 1105 |
| 1106 | 1106 |
| 1107 HeapObject* MapWord::ToForwardingAddress() { | 1107 HeapObject* MapWord::ToForwardingAddress() { |
| 1108 ASSERT(IsForwardingAddress()); | 1108 ASSERT(IsForwardingAddress()); |
| 1109 return HeapObject::FromAddress(reinterpret_cast<Address>(value_)); | 1109 return HeapObject::FromAddress(reinterpret_cast<Address>(value_)); |
| 1110 } | 1110 } |
| 1111 | 1111 |
| 1112 | 1112 |
| 1113 #ifdef DEBUG | 1113 #ifdef VERIFY_HEAP |
| 1114 void HeapObject::VerifyObjectField(int offset) { | 1114 void HeapObject::VerifyObjectField(int offset) { |
| 1115 VerifyPointer(READ_FIELD(this, offset)); | 1115 VerifyPointer(READ_FIELD(this, offset)); |
| 1116 } | 1116 } |
| 1117 | 1117 |
| 1118 void HeapObject::VerifySmiField(int offset) { | 1118 void HeapObject::VerifySmiField(int offset) { |
| 1119 ASSERT(READ_FIELD(this, offset)->IsSmi()); | 1119 CHECK(READ_FIELD(this, offset)->IsSmi()); |
| 1120 } | 1120 } |
| 1121 #endif | 1121 #endif |
| 1122 | 1122 |
| 1123 | 1123 |
| 1124 Heap* HeapObject::GetHeap() { | 1124 Heap* HeapObject::GetHeap() { |
| 1125 Heap* heap = | 1125 Heap* heap = |
| 1126 MemoryChunk::FromAddress(reinterpret_cast<Address>(this))->heap(); | 1126 MemoryChunk::FromAddress(reinterpret_cast<Address>(this))->heap(); |
| 1127 ASSERT(heap != NULL); | 1127 ASSERT(heap != NULL); |
| 1128 ASSERT(heap->isolate() == Isolate::Current()); | 1128 ASSERT(heap->isolate() == Isolate::Current()); |
| 1129 return heap; | 1129 return heap; |
| (...skipping 2491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3621 SetNumberOfOwnDescriptors(len); | 3621 SetNumberOfOwnDescriptors(len); |
| 3622 return this; | 3622 return this; |
| 3623 } | 3623 } |
| 3624 | 3624 |
| 3625 | 3625 |
| 3626 SMI_ACCESSORS(Map, bit_field3, kBitField3Offset) | 3626 SMI_ACCESSORS(Map, bit_field3, kBitField3Offset) |
| 3627 | 3627 |
| 3628 | 3628 |
| 3629 void Map::ClearTransitions(Heap* heap, WriteBarrierMode mode) { | 3629 void Map::ClearTransitions(Heap* heap, WriteBarrierMode mode) { |
| 3630 Object* back_pointer = GetBackPointer(); | 3630 Object* back_pointer = GetBackPointer(); |
| 3631 #ifdef DEBUG | 3631 |
| 3632 Object* object = READ_FIELD(this, kTransitionsOrBackPointerOffset); | 3632 if (Heap::ShouldZapGarbage() && HasTransitionArray()) { |
| 3633 if (object->IsTransitionArray()) { | |
| 3634 ZapTransitions(); | 3633 ZapTransitions(); |
| 3635 } else { | |
| 3636 ASSERT(object->IsMap() || object->IsUndefined()); | |
| 3637 } | 3634 } |
| 3638 #endif | 3635 |
| 3639 WRITE_FIELD(this, kTransitionsOrBackPointerOffset, back_pointer); | 3636 WRITE_FIELD(this, kTransitionsOrBackPointerOffset, back_pointer); |
| 3640 CONDITIONAL_WRITE_BARRIER( | 3637 CONDITIONAL_WRITE_BARRIER( |
| 3641 heap, this, kTransitionsOrBackPointerOffset, back_pointer, mode); | 3638 heap, this, kTransitionsOrBackPointerOffset, back_pointer, mode); |
| 3642 } | 3639 } |
| 3643 | 3640 |
| 3644 | 3641 |
| 3645 void Map::AppendDescriptor(Descriptor* desc, | 3642 void Map::AppendDescriptor(Descriptor* desc, |
| 3646 const DescriptorArray::WhitenessWitness& witness) { | 3643 const DescriptorArray::WhitenessWitness& witness) { |
| 3647 DescriptorArray* descriptors = instance_descriptors(); | 3644 DescriptorArray* descriptors = instance_descriptors(); |
| 3648 int number_of_own_descriptors = NumberOfOwnDescriptors(); | 3645 int number_of_own_descriptors = NumberOfOwnDescriptors(); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3750 | 3747 |
| 3751 TransitionArray* Map::transitions() { | 3748 TransitionArray* Map::transitions() { |
| 3752 ASSERT(HasTransitionArray()); | 3749 ASSERT(HasTransitionArray()); |
| 3753 Object* object = READ_FIELD(this, kTransitionsOrBackPointerOffset); | 3750 Object* object = READ_FIELD(this, kTransitionsOrBackPointerOffset); |
| 3754 return TransitionArray::cast(object); | 3751 return TransitionArray::cast(object); |
| 3755 } | 3752 } |
| 3756 | 3753 |
| 3757 | 3754 |
| 3758 void Map::set_transitions(TransitionArray* transition_array, | 3755 void Map::set_transitions(TransitionArray* transition_array, |
| 3759 WriteBarrierMode mode) { | 3756 WriteBarrierMode mode) { |
| 3760 #ifdef DEBUG | 3757 // In release mode, only run this code if verify_heap is on. |
| 3761 if (HasTransitionArray()) { | 3758 if (Heap::ShouldZapGarbage() && HasTransitionArray()) { |
| 3762 ASSERT(transitions() != transition_array); | 3759 CHECK(transitions() != transition_array); |
| 3763 ZapTransitions(); | 3760 ZapTransitions(); |
| 3764 } | 3761 } |
| 3765 #endif | |
| 3766 | 3762 |
| 3767 WRITE_FIELD(this, kTransitionsOrBackPointerOffset, transition_array); | 3763 WRITE_FIELD(this, kTransitionsOrBackPointerOffset, transition_array); |
| 3768 CONDITIONAL_WRITE_BARRIER( | 3764 CONDITIONAL_WRITE_BARRIER( |
| 3769 GetHeap(), this, kTransitionsOrBackPointerOffset, transition_array, mode); | 3765 GetHeap(), this, kTransitionsOrBackPointerOffset, transition_array, mode); |
| 3770 } | 3766 } |
| 3771 | 3767 |
| 3772 | 3768 |
| 3773 void Map::init_back_pointer(Object* undefined) { | 3769 void Map::init_back_pointer(Object* undefined) { |
| 3774 ASSERT(undefined->IsUndefined()); | 3770 ASSERT(undefined->IsUndefined()); |
| 3775 WRITE_FIELD(this, kTransitionsOrBackPointerOffset, undefined); | 3771 WRITE_FIELD(this, kTransitionsOrBackPointerOffset, undefined); |
| (...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5544 #undef WRITE_UINT32_FIELD | 5540 #undef WRITE_UINT32_FIELD |
| 5545 #undef READ_SHORT_FIELD | 5541 #undef READ_SHORT_FIELD |
| 5546 #undef WRITE_SHORT_FIELD | 5542 #undef WRITE_SHORT_FIELD |
| 5547 #undef READ_BYTE_FIELD | 5543 #undef READ_BYTE_FIELD |
| 5548 #undef WRITE_BYTE_FIELD | 5544 #undef WRITE_BYTE_FIELD |
| 5549 | 5545 |
| 5550 | 5546 |
| 5551 } } // namespace v8::internal | 5547 } } // namespace v8::internal |
| 5552 | 5548 |
| 5553 #endif // V8_OBJECTS_INL_H_ | 5549 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |