OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/assert-scope.h" | 10 #include "src/assert-scope.h" |
(...skipping 4376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4387 // ByteArray represents fixed sized byte arrays. Used for the relocation info | 4387 // ByteArray represents fixed sized byte arrays. Used for the relocation info |
4388 // that is attached to code objects. | 4388 // that is attached to code objects. |
4389 class ByteArray: public FixedArrayBase { | 4389 class ByteArray: public FixedArrayBase { |
4390 public: | 4390 public: |
4391 inline int Size(); | 4391 inline int Size(); |
4392 | 4392 |
4393 // Setter and getter. | 4393 // Setter and getter. |
4394 inline byte get(int index); | 4394 inline byte get(int index); |
4395 inline void set(int index, byte value); | 4395 inline void set(int index, byte value); |
4396 | 4396 |
| 4397 // Copy in / copy out whole byte slices. |
| 4398 inline void copy_out(int index, byte* buffer, int length); |
| 4399 inline void copy_in(int index, const byte* buffer, int length); |
| 4400 |
4397 // Treat contents as an int array. | 4401 // Treat contents as an int array. |
4398 inline int get_int(int index); | 4402 inline int get_int(int index); |
| 4403 inline void set_int(int index, int value); |
4399 | 4404 |
4400 static int SizeFor(int length) { | 4405 static int SizeFor(int length) { |
4401 return OBJECT_POINTER_ALIGN(kHeaderSize + length); | 4406 return OBJECT_POINTER_ALIGN(kHeaderSize + length); |
4402 } | 4407 } |
4403 // We use byte arrays for free blocks in the heap. Given a desired size in | 4408 // We use byte arrays for free blocks in the heap. Given a desired size in |
4404 // bytes that is a multiple of the word size and big enough to hold a byte | 4409 // bytes that is a multiple of the word size and big enough to hold a byte |
4405 // array, this function returns the number of elements a byte array should | 4410 // array, this function returns the number of elements a byte array should |
4406 // have. | 4411 // have. |
4407 static int LengthFor(int size_in_bytes) { | 4412 static int LengthFor(int size_in_bytes) { |
4408 DCHECK(IsAligned(size_in_bytes, kPointerSize)); | 4413 DCHECK(IsAligned(size_in_bytes, kPointerSize)); |
(...skipping 6368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10777 } | 10782 } |
10778 return value; | 10783 return value; |
10779 } | 10784 } |
10780 }; | 10785 }; |
10781 | 10786 |
10782 | 10787 |
10783 } // NOLINT, false-positive due to second-order macros. | 10788 } // NOLINT, false-positive due to second-order macros. |
10784 } // NOLINT, false-positive due to second-order macros. | 10789 } // NOLINT, false-positive due to second-order macros. |
10785 | 10790 |
10786 #endif // V8_OBJECTS_H_ | 10791 #endif // V8_OBJECTS_H_ |
OLD | NEW |