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