| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 | 973 |
| 974 // During serialization: the map word is used to hold an encoded | 974 // During serialization: the map word is used to hold an encoded |
| 975 // address, and possibly a mark bit (set and cleared with SetMark | 975 // address, and possibly a mark bit (set and cleared with SetMark |
| 976 // and ClearMark). | 976 // and ClearMark). |
| 977 | 977 |
| 978 // Create a map word from an encoded address. | 978 // Create a map word from an encoded address. |
| 979 static inline MapWord FromEncodedAddress(Address address); | 979 static inline MapWord FromEncodedAddress(Address address); |
| 980 | 980 |
| 981 inline Address ToEncodedAddress(); | 981 inline Address ToEncodedAddress(); |
| 982 | 982 |
| 983 private: | |
| 984 // HeapObject calls the private constructor and directly reads the value. | |
| 985 friend class HeapObject; | |
| 986 | |
| 987 explicit MapWord(uintptr_t value) : value_(value) {} | |
| 988 | |
| 989 uintptr_t value_; | |
| 990 | |
| 991 // Bits used by the marking phase of the garbage collector. | 983 // Bits used by the marking phase of the garbage collector. |
| 992 // | 984 // |
| 993 // The first word of a heap object is normally a map pointer. The last two | 985 // The first word of a heap object is normally a map pointer. The last two |
| 994 // bits are tagged as '01' (kHeapObjectTag). We reuse the last two bits to | 986 // bits are tagged as '01' (kHeapObjectTag). We reuse the last two bits to |
| 995 // mark an object as live and/or overflowed: | 987 // mark an object as live and/or overflowed: |
| 996 // last bit = 0, marked as alive | 988 // last bit = 0, marked as alive |
| 997 // second bit = 1, overflowed | 989 // second bit = 1, overflowed |
| 998 // An object is only marked as overflowed when it is marked as live while | 990 // An object is only marked as overflowed when it is marked as live while |
| 999 // the marking stack is overflowed. | 991 // the marking stack is overflowed. |
| 1000 static const int kMarkingBit = 0; // marking bit | 992 static const int kMarkingBit = 0; // marking bit |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1022 static const uint32_t kMapPageIndexMask = | 1014 static const uint32_t kMapPageIndexMask = |
| 1023 (1 << kMapPageOffsetShift) - 1; | 1015 (1 << kMapPageOffsetShift) - 1; |
| 1024 | 1016 |
| 1025 // 0x001FFC00 | 1017 // 0x001FFC00 |
| 1026 static const uint32_t kMapPageOffsetMask = | 1018 static const uint32_t kMapPageOffsetMask = |
| 1027 ((1 << kForwardingOffsetShift) - 1) & ~kMapPageIndexMask; | 1019 ((1 << kForwardingOffsetShift) - 1) & ~kMapPageIndexMask; |
| 1028 | 1020 |
| 1029 // 0xFFE00000 | 1021 // 0xFFE00000 |
| 1030 static const uint32_t kForwardingOffsetMask = | 1022 static const uint32_t kForwardingOffsetMask = |
| 1031 ~(kMapPageIndexMask | kMapPageOffsetMask); | 1023 ~(kMapPageIndexMask | kMapPageOffsetMask); |
| 1024 |
| 1025 private: |
| 1026 // HeapObject calls the private constructor and directly reads the value. |
| 1027 friend class HeapObject; |
| 1028 |
| 1029 explicit MapWord(uintptr_t value) : value_(value) {} |
| 1030 |
| 1031 uintptr_t value_; |
| 1032 }; | 1032 }; |
| 1033 | 1033 |
| 1034 | 1034 |
| 1035 // HeapObject is the superclass for all classes describing heap allocated | 1035 // HeapObject is the superclass for all classes describing heap allocated |
| 1036 // objects. | 1036 // objects. |
| 1037 class HeapObject: public Object { | 1037 class HeapObject: public Object { |
| 1038 public: | 1038 public: |
| 1039 // [map]: Contains a map which contains the object's reflective | 1039 // [map]: Contains a map which contains the object's reflective |
| 1040 // information. | 1040 // information. |
| 1041 inline Map* map(); | 1041 inline Map* map(); |
| (...skipping 3473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4515 } else { | 4515 } else { |
| 4516 value &= ~(1 << bit_position); | 4516 value &= ~(1 << bit_position); |
| 4517 } | 4517 } |
| 4518 return value; | 4518 return value; |
| 4519 } | 4519 } |
| 4520 }; | 4520 }; |
| 4521 | 4521 |
| 4522 } } // namespace v8::internal | 4522 } } // namespace v8::internal |
| 4523 | 4523 |
| 4524 #endif // V8_OBJECTS_H_ | 4524 #endif // V8_OBJECTS_H_ |
| OLD | NEW |