| 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 4430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4441 // Maximal memory consumption for a single ByteArray. | 4441 // Maximal memory consumption for a single ByteArray. |
| 4442 static const int kMaxSize = 512 * MB; | 4442 static const int kMaxSize = 512 * MB; |
| 4443 // Maximal length of a single ByteArray. | 4443 // Maximal length of a single ByteArray. |
| 4444 static const int kMaxLength = kMaxSize - kHeaderSize; | 4444 static const int kMaxLength = kMaxSize - kHeaderSize; |
| 4445 | 4445 |
| 4446 private: | 4446 private: |
| 4447 DISALLOW_IMPLICIT_CONSTRUCTORS(ByteArray); | 4447 DISALLOW_IMPLICIT_CONSTRUCTORS(ByteArray); |
| 4448 }; | 4448 }; |
| 4449 | 4449 |
| 4450 | 4450 |
| 4451 // FreeSpace are fixed-size free memory blocks used by the heap and GC. | 4451 // FreeSpace represents fixed sized areas of the heap that are not currently in |
| 4452 // They look like heap objects (are heap object tagged and have a map) so that | 4452 // use. Used by the heap and GC. |
| 4453 // the heap remains iterable. They have a size and a next pointer. | |
| 4454 // The next pointer is the raw address of the next FreeSpace object (or NULL) | |
| 4455 // in the free list. | |
| 4456 class FreeSpace: public HeapObject { | 4453 class FreeSpace: public HeapObject { |
| 4457 public: | 4454 public: |
| 4458 // [size]: size of the free space including the header. | 4455 // [size]: size of the free space including the header. |
| 4459 inline int size() const; | 4456 inline int size() const; |
| 4460 inline void set_size(int value); | 4457 inline void set_size(int value); |
| 4461 | 4458 |
| 4462 inline int nobarrier_size() const; | 4459 inline int nobarrier_size() const; |
| 4463 inline void nobarrier_set_size(int value); | 4460 inline void nobarrier_set_size(int value); |
| 4464 | 4461 |
| 4465 inline int Size() { return size(); } | 4462 inline int Size() { return size(); } |
| 4466 | 4463 |
| 4467 // Accessors for the next field. | 4464 DECLARE_CAST(FreeSpace) |
| 4468 inline FreeSpace* next(); | |
| 4469 inline FreeSpace** next_address(); | |
| 4470 inline void set_next(FreeSpace* next); | |
| 4471 | |
| 4472 inline static FreeSpace* cast(HeapObject* obj); | |
| 4473 | 4465 |
| 4474 // Dispatched behavior. | 4466 // Dispatched behavior. |
| 4475 DECLARE_PRINTER(FreeSpace) | 4467 DECLARE_PRINTER(FreeSpace) |
| 4476 DECLARE_VERIFIER(FreeSpace) | 4468 DECLARE_VERIFIER(FreeSpace) |
| 4477 | 4469 |
| 4478 // Layout description. | 4470 // Layout description. |
| 4479 // Size is smi tagged when it is stored. | 4471 // Size is smi tagged when it is stored. |
| 4480 static const int kSizeOffset = HeapObject::kHeaderSize; | 4472 static const int kSizeOffset = HeapObject::kHeaderSize; |
| 4481 static const int kNextOffset = POINTER_SIZE_ALIGN(kSizeOffset + kPointerSize); | 4473 static const int kHeaderSize = kSizeOffset + kPointerSize; |
| 4474 |
| 4475 static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize); |
| 4482 | 4476 |
| 4483 private: | 4477 private: |
| 4484 DISALLOW_IMPLICIT_CONSTRUCTORS(FreeSpace); | 4478 DISALLOW_IMPLICIT_CONSTRUCTORS(FreeSpace); |
| 4485 }; | 4479 }; |
| 4486 | 4480 |
| 4487 | 4481 |
| 4488 // V has parameters (Type, type, TYPE, C type, element_size) | 4482 // V has parameters (Type, type, TYPE, C type, element_size) |
| 4489 #define TYPED_ARRAYS(V) \ | 4483 #define TYPED_ARRAYS(V) \ |
| 4490 V(Uint8, uint8, UINT8, uint8_t, 1) \ | 4484 V(Uint8, uint8, UINT8, uint8_t, 1) \ |
| 4491 V(Int8, int8, INT8, int8_t, 1) \ | 4485 V(Int8, int8, INT8, int8_t, 1) \ |
| (...skipping 6447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10939 } else { | 10933 } else { |
| 10940 value &= ~(1 << bit_position); | 10934 value &= ~(1 << bit_position); |
| 10941 } | 10935 } |
| 10942 return value; | 10936 return value; |
| 10943 } | 10937 } |
| 10944 }; | 10938 }; |
| 10945 | 10939 |
| 10946 } } // namespace v8::internal | 10940 } } // namespace v8::internal |
| 10947 | 10941 |
| 10948 #endif // V8_OBJECTS_H_ | 10942 #endif // V8_OBJECTS_H_ |
| OLD | NEW |