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

Unified Diff: src/objects-inl.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/objects.h ('k') | src/runtime/runtime-typedarray.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index b505baa2108cd1fdc1d954d1f780e5ac6bf76865..647b123e97e394324af3ab65240d38366219ef97 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -6424,46 +6424,54 @@ void JSArrayBuffer::set_backing_store(void* value, WriteBarrierMode mode) {
ACCESSORS(JSArrayBuffer, byte_length, Object, kByteLengthOffset)
-ACCESSORS_TO_SMI(JSArrayBuffer, flag, kFlagOffset)
-bool JSArrayBuffer::is_external() {
- return BooleanBit::get(flag(), kIsExternalBit);
+void JSArrayBuffer::set_bit_field(uint32_t bits) {
+ if (kInt32Size != kPointerSize) {
+ WRITE_UINT32_FIELD(this, kBitFieldOffset + kInt32Size, 0);
+ }
+ WRITE_UINT32_FIELD(this, kBitFieldOffset, bits);
+}
+
+
+uint32_t JSArrayBuffer::bit_field() const {
+ return READ_UINT32_FIELD(this, kBitFieldOffset);
}
+bool JSArrayBuffer::is_external() { return IsExternal::decode(bit_field()); }
+
+
void JSArrayBuffer::set_is_external(bool value) {
- set_flag(BooleanBit::set(flag(), kIsExternalBit, value));
+ set_bit_field(IsExternal::update(bit_field(), value));
}
bool JSArrayBuffer::should_be_freed() {
- return BooleanBit::get(flag(), kShouldBeFreed);
+ return ShouldBeFreed::decode(bit_field());
}
void JSArrayBuffer::set_should_be_freed(bool value) {
- set_flag(BooleanBit::set(flag(), kShouldBeFreed, value));
+ set_bit_field(ShouldBeFreed::update(bit_field(), value));
}
bool JSArrayBuffer::is_neuterable() {
- return BooleanBit::get(flag(), kIsNeuterableBit);
+ return IsNeuterable::decode(bit_field());
}
void JSArrayBuffer::set_is_neuterable(bool value) {
- set_flag(BooleanBit::set(flag(), kIsNeuterableBit, value));
+ set_bit_field(IsNeuterable::update(bit_field(), value));
}
-bool JSArrayBuffer::was_neutered() {
- return BooleanBit::get(flag(), kWasNeuteredBit);
-}
+bool JSArrayBuffer::was_neutered() { return WasNeutered::decode(bit_field()); }
void JSArrayBuffer::set_was_neutered(bool value) {
- set_flag(BooleanBit::set(flag(), kWasNeuteredBit, value));
+ set_bit_field(WasNeutered::update(bit_field(), value));
}
« no previous file with comments | « src/objects.h ('k') | src/runtime/runtime-typedarray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698