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 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 // - JSGlobalObject | 66 // - JSGlobalObject |
67 // - JSBuiltinsObject | 67 // - JSBuiltinsObject |
68 // - JSGlobalProxy | 68 // - JSGlobalProxy |
69 // - JSValue | 69 // - JSValue |
70 // - JSDate | 70 // - JSDate |
71 // - JSMessageObject | 71 // - JSMessageObject |
72 // - JSProxy | 72 // - JSProxy |
73 // - JSFunctionProxy | 73 // - JSFunctionProxy |
74 // - FixedArrayBase | 74 // - FixedArrayBase |
75 // - ByteArray | 75 // - ByteArray |
76 // - BytecodeArray | |
76 // - FixedArray | 77 // - FixedArray |
77 // - DescriptorArray | 78 // - DescriptorArray |
78 // - HashTable | 79 // - HashTable |
79 // - Dictionary | 80 // - Dictionary |
80 // - StringTable | 81 // - StringTable |
81 // - CompilationCacheTable | 82 // - CompilationCacheTable |
82 // - CodeCacheHashTable | 83 // - CodeCacheHashTable |
83 // - MapCache | 84 // - MapCache |
84 // - OrderedHashTable | 85 // - OrderedHashTable |
85 // - OrderedHashSet | 86 // - OrderedHashSet |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
391 V(CODE_TYPE) \ | 392 V(CODE_TYPE) \ |
392 V(ODDBALL_TYPE) \ | 393 V(ODDBALL_TYPE) \ |
393 V(CELL_TYPE) \ | 394 V(CELL_TYPE) \ |
394 V(PROPERTY_CELL_TYPE) \ | 395 V(PROPERTY_CELL_TYPE) \ |
395 \ | 396 \ |
396 V(HEAP_NUMBER_TYPE) \ | 397 V(HEAP_NUMBER_TYPE) \ |
397 V(MUTABLE_HEAP_NUMBER_TYPE) \ | 398 V(MUTABLE_HEAP_NUMBER_TYPE) \ |
398 V(FLOAT32X4_TYPE) \ | 399 V(FLOAT32X4_TYPE) \ |
399 V(FOREIGN_TYPE) \ | 400 V(FOREIGN_TYPE) \ |
400 V(BYTE_ARRAY_TYPE) \ | 401 V(BYTE_ARRAY_TYPE) \ |
402 V(BYTECODE_ARRAY_TYPE) \ | |
401 V(FREE_SPACE_TYPE) \ | 403 V(FREE_SPACE_TYPE) \ |
402 /* Note: the order of these external array */ \ | 404 /* Note: the order of these external array */ \ |
403 /* types is relied upon in */ \ | 405 /* types is relied upon in */ \ |
404 /* Object::IsExternalArray(). */ \ | 406 /* Object::IsExternalArray(). */ \ |
405 V(EXTERNAL_INT8_ARRAY_TYPE) \ | 407 V(EXTERNAL_INT8_ARRAY_TYPE) \ |
406 V(EXTERNAL_UINT8_ARRAY_TYPE) \ | 408 V(EXTERNAL_UINT8_ARRAY_TYPE) \ |
407 V(EXTERNAL_INT16_ARRAY_TYPE) \ | 409 V(EXTERNAL_INT16_ARRAY_TYPE) \ |
408 V(EXTERNAL_UINT16_ARRAY_TYPE) \ | 410 V(EXTERNAL_UINT16_ARRAY_TYPE) \ |
409 V(EXTERNAL_INT32_ARRAY_TYPE) \ | 411 V(EXTERNAL_INT32_ARRAY_TYPE) \ |
410 V(EXTERNAL_UINT32_ARRAY_TYPE) \ | 412 V(EXTERNAL_UINT32_ARRAY_TYPE) \ |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
687 CODE_TYPE, | 689 CODE_TYPE, |
688 ODDBALL_TYPE, | 690 ODDBALL_TYPE, |
689 | 691 |
690 // "Data", objects that cannot contain non-map-word pointers to heap | 692 // "Data", objects that cannot contain non-map-word pointers to heap |
691 // objects. | 693 // objects. |
692 HEAP_NUMBER_TYPE, | 694 HEAP_NUMBER_TYPE, |
693 MUTABLE_HEAP_NUMBER_TYPE, | 695 MUTABLE_HEAP_NUMBER_TYPE, |
694 FLOAT32X4_TYPE, // FIRST_SIMD_TYPE, LAST_SIMD_TYPE | 696 FLOAT32X4_TYPE, // FIRST_SIMD_TYPE, LAST_SIMD_TYPE |
695 FOREIGN_TYPE, | 697 FOREIGN_TYPE, |
696 BYTE_ARRAY_TYPE, | 698 BYTE_ARRAY_TYPE, |
699 BYTECODE_ARRAY_TYPE, | |
697 FREE_SPACE_TYPE, | 700 FREE_SPACE_TYPE, |
698 EXTERNAL_INT8_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE | 701 EXTERNAL_INT8_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE |
699 EXTERNAL_UINT8_ARRAY_TYPE, | 702 EXTERNAL_UINT8_ARRAY_TYPE, |
700 EXTERNAL_INT16_ARRAY_TYPE, | 703 EXTERNAL_INT16_ARRAY_TYPE, |
701 EXTERNAL_UINT16_ARRAY_TYPE, | 704 EXTERNAL_UINT16_ARRAY_TYPE, |
702 EXTERNAL_INT32_ARRAY_TYPE, | 705 EXTERNAL_INT32_ARRAY_TYPE, |
703 EXTERNAL_UINT32_ARRAY_TYPE, | 706 EXTERNAL_UINT32_ARRAY_TYPE, |
704 EXTERNAL_FLOAT32_ARRAY_TYPE, | 707 EXTERNAL_FLOAT32_ARRAY_TYPE, |
705 EXTERNAL_FLOAT64_ARRAY_TYPE, | 708 EXTERNAL_FLOAT64_ARRAY_TYPE, |
706 EXTERNAL_UINT8_CLAMPED_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE | 709 EXTERNAL_UINT8_CLAMPED_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
953 V(FixedInt8Array) \ | 956 V(FixedInt8Array) \ |
954 V(FixedUint16Array) \ | 957 V(FixedUint16Array) \ |
955 V(FixedInt16Array) \ | 958 V(FixedInt16Array) \ |
956 V(FixedUint32Array) \ | 959 V(FixedUint32Array) \ |
957 V(FixedInt32Array) \ | 960 V(FixedInt32Array) \ |
958 V(FixedFloat32Array) \ | 961 V(FixedFloat32Array) \ |
959 V(FixedFloat64Array) \ | 962 V(FixedFloat64Array) \ |
960 V(FixedUint8ClampedArray) \ | 963 V(FixedUint8ClampedArray) \ |
961 V(Float32x4) \ | 964 V(Float32x4) \ |
962 V(ByteArray) \ | 965 V(ByteArray) \ |
966 V(BytecodeArray) \ | |
963 V(FreeSpace) \ | 967 V(FreeSpace) \ |
964 V(JSReceiver) \ | 968 V(JSReceiver) \ |
965 V(JSObject) \ | 969 V(JSObject) \ |
966 V(JSContextExtensionObject) \ | 970 V(JSContextExtensionObject) \ |
967 V(JSGeneratorObject) \ | 971 V(JSGeneratorObject) \ |
968 V(JSModule) \ | 972 V(JSModule) \ |
969 V(LayoutDescriptor) \ | 973 V(LayoutDescriptor) \ |
970 V(Map) \ | 974 V(Map) \ |
971 V(DescriptorArray) \ | 975 V(DescriptorArray) \ |
972 V(TransitionArray) \ | 976 V(TransitionArray) \ |
(...skipping 3280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4253 // Maximal memory consumption for a single ByteArray. | 4257 // Maximal memory consumption for a single ByteArray. |
4254 static const int kMaxSize = 512 * MB; | 4258 static const int kMaxSize = 512 * MB; |
4255 // Maximal length of a single ByteArray. | 4259 // Maximal length of a single ByteArray. |
4256 static const int kMaxLength = kMaxSize - kHeaderSize; | 4260 static const int kMaxLength = kMaxSize - kHeaderSize; |
4257 | 4261 |
4258 private: | 4262 private: |
4259 DISALLOW_IMPLICIT_CONSTRUCTORS(ByteArray); | 4263 DISALLOW_IMPLICIT_CONSTRUCTORS(ByteArray); |
4260 }; | 4264 }; |
4261 | 4265 |
4262 | 4266 |
4267 // BytecodeArray represents a sequence of interpreter bytecodes. | |
4268 class BytecodeArray : public ByteArray { | |
4269 public: | |
4270 static int SizeFor(int length) { | |
4271 return OBJECT_POINTER_ALIGN(kHeaderSize + length); | |
4272 } | |
4273 | |
4274 // Returns data start address. | |
4275 inline Address GetFirstBytecodeAddress(); | |
4276 | |
4277 // Accessors for frame size and the number of locals | |
4278 inline int frame_size() const; | |
4279 inline void set_frame_size(int value); | |
4280 inline int number_of_locals() const; | |
4281 inline void set_number_of_locals(int value); | |
4282 | |
4283 DECLARE_CAST(BytecodeArray) | |
4284 | |
4285 // Dispatched behavior. | |
4286 inline int BytecodeArraySize() { return SizeFor(this->length()); } | |
4287 | |
4288 DECLARE_PRINTER(BytecodeArray) | |
4289 DECLARE_VERIFIER(BytecodeArray) | |
4290 | |
4291 void Disassemble(std::ostream& os); | |
4292 | |
4293 // Layout description. | |
4294 static const int kFrameSizeOffset = ByteArray::kHeaderSize; | |
4295 static const int kNumberOfLocalsOffset = kFrameSizeOffset + kIntSize; | |
4296 static const int kHeaderSize = kNumberOfLocalsOffset + kIntSize; | |
4297 | |
4298 static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize); | |
4299 | |
4300 // Maximal memory consumption for a single BytecodeArray. | |
4301 static const int kMaxSize = ByteArray::kMaxSize; | |
4302 // Maximal length of a single BytecodeArray. | |
4303 static const int kMaxLength = kMaxSize - kHeaderSize; | |
4304 | |
4305 private: | |
4306 DISALLOW_IMPLICIT_CONSTRUCTORS(BytecodeArray); | |
4307 }; | |
4308 | |
4309 | |
4263 // FreeSpace are fixed-size free memory blocks used by the heap and GC. | 4310 // FreeSpace are fixed-size free memory blocks used by the heap and GC. |
4264 // They look like heap objects (are heap object tagged and have a map) so that | 4311 // They look like heap objects (are heap object tagged and have a map) so that |
4265 // the heap remains iterable. They have a size and a next pointer. | 4312 // the heap remains iterable. They have a size and a next pointer. |
4266 // The next pointer is the raw address of the next FreeSpace object (or NULL) | 4313 // The next pointer is the raw address of the next FreeSpace object (or NULL) |
4267 // in the free list. | 4314 // in the free list. |
4268 class FreeSpace: public HeapObject { | 4315 class FreeSpace: public HeapObject { |
4269 public: | 4316 public: |
4270 // [size]: size of the free space including the header. | 4317 // [size]: size of the free space including the header. |
4271 inline int size() const; | 4318 inline int size() const; |
4272 inline void set_size(int value); | 4319 inline void set_size(int value); |
(...skipping 2379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6652 // (increasingly) from crankshafted code where sufficient feedback isn't | 6699 // (increasingly) from crankshafted code where sufficient feedback isn't |
6653 // available. | 6700 // available. |
6654 DECL_ACCESSORS(feedback_vector, TypeFeedbackVector) | 6701 DECL_ACCESSORS(feedback_vector, TypeFeedbackVector) |
6655 | 6702 |
6656 // Unconditionally clear the type feedback vector (including vector ICs). | 6703 // Unconditionally clear the type feedback vector (including vector ICs). |
6657 void ClearTypeFeedbackInfo(); | 6704 void ClearTypeFeedbackInfo(); |
6658 | 6705 |
6659 // Clear the type feedback vector with a more subtle policy at GC time. | 6706 // Clear the type feedback vector with a more subtle policy at GC time. |
6660 void ClearTypeFeedbackInfoAtGCTime(); | 6707 void ClearTypeFeedbackInfoAtGCTime(); |
6661 | 6708 |
6709 // [bytecode_array]: Interpreter bytecodes. | |
6710 DECL_ACCESSORS(bytecode_array, BytecodeArray) | |
ulan
2015/07/21 11:55:24
This will increase memory footprint. Couple of mon
oth
2015/07/21 20:39:26
Done. Moved to SharedFunctionInfo::function_data.
| |
6711 | |
6662 #if TRACE_MAPS | 6712 #if TRACE_MAPS |
6663 // [unique_id] - For --trace-maps purposes, an identifier that's persistent | 6713 // [unique_id] - For --trace-maps purposes, an identifier that's persistent |
6664 // even if the GC moves this SharedFunctionInfo. | 6714 // even if the GC moves this SharedFunctionInfo. |
6665 inline int unique_id() const; | 6715 inline int unique_id() const; |
6666 inline void set_unique_id(int value); | 6716 inline void set_unique_id(int value); |
6667 #endif | 6717 #endif |
6668 | 6718 |
6669 // [instance class name]: class name for instances. | 6719 // [instance class name]: class name for instances. |
6670 DECL_ACCESSORS(instance_class_name, Object) | 6720 DECL_ACCESSORS(instance_class_name, Object) |
6671 | 6721 |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6925 static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize; | 6975 static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize; |
6926 static const int kInstanceClassNameOffset = | 6976 static const int kInstanceClassNameOffset = |
6927 kConstructStubOffset + kPointerSize; | 6977 kConstructStubOffset + kPointerSize; |
6928 static const int kFunctionDataOffset = | 6978 static const int kFunctionDataOffset = |
6929 kInstanceClassNameOffset + kPointerSize; | 6979 kInstanceClassNameOffset + kPointerSize; |
6930 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; | 6980 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; |
6931 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; | 6981 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; |
6932 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; | 6982 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; |
6933 static const int kFeedbackVectorOffset = | 6983 static const int kFeedbackVectorOffset = |
6934 kInferredNameOffset + kPointerSize; | 6984 kInferredNameOffset + kPointerSize; |
6985 static const int kBytecodeArrayOffset = kFeedbackVectorOffset + kPointerSize; | |
6935 #if TRACE_MAPS | 6986 #if TRACE_MAPS |
6936 static const int kUniqueIdOffset = kFeedbackVectorOffset + kPointerSize; | 6987 static const int kUniqueIdOffset = kBytecodeArrayOffset + kPointerSize; |
6937 static const int kLastPointerFieldOffset = kUniqueIdOffset; | 6988 static const int kLastPointerFieldOffset = kUniqueIdOffset; |
6938 #else | 6989 #else |
6939 // Just to not break the postmortrem support with conditional offsets | 6990 // Just to not break the postmortrem support with conditional offsets |
6940 static const int kUniqueIdOffset = kFeedbackVectorOffset; | 6991 static const int kUniqueIdOffset = kBytecodeArrayOffset; |
6941 static const int kLastPointerFieldOffset = kFeedbackVectorOffset; | 6992 static const int kLastPointerFieldOffset = kBytecodeArrayOffset; |
6942 #endif | 6993 #endif |
6943 | 6994 |
6944 #if V8_HOST_ARCH_32_BIT | 6995 #if V8_HOST_ARCH_32_BIT |
6945 // Smi fields. | 6996 // Smi fields. |
6946 static const int kLengthOffset = kLastPointerFieldOffset + kPointerSize; | 6997 static const int kLengthOffset = kLastPointerFieldOffset + kPointerSize; |
6947 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize; | 6998 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize; |
6948 static const int kExpectedNofPropertiesOffset = | 6999 static const int kExpectedNofPropertiesOffset = |
6949 kFormalParameterCountOffset + kPointerSize; | 7000 kFormalParameterCountOffset + kPointerSize; |
6950 static const int kNumLiteralsOffset = | 7001 static const int kNumLiteralsOffset = |
6951 kExpectedNofPropertiesOffset + kPointerSize; | 7002 kExpectedNofPropertiesOffset + kPointerSize; |
(...skipping 3872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10824 } else { | 10875 } else { |
10825 value &= ~(1 << bit_position); | 10876 value &= ~(1 << bit_position); |
10826 } | 10877 } |
10827 return value; | 10878 return value; |
10828 } | 10879 } |
10829 }; | 10880 }; |
10830 | 10881 |
10831 } } // namespace v8::internal | 10882 } } // namespace v8::internal |
10832 | 10883 |
10833 #endif // V8_OBJECTS_H_ | 10884 #endif // V8_OBJECTS_H_ |
OLD | NEW |