Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(425)

Unified Diff: src/objects.h

Issue 1112503002: Turn JSArrayBuffer::flags into a bit field (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index c5b235de4c24cd7f53623efd669ff3893fc9dde0..1a6c179514859c16d05c7359bace742d2b864219 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -10242,8 +10242,8 @@ class JSArrayBuffer: public JSObject {
// [byte_length]: length in bytes
DECL_ACCESSORS(byte_length, Object)
- // [flags]
- DECL_ACCESSORS(flag, Smi)
+ inline uint32_t bit_field() const;
+ inline void set_bit_field(uint32_t bits);
inline bool is_external();
inline void set_is_external(bool value);
@@ -10270,18 +10270,17 @@ class JSArrayBuffer: public JSObject {
static const int kBackingStoreOffset = JSObject::kHeaderSize;
static const int kByteLengthOffset = kBackingStoreOffset + kPointerSize;
- static const int kFlagOffset = kByteLengthOffset + kPointerSize;
- static const int kWeakNextOffset = kFlagOffset + kPointerSize;
+ static const int kBitFieldOffset = kByteLengthOffset + kPointerSize;
+ static const int kWeakNextOffset = kBitFieldOffset + kPointerSize;
static const int kSize = kWeakNextOffset + kPointerSize;
static const int kSizeWithInternalFields =
kSize + v8::ArrayBuffer::kInternalFieldCount * kPointerSize;
- // Bit position in a flag
- static const int kIsExternalBit = 0;
- static const int kShouldBeFreed = 1;
- static const int kIsNeuterableBit = 2;
- static const int kWasNeuteredBit = 3;
+ class IsExternal : public BitField<bool, 1, 1> {};
+ class ShouldBeFreed : public BitField<bool, 2, 1> {};
+ class IsNeuterable : public BitField<bool, 3, 1> {};
+ class WasNeutered : public BitField<bool, 4, 1> {};
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer);
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698