Index: src/objects.h |
diff --git a/src/objects.h b/src/objects.h |
index 12eba2ba25f4468a172436daf03d85ac8a252f10..8576893cf30c653258cf2efe185bb81475579849 100644 |
--- a/src/objects.h |
+++ b/src/objects.h |
@@ -73,6 +73,7 @@ |
// - JSFunctionProxy |
// - FixedArrayBase |
// - ByteArray |
+// - BytecodeArray |
// - FixedArray |
// - DescriptorArray |
// - HashTable |
@@ -398,6 +399,7 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1; |
V(FLOAT32X4_TYPE) \ |
V(FOREIGN_TYPE) \ |
V(BYTE_ARRAY_TYPE) \ |
+ V(BYTECODE_ARRAY_TYPE) \ |
V(FREE_SPACE_TYPE) \ |
/* Note: the order of these external array */ \ |
/* types is relied upon in */ \ |
@@ -694,6 +696,7 @@ enum InstanceType { |
FLOAT32X4_TYPE, // FIRST_SIMD_TYPE, LAST_SIMD_TYPE |
FOREIGN_TYPE, |
BYTE_ARRAY_TYPE, |
+ BYTECODE_ARRAY_TYPE, |
FREE_SPACE_TYPE, |
EXTERNAL_INT8_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE |
EXTERNAL_UINT8_ARRAY_TYPE, |
@@ -960,6 +963,7 @@ template <class C> inline bool Is(Object* obj); |
V(FixedUint8ClampedArray) \ |
V(Float32x4) \ |
V(ByteArray) \ |
+ V(BytecodeArray) \ |
V(FreeSpace) \ |
V(JSReceiver) \ |
V(JSObject) \ |
@@ -4260,6 +4264,51 @@ class ByteArray: public FixedArrayBase { |
}; |
+// 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.
|
+class BytecodeArray : public ByteArray { |
+ public: |
+ static int SizeFor(int length) { |
+ return OBJECT_POINTER_ALIGN(kHeaderSize + length); |
+ } |
+ |
+ // We use byte arrays for free blocks in the heap. Given a desired size in |
+ // bytes that is a multiple of the word size and big enough to hold a byte |
+ // array, this function returns the number of elements a byte array should |
+ // have. |
rmcilroy
2015/07/15 13:33:38
Copy and pasted ByteArray comment here?
oth
2015/07/16 09:15:50
Done.
|
+ 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.
|
+ DCHECK(IsAligned(size_in_bytes, kPointerSize)); |
+ DCHECK(size_in_bytes >= kHeaderSize); |
+ return size_in_bytes - kHeaderSize; |
+ } |
+ |
+ // Returns data start address. |
+ inline Address GetDataStartAddress() { |
rmcilroy
2015/07/15 13:33:38
nit - GetFirstBytecodeAddress() ?
oth
2015/07/16 09:15:50
Done.
|
+ return ByteArray::GetDataStartAddress(); |
+ } |
+ |
+ // Returns a pointer to the ByteArray object for a given data start address. |
+ 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.
|
+ |
+ DECLARE_CAST(BytecodeArray) |
+ |
+ // Dispatched behavior. |
+ 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.
|
+ DECLARE_PRINTER(BytecodeArray) |
+ DECLARE_VERIFIER(BytecodeArray) |
+ |
+ // Layout description. |
+ static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize); |
+ |
+ // Maximal memory consumption for a single ByteArray. |
+ 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.
|
+ // Maximal length of a single ByteArray. |
+ static const int kMaxLength = kMaxSize - kHeaderSize; |
+ |
+ private: |
+ DISALLOW_IMPLICIT_CONSTRUCTORS(BytecodeArray); |
+}; |
+ |
+ |
// FreeSpace are fixed-size free memory blocks used by the heap and GC. |
// They look like heap objects (are heap object tagged and have a map) so that |
// the heap remains iterable. They have a size and a next pointer. |
@@ -6666,6 +6715,9 @@ class SharedFunctionInfo: public HeapObject { |
// Clear the type feedback vector with a more subtle policy at GC time. |
void ClearTypeFeedbackInfoAtGCTime(); |
+ // [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.
|
+ DECL_ACCESSORS(bytecode_array, BytecodeArray) |
+ |
#if TRACE_MAPS |
// [unique_id] - For --trace-maps purposes, an identifier that's persistent |
// even if the GC moves this SharedFunctionInfo. |
@@ -6939,13 +6991,14 @@ class SharedFunctionInfo: public HeapObject { |
static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; |
static const int kFeedbackVectorOffset = |
kInferredNameOffset + kPointerSize; |
+ static const int kBytecodeArrayOffset = kFeedbackVectorOffset + kPointerSize; |
#if TRACE_MAPS |
- static const int kUniqueIdOffset = kFeedbackVectorOffset + kPointerSize; |
+ static const int kUniqueIdOffset = kBytecodeArrayOffset + kPointerSize; |
static const int kLastPointerFieldOffset = kUniqueIdOffset; |
#else |
// Just to not break the postmortrem support with conditional offsets |
- static const int kUniqueIdOffset = kFeedbackVectorOffset; |
- static const int kLastPointerFieldOffset = kFeedbackVectorOffset; |
+ static const int kUniqueIdOffset = kBytecodeArrayOffset; |
+ static const int kLastPointerFieldOffset = kBytecodeArrayOffset; |
#endif |
#if V8_HOST_ARCH_32_BIT |