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 10258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10269 | 10269 |
10270 // Dispatched behavior. | 10270 // Dispatched behavior. |
10271 DECLARE_PRINTER(JSWeakSet) | 10271 DECLARE_PRINTER(JSWeakSet) |
10272 DECLARE_VERIFIER(JSWeakSet) | 10272 DECLARE_VERIFIER(JSWeakSet) |
10273 | 10273 |
10274 private: | 10274 private: |
10275 DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakSet); | 10275 DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakSet); |
10276 }; | 10276 }; |
10277 | 10277 |
10278 | 10278 |
| 10279 // Whether a JSArrayBuffer is a SharedArrayBuffer or not. |
| 10280 enum class SharedFlag { kNotShared, kShared }; |
| 10281 |
| 10282 |
10279 class JSArrayBuffer: public JSObject { | 10283 class JSArrayBuffer: public JSObject { |
10280 public: | 10284 public: |
10281 // [backing_store]: backing memory for this array | 10285 // [backing_store]: backing memory for this array |
10282 DECL_ACCESSORS(backing_store, void) | 10286 DECL_ACCESSORS(backing_store, void) |
10283 | 10287 |
10284 // [byte_length]: length in bytes | 10288 // [byte_length]: length in bytes |
10285 DECL_ACCESSORS(byte_length, Object) | 10289 DECL_ACCESSORS(byte_length, Object) |
10286 | 10290 |
10287 inline uint32_t bit_field() const; | 10291 inline uint32_t bit_field() const; |
10288 inline void set_bit_field(uint32_t bits); | 10292 inline void set_bit_field(uint32_t bits); |
10289 | 10293 |
10290 inline bool is_external(); | 10294 inline bool is_external(); |
10291 inline void set_is_external(bool value); | 10295 inline void set_is_external(bool value); |
10292 | 10296 |
10293 inline bool is_neuterable(); | 10297 inline bool is_neuterable(); |
10294 inline void set_is_neuterable(bool value); | 10298 inline void set_is_neuterable(bool value); |
10295 | 10299 |
10296 inline bool was_neutered(); | 10300 inline bool was_neutered(); |
10297 inline void set_was_neutered(bool value); | 10301 inline void set_was_neutered(bool value); |
10298 | 10302 |
| 10303 inline bool is_shared(); |
| 10304 inline void set_is_shared(bool value); |
| 10305 |
10299 DECLARE_CAST(JSArrayBuffer) | 10306 DECLARE_CAST(JSArrayBuffer) |
10300 | 10307 |
10301 void Neuter(); | 10308 void Neuter(); |
10302 | 10309 |
10303 // Dispatched behavior. | 10310 // Dispatched behavior. |
10304 DECLARE_PRINTER(JSArrayBuffer) | 10311 DECLARE_PRINTER(JSArrayBuffer) |
10305 DECLARE_VERIFIER(JSArrayBuffer) | 10312 DECLARE_VERIFIER(JSArrayBuffer) |
10306 | 10313 |
10307 static const int kBackingStoreOffset = JSObject::kHeaderSize; | 10314 static const int kBackingStoreOffset = JSObject::kHeaderSize; |
10308 static const int kByteLengthOffset = kBackingStoreOffset + kPointerSize; | 10315 static const int kByteLengthOffset = kBackingStoreOffset + kPointerSize; |
10309 static const int kBitFieldSlot = kByteLengthOffset + kPointerSize; | 10316 static const int kBitFieldSlot = kByteLengthOffset + kPointerSize; |
10310 #if V8_TARGET_LITTLE_ENDIAN || !V8_HOST_ARCH_64_BIT | 10317 #if V8_TARGET_LITTLE_ENDIAN || !V8_HOST_ARCH_64_BIT |
10311 static const int kBitFieldOffset = kBitFieldSlot; | 10318 static const int kBitFieldOffset = kBitFieldSlot; |
10312 #else | 10319 #else |
10313 static const int kBitFieldOffset = kBitFieldSlot + kIntSize; | 10320 static const int kBitFieldOffset = kBitFieldSlot + kIntSize; |
10314 #endif | 10321 #endif |
10315 static const int kSize = kBitFieldSlot + kPointerSize; | 10322 static const int kSize = kBitFieldSlot + kPointerSize; |
10316 | 10323 |
10317 static const int kSizeWithInternalFields = | 10324 static const int kSizeWithInternalFields = |
10318 kSize + v8::ArrayBuffer::kInternalFieldCount * kPointerSize; | 10325 kSize + v8::ArrayBuffer::kInternalFieldCount * kPointerSize; |
10319 | 10326 |
10320 class IsExternal : public BitField<bool, 1, 1> {}; | 10327 class IsExternal : public BitField<bool, 1, 1> {}; |
10321 class IsNeuterable : public BitField<bool, 2, 1> {}; | 10328 class IsNeuterable : public BitField<bool, 2, 1> {}; |
10322 class WasNeutered : public BitField<bool, 3, 1> {}; | 10329 class WasNeutered : public BitField<bool, 3, 1> {}; |
| 10330 class IsShared : public BitField<bool, 4, 1> {}; |
10323 | 10331 |
10324 private: | 10332 private: |
10325 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer); | 10333 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer); |
10326 }; | 10334 }; |
10327 | 10335 |
10328 | 10336 |
10329 class JSArrayBufferView: public JSObject { | 10337 class JSArrayBufferView: public JSObject { |
10330 public: | 10338 public: |
10331 // [buffer]: ArrayBuffer that this typed array views. | 10339 // [buffer]: ArrayBuffer that this typed array views. |
10332 DECL_ACCESSORS(buffer, Object) | 10340 DECL_ACCESSORS(buffer, Object) |
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11146 } else { | 11154 } else { |
11147 value &= ~(1 << bit_position); | 11155 value &= ~(1 << bit_position); |
11148 } | 11156 } |
11149 return value; | 11157 return value; |
11150 } | 11158 } |
11151 }; | 11159 }; |
11152 | 11160 |
11153 } } // namespace v8::internal | 11161 } } // namespace v8::internal |
11154 | 11162 |
11155 #endif // V8_OBJECTS_H_ | 11163 #endif // V8_OBJECTS_H_ |
OLD | NEW |