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 10242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10253 | 10253 |
10254 // Dispatched behavior. | 10254 // Dispatched behavior. |
10255 DECLARE_PRINTER(JSWeakSet) | 10255 DECLARE_PRINTER(JSWeakSet) |
10256 DECLARE_VERIFIER(JSWeakSet) | 10256 DECLARE_VERIFIER(JSWeakSet) |
10257 | 10257 |
10258 private: | 10258 private: |
10259 DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakSet); | 10259 DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakSet); |
10260 }; | 10260 }; |
10261 | 10261 |
10262 | 10262 |
10263 // Whether a JSArrayBuffer is a SharedArrayBuffer or not. | |
10264 enum class SharedFlag { kNotShared, kShared }; | |
10265 | |
10266 | |
10267 class JSArrayBuffer: public JSObject { | 10263 class JSArrayBuffer: public JSObject { |
10268 public: | 10264 public: |
10269 // [backing_store]: backing memory for this array | 10265 // [backing_store]: backing memory for this array |
10270 DECL_ACCESSORS(backing_store, void) | 10266 DECL_ACCESSORS(backing_store, void) |
10271 | 10267 |
10272 // [byte_length]: length in bytes | 10268 // [byte_length]: length in bytes |
10273 DECL_ACCESSORS(byte_length, Object) | 10269 DECL_ACCESSORS(byte_length, Object) |
10274 | 10270 |
10275 inline uint32_t bit_field() const; | 10271 inline uint32_t bit_field() const; |
10276 inline void set_bit_field(uint32_t bits); | 10272 inline void set_bit_field(uint32_t bits); |
10277 | 10273 |
10278 inline bool is_external(); | 10274 inline bool is_external(); |
10279 inline void set_is_external(bool value); | 10275 inline void set_is_external(bool value); |
10280 | 10276 |
10281 inline bool is_neuterable(); | 10277 inline bool is_neuterable(); |
10282 inline void set_is_neuterable(bool value); | 10278 inline void set_is_neuterable(bool value); |
10283 | 10279 |
10284 inline bool was_neutered(); | 10280 inline bool was_neutered(); |
10285 inline void set_was_neutered(bool value); | 10281 inline void set_was_neutered(bool value); |
10286 | 10282 |
10287 inline bool is_shared(); | |
10288 inline void set_is_shared(bool value); | |
10289 | |
10290 DECLARE_CAST(JSArrayBuffer) | 10283 DECLARE_CAST(JSArrayBuffer) |
10291 | 10284 |
10292 void Neuter(); | 10285 void Neuter(); |
10293 | 10286 |
10294 // Dispatched behavior. | 10287 // Dispatched behavior. |
10295 DECLARE_PRINTER(JSArrayBuffer) | 10288 DECLARE_PRINTER(JSArrayBuffer) |
10296 DECLARE_VERIFIER(JSArrayBuffer) | 10289 DECLARE_VERIFIER(JSArrayBuffer) |
10297 | 10290 |
10298 static const int kBackingStoreOffset = JSObject::kHeaderSize; | 10291 static const int kBackingStoreOffset = JSObject::kHeaderSize; |
10299 static const int kByteLengthOffset = kBackingStoreOffset + kPointerSize; | 10292 static const int kByteLengthOffset = kBackingStoreOffset + kPointerSize; |
10300 static const int kBitFieldSlot = kByteLengthOffset + kPointerSize; | 10293 static const int kBitFieldSlot = kByteLengthOffset + kPointerSize; |
10301 #if V8_TARGET_LITTLE_ENDIAN || !V8_HOST_ARCH_64_BIT | 10294 #if V8_TARGET_LITTLE_ENDIAN || !V8_HOST_ARCH_64_BIT |
10302 static const int kBitFieldOffset = kBitFieldSlot; | 10295 static const int kBitFieldOffset = kBitFieldSlot; |
10303 #else | 10296 #else |
10304 static const int kBitFieldOffset = kBitFieldSlot + kIntSize; | 10297 static const int kBitFieldOffset = kBitFieldSlot + kIntSize; |
10305 #endif | 10298 #endif |
10306 static const int kSize = kBitFieldSlot + kPointerSize; | 10299 static const int kSize = kBitFieldSlot + kPointerSize; |
10307 | 10300 |
10308 static const int kSizeWithInternalFields = | 10301 static const int kSizeWithInternalFields = |
10309 kSize + v8::ArrayBuffer::kInternalFieldCount * kPointerSize; | 10302 kSize + v8::ArrayBuffer::kInternalFieldCount * kPointerSize; |
10310 | 10303 |
10311 class IsExternal : public BitField<bool, 1, 1> {}; | 10304 class IsExternal : public BitField<bool, 1, 1> {}; |
10312 class IsNeuterable : public BitField<bool, 2, 1> {}; | 10305 class IsNeuterable : public BitField<bool, 2, 1> {}; |
10313 class WasNeutered : public BitField<bool, 3, 1> {}; | 10306 class WasNeutered : public BitField<bool, 3, 1> {}; |
10314 class IsShared : public BitField<bool, 4, 1> {}; | |
10315 | 10307 |
10316 private: | 10308 private: |
10317 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer); | 10309 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer); |
10318 }; | 10310 }; |
10319 | 10311 |
10320 | 10312 |
10321 class JSArrayBufferView: public JSObject { | 10313 class JSArrayBufferView: public JSObject { |
10322 public: | 10314 public: |
10323 // [buffer]: ArrayBuffer that this typed array views. | 10315 // [buffer]: ArrayBuffer that this typed array views. |
10324 DECL_ACCESSORS(buffer, Object) | 10316 DECL_ACCESSORS(buffer, Object) |
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11138 } else { | 11130 } else { |
11139 value &= ~(1 << bit_position); | 11131 value &= ~(1 << bit_position); |
11140 } | 11132 } |
11141 return value; | 11133 return value; |
11142 } | 11134 } |
11143 }; | 11135 }; |
11144 | 11136 |
11145 } } // namespace v8::internal | 11137 } } // namespace v8::internal |
11146 | 11138 |
11147 #endif // V8_OBJECTS_H_ | 11139 #endif // V8_OBJECTS_H_ |
OLD | NEW |