Index: src/objects.h |
diff --git a/src/objects.h b/src/objects.h |
index c256a7cd9c6cb30c2f435cb93285103d96be3758..32c785cffc629f3f5f637ae8fe9764fbb4b74474 100644 |
--- a/src/objects.h |
+++ b/src/objects.h |
@@ -58,7 +58,9 @@ |
// - JSObject |
// - JSArray |
// - JSArrayBuffer |
-// - JSTypedArray |
+// - JSArrayBufferView |
+// - JSTypedArray |
+// - JSDataView |
// - JSSet |
// - JSMap |
// - JSWeakMap |
@@ -408,6 +410,7 @@ const int kStubMinorKeyBits = kBitsPerInt - kSmiTagSize - kStubMajorKeyBits; |
V(JS_ARRAY_TYPE) \ |
V(JS_ARRAY_BUFFER_TYPE) \ |
V(JS_TYPED_ARRAY_TYPE) \ |
+ V(JS_DATA_VIEW_TYPE) \ |
V(JS_PROXY_TYPE) \ |
V(JS_WEAK_MAP_TYPE) \ |
V(JS_REGEXP_TYPE) \ |
@@ -744,6 +747,7 @@ enum InstanceType { |
JS_ARRAY_TYPE, |
JS_ARRAY_BUFFER_TYPE, |
JS_TYPED_ARRAY_TYPE, |
+ JS_DATA_VIEW_TYPE, |
JS_SET_TYPE, |
JS_MAP_TYPE, |
JS_WEAK_MAP_TYPE, |
@@ -993,7 +997,9 @@ class MaybeObject BASE_EMBEDDED { |
V(Boolean) \ |
V(JSArray) \ |
V(JSArrayBuffer) \ |
+ V(JSArrayBufferView) \ |
V(JSTypedArray) \ |
+ V(JSDataView) \ |
V(JSProxy) \ |
V(JSFunctionProxy) \ |
V(JSSet) \ |
@@ -8810,8 +8816,8 @@ class JSArrayBuffer: public JSObject { |
// [weak_next]: linked list of array buffers. |
DECL_ACCESSORS(weak_next, Object) |
- // [weak_first_array]: weak linked list of typed arrays. |
- DECL_ACCESSORS(weak_first_array, Object) |
+ // [weak_first_array]: weak linked list of views. |
+ DECL_ACCESSORS(weak_first_view, Object) |
// Casting. |
static inline JSArrayBuffer* cast(Object* obj); |
@@ -8827,8 +8833,8 @@ class JSArrayBuffer: public JSObject { |
static const int kByteLengthOffset = kBackingStoreOffset + kPointerSize; |
static const int kFlagOffset = kByteLengthOffset + kPointerSize; |
static const int kWeakNextOffset = kFlagOffset + kPointerSize; |
- static const int kWeakFirstArrayOffset = kWeakNextOffset + kPointerSize; |
- static const int kSize = kWeakFirstArrayOffset + kPointerSize; |
+ static const int kWeakFirstViewOffset = kWeakNextOffset + kPointerSize; |
+ static const int kSize = kWeakFirstViewOffset + kPointerSize; |
static const int kSizeWithInternalFields = |
kSize + v8::ArrayBuffer::kInternalFieldCount * kPointerSize; |
@@ -8841,7 +8847,7 @@ class JSArrayBuffer: public JSObject { |
}; |
-class JSTypedArray: public JSObject { |
+class JSArrayBufferView: public JSObject { |
public: |
// [buffer]: ArrayBuffer that this typed array views. |
DECL_ACCESSORS(buffer, Object) |
@@ -8852,12 +8858,33 @@ class JSTypedArray: public JSObject { |
// [byte_length]: length of typed array in bytes. |
DECL_ACCESSORS(byte_length, Object) |
- // [length]: length of typed array in elements. |
- DECL_ACCESSORS(length, Object) |
- |
// [weak_next]: linked list of typed arrays over the same array buffer. |
DECL_ACCESSORS(weak_next, Object) |
+ // Casting. |
+ static inline JSArrayBufferView* cast(Object* obj); |
+ |
+ DECLARE_VERIFIER(JSArrayBufferView) |
+ |
+ static const int kBufferOffset = JSObject::kHeaderSize; |
+ static const int kByteOffsetOffset = kBufferOffset + kPointerSize; |
+ static const int kByteLengthOffset = kByteOffsetOffset + kPointerSize; |
+ static const int kWeakNextOffset = kByteLengthOffset + kPointerSize; |
+ static const int kViewSize = kWeakNextOffset + kPointerSize; |
+ |
+ protected: |
+ void NeuterView(); |
+ |
+ private: |
+ DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBufferView); |
+}; |
+ |
+ |
+class JSTypedArray: public JSArrayBufferView { |
+ public: |
+ // [length]: length of typed array in elements. |
+ DECL_ACCESSORS(length, Object) |
+ |
// Neutering. Only neuters this typed array. |
void Neuter(); |
@@ -8871,18 +8898,33 @@ class JSTypedArray: public JSObject { |
DECLARE_PRINTER(JSTypedArray) |
DECLARE_VERIFIER(JSTypedArray) |
- static const int kBufferOffset = JSObject::kHeaderSize; |
- static const int kByteOffsetOffset = kBufferOffset + kPointerSize; |
- static const int kByteLengthOffset = kByteOffsetOffset + kPointerSize; |
- static const int kLengthOffset = kByteLengthOffset + kPointerSize; |
- static const int kWeakNextOffset = kLengthOffset + kPointerSize; |
- static const int kSize = kWeakNextOffset + kPointerSize; |
+ static const int kLengthOffset = kViewSize + kPointerSize; |
+ static const int kSize = kLengthOffset + kPointerSize; |
private: |
DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray); |
}; |
+class JSDataView: public JSArrayBufferView { |
+ public: |
+ // Only neuters this DataView |
+ void Neuter(); |
+ |
+ // Casting. |
+ static inline JSDataView* cast(Object* obj); |
+ |
+ // Dispatched behavior. |
+ DECLARE_PRINTER(JSDataView) |
+ DECLARE_VERIFIER(JSDataView) |
+ |
+ static const int kSize = kViewSize; |
+ |
+ private: |
+ DISALLOW_IMPLICIT_CONSTRUCTORS(JSDataView); |
+}; |
+ |
+ |
// Foreign describes objects pointing from JavaScript to C structures. |
// Since they cannot contain references to JS HeapObjects they can be |
// placed in old_data_space. |