Loading...
Searching...
No Matches
v8-primitive.h
Go to the documentation of this file.
1// Copyright 2021 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef INCLUDE_V8_PRIMITIVE_H_
6#define INCLUDE_V8_PRIMITIVE_H_
7
8#include "v8-data.h" // NOLINT(build/include_directory)
9#include "v8-internal.h" // NOLINT(build/include_directory)
10#include "v8-local-handle.h" // NOLINT(build/include_directory)
11#include "v8-value.h" // NOLINT(build/include_directory)
12#include "v8config.h" // NOLINT(build/include_directory)
13
14namespace v8 {
15
16class Context;
17class Isolate;
18class String;
19
20namespace internal {
21class ExternalString;
22class ScopedExternalStringLock;
23class StringForwardingTable;
24} // namespace internal
25
29class V8_EXPORT Primitive : public Value {};
30
35class V8_EXPORT Boolean : public Primitive {
36 public:
37 bool Value() const;
38 V8_INLINE static Boolean* Cast(v8::Data* data) {
39#ifdef V8_ENABLE_CHECKS
40 CheckCast(data);
41#endif
42 return static_cast<Boolean*>(data);
43 }
44
45 V8_INLINE static Local<Boolean> New(Isolate* isolate, bool value);
46
47 private:
48 static void CheckCast(v8::Data* that);
49};
50
59 public:
60 static Local<PrimitiveArray> New(Isolate* isolate, int length);
61 int Length() const;
62 void Set(Isolate* isolate, int index, Local<Primitive> item);
63 Local<Primitive> Get(Isolate* isolate, int index);
64
66#ifdef V8_ENABLE_CHECKS
67 CheckCast(data);
68#endif
69 return reinterpret_cast<PrimitiveArray*>(data);
70 }
71
72 private:
73 static void CheckCast(Data* obj);
74};
75
79class V8_EXPORT Name : public Primitive {
80 public:
89
90 V8_INLINE static Name* Cast(Data* data) {
91#ifdef V8_ENABLE_CHECKS
92 CheckCast(data);
93#endif
94 return static_cast<Name*>(data);
95 }
96
97 private:
98 static void CheckCast(Data* that);
99};
100
107enum class NewStringType {
111 kNormal,
112
119};
120
124class V8_EXPORT String : public Name {
125 public:
126 static constexpr int kMaxLength =
127 internal::kApiSystemPointerSize == 4 ? (1 << 28) - 16 : (1 << 29) - 24;
128
129 enum Encoding {
130 UNKNOWN_ENCODING = 0x1,
131 TWO_BYTE_ENCODING = 0x0,
132 ONE_BYTE_ENCODING = 0x8
133 };
137 int Length() const;
138
143 V8_DEPRECATE_SOON("Use Utf8LengthV2 instead.")
144 int Utf8Length(Isolate* isolate) const;
145
149 size_t Utf8LengthV2(Isolate* isolate) const;
150
157 bool IsOneByte() const;
158
164 bool ContainsOnlyOneByte() const;
165
192 NO_OPTIONS = 0,
193 HINT_MANY_WRITES_EXPECTED = 1,
194 NO_NULL_TERMINATION = 2,
195 PRESERVE_ONE_BYTE_NULL = 4,
196 // Used by WriteUtf8 to replace orphan surrogate code units with the
197 // unicode replacement character. Needs to be set to guarantee valid UTF-8
198 // output.
199 REPLACE_INVALID_UTF8 = 8
200 };
201
202 // 16-bit character codes.
203 V8_DEPRECATE_SOON("Use WriteV2 instead.")
204 int Write(Isolate* isolate, uint16_t* buffer, int start = 0, int length = -1,
205 int options = NO_OPTIONS) const;
206 // One byte characters.
207 V8_DEPRECATE_SOON("Use WriteOneByteV2 instead.")
208 int WriteOneByte(Isolate* isolate, uint8_t* buffer, int start = 0,
209 int length = -1, int options = NO_OPTIONS) const;
210 // UTF-8 encoded characters.
211 V8_DEPRECATE_SOON("Use WriteUtf8V2 instead.")
212 int WriteUtf8(Isolate* isolate, char* buffer, int length = -1,
213 int* nchars_ref = nullptr, int options = NO_OPTIONS) const;
214
215 struct WriteFlags {
216 enum {
217 kNone = 0,
218 // Indicates that the output string should be null-terminated. In that
219 // case, the output buffer must include sufficient space for the
220 // additional null character.
221 kNullTerminate = 1,
222 // Used by WriteUtf8 to replace orphan surrogate code units with the
223 // unicode replacement character. Needs to be set to guarantee valid UTF-8
224 // output.
225 kReplaceInvalidUtf8 = 2
226 };
227 };
228
241 void WriteV2(Isolate* isolate, uint32_t offset, uint32_t length,
242 uint16_t* buffer, int flags = WriteFlags::kNone) const;
243 void WriteOneByteV2(Isolate* isolate, uint32_t offset, uint32_t length,
244 uint8_t* buffer, int flags = WriteFlags::kNone) const;
245
263 size_t WriteUtf8V2(Isolate* isolate, char* buffer, size_t capacity,
264 int flags = WriteFlags::kNone) const;
265
269 V8_INLINE static Local<String> Empty(Isolate* isolate);
270
274 bool IsExternal() const;
275
279 bool IsExternalTwoByte() const;
280
284 bool IsExternalOneByte() const;
285
291
293 public:
294 virtual ~ExternalStringResourceBase() = default;
295
301 virtual bool IsCacheable() const { return true; }
302
308 virtual void Unaccount(Isolate* isolate) {}
309
310 // Disallow copying and assigning.
313
314 protected:
316
323 virtual void Dispose() { delete this; }
324
336 virtual void Lock() const {}
337
341 virtual void Unlock() const {}
342
343 private:
344 friend class internal::ExternalString;
345 friend class v8::String;
346 friend class internal::StringForwardingTable;
347 friend class internal::ScopedExternalStringLock;
348 };
349
357 public:
362 ~ExternalStringResource() override = default;
363
368 virtual const uint16_t* data() const = 0;
369
373 virtual size_t length() const = 0;
374
380 const uint16_t* cached_data() const {
381 CheckCachedDataInvariants();
382 return cached_data_;
383 }
390
391 protected:
393
394 private:
395 void CheckCachedDataInvariants() const;
396
397 const uint16_t* cached_data_ = nullptr;
398 };
399
412 public:
417 ~ExternalOneByteStringResource() override = default;
418
423 virtual const char* data() const = 0;
424
426 virtual size_t length() const = 0;
427
433 const char* cached_data() const {
434 CheckCachedDataInvariants();
435 return cached_data_;
436 }
437
443
444 protected:
446
447 private:
448 void CheckCachedDataInvariants() const;
449
450 const char* cached_data_ = nullptr;
451 };
452
458 V8_INLINE ExternalStringResourceBase* GetExternalStringResourceBase(
459 v8::Isolate* isolate, Encoding* encoding_out) const;
460 V8_INLINE ExternalStringResourceBase* GetExternalStringResourceBase(
461 Encoding* encoding_out) const;
462
467 V8_INLINE ExternalStringResource* GetExternalStringResource() const;
468
474
475 V8_INLINE static String* Cast(v8::Data* data) {
476#ifdef V8_ENABLE_CHECKS
477 CheckCast(data);
478#endif
479 return static_cast<String*>(data);
480 }
481
491 template <int N>
493 Isolate* isolate, const char (&literal)[N],
494 NewStringType type = NewStringType::kNormal) {
495 static_assert(N <= kMaxLength, "String is too long");
496 return NewFromUtf8Literal(isolate, literal, type, N - 1);
497 }
498
502 Isolate* isolate, const char* data,
503 NewStringType type = NewStringType::kNormal, int length = -1);
504
508 Isolate* isolate, const uint8_t* data,
509 NewStringType type = NewStringType::kNormal, int length = -1);
510
514 Isolate* isolate, const uint16_t* data,
515 NewStringType type = NewStringType::kNormal, int length = -1);
516
522 Local<String> right);
523
533 Isolate* isolate, ExternalStringResource* resource);
534
544 V8_DEPRECATE_SOON("Use the version with the isolate argument instead.")
545 bool MakeExternal(ExternalStringResource* resource);
546
556 bool MakeExternal(Isolate* isolate, ExternalStringResource* resource);
557
566 static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewExternalOneByte(
567 Isolate* isolate, ExternalOneByteStringResource* resource);
568
578 V8_DEPRECATE_SOON("Use the version with the isolate argument instead.")
579 bool MakeExternal(ExternalOneByteStringResource* resource);
580
590 bool MakeExternal(Isolate* isolate, ExternalOneByteStringResource* resource);
591
596 bool CanMakeExternal(Encoding encoding) const;
597
601 bool StringEquals(Local<String> str) const;
602
615 public:
617 WriteOptions options = REPLACE_INVALID_UTF8);
619 char* operator*() { return str_; }
620 const char* operator*() const { return str_; }
621 size_t length() const { return length_; }
622
623 // Disallow copying and assigning.
624 Utf8Value(const Utf8Value&) = delete;
625 void operator=(const Utf8Value&) = delete;
626
627 private:
628 char* str_;
629 size_t length_;
630 };
631
643 public:
645 "Prefer using String::ValueView if you can, or string->Write to a "
646 "buffer if you cannot.")
647 Value(Isolate* isolate, Local<v8::Value> obj);
649 uint16_t* operator*() { return str_; }
650 const uint16_t* operator*() const { return str_; }
651 uint32_t length() const { return length_; }
652
653 // Disallow copying and assigning.
654 Value(const Value&) = delete;
655 void operator=(const Value&) = delete;
656
657 private:
658 uint16_t* str_;
659 uint32_t length_;
660 };
661
673 public:
676 const uint8_t* data8() const {
677#if V8_ENABLE_CHECKS
678 CheckOneByte(true);
679#endif
680 return data8_;
681 }
682 const uint16_t* data16() const {
683#if V8_ENABLE_CHECKS
684 CheckOneByte(false);
685#endif
686 return data16_;
687 }
688 uint32_t length() const { return length_; }
689 bool is_one_byte() const { return is_one_byte_; }
690
691 // Disallow copying and assigning.
692 ValueView(const ValueView&) = delete;
693 void operator=(const ValueView&) = delete;
694
695 private:
696 void CheckOneByte(bool is_one_byte) const;
697
698 Local<v8::String> flat_str_;
699 union {
700 const uint8_t* data8_;
701 const uint16_t* data16_;
702 };
703 uint32_t length_;
704 bool is_one_byte_;
705 // Avoid exposing the internal DisallowGarbageCollection scope.
706 alignas(internal::Internals::
707 kDisallowGarbageCollectionAlign) char no_gc_debug_scope_
708 [internal::Internals::kDisallowGarbageCollectionSize];
709 };
710
711 private:
712 void VerifyExternalStringResourceBase(ExternalStringResourceBase* v,
713 Encoding encoding) const;
714 void VerifyExternalStringResource(ExternalStringResource* val) const;
715 ExternalStringResource* GetExternalStringResourceSlow() const;
716 ExternalStringResourceBase* GetExternalStringResourceBaseSlow(
717 String::Encoding* encoding_out) const;
718
719 static Local<v8::String> NewFromUtf8Literal(Isolate* isolate,
720 const char* literal,
721 NewStringType type, int length);
722
723 static void CheckCast(v8::Data* that);
724};
725
726// Zero-length string specialization (templated string size includes
727// terminator).
728template <>
730 Isolate* isolate, const char (&literal)[1], NewStringType type) {
731 return String::Empty(isolate);
732}
733
738 public:
739 virtual ~ExternalResourceVisitor() = default;
740 virtual void VisitExternalString(Local<String> string) {}
741};
742
746class V8_EXPORT Symbol : public Name {
747 public:
752
757 static Local<Symbol> New(Isolate* isolate,
758 Local<String> description = Local<String>());
759
768 static Local<Symbol> For(Isolate* isolate, Local<String> description);
769
774 static Local<Symbol> ForApi(Isolate* isolate, Local<String> description);
775
776 // Well-known symbols
788
789 V8_INLINE static Symbol* Cast(Data* data) {
790#ifdef V8_ENABLE_CHECKS
791 CheckCast(data);
792#endif
793 return static_cast<Symbol*>(data);
794 }
795
796 private:
797 Symbol();
798 static void CheckCast(Data* that);
799};
800
806 private:
807 Numeric();
808 static void CheckCast(v8::Data* that);
809};
810
814class V8_EXPORT Number : public Numeric {
815 public:
816 double Value() const;
817 static Local<Number> New(Isolate* isolate, double value);
818 V8_INLINE static Number* Cast(v8::Data* data) {
819#ifdef V8_ENABLE_CHECKS
820 CheckCast(data);
821#endif
822 return static_cast<Number*>(data);
823 }
824
825 private:
826 Number();
827 static void CheckCast(v8::Data* that);
828};
829
833class V8_EXPORT Integer : public Number {
834 public:
835 static Local<Integer> New(Isolate* isolate, int32_t value);
836 static Local<Integer> NewFromUnsigned(Isolate* isolate, uint32_t value);
837 int64_t Value() const;
839#ifdef V8_ENABLE_CHECKS
840 CheckCast(data);
841#endif
842 return static_cast<Integer*>(data);
843 }
844
845 private:
846 Integer();
847 static void CheckCast(v8::Data* that);
848};
849
853class V8_EXPORT Int32 : public Integer {
854 public:
855 int32_t Value() const;
856 V8_INLINE static Int32* Cast(v8::Data* data) {
857#ifdef V8_ENABLE_CHECKS
858 CheckCast(data);
859#endif
860 return static_cast<Int32*>(data);
861 }
862
863 private:
864 Int32();
865 static void CheckCast(v8::Data* that);
866};
867
871class V8_EXPORT Uint32 : public Integer {
872 public:
873 uint32_t Value() const;
874 V8_INLINE static Uint32* Cast(v8::Data* data) {
875#ifdef V8_ENABLE_CHECKS
876 CheckCast(data);
877#endif
878 return static_cast<Uint32*>(data);
879 }
880
881 private:
882 Uint32();
883 static void CheckCast(v8::Data* that);
884};
885
889class V8_EXPORT BigInt : public Numeric {
890 public:
891 static Local<BigInt> New(Isolate* isolate, int64_t value);
892 static Local<BigInt> NewFromUnsigned(Isolate* isolate, uint64_t value);
900 static MaybeLocal<BigInt> NewFromWords(Local<Context> context, int sign_bit,
901 int word_count, const uint64_t* words);
902
909 uint64_t Uint64Value(bool* lossless = nullptr) const;
910
916 int64_t Int64Value(bool* lossless = nullptr) const;
917
922 int WordCount() const;
923
932 void ToWordsArray(int* sign_bit, int* word_count, uint64_t* words) const;
933
934 V8_INLINE static BigInt* Cast(v8::Data* data) {
935#ifdef V8_ENABLE_CHECKS
936 CheckCast(data);
937#endif
938 return static_cast<BigInt*>(data);
939 }
940
941 private:
942 BigInt();
943 static void CheckCast(v8::Data* that);
944};
945
947 using S = internal::Address;
948 using I = internal::Internals;
949 I::CheckInitialized(isolate);
950 S* slot = I::GetRootSlot(isolate, I::kEmptyStringRootIndex);
951 return Local<String>::FromSlot(slot);
952}
953
955 using A = internal::Address;
956 using I = internal::Internals;
958
960 if (I::IsExternalTwoByteString(I::GetInstanceType(obj))) {
961 Isolate* isolate = I::GetIsolateForSandbox(obj);
962 A value = I::ReadExternalPointerField<internal::kExternalStringResourceTag>(
963 isolate, obj, I::kStringResourceOffset);
964 result = reinterpret_cast<String::ExternalStringResource*>(value);
965 } else {
966 result = GetExternalStringResourceSlow();
967 }
968#ifdef V8_ENABLE_CHECKS
969 VerifyExternalStringResource(result);
970#endif
971 return result;
972}
973
975 v8::Isolate* isolate, String::Encoding* encoding_out) const {
976 using A = internal::Address;
977 using I = internal::Internals;
979 int type = I::GetInstanceType(obj) & I::kStringRepresentationAndEncodingMask;
980 *encoding_out = static_cast<Encoding>(type & I::kStringEncodingMask);
982 if (type == I::kExternalOneByteRepresentationTag ||
983 type == I::kExternalTwoByteRepresentationTag) {
984 A value = I::ReadExternalPointerField<internal::kExternalStringResourceTag>(
985 isolate, obj, I::kStringResourceOffset);
986 resource = reinterpret_cast<ExternalStringResourceBase*>(value);
987 } else {
988 resource = GetExternalStringResourceBaseSlow(encoding_out);
989 }
990#ifdef V8_ENABLE_CHECKS
991 VerifyExternalStringResourceBase(resource, *encoding_out);
992#endif
993 return resource;
994}
995
997 String::Encoding* encoding_out) const {
998 using A = internal::Address;
999 using I = internal::Internals;
1001 int type = I::GetInstanceType(obj) & I::kStringRepresentationAndEncodingMask;
1002 *encoding_out = static_cast<Encoding>(type & I::kStringEncodingMask);
1004 if (type == I::kExternalOneByteRepresentationTag ||
1005 type == I::kExternalTwoByteRepresentationTag) {
1006 Isolate* isolate = I::GetIsolateForSandbox(obj);
1007 A value = I::ReadExternalPointerField<internal::kExternalStringResourceTag>(
1008 isolate, obj, I::kStringResourceOffset);
1009 resource = reinterpret_cast<ExternalStringResourceBase*>(value);
1010 } else {
1011 resource = GetExternalStringResourceBaseSlow(encoding_out);
1012 }
1013#ifdef V8_ENABLE_CHECKS
1014 VerifyExternalStringResourceBase(resource, *encoding_out);
1015#endif
1016 return resource;
1017}
1018
1019// --- Statics ---
1020
1022 using S = internal::Address;
1023 using I = internal::Internals;
1024 I::CheckInitialized(isolate);
1025 S* slot = I::GetRootSlot(isolate, I::kUndefinedValueRootIndex);
1026 return Local<Primitive>::FromSlot(slot);
1027}
1028
1030 using S = internal::Address;
1031 using I = internal::Internals;
1032 I::CheckInitialized(isolate);
1033 S* slot = I::GetRootSlot(isolate, I::kNullValueRootIndex);
1034 return Local<Primitive>::FromSlot(slot);
1035}
1036
1038 using S = internal::Address;
1039 using I = internal::Internals;
1040 I::CheckInitialized(isolate);
1041 S* slot = I::GetRootSlot(isolate, I::kTrueValueRootIndex);
1042 return Local<Boolean>::FromSlot(slot);
1043}
1044
1046 using S = internal::Address;
1047 using I = internal::Internals;
1048 I::CheckInitialized(isolate);
1049 S* slot = I::GetRootSlot(isolate, I::kFalseValueRootIndex);
1050 return Local<Boolean>::FromSlot(slot);
1051}
1052
1053Local<Boolean> Boolean::New(Isolate* isolate, bool value) {
1054 return value ? True(isolate) : False(isolate);
1055}
1056
1057} // namespace v8
1058
1059#endif // INCLUDE_V8_PRIMITIVE_H_
Definition: v8-primitive.h:889
uint64_t Uint64Value(bool *lossless=nullptr) const
static BigInt * Cast(v8::Data *data)
Definition: v8-primitive.h:934
static Local< BigInt > New(Isolate *isolate, int64_t value)
int64_t Int64Value(bool *lossless=nullptr) const
static MaybeLocal< BigInt > NewFromWords(Local< Context > context, int sign_bit, int word_count, const uint64_t *words)
int WordCount() const
static Local< BigInt > NewFromUnsigned(Isolate *isolate, uint64_t value)
void ToWordsArray(int *sign_bit, int *word_count, uint64_t *words) const
Definition: v8-primitive.h:35
bool Value() const
static Local< Boolean > New(Isolate *isolate, bool value)
Definition: v8-primitive.h:1053
static Boolean * Cast(v8::Data *data)
Definition: v8-primitive.h:38
Definition: v8-data.h:18
Definition: v8-primitive.h:737
virtual ~ExternalResourceVisitor()=default
virtual void VisitExternalString(Local< String > string)
Definition: v8-primitive.h:740
Definition: v8-primitive.h:853
static Int32 * Cast(v8::Data *data)
Definition: v8-primitive.h:856
int32_t Value() const
Definition: v8-primitive.h:833
static Integer * Cast(v8::Data *data)
Definition: v8-primitive.h:838
static Local< Integer > New(Isolate *isolate, int32_t value)
static Local< Integer > NewFromUnsigned(Isolate *isolate, uint32_t value)
int64_t Value() const
Definition: v8-isolate.h:261
Definition: v8-local-handle.h:266
Definition: v8-local-handle.h:632
Definition: v8-primitive.h:79
static Name * Cast(Data *data)
Definition: v8-primitive.h:90
int GetIdentityHash()
Definition: v8-primitive.h:814
static Local< Number > New(Isolate *isolate, double value)
static Number * Cast(v8::Data *data)
Definition: v8-primitive.h:818
double Value() const
Definition: v8-primitive.h:805
Definition: v8-primitive.h:58
static Local< PrimitiveArray > New(Isolate *isolate, int length)
Local< Primitive > Get(Isolate *isolate, int index)
static PrimitiveArray * Cast(Data *data)
Definition: v8-primitive.h:65
int Length() const
void Set(Isolate *isolate, int index, Local< Primitive > item)
Definition: v8-primitive.h:29
Definition: v8-primitive.h:411
const char * cached_data() const
Definition: v8-primitive.h:433
~ExternalOneByteStringResource() override=default
virtual const char * data() const =0
Definition: v8-primitive.h:292
void operator=(const ExternalStringResourceBase &)=delete
virtual void Unaccount(Isolate *isolate)
Definition: v8-primitive.h:308
ExternalStringResourceBase(const ExternalStringResourceBase &)=delete
virtual ~ExternalStringResourceBase()=default
virtual void Unlock() const
Definition: v8-primitive.h:341
virtual bool IsCacheable() const
Definition: v8-primitive.h:301
virtual void Lock() const
Definition: v8-primitive.h:336
virtual void Dispose()
Definition: v8-primitive.h:323
Definition: v8-primitive.h:356
virtual const uint16_t * data() const =0
const uint16_t * cached_data() const
Definition: v8-primitive.h:380
virtual size_t length() const =0
~ExternalStringResource() override=default
Definition: v8-primitive.h:614
char * operator*()
Definition: v8-primitive.h:619
Utf8Value(Isolate *isolate, Local< v8::Value > obj, WriteOptions options=REPLACE_INVALID_UTF8)
Utf8Value(const Utf8Value &)=delete
const char * operator*() const
Definition: v8-primitive.h:620
void operator=(const Utf8Value &)=delete
size_t length() const
Definition: v8-primitive.h:621
Definition: v8-primitive.h:672
bool is_one_byte() const
Definition: v8-primitive.h:689
const uint16_t * data16_
Definition: v8-primitive.h:701
void operator=(const ValueView &)=delete
const uint8_t * data8() const
Definition: v8-primitive.h:676
uint32_t length() const
Definition: v8-primitive.h:688
ValueView(const ValueView &)=delete
const uint16_t * data16() const
Definition: v8-primitive.h:682
ValueView(Isolate *isolate, Local< v8::String > str)
const uint8_t * data8_
Definition: v8-primitive.h:700
Definition: v8-primitive.h:642
const uint16_t * operator*() const
Definition: v8-primitive.h:650
uint32_t length() const
Definition: v8-primitive.h:651
Value(const Value &)=delete
void operator=(const Value &)=delete
Definition: v8-primitive.h:124
bool IsExternalTwoByte() const
bool IsExternal() const
static Local< String > Concat(Isolate *isolate, Local< String > left, Local< String > right)
bool IsExternalOneByte() const
ExternalStringResourceBase * GetExternalStringResourceBase(v8::Isolate *isolate, Encoding *encoding_out) const
Definition: v8-primitive.h:974
Encoding
Definition: v8-primitive.h:129
size_t WriteUtf8V2(Isolate *isolate, char *buffer, size_t capacity, int flags=WriteFlags::kNone) const
void WriteOneByteV2(Isolate *isolate, uint32_t offset, uint32_t length, uint8_t *buffer, int flags=WriteFlags::kNone) const
Local< String > InternalizeString(Isolate *isolate)
static MaybeLocal< String > NewFromUtf8(Isolate *isolate, const char *data, NewStringType type=NewStringType::kNormal, int length=-1)
void WriteV2(Isolate *isolate, uint32_t offset, uint32_t length, uint16_t *buffer, int flags=WriteFlags::kNone) const
const ExternalOneByteStringResource * GetExternalOneByteStringResource() const
static MaybeLocal< String > NewExternalTwoByte(Isolate *isolate, ExternalStringResource *resource)
static MaybeLocal< String > NewFromOneByte(Isolate *isolate, const uint8_t *data, NewStringType type=NewStringType::kNormal, int length=-1)
static String * Cast(v8::Data *data)
Definition: v8-primitive.h:475
WriteOptions
Definition: v8-primitive.h:191
static Local< String > Empty(Isolate *isolate)
Definition: v8-primitive.h:946
static MaybeLocal< String > NewFromTwoByte(Isolate *isolate, const uint16_t *data, NewStringType type=NewStringType::kNormal, int length=-1)
static Local< String > NewFromUtf8Literal(Isolate *isolate, const char(&literal)[N], NewStringType type=NewStringType::kNormal)
Definition: v8-primitive.h:492
ExternalStringResource * GetExternalStringResource() const
Definition: v8-primitive.h:954
int Length() const
Definition: v8-primitive.h:746
static Local< Symbol > GetMatch(Isolate *isolate)
static Local< Symbol > GetIterator(Isolate *isolate)
static Symbol * Cast(Data *data)
Definition: v8-primitive.h:789
static Local< Symbol > ForApi(Isolate *isolate, Local< String > description)
static Local< Symbol > GetSearch(Isolate *isolate)
static Local< Symbol > GetToPrimitive(Isolate *isolate)
static Local< Symbol > GetAsyncIterator(Isolate *isolate)
static Local< Symbol > GetIsConcatSpreadable(Isolate *isolate)
static Local< Symbol > New(Isolate *isolate, Local< String > description=Local< String >())
static Local< Symbol > GetReplace(Isolate *isolate)
static Local< Symbol > GetToStringTag(Isolate *isolate)
static Local< Symbol > GetSplit(Isolate *isolate)
static Local< Symbol > GetUnscopables(Isolate *isolate)
static Local< Symbol > For(Isolate *isolate, Local< String > description)
Local< Value > Description(Isolate *isolate) const
static Local< Symbol > GetHasInstance(Isolate *isolate)
Definition: v8-primitive.h:871
static Uint32 * Cast(v8::Data *data)
Definition: v8-primitive.h:874
uint32_t Value() const
Definition: v8-value.h:32
Definition: v8-internal.h:794
static Address ValueAsAddress(const T *value)
Definition: v8-internal.h:1625
uintptr_t Address
Definition: v8-internal.h:52
Definition: libplatform.h:15
Local< Primitive > Null(Isolate *isolate)
Definition: v8-primitive.h:1029
Local< Primitive > Undefined(Isolate *isolate)
Definition: v8-primitive.h:1021
Local< Boolean > False(Isolate *isolate)
Definition: v8-primitive.h:1045
Local< Boolean > True(Isolate *isolate)
Definition: v8-primitive.h:1037
NewStringType
Definition: v8-primitive.h:107
Definition: v8-primitive.h:215
#define V8_EXPORT
Definition: v8config.h:793
#define V8_INLINE
Definition: v8config.h:499
#define V8_DEPRECATE_SOON(message)
Definition: v8config.h:603
#define V8_WARN_UNUSED_RESULT
Definition: v8config.h:660