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