File tree Expand file tree Collapse file tree 3 files changed +40
-2
lines changed
Expand file tree Collapse file tree 3 files changed +40
-2
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,10 @@ const int kApiTaggedSize = kApiInt32Size;
106106const int kApiTaggedSize = kApiSystemPointerSize ;
107107#endif
108108
109+ constexpr bool PointerCompressionIsEnabled () {
110+ return kApiTaggedSize != kApiSystemPointerSize ;
111+ }
112+
109113#ifdef V8_31BIT_SMIS_ON_64BIT_ARCH
110114using PlatformSmiTagging = SmiTagging<kApiInt32Size >;
111115#else
Original file line number Diff line number Diff line change @@ -9610,7 +9610,12 @@ class V8_EXPORT V8 {
96109610 * Initializes V8. This function needs to be called before the first Isolate
96119611 * is created. It always returns true.
96129612 */
9613- static bool Initialize ();
9613+ V8_INLINE static bool Initialize () {
9614+ const int kBuildConfiguration =
9615+ (internal::PointerCompressionIsEnabled () ? kPointerCompression : 0 ) |
9616+ (internal::SmiValuesAre31Bits () ? k31BitSmis : 0 );
9617+ return Initialize (kBuildConfiguration );
9618+ }
96149619
96159620 /* *
96169621 * Allows the host application to provide a callback which can be used
@@ -9744,6 +9749,17 @@ class V8_EXPORT V8 {
97449749 private:
97459750 V8 ();
97469751
9752+ enum BuildConfigurationFeatures {
9753+ kPointerCompression = 1 << 0 ,
9754+ k31BitSmis = 1 << 1 ,
9755+ };
9756+
9757+ /* *
9758+ * Checks that the embedder build configuration is compatible with
9759+ * the V8 binary and if so initializes V8.
9760+ */
9761+ static bool Initialize (int build_config);
9762+
97479763 static internal::Address* GlobalizeReference (internal::Isolate* isolate,
97489764 internal::Address* handle);
97499765 static internal::Address* GlobalizeTracedReference (internal::Isolate* isolate,
Original file line number Diff line number Diff line change @@ -5722,7 +5722,25 @@ void v8::V8::InitializePlatform(Platform* platform) {
57225722
57235723void v8::V8::ShutdownPlatform () { i::V8::ShutdownPlatform (); }
57245724
5725- bool v8::V8::Initialize () {
5725+ bool v8::V8::Initialize (const int build_config) {
5726+ const bool kEmbedderPointerCompression =
5727+ (build_config & kPointerCompression ) != 0 ;
5728+ if (kEmbedderPointerCompression != COMPRESS_POINTERS_BOOL) {
5729+ FATAL (
5730+ " Embedder-vs-V8 build configuration mismatch. On embedder side "
5731+ " pointer compression is %s while on V8 side it's %s." ,
5732+ kEmbedderPointerCompression ? " ENABLED" : " DISABLED" ,
5733+ COMPRESS_POINTERS_BOOL ? " ENABLED" : " DISABLED" );
5734+ }
5735+
5736+ const int kEmbedderSmiValueSize = (build_config & k31BitSmis) ? 31 : 32 ;
5737+ if (kEmbedderSmiValueSize != internal::kSmiValueSize ) {
5738+ FATAL (
5739+ " Embedder-vs-V8 build configuration mismatch. On embedder side "
5740+ " Smi value size is %d while on V8 side it's %d." ,
5741+ kEmbedderSmiValueSize , internal::kSmiValueSize );
5742+ }
5743+
57265744 i::V8::Initialize ();
57275745 return true ;
57285746}
You can’t perform that action at this time.
0 commit comments