Index: src/objects.h |
diff --git a/src/objects.h b/src/objects.h |
index 16938972ba28f1a2af618a731cb2314502adf6d2..ed10d1baab172a8d64c2e3db516f825e05bb8548 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,49 @@ class ByteArray: public FixedArrayBase { |
}; |
+// BytecodeArray represents a sequence of interpreter bytecodes. |
+class BytecodeArray : public ByteArray { |
+ public: |
+ static int SizeFor(int length) { |
+ return OBJECT_POINTER_ALIGN(kHeaderSize + length); |
+ } |
+ |
+ // Returns data start address. |
+ inline Address GetFirstBytecodeAddress(); |
+ |
+ // Accessors for frame size and offsets |
rmcilroy
2015/07/20 11:39:46
/s/offsets/locals count./
oth
2015/07/20 13:47:31
Done.
|
+ inline int frame_size(); |
+ inline void set_frame_size(int value); |
+ inline int number_of_locals(); |
+ inline void set_number_of_locals(int value); |
+ |
+ DECLARE_CAST(BytecodeArray) |
+ |
+ // Dispatched behavior. |
+ inline int BytecodeArraySize() { return SizeFor(this->length()); } |
+ |
+ DECLARE_PRINTER(BytecodeArray) |
+ DECLARE_VERIFIER(BytecodeArray) |
+ |
+ void Disassemble(std::ostream& os); |
+ |
+ // Layout description. |
+ static const int kFrameSizeOffset = ByteArray::kHeaderSize; |
+ static const int kNumberOfLocalsOffset = kFrameSizeOffset + kIntSize; |
+ static const int kHeaderSize = kNumberOfLocalsOffset + kIntSize; |
+ |
+ static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize); |
+ |
+ // Maximal memory consumption for a single BytecodeArray. |
+ static const int kMaxSize = ByteArray::kMaxSize; |
+ // Maximal length of a single BytecodeArray. |
+ 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. |
@@ -6659,6 +6706,9 @@ class SharedFunctionInfo: public HeapObject { |
// Clear the type feedback vector with a more subtle policy at GC time. |
void ClearTypeFeedbackInfoAtGCTime(); |
+ // [bytecode_array]: Interpreter bytecodes. |
+ 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. |
@@ -6932,13 +6982,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 |