| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 984 return MapWord(reinterpret_cast<uintptr_t>(raw)); | 984 return MapWord(reinterpret_cast<uintptr_t>(raw)); |
| 985 } | 985 } |
| 986 | 986 |
| 987 | 987 |
| 988 HeapObject* MapWord::ToForwardingAddress() { | 988 HeapObject* MapWord::ToForwardingAddress() { |
| 989 ASSERT(IsForwardingAddress()); | 989 ASSERT(IsForwardingAddress()); |
| 990 return HeapObject::FromAddress(reinterpret_cast<Address>(value_)); | 990 return HeapObject::FromAddress(reinterpret_cast<Address>(value_)); |
| 991 } | 991 } |
| 992 | 992 |
| 993 | 993 |
| 994 bool MapWord::IsMarked() { | |
| 995 return (value_ & kMarkingMask) == 0; | |
| 996 } | |
| 997 | |
| 998 | |
| 999 void MapWord::SetMark() { | |
| 1000 value_ &= ~kMarkingMask; | |
| 1001 } | |
| 1002 | |
| 1003 | |
| 1004 void MapWord::ClearMark() { | |
| 1005 value_ |= kMarkingMask; | |
| 1006 } | |
| 1007 | |
| 1008 | |
| 1009 bool MapWord::IsOverflowed() { | |
| 1010 return (value_ & kOverflowMask) != 0; | |
| 1011 } | |
| 1012 | |
| 1013 | |
| 1014 void MapWord::SetOverflow() { | |
| 1015 value_ |= kOverflowMask; | |
| 1016 } | |
| 1017 | |
| 1018 | |
| 1019 void MapWord::ClearOverflow() { | |
| 1020 value_ &= ~kOverflowMask; | |
| 1021 } | |
| 1022 | |
| 1023 | |
| 1024 #ifdef DEBUG | 994 #ifdef DEBUG |
| 1025 void HeapObject::VerifyObjectField(int offset) { | 995 void HeapObject::VerifyObjectField(int offset) { |
| 1026 VerifyPointer(READ_FIELD(this, offset)); | 996 VerifyPointer(READ_FIELD(this, offset)); |
| 1027 } | 997 } |
| 1028 | 998 |
| 1029 void HeapObject::VerifySmiField(int offset) { | 999 void HeapObject::VerifySmiField(int offset) { |
| 1030 ASSERT(READ_FIELD(this, offset)->IsSmi()); | 1000 ASSERT(READ_FIELD(this, offset)->IsSmi()); |
| 1031 } | 1001 } |
| 1032 #endif | 1002 #endif |
| 1033 | 1003 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 v->VisitPointers(reinterpret_cast<Object**>(FIELD_ADDR(this, start)), | 1044 v->VisitPointers(reinterpret_cast<Object**>(FIELD_ADDR(this, start)), |
| 1075 reinterpret_cast<Object**>(FIELD_ADDR(this, end))); | 1045 reinterpret_cast<Object**>(FIELD_ADDR(this, end))); |
| 1076 } | 1046 } |
| 1077 | 1047 |
| 1078 | 1048 |
| 1079 void HeapObject::IteratePointer(ObjectVisitor* v, int offset) { | 1049 void HeapObject::IteratePointer(ObjectVisitor* v, int offset) { |
| 1080 v->VisitPointer(reinterpret_cast<Object**>(FIELD_ADDR(this, offset))); | 1050 v->VisitPointer(reinterpret_cast<Object**>(FIELD_ADDR(this, offset))); |
| 1081 } | 1051 } |
| 1082 | 1052 |
| 1083 | 1053 |
| 1084 bool HeapObject::IsMarked() { | |
| 1085 return map_word().IsMarked(); | |
| 1086 } | |
| 1087 | |
| 1088 | |
| 1089 void HeapObject::SetMark() { | |
| 1090 ASSERT(!IsMarked()); | |
| 1091 MapWord first_word = map_word(); | |
| 1092 first_word.SetMark(); | |
| 1093 set_map_word(first_word); | |
| 1094 } | |
| 1095 | |
| 1096 | |
| 1097 void HeapObject::ClearMark() { | |
| 1098 ASSERT(IsMarked()); | |
| 1099 MapWord first_word = map_word(); | |
| 1100 first_word.ClearMark(); | |
| 1101 set_map_word(first_word); | |
| 1102 } | |
| 1103 | |
| 1104 | |
| 1105 bool HeapObject::IsOverflowed() { | |
| 1106 return map_word().IsOverflowed(); | |
| 1107 } | |
| 1108 | |
| 1109 | |
| 1110 void HeapObject::SetOverflow() { | |
| 1111 MapWord first_word = map_word(); | |
| 1112 first_word.SetOverflow(); | |
| 1113 set_map_word(first_word); | |
| 1114 } | |
| 1115 | |
| 1116 | |
| 1117 void HeapObject::ClearOverflow() { | |
| 1118 ASSERT(IsOverflowed()); | |
| 1119 MapWord first_word = map_word(); | |
| 1120 first_word.ClearOverflow(); | |
| 1121 set_map_word(first_word); | |
| 1122 } | |
| 1123 | |
| 1124 | |
| 1125 double HeapNumber::value() { | 1054 double HeapNumber::value() { |
| 1126 return READ_DOUBLE_FIELD(this, kValueOffset); | 1055 return READ_DOUBLE_FIELD(this, kValueOffset); |
| 1127 } | 1056 } |
| 1128 | 1057 |
| 1129 | 1058 |
| 1130 void HeapNumber::set_value(double value) { | 1059 void HeapNumber::set_value(double value) { |
| 1131 WRITE_DOUBLE_FIELD(this, kValueOffset, value); | 1060 WRITE_DOUBLE_FIELD(this, kValueOffset, value); |
| 1132 } | 1061 } |
| 1133 | 1062 |
| 1134 | 1063 |
| (...skipping 2659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3794 #undef WRITE_INT_FIELD | 3723 #undef WRITE_INT_FIELD |
| 3795 #undef READ_SHORT_FIELD | 3724 #undef READ_SHORT_FIELD |
| 3796 #undef WRITE_SHORT_FIELD | 3725 #undef WRITE_SHORT_FIELD |
| 3797 #undef READ_BYTE_FIELD | 3726 #undef READ_BYTE_FIELD |
| 3798 #undef WRITE_BYTE_FIELD | 3727 #undef WRITE_BYTE_FIELD |
| 3799 | 3728 |
| 3800 | 3729 |
| 3801 } } // namespace v8::internal | 3730 } } // namespace v8::internal |
| 3802 | 3731 |
| 3803 #endif // V8_OBJECTS_INL_H_ | 3732 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |