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

Side by Side 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, 7 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 unified diff | Download patch
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10224 matching lines...) Expand 10 before | Expand all | Expand 10 after
10235 10235
10236 10236
10237 class JSArrayBuffer: public JSObject { 10237 class JSArrayBuffer: public JSObject {
10238 public: 10238 public:
10239 // [backing_store]: backing memory for this array 10239 // [backing_store]: backing memory for this array
10240 DECL_ACCESSORS(backing_store, void) 10240 DECL_ACCESSORS(backing_store, void)
10241 10241
10242 // [byte_length]: length in bytes 10242 // [byte_length]: length in bytes
10243 DECL_ACCESSORS(byte_length, Object) 10243 DECL_ACCESSORS(byte_length, Object)
10244 10244
10245 // [flags] 10245 inline uint32_t bit_field() const;
10246 DECL_ACCESSORS(flag, Smi) 10246 inline void set_bit_field(uint32_t bits);
10247 10247
10248 inline bool is_external(); 10248 inline bool is_external();
10249 inline void set_is_external(bool value); 10249 inline void set_is_external(bool value);
10250 10250
10251 inline bool should_be_freed(); 10251 inline bool should_be_freed();
10252 inline void set_should_be_freed(bool value); 10252 inline void set_should_be_freed(bool value);
10253 10253
10254 inline bool is_neuterable(); 10254 inline bool is_neuterable();
10255 inline void set_is_neuterable(bool value); 10255 inline void set_is_neuterable(bool value);
10256 10256
10257 inline bool was_neutered(); 10257 inline bool was_neutered();
10258 inline void set_was_neutered(bool value); 10258 inline void set_was_neutered(bool value);
10259 10259
10260 // [weak_next]: linked list of array buffers. 10260 // [weak_next]: linked list of array buffers.
10261 DECL_ACCESSORS(weak_next, Object) 10261 DECL_ACCESSORS(weak_next, Object)
10262 10262
10263 DECLARE_CAST(JSArrayBuffer) 10263 DECLARE_CAST(JSArrayBuffer)
10264 10264
10265 void Neuter(); 10265 void Neuter();
10266 10266
10267 // Dispatched behavior. 10267 // Dispatched behavior.
10268 DECLARE_PRINTER(JSArrayBuffer) 10268 DECLARE_PRINTER(JSArrayBuffer)
10269 DECLARE_VERIFIER(JSArrayBuffer) 10269 DECLARE_VERIFIER(JSArrayBuffer)
10270 10270
10271 static const int kBackingStoreOffset = JSObject::kHeaderSize; 10271 static const int kBackingStoreOffset = JSObject::kHeaderSize;
10272 static const int kByteLengthOffset = kBackingStoreOffset + kPointerSize; 10272 static const int kByteLengthOffset = kBackingStoreOffset + kPointerSize;
10273 static const int kFlagOffset = kByteLengthOffset + kPointerSize; 10273 static const int kBitFieldOffset = kByteLengthOffset + kPointerSize;
10274 static const int kWeakNextOffset = kFlagOffset + kPointerSize; 10274 static const int kWeakNextOffset = kBitFieldOffset + kPointerSize;
10275 static const int kSize = kWeakNextOffset + kPointerSize; 10275 static const int kSize = kWeakNextOffset + kPointerSize;
10276 10276
10277 static const int kSizeWithInternalFields = 10277 static const int kSizeWithInternalFields =
10278 kSize + v8::ArrayBuffer::kInternalFieldCount * kPointerSize; 10278 kSize + v8::ArrayBuffer::kInternalFieldCount * kPointerSize;
10279 10279
10280 // Bit position in a flag 10280 class IsExternal : public BitField<bool, 1, 1> {};
10281 static const int kIsExternalBit = 0; 10281 class ShouldBeFreed : public BitField<bool, 2, 1> {};
10282 static const int kShouldBeFreed = 1; 10282 class IsNeuterable : public BitField<bool, 3, 1> {};
10283 static const int kIsNeuterableBit = 2; 10283 class WasNeutered : public BitField<bool, 4, 1> {};
10284 static const int kWasNeuteredBit = 3;
10285 10284
10286 private: 10285 private:
10287 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer); 10286 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer);
10288 }; 10287 };
10289 10288
10290 10289
10291 class JSArrayBufferView: public JSObject { 10290 class JSArrayBufferView: public JSObject {
10292 public: 10291 public:
10293 // [buffer]: ArrayBuffer that this typed array views. 10292 // [buffer]: ArrayBuffer that this typed array views.
10294 DECL_ACCESSORS(buffer, Object) 10293 DECL_ACCESSORS(buffer, Object)
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
11103 } else { 11102 } else {
11104 value &= ~(1 << bit_position); 11103 value &= ~(1 << bit_position);
11105 } 11104 }
11106 return value; 11105 return value;
11107 } 11106 }
11108 }; 11107 };
11109 11108
11110 } } // namespace v8::internal 11109 } } // namespace v8::internal
11111 11110
11112 #endif // V8_OBJECTS_H_ 11111 #endif // V8_OBJECTS_H_
OLDNEW
« 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