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 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 2875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2886 // Prevents overflowing size computations, as well as extreme memory | 2886 // Prevents overflowing size computations, as well as extreme memory |
2887 // consumption. | 2887 // consumption. |
2888 static const int kMaxSize = 512 * MB; | 2888 static const int kMaxSize = 512 * MB; |
2889 // Maximally allowed length of a FixedArray. | 2889 // Maximally allowed length of a FixedArray. |
2890 static const int kMaxLength = (kMaxSize - kHeaderSize) / kDoubleSize; | 2890 static const int kMaxLength = (kMaxSize - kHeaderSize) / kDoubleSize; |
2891 | 2891 |
2892 // Dispatched behavior. | 2892 // Dispatched behavior. |
2893 DECLARE_PRINTER(FixedDoubleArray) | 2893 DECLARE_PRINTER(FixedDoubleArray) |
2894 DECLARE_VERIFIER(FixedDoubleArray) | 2894 DECLARE_VERIFIER(FixedDoubleArray) |
2895 | 2895 |
| 2896 class BodyDescriptor; |
| 2897 |
2896 private: | 2898 private: |
2897 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedDoubleArray); | 2899 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedDoubleArray); |
2898 }; | 2900 }; |
2899 | 2901 |
2900 // Helper class to access FAST_ and SLOW_SLOPPY_ARGUMENTS_ELEMENTS | 2902 // Helper class to access FAST_ and SLOW_SLOPPY_ARGUMENTS_ELEMENTS |
2901 // | 2903 // |
2902 // +---+-----------------------+ | 2904 // +---+-----------------------+ |
2903 // | 0 | Context* context | | 2905 // | 0 | Context* context | |
2904 // +---------------------------+ | 2906 // +---------------------------+ |
2905 // | 1 | FixedArray* arguments +----+ FAST_HOLEY_ELEMENTS | 2907 // | 1 | FixedArray* arguments +----+ FAST_HOLEY_ELEMENTS |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3224 DECLARE_VERIFIER(ByteArray) | 3226 DECLARE_VERIFIER(ByteArray) |
3225 | 3227 |
3226 // Layout description. | 3228 // Layout description. |
3227 static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize); | 3229 static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize); |
3228 | 3230 |
3229 // Maximal memory consumption for a single ByteArray. | 3231 // Maximal memory consumption for a single ByteArray. |
3230 static const int kMaxSize = 512 * MB; | 3232 static const int kMaxSize = 512 * MB; |
3231 // Maximal length of a single ByteArray. | 3233 // Maximal length of a single ByteArray. |
3232 static const int kMaxLength = kMaxSize - kHeaderSize; | 3234 static const int kMaxLength = kMaxSize - kHeaderSize; |
3233 | 3235 |
| 3236 class BodyDescriptor; |
| 3237 |
3234 private: | 3238 private: |
3235 DISALLOW_IMPLICIT_CONSTRUCTORS(ByteArray); | 3239 DISALLOW_IMPLICIT_CONSTRUCTORS(ByteArray); |
3236 }; | 3240 }; |
3237 | 3241 |
3238 // Wrapper class for ByteArray which can store arbitrary C++ classes, as long | 3242 // Wrapper class for ByteArray which can store arbitrary C++ classes, as long |
3239 // as they can be copied with memcpy. | 3243 // as they can be copied with memcpy. |
3240 template <class T> | 3244 template <class T> |
3241 class PodArray : public ByteArray { | 3245 class PodArray : public ByteArray { |
3242 public: | 3246 public: |
3243 static Handle<PodArray<T>> New(Isolate* isolate, int length, | 3247 static Handle<PodArray<T>> New(Isolate* isolate, int length, |
(...skipping 5237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8481 | 8485 |
8482 // Computes the size for an OneByteString instance of a given length. | 8486 // Computes the size for an OneByteString instance of a given length. |
8483 static int SizeFor(int length) { | 8487 static int SizeFor(int length) { |
8484 return OBJECT_POINTER_ALIGN(kHeaderSize + length * kCharSize); | 8488 return OBJECT_POINTER_ALIGN(kHeaderSize + length * kCharSize); |
8485 } | 8489 } |
8486 | 8490 |
8487 // Maximal memory usage for a single sequential one-byte string. | 8491 // Maximal memory usage for a single sequential one-byte string. |
8488 static const int kMaxSize = 512 * MB - 1; | 8492 static const int kMaxSize = 512 * MB - 1; |
8489 STATIC_ASSERT((kMaxSize - kHeaderSize) >= String::kMaxLength); | 8493 STATIC_ASSERT((kMaxSize - kHeaderSize) >= String::kMaxLength); |
8490 | 8494 |
| 8495 class BodyDescriptor; |
| 8496 |
8491 private: | 8497 private: |
8492 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqOneByteString); | 8498 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqOneByteString); |
8493 }; | 8499 }; |
8494 | 8500 |
8495 | 8501 |
8496 // The TwoByteString class captures sequential unicode string objects. | 8502 // The TwoByteString class captures sequential unicode string objects. |
8497 // Each character in the TwoByteString is a two-byte uint16_t. | 8503 // Each character in the TwoByteString is a two-byte uint16_t. |
8498 class SeqTwoByteString: public SeqString { | 8504 class SeqTwoByteString: public SeqString { |
8499 public: | 8505 public: |
8500 static const bool kHasOneByteEncoding = false; | 8506 static const bool kHasOneByteEncoding = false; |
(...skipping 20 matching lines...) Expand all Loading... |
8521 // Computes the size for a TwoByteString instance of a given length. | 8527 // Computes the size for a TwoByteString instance of a given length. |
8522 static int SizeFor(int length) { | 8528 static int SizeFor(int length) { |
8523 return OBJECT_POINTER_ALIGN(kHeaderSize + length * kShortSize); | 8529 return OBJECT_POINTER_ALIGN(kHeaderSize + length * kShortSize); |
8524 } | 8530 } |
8525 | 8531 |
8526 // Maximal memory usage for a single sequential two-byte string. | 8532 // Maximal memory usage for a single sequential two-byte string. |
8527 static const int kMaxSize = 512 * MB - 1; | 8533 static const int kMaxSize = 512 * MB - 1; |
8528 STATIC_ASSERT(static_cast<int>((kMaxSize - kHeaderSize)/sizeof(uint16_t)) >= | 8534 STATIC_ASSERT(static_cast<int>((kMaxSize - kHeaderSize)/sizeof(uint16_t)) >= |
8529 String::kMaxLength); | 8535 String::kMaxLength); |
8530 | 8536 |
| 8537 class BodyDescriptor; |
| 8538 |
8531 private: | 8539 private: |
8532 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqTwoByteString); | 8540 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqTwoByteString); |
8533 }; | 8541 }; |
8534 | 8542 |
8535 | 8543 |
8536 // The ConsString class describes string values built by using the | 8544 // The ConsString class describes string values built by using the |
8537 // addition operator on strings. A ConsString is a pair where the | 8545 // addition operator on strings. A ConsString is a pair where the |
8538 // first and second components are pointers to other string values. | 8546 // first and second components are pointers to other string values. |
8539 // One or both components of a ConsString can be pointers to other | 8547 // One or both components of a ConsString can be pointers to other |
8540 // ConsStrings, creating a binary tree of ConsStrings where the leaves | 8548 // ConsStrings, creating a binary tree of ConsStrings where the leaves |
(...skipping 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10271 } | 10279 } |
10272 }; | 10280 }; |
10273 | 10281 |
10274 | 10282 |
10275 } // NOLINT, false-positive due to second-order macros. | 10283 } // NOLINT, false-positive due to second-order macros. |
10276 } // NOLINT, false-positive due to second-order macros. | 10284 } // NOLINT, false-positive due to second-order macros. |
10277 | 10285 |
10278 #include "src/objects/object-macros-undef.h" | 10286 #include "src/objects/object-macros-undef.h" |
10279 | 10287 |
10280 #endif // V8_OBJECTS_H_ | 10288 #endif // V8_OBJECTS_H_ |
OLD | NEW |