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 interpreter bytecodes. | |
rmcilroy
2015/07/15 13:33:38
/s/sequence interpreter/sequence of interpreter
oth
2015/07/16 09:15:50
Done.
| |
4268 class BytecodeArray : public ByteArray { | |
4269 public: | |
4270 static int SizeFor(int length) { | |
4271 return OBJECT_POINTER_ALIGN(kHeaderSize + length); | |
4272 } | |
4273 | |
4274 // We use byte arrays for free blocks in the heap. Given a desired size in | |
4275 // bytes that is a multiple of the word size and big enough to hold a byte | |
4276 // array, this function returns the number of elements a byte array should | |
4277 // have. | |
rmcilroy
2015/07/15 13:33:38
Copy and pasted ByteArray comment here?
oth
2015/07/16 09:15:50
Done.
| |
4278 static int LengthFor(int size_in_bytes) { | |
rmcilroy
2015/07/15 13:33:38
Do we need this function? I think it's only necess
oth
2015/07/16 09:15:50
Done.
| |
4279 DCHECK(IsAligned(size_in_bytes, kPointerSize)); | |
4280 DCHECK(size_in_bytes >= kHeaderSize); | |
4281 return size_in_bytes - kHeaderSize; | |
4282 } | |
4283 | |
4284 // Returns data start address. | |
4285 inline Address GetDataStartAddress() { | |
rmcilroy
2015/07/15 13:33:38
nit - GetFirstBytecodeAddress() ?
oth
2015/07/16 09:15:50
Done.
| |
4286 return ByteArray::GetDataStartAddress(); | |
4287 } | |
4288 | |
4289 // Returns a pointer to the ByteArray object for a given data start address. | |
4290 static inline BytecodeArray* FromDataStartAddress(Address address); | |
rmcilroy
2015/07/15 13:33:38
Looks like this isn't used, let's drop it until it
oth
2015/07/16 09:15:50
Done.
| |
4291 | |
4292 DECLARE_CAST(BytecodeArray) | |
4293 | |
4294 // Dispatched behavior. | |
4295 inline int BytecodeArraySize() { return SizeFor(this->length()); } | |
rmcilroy
2015/07/15 13:33:38
Same for this (also remove comment).
oth
2015/07/16 09:15:50
Done.
| |
4296 DECLARE_PRINTER(BytecodeArray) | |
4297 DECLARE_VERIFIER(BytecodeArray) | |
4298 | |
4299 // Layout description. | |
4300 static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize); | |
4301 | |
4302 // Maximal memory consumption for a single ByteArray. | |
4303 static const int kMaxSize = 512 * MB; | |
rmcilroy
2015/07/15 13:33:38
nit - /s/512 * MB/ByteArray::kMaxSize/
oth
2015/07/16 09:15:50
Done.
| |
4304 // Maximal length of a single ByteArray. | |
4305 static const int kMaxLength = kMaxSize - kHeaderSize; | |
4306 | |
4307 private: | |
4308 DISALLOW_IMPLICIT_CONSTRUCTORS(BytecodeArray); | |
4309 }; | |
4310 | |
4311 | |
4263 // FreeSpace are fixed-size free memory blocks used by the heap and GC. | 4312 // 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 | 4313 // 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. | 4314 // 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) | 4315 // The next pointer is the raw address of the next FreeSpace object (or NULL) |
4267 // in the free list. | 4316 // in the free list. |
4268 class FreeSpace: public HeapObject { | 4317 class FreeSpace: public HeapObject { |
4269 public: | 4318 public: |
4270 // [size]: size of the free space including the header. | 4319 // [size]: size of the free space including the header. |
4271 inline int size() const; | 4320 inline int size() const; |
4272 inline void set_size(int value); | 4321 inline void set_size(int value); |
(...skipping 2386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6659 // (increasingly) from crankshafted code where sufficient feedback isn't | 6708 // (increasingly) from crankshafted code where sufficient feedback isn't |
6660 // available. | 6709 // available. |
6661 DECL_ACCESSORS(feedback_vector, TypeFeedbackVector) | 6710 DECL_ACCESSORS(feedback_vector, TypeFeedbackVector) |
6662 | 6711 |
6663 // Unconditionally clear the type feedback vector (including vector ICs). | 6712 // Unconditionally clear the type feedback vector (including vector ICs). |
6664 void ClearTypeFeedbackInfo(); | 6713 void ClearTypeFeedbackInfo(); |
6665 | 6714 |
6666 // Clear the type feedback vector with a more subtle policy at GC time. | 6715 // Clear the type feedback vector with a more subtle policy at GC time. |
6667 void ClearTypeFeedbackInfoAtGCTime(); | 6716 void ClearTypeFeedbackInfoAtGCTime(); |
6668 | 6717 |
6718 // [bytecode_array]: Interpreter byte codes | |
rmcilroy
2015/07/15 13:33:38
nit - /s/byte codes/bytecodes ?
oth
2015/07/16 09:15:50
Done.
| |
6719 DECL_ACCESSORS(bytecode_array, BytecodeArray) | |
6720 | |
6669 #if TRACE_MAPS | 6721 #if TRACE_MAPS |
6670 // [unique_id] - For --trace-maps purposes, an identifier that's persistent | 6722 // [unique_id] - For --trace-maps purposes, an identifier that's persistent |
6671 // even if the GC moves this SharedFunctionInfo. | 6723 // even if the GC moves this SharedFunctionInfo. |
6672 inline int unique_id() const; | 6724 inline int unique_id() const; |
6673 inline void set_unique_id(int value); | 6725 inline void set_unique_id(int value); |
6674 #endif | 6726 #endif |
6675 | 6727 |
6676 // [instance class name]: class name for instances. | 6728 // [instance class name]: class name for instances. |
6677 DECL_ACCESSORS(instance_class_name, Object) | 6729 DECL_ACCESSORS(instance_class_name, Object) |
6678 | 6730 |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6932 static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize; | 6984 static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize; |
6933 static const int kInstanceClassNameOffset = | 6985 static const int kInstanceClassNameOffset = |
6934 kConstructStubOffset + kPointerSize; | 6986 kConstructStubOffset + kPointerSize; |
6935 static const int kFunctionDataOffset = | 6987 static const int kFunctionDataOffset = |
6936 kInstanceClassNameOffset + kPointerSize; | 6988 kInstanceClassNameOffset + kPointerSize; |
6937 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; | 6989 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; |
6938 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; | 6990 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; |
6939 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; | 6991 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; |
6940 static const int kFeedbackVectorOffset = | 6992 static const int kFeedbackVectorOffset = |
6941 kInferredNameOffset + kPointerSize; | 6993 kInferredNameOffset + kPointerSize; |
6994 static const int kBytecodeArrayOffset = kFeedbackVectorOffset + kPointerSize; | |
6942 #if TRACE_MAPS | 6995 #if TRACE_MAPS |
6943 static const int kUniqueIdOffset = kFeedbackVectorOffset + kPointerSize; | 6996 static const int kUniqueIdOffset = kBytecodeArrayOffset + kPointerSize; |
6944 static const int kLastPointerFieldOffset = kUniqueIdOffset; | 6997 static const int kLastPointerFieldOffset = kUniqueIdOffset; |
6945 #else | 6998 #else |
6946 // Just to not break the postmortrem support with conditional offsets | 6999 // Just to not break the postmortrem support with conditional offsets |
6947 static const int kUniqueIdOffset = kFeedbackVectorOffset; | 7000 static const int kUniqueIdOffset = kBytecodeArrayOffset; |
6948 static const int kLastPointerFieldOffset = kFeedbackVectorOffset; | 7001 static const int kLastPointerFieldOffset = kBytecodeArrayOffset; |
6949 #endif | 7002 #endif |
6950 | 7003 |
6951 #if V8_HOST_ARCH_32_BIT | 7004 #if V8_HOST_ARCH_32_BIT |
6952 // Smi fields. | 7005 // Smi fields. |
6953 static const int kLengthOffset = kLastPointerFieldOffset + kPointerSize; | 7006 static const int kLengthOffset = kLastPointerFieldOffset + kPointerSize; |
6954 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize; | 7007 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize; |
6955 static const int kExpectedNofPropertiesOffset = | 7008 static const int kExpectedNofPropertiesOffset = |
6956 kFormalParameterCountOffset + kPointerSize; | 7009 kFormalParameterCountOffset + kPointerSize; |
6957 static const int kNumLiteralsOffset = | 7010 static const int kNumLiteralsOffset = |
6958 kExpectedNofPropertiesOffset + kPointerSize; | 7011 kExpectedNofPropertiesOffset + kPointerSize; |
(...skipping 3872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10831 } else { | 10884 } else { |
10832 value &= ~(1 << bit_position); | 10885 value &= ~(1 << bit_position); |
10833 } | 10886 } |
10834 return value; | 10887 return value; |
10835 } | 10888 } |
10836 }; | 10889 }; |
10837 | 10890 |
10838 } } // namespace v8::internal | 10891 } } // namespace v8::internal |
10839 | 10892 |
10840 #endif // V8_OBJECTS_H_ | 10893 #endif // V8_OBJECTS_H_ |
OLD | NEW |