| OLD | NEW |
| 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 6754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6765 INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset) | 6765 INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset) |
| 6766 INT_ACCESSORS(Code, prologue_offset, kPrologueOffset) | 6766 INT_ACCESSORS(Code, prologue_offset, kPrologueOffset) |
| 6767 INT_ACCESSORS(Code, constant_pool_offset, kConstantPoolOffset) | 6767 INT_ACCESSORS(Code, constant_pool_offset, kConstantPoolOffset) |
| 6768 #define CODE_ACCESSORS(name, type, offset) \ | 6768 #define CODE_ACCESSORS(name, type, offset) \ |
| 6769 ACCESSORS_CHECKED2(Code, name, type, offset, true, \ | 6769 ACCESSORS_CHECKED2(Code, name, type, offset, true, \ |
| 6770 !GetHeap()->InNewSpace(value)) | 6770 !GetHeap()->InNewSpace(value)) |
| 6771 CODE_ACCESSORS(relocation_info, ByteArray, kRelocationInfoOffset) | 6771 CODE_ACCESSORS(relocation_info, ByteArray, kRelocationInfoOffset) |
| 6772 CODE_ACCESSORS(handler_table, FixedArray, kHandlerTableOffset) | 6772 CODE_ACCESSORS(handler_table, FixedArray, kHandlerTableOffset) |
| 6773 CODE_ACCESSORS(deoptimization_data, FixedArray, kDeoptimizationDataOffset) | 6773 CODE_ACCESSORS(deoptimization_data, FixedArray, kDeoptimizationDataOffset) |
| 6774 CODE_ACCESSORS(source_position_table, ByteArray, kSourcePositionTableOffset) | 6774 CODE_ACCESSORS(source_position_table, ByteArray, kSourcePositionTableOffset) |
| 6775 CODE_ACCESSORS(protected_instructions, FixedArray, kProtectedInstructionOffset) | |
| 6776 CODE_ACCESSORS(raw_type_feedback_info, Object, kTypeFeedbackInfoOffset) | 6775 CODE_ACCESSORS(raw_type_feedback_info, Object, kTypeFeedbackInfoOffset) |
| 6777 CODE_ACCESSORS(next_code_link, Object, kNextCodeLinkOffset) | 6776 CODE_ACCESSORS(next_code_link, Object, kNextCodeLinkOffset) |
| 6778 #undef CODE_ACCESSORS | 6777 #undef CODE_ACCESSORS |
| 6779 | 6778 |
| 6780 void Code::WipeOutHeader() { | 6779 void Code::WipeOutHeader() { |
| 6781 WRITE_FIELD(this, kRelocationInfoOffset, NULL); | 6780 WRITE_FIELD(this, kRelocationInfoOffset, NULL); |
| 6782 WRITE_FIELD(this, kHandlerTableOffset, NULL); | 6781 WRITE_FIELD(this, kHandlerTableOffset, NULL); |
| 6783 WRITE_FIELD(this, kDeoptimizationDataOffset, NULL); | 6782 WRITE_FIELD(this, kDeoptimizationDataOffset, NULL); |
| 6784 WRITE_FIELD(this, kSourcePositionTableOffset, NULL); | 6783 WRITE_FIELD(this, kSourcePositionTableOffset, NULL); |
| 6785 // Do not wipe out major/minor keys on a code stub or IC | 6784 // Do not wipe out major/minor keys on a code stub or IC |
| 6786 if (!READ_FIELD(this, kTypeFeedbackInfoOffset)->IsSmi()) { | 6785 if (!READ_FIELD(this, kTypeFeedbackInfoOffset)->IsSmi()) { |
| 6787 WRITE_FIELD(this, kTypeFeedbackInfoOffset, NULL); | 6786 WRITE_FIELD(this, kTypeFeedbackInfoOffset, NULL); |
| 6788 } | 6787 } |
| 6789 WRITE_FIELD(this, kNextCodeLinkOffset, NULL); | 6788 WRITE_FIELD(this, kNextCodeLinkOffset, NULL); |
| 6790 WRITE_FIELD(this, kGCMetadataOffset, NULL); | 6789 WRITE_FIELD(this, kGCMetadataOffset, NULL); |
| 6791 WRITE_FIELD(this, kProtectedInstructionOffset, NULL); | |
| 6792 } | 6790 } |
| 6793 | 6791 |
| 6794 | 6792 |
| 6795 Object* Code::type_feedback_info() { | 6793 Object* Code::type_feedback_info() { |
| 6796 DCHECK(kind() == FUNCTION); | 6794 DCHECK(kind() == FUNCTION); |
| 6797 return raw_type_feedback_info(); | 6795 return raw_type_feedback_info(); |
| 6798 } | 6796 } |
| 6799 | 6797 |
| 6800 | 6798 |
| 6801 void Code::set_type_feedback_info(Object* value, WriteBarrierMode mode) { | 6799 void Code::set_type_feedback_info(Object* value, WriteBarrierMode mode) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6865 : instruction_size(); | 6863 : instruction_size(); |
| 6866 return RoundUp(unpadded_body_size, kObjectAlignment); | 6864 return RoundUp(unpadded_body_size, kObjectAlignment); |
| 6867 } | 6865 } |
| 6868 | 6866 |
| 6869 int Code::SizeIncludingMetadata() { | 6867 int Code::SizeIncludingMetadata() { |
| 6870 int size = CodeSize(); | 6868 int size = CodeSize(); |
| 6871 size += relocation_info()->Size(); | 6869 size += relocation_info()->Size(); |
| 6872 size += deoptimization_data()->Size(); | 6870 size += deoptimization_data()->Size(); |
| 6873 size += handler_table()->Size(); | 6871 size += handler_table()->Size(); |
| 6874 if (kind() == FUNCTION) size += source_position_table()->Size(); | 6872 if (kind() == FUNCTION) size += source_position_table()->Size(); |
| 6875 size += protected_instructions()->Size(); | |
| 6876 return size; | 6873 return size; |
| 6877 } | 6874 } |
| 6878 | 6875 |
| 6879 ByteArray* Code::unchecked_relocation_info() { | 6876 ByteArray* Code::unchecked_relocation_info() { |
| 6880 return reinterpret_cast<ByteArray*>(READ_FIELD(this, kRelocationInfoOffset)); | 6877 return reinterpret_cast<ByteArray*>(READ_FIELD(this, kRelocationInfoOffset)); |
| 6881 } | 6878 } |
| 6882 | 6879 |
| 6883 | 6880 |
| 6884 byte* Code::relocation_start() { | 6881 byte* Code::relocation_start() { |
| 6885 return unchecked_relocation_info()->GetDataStartAddress(); | 6882 return unchecked_relocation_info()->GetDataStartAddress(); |
| (...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8379 #undef WRITE_INT64_FIELD | 8376 #undef WRITE_INT64_FIELD |
| 8380 #undef READ_BYTE_FIELD | 8377 #undef READ_BYTE_FIELD |
| 8381 #undef WRITE_BYTE_FIELD | 8378 #undef WRITE_BYTE_FIELD |
| 8382 #undef NOBARRIER_READ_BYTE_FIELD | 8379 #undef NOBARRIER_READ_BYTE_FIELD |
| 8383 #undef NOBARRIER_WRITE_BYTE_FIELD | 8380 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 8384 | 8381 |
| 8385 } // namespace internal | 8382 } // namespace internal |
| 8386 } // namespace v8 | 8383 } // namespace v8 |
| 8387 | 8384 |
| 8388 #endif // V8_OBJECTS_INL_H_ | 8385 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |