| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 type* type::cast(Object* object) { \ | 92 type* type::cast(Object* object) { \ |
| 93 SLOW_ASSERT(object->Is##type()); \ | 93 SLOW_ASSERT(object->Is##type()); \ |
| 94 return reinterpret_cast<type*>(object); \ | 94 return reinterpret_cast<type*>(object); \ |
| 95 } | 95 } |
| 96 | 96 |
| 97 #define INT_ACCESSORS(holder, name, offset) \ | 97 #define INT_ACCESSORS(holder, name, offset) \ |
| 98 int holder::name() { return READ_INT_FIELD(this, offset); } \ | 98 int holder::name() { return READ_INT_FIELD(this, offset); } \ |
| 99 void holder::set_##name(int value) { WRITE_INT_FIELD(this, offset, value); } | 99 void holder::set_##name(int value) { WRITE_INT_FIELD(this, offset, value); } |
| 100 | 100 |
| 101 | 101 |
| 102 #define REGLIST_ACCESSORS(holder, name, offset) \ |
| 103 RegList holder::name() { return READ_REGLIST_FIELD(this, offset); } \ |
| 104 void holder::set_##name(RegList value) \ |
| 105 { WRITE_REGLIST_FIELD(this, offset, value); } |
| 106 |
| 107 |
| 102 #define ACCESSORS(holder, name, type, offset) \ | 108 #define ACCESSORS(holder, name, type, offset) \ |
| 103 type* holder::name() { return type::cast(READ_FIELD(this, offset)); } \ | 109 type* holder::name() { return type::cast(READ_FIELD(this, offset)); } \ |
| 104 void holder::set_##name(type* value, WriteBarrierMode mode) { \ | 110 void holder::set_##name(type* value, WriteBarrierMode mode) { \ |
| 105 WRITE_FIELD(this, offset, value); \ | 111 WRITE_FIELD(this, offset, value); \ |
| 106 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode); \ | 112 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode); \ |
| 107 } | 113 } |
| 108 | 114 |
| 109 | 115 |
| 110 // Getter that returns a tagged Smi and setter that writes a tagged Smi. | 116 // Getter that returns a tagged Smi and setter that writes a tagged Smi. |
| 111 #define ACCESSORS_TO_SMI(holder, name, offset) \ | 117 #define ACCESSORS_TO_SMI(holder, name, offset) \ |
| (...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1177 | 1183 |
| 1178 #define WRITE_SHORT_FIELD(p, offset, value) \ | 1184 #define WRITE_SHORT_FIELD(p, offset, value) \ |
| 1179 (*reinterpret_cast<uint16_t*>(FIELD_ADDR(p, offset)) = value) | 1185 (*reinterpret_cast<uint16_t*>(FIELD_ADDR(p, offset)) = value) |
| 1180 | 1186 |
| 1181 #define READ_BYTE_FIELD(p, offset) \ | 1187 #define READ_BYTE_FIELD(p, offset) \ |
| 1182 (*reinterpret_cast<byte*>(FIELD_ADDR(p, offset))) | 1188 (*reinterpret_cast<byte*>(FIELD_ADDR(p, offset))) |
| 1183 | 1189 |
| 1184 #define WRITE_BYTE_FIELD(p, offset, value) \ | 1190 #define WRITE_BYTE_FIELD(p, offset, value) \ |
| 1185 (*reinterpret_cast<byte*>(FIELD_ADDR(p, offset)) = value) | 1191 (*reinterpret_cast<byte*>(FIELD_ADDR(p, offset)) = value) |
| 1186 | 1192 |
| 1193 #define READ_REGLIST_FIELD(p, offset) \ |
| 1194 (*reinterpret_cast<RegList*>(FIELD_ADDR(p, offset))) |
| 1195 |
| 1196 #define WRITE_REGLIST_FIELD(p, offset, value) \ |
| 1197 (*reinterpret_cast<RegList*>(FIELD_ADDR(p, offset)) = value) |
| 1198 |
| 1187 | 1199 |
| 1188 Object** HeapObject::RawField(HeapObject* obj, int byte_offset) { | 1200 Object** HeapObject::RawField(HeapObject* obj, int byte_offset) { |
| 1189 return &READ_FIELD(obj, byte_offset); | 1201 return &READ_FIELD(obj, byte_offset); |
| 1190 } | 1202 } |
| 1191 | 1203 |
| 1192 | 1204 |
| 1193 int Smi::value() { | 1205 int Smi::value() { |
| 1194 return Internals::SmiValue(this); | 1206 return Internals::SmiValue(this); |
| 1195 } | 1207 } |
| 1196 | 1208 |
| (...skipping 4490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5687 | 5699 |
| 5688 JSMessageObject* JSMessageObject::cast(Object* obj) { | 5700 JSMessageObject* JSMessageObject::cast(Object* obj) { |
| 5689 ASSERT(obj->IsJSMessageObject()); | 5701 ASSERT(obj->IsJSMessageObject()); |
| 5690 ASSERT(HeapObject::cast(obj)->Size() == JSMessageObject::kSize); | 5702 ASSERT(HeapObject::cast(obj)->Size() == JSMessageObject::kSize); |
| 5691 return reinterpret_cast<JSMessageObject*>(obj); | 5703 return reinterpret_cast<JSMessageObject*>(obj); |
| 5692 } | 5704 } |
| 5693 | 5705 |
| 5694 | 5706 |
| 5695 INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset) | 5707 INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset) |
| 5696 INT_ACCESSORS(Code, prologue_offset, kPrologueOffset) | 5708 INT_ACCESSORS(Code, prologue_offset, kPrologueOffset) |
| 5709 #if V8_TARGET_ARCH_ARM |
| 5710 REGLIST_ACCESSORS(Code, registers_mask, kCoresMaskOffset) |
| 5711 REGLIST_ACCESSORS(Code, double_registers_mask, kDoublesMaskOffset) |
| 5712 #endif |
| 5697 ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset) | 5713 ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset) |
| 5698 ACCESSORS(Code, handler_table, FixedArray, kHandlerTableOffset) | 5714 ACCESSORS(Code, handler_table, FixedArray, kHandlerTableOffset) |
| 5699 ACCESSORS(Code, deoptimization_data, FixedArray, kDeoptimizationDataOffset) | 5715 ACCESSORS(Code, deoptimization_data, FixedArray, kDeoptimizationDataOffset) |
| 5700 ACCESSORS(Code, raw_type_feedback_info, Object, kTypeFeedbackInfoOffset) | 5716 ACCESSORS(Code, raw_type_feedback_info, Object, kTypeFeedbackInfoOffset) |
| 5701 | 5717 |
| 5702 | 5718 |
| 5703 void Code::WipeOutHeader() { | 5719 void Code::WipeOutHeader() { |
| 5704 WRITE_FIELD(this, kRelocationInfoOffset, NULL); | 5720 WRITE_FIELD(this, kRelocationInfoOffset, NULL); |
| 5705 WRITE_FIELD(this, kHandlerTableOffset, NULL); | 5721 WRITE_FIELD(this, kHandlerTableOffset, NULL); |
| 5706 WRITE_FIELD(this, kDeoptimizationDataOffset, NULL); | 5722 WRITE_FIELD(this, kDeoptimizationDataOffset, NULL); |
| (...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6739 int object_size, | 6755 int object_size, |
| 6740 ObjectVisitor* v) { | 6756 ObjectVisitor* v) { |
| 6741 v->VisitPointers(HeapObject::RawField(obj, start_offset), | 6757 v->VisitPointers(HeapObject::RawField(obj, start_offset), |
| 6742 HeapObject::RawField(obj, object_size)); | 6758 HeapObject::RawField(obj, object_size)); |
| 6743 } | 6759 } |
| 6744 | 6760 |
| 6745 | 6761 |
| 6746 #undef TYPE_CHECKER | 6762 #undef TYPE_CHECKER |
| 6747 #undef CAST_ACCESSOR | 6763 #undef CAST_ACCESSOR |
| 6748 #undef INT_ACCESSORS | 6764 #undef INT_ACCESSORS |
| 6765 #undef REGLIST_ACCESSORS |
| 6749 #undef ACCESSORS | 6766 #undef ACCESSORS |
| 6750 #undef ACCESSORS_TO_SMI | 6767 #undef ACCESSORS_TO_SMI |
| 6751 #undef SMI_ACCESSORS | 6768 #undef SMI_ACCESSORS |
| 6752 #undef BOOL_GETTER | 6769 #undef BOOL_GETTER |
| 6753 #undef BOOL_ACCESSORS | 6770 #undef BOOL_ACCESSORS |
| 6754 #undef FIELD_ADDR | 6771 #undef FIELD_ADDR |
| 6755 #undef READ_FIELD | 6772 #undef READ_FIELD |
| 6756 #undef WRITE_FIELD | 6773 #undef WRITE_FIELD |
| 6757 #undef WRITE_BARRIER | 6774 #undef WRITE_BARRIER |
| 6758 #undef CONDITIONAL_WRITE_BARRIER | 6775 #undef CONDITIONAL_WRITE_BARRIER |
| 6759 #undef READ_DOUBLE_FIELD | 6776 #undef READ_DOUBLE_FIELD |
| 6760 #undef WRITE_DOUBLE_FIELD | 6777 #undef WRITE_DOUBLE_FIELD |
| 6761 #undef READ_INT_FIELD | 6778 #undef READ_INT_FIELD |
| 6762 #undef WRITE_INT_FIELD | 6779 #undef WRITE_INT_FIELD |
| 6763 #undef READ_INTPTR_FIELD | 6780 #undef READ_INTPTR_FIELD |
| 6764 #undef WRITE_INTPTR_FIELD | 6781 #undef WRITE_INTPTR_FIELD |
| 6765 #undef READ_UINT32_FIELD | 6782 #undef READ_UINT32_FIELD |
| 6766 #undef WRITE_UINT32_FIELD | 6783 #undef WRITE_UINT32_FIELD |
| 6767 #undef READ_SHORT_FIELD | 6784 #undef READ_SHORT_FIELD |
| 6768 #undef WRITE_SHORT_FIELD | 6785 #undef WRITE_SHORT_FIELD |
| 6769 #undef READ_BYTE_FIELD | 6786 #undef READ_BYTE_FIELD |
| 6770 #undef WRITE_BYTE_FIELD | 6787 #undef WRITE_BYTE_FIELD |
| 6788 #undef READ_REGLIST_FIELD |
| 6789 #undef WRITE_REGLIST_FIELD |
| 6771 | 6790 |
| 6772 } } // namespace v8::internal | 6791 } } // namespace v8::internal |
| 6773 | 6792 |
| 6774 #endif // V8_OBJECTS_INL_H_ | 6793 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |