OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 20 matching lines...) Expand all Loading... |
31 #include "allocation.h" | 31 #include "allocation.h" |
32 #include "builtins.h" | 32 #include "builtins.h" |
33 #include "list.h" | 33 #include "list.h" |
34 #include "smart-array-pointer.h" | 34 #include "smart-array-pointer.h" |
35 #include "unicode-inl.h" | 35 #include "unicode-inl.h" |
36 #if V8_TARGET_ARCH_ARM | 36 #if V8_TARGET_ARCH_ARM |
37 #include "arm/constants-arm.h" | 37 #include "arm/constants-arm.h" |
38 #elif V8_TARGET_ARCH_MIPS | 38 #elif V8_TARGET_ARCH_MIPS |
39 #include "mips/constants-mips.h" | 39 #include "mips/constants-mips.h" |
40 #endif | 40 #endif |
| 41 #include "v8checks.h" |
41 | 42 |
42 // | 43 // |
43 // Most object types in the V8 JavaScript are described in this file. | 44 // Most object types in the V8 JavaScript are described in this file. |
44 // | 45 // |
45 // Inheritance hierarchy: | 46 // Inheritance hierarchy: |
46 // - MaybeObject (an object or a failure) | 47 // - MaybeObject (an object or a failure) |
47 // - Failure (immediate for marking failed operation) | 48 // - Failure (immediate for marking failed operation) |
48 // - Object | 49 // - Object |
49 // - Smi (immediate small integer) | 50 // - Smi (immediate small integer) |
50 // - HeapObject (superclass for everything allocated in the heap) | 51 // - HeapObject (superclass for everything allocated in the heap) |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 V(PRIVATE_EXTERNAL_ASCII_STRING_TYPE) \ | 323 V(PRIVATE_EXTERNAL_ASCII_STRING_TYPE) \ |
323 \ | 324 \ |
324 V(MAP_TYPE) \ | 325 V(MAP_TYPE) \ |
325 V(CODE_TYPE) \ | 326 V(CODE_TYPE) \ |
326 V(ODDBALL_TYPE) \ | 327 V(ODDBALL_TYPE) \ |
327 V(JS_GLOBAL_PROPERTY_CELL_TYPE) \ | 328 V(JS_GLOBAL_PROPERTY_CELL_TYPE) \ |
328 \ | 329 \ |
329 V(HEAP_NUMBER_TYPE) \ | 330 V(HEAP_NUMBER_TYPE) \ |
330 V(FOREIGN_TYPE) \ | 331 V(FOREIGN_TYPE) \ |
331 V(BYTE_ARRAY_TYPE) \ | 332 V(BYTE_ARRAY_TYPE) \ |
| 333 V(FREE_SPACE_TYPE) \ |
332 /* Note: the order of these external array */ \ | 334 /* Note: the order of these external array */ \ |
333 /* types is relied upon in */ \ | 335 /* types is relied upon in */ \ |
334 /* Object::IsExternalArray(). */ \ | 336 /* Object::IsExternalArray(). */ \ |
335 V(EXTERNAL_BYTE_ARRAY_TYPE) \ | 337 V(EXTERNAL_BYTE_ARRAY_TYPE) \ |
336 V(EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE) \ | 338 V(EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE) \ |
337 V(EXTERNAL_SHORT_ARRAY_TYPE) \ | 339 V(EXTERNAL_SHORT_ARRAY_TYPE) \ |
338 V(EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE) \ | 340 V(EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE) \ |
339 V(EXTERNAL_INT_ARRAY_TYPE) \ | 341 V(EXTERNAL_INT_ARRAY_TYPE) \ |
340 V(EXTERNAL_UNSIGNED_INT_ARRAY_TYPE) \ | 342 V(EXTERNAL_UNSIGNED_INT_ARRAY_TYPE) \ |
341 V(EXTERNAL_FLOAT_ARRAY_TYPE) \ | 343 V(EXTERNAL_FLOAT_ARRAY_TYPE) \ |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 MAP_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE | 580 MAP_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE |
579 CODE_TYPE, | 581 CODE_TYPE, |
580 ODDBALL_TYPE, | 582 ODDBALL_TYPE, |
581 JS_GLOBAL_PROPERTY_CELL_TYPE, | 583 JS_GLOBAL_PROPERTY_CELL_TYPE, |
582 | 584 |
583 // "Data", objects that cannot contain non-map-word pointers to heap | 585 // "Data", objects that cannot contain non-map-word pointers to heap |
584 // objects. | 586 // objects. |
585 HEAP_NUMBER_TYPE, | 587 HEAP_NUMBER_TYPE, |
586 FOREIGN_TYPE, | 588 FOREIGN_TYPE, |
587 BYTE_ARRAY_TYPE, | 589 BYTE_ARRAY_TYPE, |
| 590 FREE_SPACE_TYPE, |
588 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE | 591 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE |
589 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE, | 592 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE, |
590 EXTERNAL_SHORT_ARRAY_TYPE, | 593 EXTERNAL_SHORT_ARRAY_TYPE, |
591 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE, | 594 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE, |
592 EXTERNAL_INT_ARRAY_TYPE, | 595 EXTERNAL_INT_ARRAY_TYPE, |
593 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE, | 596 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE, |
594 EXTERNAL_FLOAT_ARRAY_TYPE, | 597 EXTERNAL_FLOAT_ARRAY_TYPE, |
595 EXTERNAL_DOUBLE_ARRAY_TYPE, | 598 EXTERNAL_DOUBLE_ARRAY_TYPE, |
596 EXTERNAL_PIXEL_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE | 599 EXTERNAL_PIXEL_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE |
597 FIXED_DOUBLE_ARRAY_TYPE, | 600 FIXED_DOUBLE_ARRAY_TYPE, |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 inline type* name(); \ | 693 inline type* name(); \ |
691 inline void set_##name(type* value, \ | 694 inline void set_##name(type* value, \ |
692 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \ | 695 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \ |
693 | 696 |
694 | 697 |
695 class DictionaryElementsAccessor; | 698 class DictionaryElementsAccessor; |
696 class ElementsAccessor; | 699 class ElementsAccessor; |
697 class FixedArrayBase; | 700 class FixedArrayBase; |
698 class ObjectVisitor; | 701 class ObjectVisitor; |
699 class StringStream; | 702 class StringStream; |
| 703 class Failure; |
700 | 704 |
701 struct ValueInfo : public Malloced { | 705 struct ValueInfo : public Malloced { |
702 ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { } | 706 ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { } |
703 InstanceType type; | 707 InstanceType type; |
704 Object* ptr; | 708 Object* ptr; |
705 const char* str; | 709 const char* str; |
706 double number; | 710 double number; |
707 }; | 711 }; |
708 | 712 |
709 | 713 |
710 // A template-ized version of the IsXXX functions. | 714 // A template-ized version of the IsXXX functions. |
711 template <class C> static inline bool Is(Object* obj); | 715 template <class C> static inline bool Is(Object* obj); |
712 | 716 |
713 class Failure; | |
714 | 717 |
715 class MaybeObject BASE_EMBEDDED { | 718 class MaybeObject BASE_EMBEDDED { |
716 public: | 719 public: |
717 inline bool IsFailure(); | 720 inline bool IsFailure(); |
718 inline bool IsRetryAfterGC(); | 721 inline bool IsRetryAfterGC(); |
719 inline bool IsOutOfMemory(); | 722 inline bool IsOutOfMemory(); |
720 inline bool IsException(); | 723 inline bool IsException(); |
721 INLINE(bool IsTheHole()); | 724 INLINE(bool IsTheHole()); |
722 inline bool ToObject(Object** obj) { | 725 inline bool ToObject(Object** obj) { |
723 if (IsFailure()) return false; | 726 if (IsFailure()) return false; |
(...skipping 17 matching lines...) Expand all Loading... |
741 inline bool To(T** obj) { | 744 inline bool To(T** obj) { |
742 if (IsFailure()) return false; | 745 if (IsFailure()) return false; |
743 *obj = T::cast(reinterpret_cast<Object*>(this)); | 746 *obj = T::cast(reinterpret_cast<Object*>(this)); |
744 return true; | 747 return true; |
745 } | 748 } |
746 | 749 |
747 #ifdef OBJECT_PRINT | 750 #ifdef OBJECT_PRINT |
748 // Prints this object with details. | 751 // Prints this object with details. |
749 inline void Print() { | 752 inline void Print() { |
750 Print(stdout); | 753 Print(stdout); |
751 }; | 754 } |
752 inline void PrintLn() { | 755 inline void PrintLn() { |
753 PrintLn(stdout); | 756 PrintLn(stdout); |
754 } | 757 } |
755 void Print(FILE* out); | 758 void Print(FILE* out); |
756 void PrintLn(FILE* out); | 759 void PrintLn(FILE* out); |
757 #endif | 760 #endif |
758 #ifdef DEBUG | 761 #ifdef DEBUG |
759 // Verifies the object. | 762 // Verifies the object. |
760 void Verify(); | 763 void Verify(); |
761 #endif | 764 #endif |
(...skipping 22 matching lines...) Expand all Loading... |
784 V(ExternalByteArray) \ | 787 V(ExternalByteArray) \ |
785 V(ExternalUnsignedByteArray) \ | 788 V(ExternalUnsignedByteArray) \ |
786 V(ExternalShortArray) \ | 789 V(ExternalShortArray) \ |
787 V(ExternalUnsignedShortArray) \ | 790 V(ExternalUnsignedShortArray) \ |
788 V(ExternalIntArray) \ | 791 V(ExternalIntArray) \ |
789 V(ExternalUnsignedIntArray) \ | 792 V(ExternalUnsignedIntArray) \ |
790 V(ExternalFloatArray) \ | 793 V(ExternalFloatArray) \ |
791 V(ExternalDoubleArray) \ | 794 V(ExternalDoubleArray) \ |
792 V(ExternalPixelArray) \ | 795 V(ExternalPixelArray) \ |
793 V(ByteArray) \ | 796 V(ByteArray) \ |
| 797 V(FreeSpace) \ |
794 V(JSReceiver) \ | 798 V(JSReceiver) \ |
795 V(JSObject) \ | 799 V(JSObject) \ |
796 V(JSContextExtensionObject) \ | 800 V(JSContextExtensionObject) \ |
797 V(Map) \ | 801 V(Map) \ |
798 V(DescriptorArray) \ | 802 V(DescriptorArray) \ |
799 V(DeoptimizationInputData) \ | 803 V(DeoptimizationInputData) \ |
800 V(DeoptimizationOutputData) \ | 804 V(DeoptimizationOutputData) \ |
801 V(FixedArray) \ | 805 V(FixedArray) \ |
802 V(FixedDoubleArray) \ | 806 V(FixedDoubleArray) \ |
803 V(Context) \ | 807 V(Context) \ |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 | 864 |
861 INLINE(bool IsSpecObject()); | 865 INLINE(bool IsSpecObject()); |
862 | 866 |
863 // Oddball testing. | 867 // Oddball testing. |
864 INLINE(bool IsUndefined()); | 868 INLINE(bool IsUndefined()); |
865 INLINE(bool IsNull()); | 869 INLINE(bool IsNull()); |
866 INLINE(bool IsTheHole()); // Shadows MaybeObject's implementation. | 870 INLINE(bool IsTheHole()); // Shadows MaybeObject's implementation. |
867 INLINE(bool IsTrue()); | 871 INLINE(bool IsTrue()); |
868 INLINE(bool IsFalse()); | 872 INLINE(bool IsFalse()); |
869 inline bool IsArgumentsMarker(); | 873 inline bool IsArgumentsMarker(); |
| 874 inline bool NonFailureIsHeapObject(); |
| 875 |
| 876 // Filler objects (fillers and free space objects). |
| 877 inline bool IsFiller(); |
870 | 878 |
871 // Extract the number. | 879 // Extract the number. |
872 inline double Number(); | 880 inline double Number(); |
873 | 881 |
874 // Returns true if the object is of the correct type to be used as a | 882 // Returns true if the object is of the correct type to be used as a |
875 // implementation of a JSObject's elements. | 883 // implementation of a JSObject's elements. |
876 inline bool HasValidElements(); | 884 inline bool HasValidElements(); |
877 | 885 |
878 inline bool HasSpecificClassOf(String* name); | 886 inline bool HasSpecificClassOf(String* name); |
879 | 887 |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1085 // collection. Only valid during a scavenge collection (specifically, | 1093 // collection. Only valid during a scavenge collection (specifically, |
1086 // when all map words are heap object pointers, ie. not during a full GC). | 1094 // when all map words are heap object pointers, ie. not during a full GC). |
1087 inline bool IsForwardingAddress(); | 1095 inline bool IsForwardingAddress(); |
1088 | 1096 |
1089 // Create a map word from a forwarding address. | 1097 // Create a map word from a forwarding address. |
1090 static inline MapWord FromForwardingAddress(HeapObject* object); | 1098 static inline MapWord FromForwardingAddress(HeapObject* object); |
1091 | 1099 |
1092 // View this map word as a forwarding address. | 1100 // View this map word as a forwarding address. |
1093 inline HeapObject* ToForwardingAddress(); | 1101 inline HeapObject* ToForwardingAddress(); |
1094 | 1102 |
1095 // Marking phase of full collection: the map word of live objects is | 1103 static inline MapWord FromRawValue(uintptr_t value) { |
1096 // marked, and may be marked as overflowed (eg, the object is live, its | 1104 return MapWord(value); |
1097 // children have not been visited, and it does not fit in the marking | 1105 } |
1098 // stack). | |
1099 | 1106 |
1100 // True if this map word's mark bit is set. | 1107 inline uintptr_t ToRawValue() { |
1101 inline bool IsMarked(); | 1108 return value_; |
1102 | 1109 } |
1103 // Return this map word but with its mark bit set. | |
1104 inline void SetMark(); | |
1105 | |
1106 // Return this map word but with its mark bit cleared. | |
1107 inline void ClearMark(); | |
1108 | |
1109 // True if this map word's overflow bit is set. | |
1110 inline bool IsOverflowed(); | |
1111 | |
1112 // Return this map word but with its overflow bit set. | |
1113 inline void SetOverflow(); | |
1114 | |
1115 // Return this map word but with its overflow bit cleared. | |
1116 inline void ClearOverflow(); | |
1117 | |
1118 | |
1119 // Compacting phase of a full compacting collection: the map word of live | |
1120 // objects contains an encoding of the original map address along with the | |
1121 // forwarding address (represented as an offset from the first live object | |
1122 // in the same page as the (old) object address). | |
1123 | |
1124 // Create a map word from a map address and a forwarding address offset. | |
1125 static inline MapWord EncodeAddress(Address map_address, int offset); | |
1126 | |
1127 // Return the map address encoded in this map word. | |
1128 inline Address DecodeMapAddress(MapSpace* map_space); | |
1129 | |
1130 // Return the forwarding offset encoded in this map word. | |
1131 inline int DecodeOffset(); | |
1132 | |
1133 | |
1134 // During serialization: the map word is used to hold an encoded | |
1135 // address, and possibly a mark bit (set and cleared with SetMark | |
1136 // and ClearMark). | |
1137 | |
1138 // Create a map word from an encoded address. | |
1139 static inline MapWord FromEncodedAddress(Address address); | |
1140 | |
1141 inline Address ToEncodedAddress(); | |
1142 | |
1143 // Bits used by the marking phase of the garbage collector. | |
1144 // | |
1145 // The first word of a heap object is normally a map pointer. The last two | |
1146 // bits are tagged as '01' (kHeapObjectTag). We reuse the last two bits to | |
1147 // mark an object as live and/or overflowed: | |
1148 // last bit = 0, marked as alive | |
1149 // second bit = 1, overflowed | |
1150 // An object is only marked as overflowed when it is marked as live while | |
1151 // the marking stack is overflowed. | |
1152 static const int kMarkingBit = 0; // marking bit | |
1153 static const int kMarkingMask = (1 << kMarkingBit); // marking mask | |
1154 static const int kOverflowBit = 1; // overflow bit | |
1155 static const int kOverflowMask = (1 << kOverflowBit); // overflow mask | |
1156 | |
1157 // Forwarding pointers and map pointer encoding. On 32 bit all the bits are | |
1158 // used. | |
1159 // +-----------------+------------------+-----------------+ | |
1160 // |forwarding offset|page offset of map|page index of map| | |
1161 // +-----------------+------------------+-----------------+ | |
1162 // ^ ^ ^ | |
1163 // | | | | |
1164 // | | kMapPageIndexBits | |
1165 // | kMapPageOffsetBits | |
1166 // kForwardingOffsetBits | |
1167 static const int kMapPageOffsetBits = kPageSizeBits - kMapAlignmentBits; | |
1168 static const int kForwardingOffsetBits = kPageSizeBits - kObjectAlignmentBits; | |
1169 #ifdef V8_HOST_ARCH_64_BIT | |
1170 static const int kMapPageIndexBits = 16; | |
1171 #else | |
1172 // Use all the 32-bits to encode on a 32-bit platform. | |
1173 static const int kMapPageIndexBits = | |
1174 32 - (kMapPageOffsetBits + kForwardingOffsetBits); | |
1175 #endif | |
1176 | |
1177 static const int kMapPageIndexShift = 0; | |
1178 static const int kMapPageOffsetShift = | |
1179 kMapPageIndexShift + kMapPageIndexBits; | |
1180 static const int kForwardingOffsetShift = | |
1181 kMapPageOffsetShift + kMapPageOffsetBits; | |
1182 | |
1183 // Bit masks covering the different parts the encoding. | |
1184 static const uintptr_t kMapPageIndexMask = | |
1185 (1 << kMapPageOffsetShift) - 1; | |
1186 static const uintptr_t kMapPageOffsetMask = | |
1187 ((1 << kForwardingOffsetShift) - 1) & ~kMapPageIndexMask; | |
1188 static const uintptr_t kForwardingOffsetMask = | |
1189 ~(kMapPageIndexMask | kMapPageOffsetMask); | |
1190 | 1110 |
1191 private: | 1111 private: |
1192 // HeapObject calls the private constructor and directly reads the value. | 1112 // HeapObject calls the private constructor and directly reads the value. |
1193 friend class HeapObject; | 1113 friend class HeapObject; |
1194 | 1114 |
1195 explicit MapWord(uintptr_t value) : value_(value) {} | 1115 explicit MapWord(uintptr_t value) : value_(value) {} |
1196 | 1116 |
1197 uintptr_t value_; | 1117 uintptr_t value_; |
1198 }; | 1118 }; |
1199 | 1119 |
1200 | 1120 |
1201 // HeapObject is the superclass for all classes describing heap allocated | 1121 // HeapObject is the superclass for all classes describing heap allocated |
1202 // objects. | 1122 // objects. |
1203 class HeapObject: public Object { | 1123 class HeapObject: public Object { |
1204 public: | 1124 public: |
1205 // [map]: Contains a map which contains the object's reflective | 1125 // [map]: Contains a map which contains the object's reflective |
1206 // information. | 1126 // information. |
1207 inline Map* map(); | 1127 inline Map* map(); |
1208 inline void set_map(Map* value); | 1128 inline void set_map(Map* value); |
1209 | 1129 |
1210 // During garbage collection, the map word of a heap object does not | 1130 // During garbage collection, the map word of a heap object does not |
1211 // necessarily contain a map pointer. | 1131 // necessarily contain a map pointer. |
1212 inline MapWord map_word(); | 1132 inline MapWord map_word(); |
1213 inline void set_map_word(MapWord map_word); | 1133 inline void set_map_word(MapWord map_word); |
1214 | 1134 |
1215 // The Heap the object was allocated in. Used also to access Isolate. | 1135 // The Heap the object was allocated in. Used also to access Isolate. |
1216 // This method can not be used during GC, it ASSERTs this. | |
1217 inline Heap* GetHeap(); | 1136 inline Heap* GetHeap(); |
| 1137 |
1218 // Convenience method to get current isolate. This method can be | 1138 // Convenience method to get current isolate. This method can be |
1219 // accessed only when its result is the same as | 1139 // accessed only when its result is the same as |
1220 // Isolate::Current(), it ASSERTs this. See also comment for GetHeap. | 1140 // Isolate::Current(), it ASSERTs this. See also comment for GetHeap. |
1221 inline Isolate* GetIsolate(); | 1141 inline Isolate* GetIsolate(); |
1222 | 1142 |
1223 // Converts an address to a HeapObject pointer. | 1143 // Converts an address to a HeapObject pointer. |
1224 static inline HeapObject* FromAddress(Address address); | 1144 static inline HeapObject* FromAddress(Address address); |
1225 | 1145 |
1226 // Returns the address of this HeapObject. | 1146 // Returns the address of this HeapObject. |
1227 inline Address address(); | 1147 inline Address address(); |
1228 | 1148 |
1229 // Iterates over pointers contained in the object (including the Map) | 1149 // Iterates over pointers contained in the object (including the Map) |
1230 void Iterate(ObjectVisitor* v); | 1150 void Iterate(ObjectVisitor* v); |
1231 | 1151 |
1232 // Iterates over all pointers contained in the object except the | 1152 // Iterates over all pointers contained in the object except the |
1233 // first map pointer. The object type is given in the first | 1153 // first map pointer. The object type is given in the first |
1234 // parameter. This function does not access the map pointer in the | 1154 // parameter. This function does not access the map pointer in the |
1235 // object, and so is safe to call while the map pointer is modified. | 1155 // object, and so is safe to call while the map pointer is modified. |
1236 void IterateBody(InstanceType type, int object_size, ObjectVisitor* v); | 1156 void IterateBody(InstanceType type, int object_size, ObjectVisitor* v); |
1237 | 1157 |
1238 // Returns the heap object's size in bytes | 1158 // Returns the heap object's size in bytes |
1239 inline int Size(); | 1159 inline int Size(); |
1240 | 1160 |
1241 // Given a heap object's map pointer, returns the heap size in bytes | 1161 // Given a heap object's map pointer, returns the heap size in bytes |
1242 // Useful when the map pointer field is used for other purposes. | 1162 // Useful when the map pointer field is used for other purposes. |
1243 // GC internal. | 1163 // GC internal. |
1244 inline int SizeFromMap(Map* map); | 1164 inline int SizeFromMap(Map* map); |
1245 | 1165 |
1246 // Support for the marking heap objects during the marking phase of GC. | |
1247 // True if the object is marked live. | |
1248 inline bool IsMarked(); | |
1249 | |
1250 // Mutate this object's map pointer to indicate that the object is live. | |
1251 inline void SetMark(); | |
1252 | |
1253 // Mutate this object's map pointer to remove the indication that the | |
1254 // object is live (ie, partially restore the map pointer). | |
1255 inline void ClearMark(); | |
1256 | |
1257 // True if this object is marked as overflowed. Overflowed objects have | |
1258 // been reached and marked during marking of the heap, but their children | |
1259 // have not necessarily been marked and they have not been pushed on the | |
1260 // marking stack. | |
1261 inline bool IsOverflowed(); | |
1262 | |
1263 // Mutate this object's map pointer to indicate that the object is | |
1264 // overflowed. | |
1265 inline void SetOverflow(); | |
1266 | |
1267 // Mutate this object's map pointer to remove the indication that the | |
1268 // object is overflowed (ie, partially restore the map pointer). | |
1269 inline void ClearOverflow(); | |
1270 | |
1271 // Returns the field at offset in obj, as a read/write Object* reference. | 1166 // Returns the field at offset in obj, as a read/write Object* reference. |
1272 // Does no checking, and is safe to use during GC, while maps are invalid. | 1167 // Does no checking, and is safe to use during GC, while maps are invalid. |
1273 // Does not invoke write barrier, so should only be assigned to | 1168 // Does not invoke write barrier, so should only be assigned to |
1274 // during marking GC. | 1169 // during marking GC. |
1275 static inline Object** RawField(HeapObject* obj, int offset); | 1170 static inline Object** RawField(HeapObject* obj, int offset); |
1276 | 1171 |
1277 // Casting. | 1172 // Casting. |
1278 static inline HeapObject* cast(Object* obj); | 1173 static inline HeapObject* cast(Object* obj); |
1279 | 1174 |
1280 // Return the write barrier mode for this. Callers of this function | 1175 // Return the write barrier mode for this. Callers of this function |
1281 // must be able to present a reference to an AssertNoAllocation | 1176 // must be able to present a reference to an AssertNoAllocation |
1282 // object as a sign that they are not going to use this function | 1177 // object as a sign that they are not going to use this function |
1283 // from code that allocates and thus invalidates the returned write | 1178 // from code that allocates and thus invalidates the returned write |
1284 // barrier mode. | 1179 // barrier mode. |
1285 inline WriteBarrierMode GetWriteBarrierMode(const AssertNoAllocation&); | 1180 inline WriteBarrierMode GetWriteBarrierMode(const AssertNoAllocation&); |
1286 | 1181 |
1287 // Dispatched behavior. | 1182 // Dispatched behavior. |
1288 void HeapObjectShortPrint(StringStream* accumulator); | 1183 void HeapObjectShortPrint(StringStream* accumulator); |
1289 #ifdef OBJECT_PRINT | 1184 #ifdef OBJECT_PRINT |
1290 inline void HeapObjectPrint() { | 1185 inline void HeapObjectPrint() { |
1291 HeapObjectPrint(stdout); | 1186 HeapObjectPrint(stdout); |
1292 } | 1187 } |
1293 void HeapObjectPrint(FILE* out); | 1188 void HeapObjectPrint(FILE* out); |
| 1189 void PrintHeader(FILE* out, const char* id); |
1294 #endif | 1190 #endif |
| 1191 |
1295 #ifdef DEBUG | 1192 #ifdef DEBUG |
1296 void HeapObjectVerify(); | 1193 void HeapObjectVerify(); |
1297 inline void VerifyObjectField(int offset); | 1194 inline void VerifyObjectField(int offset); |
1298 inline void VerifySmiField(int offset); | 1195 inline void VerifySmiField(int offset); |
1299 #endif | |
1300 | 1196 |
1301 #ifdef OBJECT_PRINT | |
1302 void PrintHeader(FILE* out, const char* id); | |
1303 #endif | |
1304 | |
1305 #ifdef DEBUG | |
1306 // Verify a pointer is a valid HeapObject pointer that points to object | 1197 // Verify a pointer is a valid HeapObject pointer that points to object |
1307 // areas in the heap. | 1198 // areas in the heap. |
1308 static void VerifyHeapPointer(Object* p); | 1199 static void VerifyHeapPointer(Object* p); |
1309 #endif | 1200 #endif |
1310 | 1201 |
1311 // Layout description. | 1202 // Layout description. |
1312 // First field in a heap object is map. | 1203 // First field in a heap object is map. |
1313 static const int kMapOffset = Object::kHeaderSize; | 1204 static const int kMapOffset = Object::kHeaderSize; |
1314 static const int kHeaderSize = kMapOffset + kPointerSize; | 1205 static const int kHeaderSize = kMapOffset + kPointerSize; |
1315 | 1206 |
(...skipping 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3071 | 2962 |
3072 // Casting | 2963 // Casting |
3073 static inline NormalizedMapCache* cast(Object* obj); | 2964 static inline NormalizedMapCache* cast(Object* obj); |
3074 | 2965 |
3075 #ifdef DEBUG | 2966 #ifdef DEBUG |
3076 void NormalizedMapCacheVerify(); | 2967 void NormalizedMapCacheVerify(); |
3077 #endif | 2968 #endif |
3078 }; | 2969 }; |
3079 | 2970 |
3080 | 2971 |
3081 // ByteArray represents fixed sized byte arrays. Used by the outside world, | 2972 // ByteArray represents fixed sized byte arrays. Used for the relocation info |
3082 // such as PCRE, and also by the memory allocator and garbage collector to | 2973 // that is attached to code objects. |
3083 // fill in free blocks in the heap. | |
3084 class ByteArray: public FixedArrayBase { | 2974 class ByteArray: public FixedArrayBase { |
3085 public: | 2975 public: |
| 2976 inline int Size() { return RoundUp(length() + kHeaderSize, kPointerSize); } |
| 2977 |
3086 // Setter and getter. | 2978 // Setter and getter. |
3087 inline byte get(int index); | 2979 inline byte get(int index); |
3088 inline void set(int index, byte value); | 2980 inline void set(int index, byte value); |
3089 | 2981 |
3090 // Treat contents as an int array. | 2982 // Treat contents as an int array. |
3091 inline int get_int(int index); | 2983 inline int get_int(int index); |
3092 | 2984 |
3093 static int SizeFor(int length) { | 2985 static int SizeFor(int length) { |
3094 return OBJECT_POINTER_ALIGN(kHeaderSize + length); | 2986 return OBJECT_POINTER_ALIGN(kHeaderSize + length); |
3095 } | 2987 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3132 // Maximal memory consumption for a single ByteArray. | 3024 // Maximal memory consumption for a single ByteArray. |
3133 static const int kMaxSize = 512 * MB; | 3025 static const int kMaxSize = 512 * MB; |
3134 // Maximal length of a single ByteArray. | 3026 // Maximal length of a single ByteArray. |
3135 static const int kMaxLength = kMaxSize - kHeaderSize; | 3027 static const int kMaxLength = kMaxSize - kHeaderSize; |
3136 | 3028 |
3137 private: | 3029 private: |
3138 DISALLOW_IMPLICIT_CONSTRUCTORS(ByteArray); | 3030 DISALLOW_IMPLICIT_CONSTRUCTORS(ByteArray); |
3139 }; | 3031 }; |
3140 | 3032 |
3141 | 3033 |
| 3034 // FreeSpace represents fixed sized areas of the heap that are not currently in |
| 3035 // use. Used by the heap and GC. |
| 3036 class FreeSpace: public HeapObject { |
| 3037 public: |
| 3038 // [size]: size of the free space including the header. |
| 3039 inline int size(); |
| 3040 inline void set_size(int value); |
| 3041 |
| 3042 inline int Size() { return size(); } |
| 3043 |
| 3044 // Casting. |
| 3045 static inline FreeSpace* cast(Object* obj); |
| 3046 |
| 3047 #ifdef OBJECT_PRINT |
| 3048 inline void FreeSpacePrint() { |
| 3049 FreeSpacePrint(stdout); |
| 3050 } |
| 3051 void FreeSpacePrint(FILE* out); |
| 3052 #endif |
| 3053 #ifdef DEBUG |
| 3054 void FreeSpaceVerify(); |
| 3055 #endif |
| 3056 |
| 3057 // Layout description. |
| 3058 // Size is smi tagged when it is stored. |
| 3059 static const int kSizeOffset = HeapObject::kHeaderSize; |
| 3060 static const int kHeaderSize = kSizeOffset + kPointerSize; |
| 3061 |
| 3062 static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize); |
| 3063 |
| 3064 // Maximal size of a single FreeSpace. |
| 3065 static const int kMaxSize = 512 * MB; |
| 3066 |
| 3067 private: |
| 3068 DISALLOW_IMPLICIT_CONSTRUCTORS(FreeSpace); |
| 3069 }; |
| 3070 |
| 3071 |
3142 // An ExternalArray represents a fixed-size array of primitive values | 3072 // An ExternalArray represents a fixed-size array of primitive values |
3143 // which live outside the JavaScript heap. Its subclasses are used to | 3073 // which live outside the JavaScript heap. Its subclasses are used to |
3144 // implement the CanvasArray types being defined in the WebGL | 3074 // implement the CanvasArray types being defined in the WebGL |
3145 // specification. As of this writing the first public draft is not yet | 3075 // specification. As of this writing the first public draft is not yet |
3146 // available, but Khronos members can access the draft at: | 3076 // available, but Khronos members can access the draft at: |
3147 // https://cvs.khronos.org/svn/repos/3dweb/trunk/doc/spec/WebGL-spec.html | 3077 // https://cvs.khronos.org/svn/repos/3dweb/trunk/doc/spec/WebGL-spec.html |
3148 // | 3078 // |
3149 // The semantics of these arrays differ from CanvasPixelArray. | 3079 // The semantics of these arrays differ from CanvasPixelArray. |
3150 // Out-of-range values passed to the setter are converted via a C | 3080 // Out-of-range values passed to the setter are converted via a C |
3151 // cast, not clamping. Out-of-range indices cause exceptions to be | 3081 // cast, not clamping. Out-of-range indices cause exceptions to be |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3828 #ifdef OBJECT_PRINT | 3758 #ifdef OBJECT_PRINT |
3829 inline void CodePrint() { | 3759 inline void CodePrint() { |
3830 CodePrint(stdout); | 3760 CodePrint(stdout); |
3831 } | 3761 } |
3832 void CodePrint(FILE* out); | 3762 void CodePrint(FILE* out); |
3833 #endif | 3763 #endif |
3834 #ifdef DEBUG | 3764 #ifdef DEBUG |
3835 void CodeVerify(); | 3765 void CodeVerify(); |
3836 #endif | 3766 #endif |
3837 | 3767 |
3838 // Returns the isolate/heap this code object belongs to. | |
3839 inline Isolate* isolate(); | |
3840 inline Heap* heap(); | |
3841 | |
3842 // Max loop nesting marker used to postpose OSR. We don't take loop | 3768 // Max loop nesting marker used to postpose OSR. We don't take loop |
3843 // nesting that is deeper than 5 levels into account. | 3769 // nesting that is deeper than 5 levels into account. |
3844 static const int kMaxLoopNestingMarker = 6; | 3770 static const int kMaxLoopNestingMarker = 6; |
3845 | 3771 |
3846 // Layout description. | 3772 // Layout description. |
3847 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; | 3773 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; |
3848 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize; | 3774 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize; |
3849 static const int kDeoptimizationDataOffset = | 3775 static const int kDeoptimizationDataOffset = |
3850 kRelocationInfoOffset + kPointerSize; | 3776 kRelocationInfoOffset + kPointerSize; |
3851 static const int kNextCodeFlushingCandidateOffset = | 3777 static const int kNextCodeFlushingCandidateOffset = |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4092 DECL_ACCESSORS(code_cache, Object) | 4018 DECL_ACCESSORS(code_cache, Object) |
4093 | 4019 |
4094 // [prototype transitions]: cache of prototype transitions. | 4020 // [prototype transitions]: cache of prototype transitions. |
4095 // Prototype transition is a transition that happens | 4021 // Prototype transition is a transition that happens |
4096 // when we change object's prototype to a new one. | 4022 // when we change object's prototype to a new one. |
4097 // Cache format: | 4023 // Cache format: |
4098 // 0: finger - index of the first free cell in the cache | 4024 // 0: finger - index of the first free cell in the cache |
4099 // 1 + 2 * i: prototype | 4025 // 1 + 2 * i: prototype |
4100 // 2 + 2 * i: target map | 4026 // 2 + 2 * i: target map |
4101 DECL_ACCESSORS(prototype_transitions, FixedArray) | 4027 DECL_ACCESSORS(prototype_transitions, FixedArray) |
| 4028 |
4102 inline FixedArray* unchecked_prototype_transitions(); | 4029 inline FixedArray* unchecked_prototype_transitions(); |
4103 | 4030 |
4104 static const int kProtoTransitionHeaderSize = 1; | 4031 static const int kProtoTransitionHeaderSize = 1; |
4105 static const int kProtoTransitionNumberOfEntriesOffset = 0; | 4032 static const int kProtoTransitionNumberOfEntriesOffset = 0; |
4106 static const int kProtoTransitionElementsPerEntry = 2; | 4033 static const int kProtoTransitionElementsPerEntry = 2; |
4107 static const int kProtoTransitionPrototypeOffset = 0; | 4034 static const int kProtoTransitionPrototypeOffset = 0; |
4108 static const int kProtoTransitionMapOffset = 1; | 4035 static const int kProtoTransitionMapOffset = 1; |
4109 | 4036 |
4110 inline int NumberOfProtoTransitions() { | 4037 inline int NumberOfProtoTransitions() { |
4111 FixedArray* cache = unchecked_prototype_transitions(); | 4038 FixedArray* cache = prototype_transitions(); |
4112 if (cache->length() == 0) return 0; | 4039 if (cache->length() == 0) return 0; |
4113 return | 4040 return |
4114 Smi::cast(cache->get(kProtoTransitionNumberOfEntriesOffset))->value(); | 4041 Smi::cast(cache->get(kProtoTransitionNumberOfEntriesOffset))->value(); |
4115 } | 4042 } |
4116 | 4043 |
4117 inline void SetNumberOfProtoTransitions(int value) { | 4044 inline void SetNumberOfProtoTransitions(int value) { |
4118 FixedArray* cache = unchecked_prototype_transitions(); | 4045 FixedArray* cache = prototype_transitions(); |
4119 ASSERT(cache->length() != 0); | 4046 ASSERT(cache->length() != 0); |
4120 cache->set_unchecked(kProtoTransitionNumberOfEntriesOffset, | 4047 cache->set_unchecked(kProtoTransitionNumberOfEntriesOffset, |
4121 Smi::FromInt(value)); | 4048 Smi::FromInt(value)); |
4122 } | 4049 } |
4123 | 4050 |
4124 // Lookup in the map's instance descriptors and fill out the result | 4051 // Lookup in the map's instance descriptors and fill out the result |
4125 // with the given holder if the name is found. The holder may be | 4052 // with the given holder if the name is found. The holder may be |
4126 // NULL when this function is used from the compiler. | 4053 // NULL when this function is used from the compiler. |
4127 void LookupInDescriptors(JSObject* holder, | 4054 void LookupInDescriptors(JSObject* holder, |
4128 String* name, | 4055 String* name, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4204 void MapPrint(FILE* out); | 4131 void MapPrint(FILE* out); |
4205 #endif | 4132 #endif |
4206 #ifdef DEBUG | 4133 #ifdef DEBUG |
4207 void MapVerify(); | 4134 void MapVerify(); |
4208 void SharedMapVerify(); | 4135 void SharedMapVerify(); |
4209 #endif | 4136 #endif |
4210 | 4137 |
4211 inline int visitor_id(); | 4138 inline int visitor_id(); |
4212 inline void set_visitor_id(int visitor_id); | 4139 inline void set_visitor_id(int visitor_id); |
4213 | 4140 |
4214 // Returns the isolate/heap this map belongs to. | |
4215 inline Isolate* isolate(); | |
4216 inline Heap* heap(); | |
4217 | |
4218 typedef void (*TraverseCallback)(Map* map, void* data); | 4141 typedef void (*TraverseCallback)(Map* map, void* data); |
4219 | 4142 |
4220 void TraverseTransitionTree(TraverseCallback callback, void* data); | 4143 void TraverseTransitionTree(TraverseCallback callback, void* data); |
4221 | 4144 |
4222 static const int kMaxCachedPrototypeTransitions = 256; | 4145 static const int kMaxCachedPrototypeTransitions = 256; |
4223 | 4146 |
4224 Object* GetPrototypeTransition(Object* prototype); | 4147 Object* GetPrototypeTransition(Object* prototype); |
4225 | 4148 |
4226 MaybeObject* PutPrototypeTransition(Object* prototype, Map* map); | 4149 MaybeObject* PutPrototypeTransition(Object* prototype, Map* map); |
4227 | 4150 |
(...skipping 16 matching lines...) Expand all Loading... |
4244 static const int kInstanceDescriptorsOrBitField3Offset = | 4167 static const int kInstanceDescriptorsOrBitField3Offset = |
4245 kConstructorOffset + kPointerSize; | 4168 kConstructorOffset + kPointerSize; |
4246 static const int kCodeCacheOffset = | 4169 static const int kCodeCacheOffset = |
4247 kInstanceDescriptorsOrBitField3Offset + kPointerSize; | 4170 kInstanceDescriptorsOrBitField3Offset + kPointerSize; |
4248 static const int kPrototypeTransitionsOffset = | 4171 static const int kPrototypeTransitionsOffset = |
4249 kCodeCacheOffset + kPointerSize; | 4172 kCodeCacheOffset + kPointerSize; |
4250 static const int kPadStart = kPrototypeTransitionsOffset + kPointerSize; | 4173 static const int kPadStart = kPrototypeTransitionsOffset + kPointerSize; |
4251 static const int kSize = MAP_POINTER_ALIGN(kPadStart); | 4174 static const int kSize = MAP_POINTER_ALIGN(kPadStart); |
4252 | 4175 |
4253 // Layout of pointer fields. Heap iteration code relies on them | 4176 // Layout of pointer fields. Heap iteration code relies on them |
4254 // being continiously allocated. | 4177 // being continuously allocated. |
4255 static const int kPointerFieldsBeginOffset = Map::kPrototypeOffset; | 4178 static const int kPointerFieldsBeginOffset = Map::kPrototypeOffset; |
4256 static const int kPointerFieldsEndOffset = | 4179 static const int kPointerFieldsEndOffset = |
4257 Map::kPrototypeTransitionsOffset + kPointerSize; | 4180 Map::kPrototypeTransitionsOffset + kPointerSize; |
4258 | 4181 |
4259 // Byte offsets within kInstanceSizesOffset. | 4182 // Byte offsets within kInstanceSizesOffset. |
4260 static const int kInstanceSizeOffset = kInstanceSizesOffset + 0; | 4183 static const int kInstanceSizeOffset = kInstanceSizesOffset + 0; |
4261 static const int kInObjectPropertiesByte = 1; | 4184 static const int kInObjectPropertiesByte = 1; |
4262 static const int kInObjectPropertiesOffset = | 4185 static const int kInObjectPropertiesOffset = |
4263 kInstanceSizesOffset + kInObjectPropertiesByte; | 4186 kInstanceSizesOffset + kInObjectPropertiesByte; |
4264 static const int kPreAllocatedPropertyFieldsByte = 2; | 4187 static const int kPreAllocatedPropertyFieldsByte = 2; |
(...skipping 1970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6235 // Computes the size for an AsciiString instance of a given length. | 6158 // Computes the size for an AsciiString instance of a given length. |
6236 static int SizeFor(int length) { | 6159 static int SizeFor(int length) { |
6237 return OBJECT_POINTER_ALIGN(kHeaderSize + length * kCharSize); | 6160 return OBJECT_POINTER_ALIGN(kHeaderSize + length * kCharSize); |
6238 } | 6161 } |
6239 | 6162 |
6240 // Layout description. | 6163 // Layout description. |
6241 static const int kHeaderSize = String::kSize; | 6164 static const int kHeaderSize = String::kSize; |
6242 static const int kAlignedSize = POINTER_SIZE_ALIGN(kHeaderSize); | 6165 static const int kAlignedSize = POINTER_SIZE_ALIGN(kHeaderSize); |
6243 | 6166 |
6244 // Maximal memory usage for a single sequential ASCII string. | 6167 // Maximal memory usage for a single sequential ASCII string. |
6245 static const int kMaxSize = 512 * MB; | 6168 static const int kMaxSize = 512 * MB - 1; |
6246 // Maximal length of a single sequential ASCII string. | 6169 // Maximal length of a single sequential ASCII string. |
6247 // Q.v. String::kMaxLength which is the maximal size of concatenated strings. | 6170 // Q.v. String::kMaxLength which is the maximal size of concatenated strings. |
6248 static const int kMaxLength = (kMaxSize - kHeaderSize); | 6171 static const int kMaxLength = (kMaxSize - kHeaderSize); |
6249 | 6172 |
6250 // Support for StringInputBuffer. | 6173 // Support for StringInputBuffer. |
6251 inline void SeqAsciiStringReadBlockIntoBuffer(ReadBlockBuffer* buffer, | 6174 inline void SeqAsciiStringReadBlockIntoBuffer(ReadBlockBuffer* buffer, |
6252 unsigned* offset, | 6175 unsigned* offset, |
6253 unsigned chars); | 6176 unsigned chars); |
6254 inline const unibrow::byte* SeqAsciiStringReadBlock(unsigned* remaining, | 6177 inline const unibrow::byte* SeqAsciiStringReadBlock(unsigned* remaining, |
6255 unsigned* offset, | 6178 unsigned* offset, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6289 // Computes the size for a TwoByteString instance of a given length. | 6212 // Computes the size for a TwoByteString instance of a given length. |
6290 static int SizeFor(int length) { | 6213 static int SizeFor(int length) { |
6291 return OBJECT_POINTER_ALIGN(kHeaderSize + length * kShortSize); | 6214 return OBJECT_POINTER_ALIGN(kHeaderSize + length * kShortSize); |
6292 } | 6215 } |
6293 | 6216 |
6294 // Layout description. | 6217 // Layout description. |
6295 static const int kHeaderSize = String::kSize; | 6218 static const int kHeaderSize = String::kSize; |
6296 static const int kAlignedSize = POINTER_SIZE_ALIGN(kHeaderSize); | 6219 static const int kAlignedSize = POINTER_SIZE_ALIGN(kHeaderSize); |
6297 | 6220 |
6298 // Maximal memory usage for a single sequential two-byte string. | 6221 // Maximal memory usage for a single sequential two-byte string. |
6299 static const int kMaxSize = 512 * MB; | 6222 static const int kMaxSize = 512 * MB - 1; |
6300 // Maximal length of a single sequential two-byte string. | 6223 // Maximal length of a single sequential two-byte string. |
6301 // Q.v. String::kMaxLength which is the maximal size of concatenated strings. | 6224 // Q.v. String::kMaxLength which is the maximal size of concatenated strings. |
6302 static const int kMaxLength = (kMaxSize - kHeaderSize) / sizeof(uint16_t); | 6225 static const int kMaxLength = (kMaxSize - kHeaderSize) / sizeof(uint16_t); |
6303 | 6226 |
6304 // Support for StringInputBuffer. | 6227 // Support for StringInputBuffer. |
6305 inline void SeqTwoByteStringReadBlockIntoBuffer(ReadBlockBuffer* buffer, | 6228 inline void SeqTwoByteStringReadBlockIntoBuffer(ReadBlockBuffer* buffer, |
6306 unsigned* offset_ptr, | 6229 unsigned* offset_ptr, |
6307 unsigned chars); | 6230 unsigned chars); |
6308 | 6231 |
6309 private: | 6232 private: |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6675 #endif | 6598 #endif |
6676 | 6599 |
6677 // Layout description. | 6600 // Layout description. |
6678 static const int kValueOffset = HeapObject::kHeaderSize; | 6601 static const int kValueOffset = HeapObject::kHeaderSize; |
6679 static const int kSize = kValueOffset + kPointerSize; | 6602 static const int kSize = kValueOffset + kPointerSize; |
6680 | 6603 |
6681 typedef FixedBodyDescriptor<kValueOffset, | 6604 typedef FixedBodyDescriptor<kValueOffset, |
6682 kValueOffset + kPointerSize, | 6605 kValueOffset + kPointerSize, |
6683 kSize> BodyDescriptor; | 6606 kSize> BodyDescriptor; |
6684 | 6607 |
6685 // Returns the isolate/heap this cell object belongs to. | |
6686 inline Isolate* isolate(); | |
6687 inline Heap* heap(); | |
6688 | |
6689 private: | 6608 private: |
6690 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalPropertyCell); | 6609 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalPropertyCell); |
6691 }; | 6610 }; |
6692 | 6611 |
6693 | 6612 |
6694 // The JSProxy describes EcmaScript Harmony proxies | 6613 // The JSProxy describes EcmaScript Harmony proxies |
6695 class JSProxy: public JSReceiver { | 6614 class JSProxy: public JSReceiver { |
6696 public: | 6615 public: |
6697 // [handler]: The handler property. | 6616 // [handler]: The handler property. |
6698 DECL_ACCESSORS(handler, Object) | 6617 DECL_ACCESSORS(handler, Object) |
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7474 } else { | 7393 } else { |
7475 value &= ~(1 << bit_position); | 7394 value &= ~(1 << bit_position); |
7476 } | 7395 } |
7477 return value; | 7396 return value; |
7478 } | 7397 } |
7479 }; | 7398 }; |
7480 | 7399 |
7481 } } // namespace v8::internal | 7400 } } // namespace v8::internal |
7482 | 7401 |
7483 #endif // V8_OBJECTS_H_ | 7402 #endif // V8_OBJECTS_H_ |
OLD | NEW |